Address Sina Weibo not installed client sharing cannot be linked problem

Source: Internet
Author: User

Because it started with Sina's demo, but the demo also has this problem when the client is not installed in the case of the sharing of the link will not be displayed. Workaround:

The Wbsendmessagetoweiborequest class has a Wbmessageobject class with the text of this class that is shared content here to set the shared content to be added in the URL. The code is as follows

- (void) sharebuttonpressed{appdelegate*mydelegate = (appdelegate*) [[UIApplication sharedapplication]Delegate]; Wbauthorizerequest*authrequest =[wbauthorizerequest request]; Authrequest.redirecturi=Kredirecturi; Authrequest.scope=@" All"; Wbsendmessagetoweiborequest*request =[Wbsendmessagetoweiborequest requestwithmessage:[self Messagetoshare] authinfo:authrequest access_token:    Mydelegate.wbtoken]; Request.userinfo= @{@"Sharemessagefrom":@"Sendmessagetoweiboviewcontroller",                         @"Other_info_1": [NSNumber Numberwithint:123],                         @"other_info_2": @[@"obj1",@"Obj2"],                         @"Other_info_3": @{@"Key1":@"obj1",@"Key2":@"Obj2"}}; //request.shouldopenweiboappinstallpageifnotinstalled = NO; //To determine if there is a client that does not exist just write    if(![WEIBOSDK isweiboappinstalled]) {Request.message.text= [NSString stringWithFormat:@"%@%@", Nslocalizedstring (@"Share page title", nil),@"http://sina.cn?a=1"]; } [Weibosdk sendrequest:request];}

Messagetoshare method

-(Wbmessageobject *) messagetoshare{Wbmessageobject*message =[Wbmessageobject message]; if(self.textSwitch.on) {Message.Text= Nslocalizedstring (@"test send text to Weibo via WEIBOSDK!", nil); }        if(self.imageSwitch.on) {Wbimageobject*image = [WbimageobjectObject]; Image.imagedata= [NSData datawithcontentsoffile:[[nsbundle mainbundle] Pathforresource:@"Image_1"OfType:@"jpg"]]; Message.imageobject=image; }        if(self.mediaSwitch.on) {Wbwebpageobject*webpage = [WbwebpageobjectObject]; Webpage.objectid=@"Identifier1"; Webpage.title= Nslocalizedstring (@"Share page title", nil); Webpage.description= [NSString stringwithformat:nslocalizedstring (@"Share Web content Introduction-%.0f", nil), [[NSDate Date] timeIntervalSince1970]]; Webpage.thumbnaildata= [NSData datawithcontentsoffile:[[nsbundle mainbundle] Pathforresource:@"image_2"OfType:@"jpg"]]; Webpage.webpageurl=@"http://sina.cn?a=1"; Message.mediaobject=webpage; }        returnmessage;}

Of course, if the integration of the code in the Messagetoshare can no longer be an example.

Address Sina Weibo not installed client sharing cannot be linked problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.