【问题标题】:Twitter and Facebook integration iOS 7Twitter 和 Facebook 集成 iOS 7
【发布时间】:2014-01-05 03:15:24
【问题描述】:

我正在尝试在我的应用程序中实现 Twitter 和 Facebook。因此,我使用 iOS 中的集成方法(自 iOS 6 起可用)来执行此操作。在 iOS 6 下,如果没有配置 Facebook 或 Twitter,则会出现警报视图,通知用户他必须先配置一个帐户才能使用 Twitter 或 Facebook。警报视图使用户可以选择直接跳转到 Twitter 或 Facebook 的设置。在 iOS 7 中,如果没有配置帐户,则不会出现警报视图来通知用户。似乎在 iOS 7 下已被禁用。所以我现在自己通知用户,但有没有办法像在 iOS 6 下一样直接将用户指向设置?还是我需要在 iOS 7 下更改代码才能恢复闹钟?

    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
    {
        SLComposeViewController *tweetSheet = [SLComposeViewController
                                               composeViewControllerForServiceType:SLServiceTypeTwitter];
        [tweetSheet setInitialText:@"Hello a Tweet"];

        [self presentViewController:tweetSheet animated:YES completion:nil];
    } else {
        if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
        {
         //inform the user that no account is configured with alarm view.
        }

    }

【问题讨论】:

标签: ios facebook twitter ios7 settings


【解决方案1】:

只需从您的代码中删除这一行,它就会正常工作

 if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])

【讨论】:

  • 电子邮件 (MFMailComposeViewController) 是否仍需要此检查,还是我们仍需要在 iOS 7 中进行检查?
  • 当我点击设置时帐户未配置它不会将我移动到设置页面我该怎么做...
  • 只需转到 iPhone 设置并找到 Facebook 或您想要的帐户,然后在那里登录。
【解决方案2】:

在 ios 7 中,尝试删除此条件,如果没有配置帐户,它将告诉用户。

    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
    {
        SLComposeViewController *tweetSheet = [SLComposeViewController
                                               composeViewControllerForServiceType:SLServiceTypeTwitter];
        [tweetSheet setInitialText:@"Hello a Tweet"];

        [self presentViewController:tweetSheet animated:YES completion:nil];
    } else {
        if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
        { SLComposeViewController *tweetSheet = [SLComposeViewController
                                               composeViewControllerForServiceType:SLServiceTypeTwitter];
        [tweetSheet setInitialText:@"Hello a Tweet"];

        [self presentViewController:tweetSheet animated:YES completion:nil];


         //inform the user that no account is configured with alarm view.
        }

    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-20
    • 2012-09-26
    • 1970-01-01
    • 2013-04-09
    • 2014-08-14
    • 2011-08-31
    • 1970-01-01
    相关资源
    最近更新 更多