我使用此代码(在IOS 7中完美运行)
mySLComposerSheet = [[SLComposeViewController alloc] init];
mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[mySLComposerSheet setInitialText:[NSString stringWithFormat:@"%@",annotazioni.text]];
[mySLComposerSheet addImage:ScreenshotForShare];
[self presentViewController:mySLComposerSheet animated:YES completion:nil];
if (!mySLComposerSheet) {
return;
}else{
}
[mySLComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) {
switch (result) {
case SLComposeViewControllerResultCancelled:
NSLog(@"Post Canceled");
break;
case SLComposeViewControllerResultDone:
NSLog(@"Post Sucessful");
break;
default:
break;
}
}];
但是,当slcomposerview出现时,在没有任何输入命令的情况下1-2秒后消失,在模拟器和设备中...... 什么是正确的代码?
我发布照片的另一种方式是:
NSString *client_id = @"123456789012345"; (The same of .Plist)
fbGraph = [[FbGraph alloc] initWithFbClientID:client_id];
[fbGraph authenticateUserWithCallbackObject:self andSelector:@selector(postInAppFacebook) andExtendedPermissions:@"user_photos,user_videos,publish_stream,offline_access" andSuperView:self.view];
NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:3];
FbGraphFile *graph_file = [[FbGraphFile alloc] initWithImage:ScreenshotForShare];
[variables setObject:graph_file forKey:@"file"];
[variables setObject:[NSString stringWithFormat:@"%@",annotazioni.text] forKey:@"message"];
[fbGraph doGraphPost:@"me/photos" withPostVars:variables];
if (TwitterShare == YES) {
[self ShareOnTwitter];
}else{
[self dismissViewControllerAnimated:YES completion:nil];
}
但仅在IOS 8中我收到错误191 ...在IOS 7上一切正常,照片正确地张贴在我的日记上。 请帮助我7天后找不到解决方案... 提前谢谢