Iphone 结果出现在主线程上,但不出现在后台线程上

Iphone 结果出现在主线程上,但不出现在后台线程上,iphone,ios,Iphone,Ios,我正在从一个主线程调用一个服务,并得到结果。但当同样的电话从后台发出时,我并没有得到结果。有什么想法吗 这是我的密码: dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL), ^(void) { self.pathRequest = [[PathReques

我正在从一个主线程调用一个服务,并得到结果。但当同样的电话从后台发出时,我并没有得到结果。有什么想法吗

这是我的密码:

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,
                                             (unsigned long)NULL), ^(void) {
        self.pathRequest = [[PathRequest alloc] initWithUserId:[userInfobase userId]

        self.pathRequest.target = self;
        self.pathRequest.successSelector = @selector(success:);
        self.pathRequest.errorSelector = @selector(failure:);
        [self.pathRequest execute];
    });
在我的类PathRequest中,我定义了用于处理服务器响应的委托方法

 - (void) execute
{    
     [restClient loadData:@"/path"];
}

- (void)restClient: (AFRestClient *) client loadedData: (AFMetaData *) metadata { 
}

运行运行循环,使
n连接
工作

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,
                                         (unsigned long)NULL), ^(void) {
    [[NSRunLoop currentRunLoop] run];
    self.pathRequest = [[PathRequest alloc] initWithUserId:[userInfobase userId]

    self.pathRequest.target = self;
    self.pathRequest.successSelector = @selector(success:);
    self.pathRequest.errorSelector = @selector(failure:);
    [self.pathRequest execute];
});

请包括您的代码。那会帮助我们更好地帮助你。我试过了,但没用。我注意到线程正在退出。我收到了NSThreadWillExitNotification通知。请尝试
performSelectorInBackground:withObject:
,看看这是否有效我正在使用它-[self-performSelectorInBackground:@selector(getUserIdsInfoBase:)withObject:[listOfAccounts valueForKey:@“infoBase]”;不,它不起作用。我正在后台调用该方法(使用performSelectorInBackground),在发出请求之前,我正在添加[[nsrunlop currentRunLoop]run],正如您所提到的。然后,我担心我的朋友,接下来还有一些其他问题..:(