简体   繁体   中英

RACSignal: Handling incompatible block pointer types

I'm new to Reactive Cocoa and I'm wondering if someone could help me with this problem:

Here's the code snippet causing me trouble:

[[[self getFormItemAttachmentHeaders:listName
                      topListItemID:form.topListItemID
                              form:form
 ] map:^id(NSMutableArray* value) {
    NSArray* attachmentHeaders = [value copy];
    return attachmentHeaders;
    }
  ] subscribeNext:^(NSArray* attachmentHeaders) {
    return [self uploadFormItemAttachments:pendingAttachments
                  attachmentHeaders:attachmentHeaders
                               form:form];
    }
 ];

This code is called from a RACsignal object in the same method defined as such:

  RACSignal* batchSignal = [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
    [pendingAttachments enumerateObjectsUsingBlock:^(SEFSManagedAttachment* pendingImage, NSUInteger idx, BOOL *stop) {

The following line of code:

return [self uploadFormItemAttachments:pendingAttachments
                      attachmentHeaders:attachmentHeaders
                                   form:form];

Generates the error:

Incompatible block pointer types sending 'RACSignal *(^)(NSArray *__strong)' to parameter of type 'void (^)(__strong id)'

该错误的原因是因为subscriptionNext块返回void,并且通过放置返回值将生成与块签名的不兼容性。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM