我試圖從我的應用程序上傳照片到Facebook,並且一切順利,當我上傳並等待它完成時,但是當我按上傳然後回到之前的view
,上傳完成後我得到一個錯誤URL響應中的指針不佳
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];
}
我該怎麼做?這個方法是'nsurl'委託的一部分。這是所有在後臺調用...我做的是[[[自[appDelegate] getFacebookVar] requestWithGraphPath:[NSString stringWithFormat:@「/ me/photos?access_token =%@」,self.appDelegate.getFacebookVar.accessToken] andParams:params andHttpMethod:@「POST」andDelegate:self];'。對不起,它太混亂了。 –
您應該將該代碼添加到問題中 - 註釋中的格式使其難以閱讀。 :/ – jimbojw