xcode iOS app cannot comment to sina Weibo

dear all:

I am using the SLCompose objects to post comments from apps to social networks.
The code is pretty much standard.

-(void) socialFrameworkShare:(id)sender forServiceType:(NSString *) serviceType {
    UIAlertView *alertView;

    // check for support
    if (NSClassFromString(@"SLComposeViewController") == nil) {
        // not supported
#ifdef TRADITIONAL_CHINESE
        alertView = [[UIAlertView alloc] initWithTitle:@"漢武英俠錄分享"
                                               message:@"沒有分享的服務"
                                              delegate:self
                                     cancelButtonTitle:@"確定"
                                     otherButtonTitles:nil, nil];
#endif
#ifdef SIMPLIFIED_CHINESE
        alertView = [[UIAlertView alloc] initWithTitle:@"汉武英侠录分享"
                                               message:@"没有分享的服务"
                                              delegate:self
                                     cancelButtonTitle:@"确定"
                                     otherButtonTitles:nil, nil];
#endif
        [alertView show];
        return;
    }

    // check for support
    if (![SLComposeViewController isAvailableForServiceType:serviceType]) {
        if ([serviceType isEqualToString:SLServiceTypeSinaWeibo]) {
#ifdef TRADITIONAL_CHINESE
            alertView = [[UIAlertView alloc] initWithTitle:@"漢武英俠錄分享"
                                               message:@"請先安裝微博"
                                              delegate:self
                                     cancelButtonTitle:@"確定"
                                     otherButtonTitles:nil, nil];
#endif
#ifdef SIMPLIFIED_CHINESE
            alertView = [[UIAlertView alloc] initWithTitle:@"汉武英侠录分享"
                                               message:@"请先安装微博"
                                              delegate:self
                                     cancelButtonTitle:@"确定"
                                     otherButtonTitles:nil, nil];
#endif
        }
        else if ([serviceType isEqualToString:SLServiceTypeTwitter]) {
#ifdef TRADITIONAL_CHINESE
            alertView = [[UIAlertView alloc] initWithTitle:@"漢武英俠錄分享"
                                                       message:@"請先安裝推特(Twitter)"
                                                      delegate:self
                                             cancelButtonTitle:@"確定"
                                             otherButtonTitles:nil, nil];
#endif
#ifdef SIMPLIFIED_CHINESE
            alertView = [[UIAlertView alloc] initWithTitle:@"汉武英侠录分享"
                                                       message:@"请先安装推特(Twitter)"
                                                      delegate:self
                                             cancelButtonTitle:@"确定"
                                             otherButtonTitles:nil, nil];
#endif
        }
        else if ([serviceType isEqualToString:SLServiceTypeFacebook]) {
#ifdef TRADITIONAL_CHINESE
            alertView = [[UIAlertView alloc] initWithTitle:@"漢武英俠錄分享"
                                                            message:@"請先安裝臉書(Facebook)"
                                                           delegate:self
                                                  cancelButtonTitle:@"確定"
                                                  otherButtonTitles:nil, nil];
#endif
#ifdef SIMPLIFIED_CHINESE
            alertView = [[UIAlertView alloc] initWithTitle:@"汉武英侠录分享"
                                                            message:@"请先安装脸书(Facebook)"
                                                           delegate:self
                                                  cancelButtonTitle:@"确定"
                                                  otherButtonTitles:nil, nil];
#endif
        }
        else {
            NSLog(@"Social service type %@ not supported at the moment!", serviceType);
            return;
        }
        [alertView show];
        return;
    }

    SLComposeViewController
    *compose = [[SLComposeViewController alloc] init];
    compose = [SLComposeViewController composeViewControllerForServiceType:serviceType];
#ifdef TRADITIONAL_CHINESE
    [compose setInitialText:@"我正在看一本很不一樣的武俠小說,想知道是哪一本嘛?"];
    [compose addImage:[UIImage imageNamed:@"hanwu144.png"]];
    [compose addURL:[NSURL URLWithString:@"https://itunes.apple.com/tw/app/han-wu-ying-xia-lu/id595931628"]];
#endif
#ifdef SIMPLIFIED_CHINESE
    [compose setInitialText:@"我正在看一本很不一样的武侠小说,想知道是哪一本嘛?"];
    [compose addImage:[UIImage imageNamed:@"hanwu144z.png"]];
    [compose addURL:[NSURL URLWithString:@"https://itunes.apple.com/tw/app/han-wu-ying-xia-lu/id596247669?mt=8"]];
#endif
    compose.completionHandler = ^(SLComposeViewControllerResult result) {
        if (result == SLComposeViewControllerResultDone) {
            flagSuccessfulSharingChapter = 3;
            [MartialArtsCheckInAppPurchaseKey setInAppPurchaseKey: 0 :YES];
        }
    };

    [self presentViewController:compose animated:YES completion:^{ }];
}
  /* socialFrameworkShare */

The code only fully works for twitter.
It fails to show initial text and url with Facebook.
Then for sina weibo, it keeps on saying connection to sina weibo failed.

Can someone help ?
Thanks

Farn


Source: facebook

Leave a Reply