将drupal-ios-sdk与iPhone应用程序集成的问题

时间:2012-09-10 11:11:55

标签: iphone ios drupal drupal-modules

我从github下载了Drupal-iOS-SDK 我还下载了AFNetworking文件from here

然后我将文件添加到我的项目中,但它显示了一个奇怪的错误

  

不兼容的块指针类型将'void(^)(NSInteger,NSInteger,NSInteger)'发送到'void(^)类型的参数(NSInteger,long long,long long)'

这段代码:

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

有谁知道这意味着什么?

1 个答案:

答案 0 :(得分:2)

NSInteger预期有一个setUploadProgressBlock(无符号整数)和两个NSUInteger参数

时,您将long long作为参数发送给totalBytesWritten

totalBytesExpectedToWritelong long需要属于AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; [operation setUploadProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) { NSLog(@"Sent %d of %d bytes", totalBytesWritten, totalBytesExpectedToWrite); }]; 类型,因为它是如何定义的,而非`NSInteger'。您的代码应如下所示:

long long

您可能还需要相应地修改NSLog,因为它已设置为NSLog(@"Sent %lld of %lld bytes", totalBytesWritten, totalBytesExpectedToWrite); ,因此编译器不会抱怨。

{{1}}