语义问题不兼容的块指针

时间:2015-02-25 10:41:55

标签: ios

我已将架构更改为标准,因为在iTunes中不会接受存档。我有一个模块的问题,代码在这里:

- (UIViewController *)modulePage:(NSString *)pageName params:(NSDictionary *)params {
    UIViewController *vc = nil;
    if ([pageName isEqualToString:LocalPathPageNameHome]) {
        vc = [[AboutTableViewController alloc] initWithNibName:@"AboutTableViewController" bundle:KGO_SHARED_RESOURCE_BUNDLE()];
    }
    else if ([pageName isEqualToString:LocalPathPageNameDetail]) {

        NSString *command = [params objectForKey:@"command"];
        if (command) {
            KGOWebViewController *webVC = [[KGOWebViewController alloc] init];
            webVC.title = [params stringForKey:@"title"];
            [webVC applyTemplate:@"common/fullscreenWebview.html"];

            KGORequest *request = [[KGORequestManager sharedManager] requestWithDelegate:nil
                                                                              module:@"about"
                                                                                path:command
                                                                             version:1
                                                                              params:nil];
            request.expectedResponseType = [NSString class];
            request.handler = ^(id jsonObject) {
                webVC.HTMLString = jsonObject;
                return 1;
            };
            [request connect];

            vc = webVC;
        }
    }

    return vc;
}

pragma mark -

@end

错误是:

  

从'int(^)(__ strong id)'

分配给'JSONObjectHandler'(又名'NSInteger(^)(__ strong id)')的不兼容块指针类型

任何想法..

1 个答案:

答案 0 :(得分:0)

尝试:

request.handler = ^NSInteger(id jsonObject) {
    webVC.HTMLString = jsonObject;
    return 1;
};

即。匹配提供的块的返回类型。