我正在尝试从我的应用程序将照片上传到 Facebook,当我上传并等待它完成时一切顺利,但是当我按下上传然后返回上一个view
时,上传完成时出现错误
Thread 1:EXC_BAD_ACCESS(code=2, address=0x9)
在代码中:
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
_responseText = [[NSMutableData alloc] init];
NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)response;
if ([_delegate respondsToSelector:
@selector(request:didReceiveResponse:)]) {
[_delegate request:self didReceiveResponse:httpResponse];
}
}
它在if
. 我不确定我将如何解决这个问题。
谢谢
编辑:在我回到上一个视图之前调用它:
-(IBAction)shareToFacefook{
[[self appDelegate] facebooking]; // checke that the user is loged in
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
labeledImage, @"source",
[[MyStrings myLocalStrings] getBackLocalstring:FB_IMG_POST_TITLE],@"message",
nil];
[[[self appDelegate] getFacebookVar] requestWithGraphPath:[NSString stringWithFormat: @"/me/photos?access_token=%@", self.appDelegate.getFacebookVar.accessToken] andParams:params andHttpMethod:@"POST" andDelegate:self];
}