添加到Facebook的圖片我越來越想上傳的SLComposeViewController選定的照片時,此錯誤:利用社會框架
[CFNumber挽留]:發送到釋放實例消息0xa1c2c00
該項目建立無錯誤或警告。 這裏是代碼:
- (IBAction)test:(id)sender {
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
API* api = [API sharedInstance];
NSURL* imageURL = [api urlForImageWithId:IdPhoto isThumb:NO];
NSData *data = [NSData dataWithContentsOfURL:imageURL];
UIImage *img = [[UIImage alloc] initWithData:data];
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:@"First post from my iPhone app"];
[controller addURL:[NSURL URLWithString:@"http://www.appcoda.com"]];
[controller addImage:img];
[self presentViewController:controller animated:YES completion:Nil];
}
}
任何想法爲什麼?感謝
編輯: 這裏是viewDidLoad中:
-(void)viewDidLoad {
API* api = [API sharedInstance];
//load the caption of the selected photo
[api commandWithParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:@"stream", @"command", IdPhoto,@"IdPhoto",label.text,@"weddingID", nil] onCompletion:^(NSDictionary *json) {
//show the text in the label
NSArray* list = [json objectForKey:@"result"];
NSDictionary* photo = [list objectAtIndex:0];
lblTitle.text = [photo objectForKey:@"title"];
}];
//load the big size photo
NSURL* imageURL = [api urlForImageWithId:IdPhoto isThumb:NO];
[photoView setImageWithURL: imageURL];
NSLog(@"image url :%@",imageURL);
}
? –
耶正在使用ARC – user2636326
您是否在調試器中發現錯誤? –