小编ale*_*0xB的帖子

尝试使用Twitter ACAccount时出现奇怪的行为

我一直在使用新的Social.Framework,特别是SLRequest,它们都可以在iOS 6及更高版本上使用.事实上,我在尝试发布此类请求时遇到的崩溃让我感到非常惊讶.

我一直在使用Facebook和Twitter帐户崩溃,这就是为什么我知道它与其中一个特定问题无关.它必须与ACAccount对象相关,我以这种方式得到它:

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0")) {
    //iOS 6
    if (_twitterEnabled) {
        if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) {
            //Set up account
            [accountStore requestAccessToAccountsWithType:accountTypeTwitter options:nil completion:^(BOOL granted, NSError *error) {
                if (granted && !error) {
                    //Get account and get ready to post.
                    NSArray *arrayOfAccounts = [accountStore accountsWithAccountType:accountTypeTwitter];
                    if ([arrayOfAccounts count] > 0) {
                        _twitterAccount = [arrayOfAccounts lastObject];
                    }
                }
            }];
        }
    }
    if (!_facebookEnabled) {
        ACAccountType *accountTypeFacebook = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
        if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
            NSArray *permissions = @[@"user_about_me",@"user_likes",@"email"];
            NSMutableDictionary *options = [NSMutableDictionary dictionaryWithObjectsAndKeys:kFacebookAppIDString, ACFacebookAppIdKey, …
Run Code Online (Sandbox Code Playgroud)

iphone core-services ios ios6 social-framework

19
推荐指数
3
解决办法
5506
查看次数

标签 统计

core-services ×1

ios ×1

ios6 ×1

iphone ×1

social-framework ×1