gpt4 book ai didi

ios - SLCOmposeviewcontroller 推特共享警报问题

转载 作者:可可西里 更新时间:2023-11-01 04:35:37 26 4
gpt4 key购买 nike

我一直在使用此代码进行 Twitter 发布。

SLComposeViewController *fbController=[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];


if([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
{
SLComposeViewControllerCompletionHandler __block completionHandler=^(SLComposeViewControllerResult result){

[fbController dismissViewControllerAnimated:YES completion:nil];

switch(result){
case SLComposeViewControllerResultCancelled:
default:
{
NSLog(@"Cancelled.....");

}
break;
case SLComposeViewControllerResultDone:
{
NSLog(@"Posted....");
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Success"
message:@"Posted Successfully"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];

}
break;
}};

[fbController addImage:[UIImage imageNamed:@"1.jpg"]];
[fbController setInitialText:@"Check out this article."];
//[fbController addURL:[NSURL URLWithString:@"http://soulwithmobiletechnology.blogspot.com/"]];
[fbController setCompletionHandler:completionHandler];
[self presentViewController:fbController animated:YES completion:nil];
}

如果用户没有设置 Twitter 帐户,它会显示带有设置和取消按钮的警报。但它没有在设备中显示警报?谁能帮帮我。提前致谢。

最佳答案

同样的事情也发生在 Facebook 分享上。删除测试:

if([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])

如果用户的 Twitter 帐户尚未在 iOS 6 中设置,则上述测试将评估为 false,并且不会执行任何共享代码。

相反,如果您跳过检查并尝试显示 SLComposeViewController,iOS 将提示用户设置他们的 Twitter 帐户。

关于ios - SLCOmposeviewcontroller 推特共享警报问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17738959/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com