Twitter Post iOS6 'Cancel' button issue

后端 未结 5 656
既然无缘
既然无缘 2021-01-04 04:13

I\'m in the process of changing my app for iOS6 and iPhone use, I can\'t seem to figure out why when I post from Twitter using the new Social framework I have to press \'Can

5条回答
  •  旧时难觅i
    2021-01-04 04:59

    My experience with SLComposeViewController is that twitter and weibo controllers need to be dismissed manually while the facebook controller seems to be better behaved.

    If I don't dismissViewControllerAnimated myself, tapping the "Send" button will send the tweet or weibo posting but I'll be left with what seems to be an invisible view over my own view. Thus I can no longer interact with my app.

    I don't know why my app is working like this... Interestingly, the completionHandler for cancel gets called just once. The second tap dismisses the view controller.

    + (void) shareText:(NSString*)text image:(UIImage*)image social:(NSString*)service url:(NSString*)url
    {
        SLComposeViewController*    controller = [SLComposeViewController composeViewControllerForServiceType:service];
    
        [controller setInitialText:text];
        [controller addImage:image];
        [controller addURL:[NSURL URLWithString:url]];
    
        controller.completionHandler = ^(SLComposeViewControllerResult result) {
            if( SLComposeViewControllerResultDone == result )
            {
                NSLog(@"rewards for share: %@!", service );
            }
            if( ![SLServiceTypeFacebook isEqualToString:service] )  // facebook behaves
                [[CBLAppDelegate instance].activeViewController dismissViewControllerAnimated:true completion:nil];
        };
        [[CBLAppDelegate instance].activeViewController presentViewController:controller animated:true completion:nil];
    }
    

提交回复
热议问题