Problems integrating drupal-ios-sdk with iPhone app

I downloaded the Drupal-iOS-SDK from github and I also downloaded AFNetworking files from here.

Then I added the files to my project, but it shows a strange error

Incompatible block pointer types sending 'void (^)(NSInteger, NSInteger, NSInteger)' to parameter of type 'void (^)(NSInteger, long long, long long)'

for this piece of code:

AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setUploadProgressBlock:^(NSInteger bytesWritten, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite) {
        NSLog(@"Sent %d of %d bytes", totalBytesWritten, totalBytesExpectedToWrite);
    }];

Does anyone have any idea what this means?

Answers


You are sending three NSIntegers as parameters to setUploadProgressBlock when it's expected one NSUInteger (unsigned integer) and two long long parameters

totalBytesWritten and totalBytesExpectedToWrite need to be of type long long because that's how they are defined, not `NSInteger's. Your piece of code should look like:

AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setUploadProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
    NSLog(@"Sent %d of %d bytes", totalBytesWritten, totalBytesExpectedToWrite);
}];

You may also want to modify your NSLog accordingly now that it's set to long long so the compiler doesn't complain.

NSLog(@"Sent %lld of %lld bytes", totalBytesWritten, totalBytesExpectedToWrite);

Need Your Help

How to get Group node in Alfresco 3.1's Java-Backed Webscript

java alfresco

With Javascript Webscript, I can get a group node with the following code:

Multiple Data Types with Vectors of Vectors

c++ arrays vector types

I am trying to find a way to create a 3 dimensional vector with three different types, such that it is structured as:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.