使用iOS 6的新SLComposeViewController
功能发布到Facebook,Twitter或新浪微博需要遵循哪些步骤?
在SLComposeViewController
用于打开Twitter或Facebook共享表的时间内,在日志中看到此错误消息,尽管不一致.我没有使用任何新的iOS 8 API,只是测试iOS 8上的现有代码.我看到其他人遇到了这个问题,甚至在使用Cocoa Touch SDK中的其他模态视图控制器时也发生了崩溃.
LaunchServices:invalidationHandler被调用
是否有新的防护措施,与SLComposeViewController
和UIActivityViewController
iOS中8?还有什么要考虑的吗?
slcomposeviewcontroller uiactivityviewcontroller xcode6 ios8
下面的代码片段是屏幕按钮的回调.Facebook表单显示但不包含任何文本.但是,如果SLServiceTypeFacebook
用SLServiceTypeTwitter
它替换它会显示初始文本.我在iPhone 6上使用XCode 6.3.1和iOS 8.3.提前谢谢你.
-(IBAction)facebookButton:(id)sender
{
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
NSString* facebookText = @"Awesome App";
SLComposeViewController *fbPostSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[fbPostSheet setInitialText:facebookText];
[self presentViewController:fbPostSheet animated:YES completion:nil];
}
else{
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Unable to Connect to Facebook"
message:@"Make sure your device has an internet connection and you have your Facebook account setup in the Settings App"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
}
Run Code Online (Sandbox Code Playgroud) I have some social sharing code that looks like this:
SLComposeViewController *composer = [SLComposeViewController composeViewControllerForServiceType:…];
[composer setInitialText:…];
[composer addURL:…];
[composer setCompletionHandler:^(SLComposeViewControllerResult result) {
[someController dismissViewControllerAnimated:YES completion:^{
… // 1
}];
}];
[someController presentModalViewController:composer animated:YES];
Run Code Online (Sandbox Code Playgroud)
The problem is that the code behaves differently for Facebook and Twitter. When the user confirms the Facebook compose screen, the composer apparently dismisses itself, because the completion handler marked as 1 is never called and even when I remove the dismissViewControllerAnimated:
call, everything works fine. …
在我的项目中,我总是使用SLComposeViewController与第三方应用程序共享内容,但现在,当我将我的iPhone更新到iOS 11测试版时,它不再起作用.并且SLComposeViewControllerCompletionHandler总是回调SLComposeViewControllerResultCancelled.为什么?
我刚刚注意到SLComposeViewController Facebook中的一个问题,里面没有文字显示,甚至官方的Youtube应用程序都有这个问题,你有解决方案吗?
我正在尝试做什么并且它不起作用如下:使用内置的facebook分享器发布我的选择的图像和facebook的facebook,问题是它无法上传两者,它要么图片+文字和工作不错或网址+文字和工作很好,但当我将它们组合文字+图片+网址时,它从网址获取图片而不是我上传的图片.有什么建议?我在iOS9上这样做
UIImage *tableViewScreenshot = [tblFeed screenshotOfCellAtIndexPath:idx];
SLComposeViewController *fbSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[fbSheet setInitialText:@"I need your vote"];
[fbSheet addURL:[NSURL URLWithString:str]];
[fbSheet addImage:tableViewScreenshot];
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用SLComposeViewController在我的iOS应用程序中共享链接.
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:@"Here's the link I promised:"];
[controller addURL:[NSURL URLWithString:@"http://www.url.com"]];
[self presentViewController:controller animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
当控制器出现时,输入框中没有文本.您可以添加文本并将其发送正常(URL也会在Post中正确显示).
我刚安装了FacebookSDK 4.01,它是iOS 7/8应用程序.
关于为什么初始文本没有出现的任何想法.我甚至试图在没有URL的情况下这样做,只是做文本,但没有.
附加说明:如果我删除了addURL,那么当我点击"发布"时该应用程序会冻结,并且该帖子永远不会被发送.
谢谢你的帮助!!!
简单的代码行:
NSLog(@"Checking on Facebook: %d -- Checking on Twitter: %d",[SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook], [SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]);
Run Code Online (Sandbox Code Playgroud)
问题是我两个BOOL都得到1.这是一个问题,因为Twitter和Facebook都没有设置帐户.这是在模拟器上,所以想知道人们是否经历过这种情况也会在设备上发生?
文档说,如果服务可用且至少设置了一个帐户,它应该只返回true.但即使没有账户设置,我也会变成现实.我想使用这些值隐藏一些社交帖子按钮,以便这样做.
我正在使用SLComposeViewController
发布到Twitter和Facebook.我对twitter和facebook都有相同的代码,但URL没有出现在twitter帖子中.我该如何解决?
Twitter代码 -
socialController = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeTwitter];
[socialController setInitialText:@"Testing: This is the app link!"];
[socialController addImage:[UIImage imageNamed:@"image.jpg"]];
[socialController addURL:[NSURL URLWithString:@"http://www.google.com"]];
[self presentViewController:socialController animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
Facebook代码 -
socialController = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeFacebook];
[socialController setInitialText:@"Testing: This is the app link!"];
[socialController addImage:[UIImage imageNamed:@"image.jpg"]];
[socialController addURL:[NSURL URLWithString:@"http://www.google.com"]];
[self presentViewController:socialController animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)