Key code for custom sharing after integration with the Friends League SDK

Source: Internet
Author: User

Share content directly to Sina without pop-up editing interface

[[Umsocialdataservice Defaultdataservice] Setsocialdata:[umsocialdata Defaultdata]];

Umsocialurlresource *urlresource = [[Umsocialurlresource alloc] Initwithsnsresourcetype: Umsocialurlresourcetypeimage URL:

_detailmodel.productinfo.imageurl];

UIImage * image = [UIImage imagewithdata:[nsdata datawithcontentsofurl:[nsurl urlwithstring:_ DetailModel.productInfo.info]];

[[Umsocialdataservice Defaultdataservice] Postsnswithtypes:@[umsharetosina] content:[nsstring stringWithFormat:@ "% @%@ ", _detailmodel.productinfo.info,_detailmodel.productinfo.shareurl] image:image location:nil urlResource: Urlresource presentedcontroller:self completion:^ (umsocialresponseentity *shareresponse) {

btn.enabled = YES;

if (Shareresponse.responsecode = = umsresponsecodesuccess) {

[[Activityremindview Loadfromxib] ShowActivityViewInView:self.view withmsg:@ " sharing success " inseconds:1];

}else{

[[Activityremindview Loadfromxib] ShowActivityViewInView:self.view withmsg:@ " sharing failed " inseconds:1];

}

}];

/*************** with edit page to share to Sina *************/

[umsocialconfig setfinishtoastishidden:YES position: Umsocialitoastpositiontop];

umsocialdata * socialdata = [umsocialdata defaultdata];

Socialdata. Urlresource = [[umsocialurlresource alloc] initwithsnsresourcetype: Umsocialurlresourcetypeimage URL:

_detailmodel. ProductInfo. ImageUrl];

    socialdata. Shareimage =  [uiimage imagewithdata< Span class= "S1" >:[nsdata datawithcontentsofurl :[nsurl urlwithstring:< Span class= "S6" >_detailmodel. Productinfo. Info

    socialdata. Sharetext = [nsstring stringwithformat:@ "%@\n%@\n" ,_detailmodel.productinfo. Info,_detailmodel. Productinfo. Shareurl     

__unsafe_unretained productdetailinfocontroller * productcontroller = self;

umsocialcontrollerservice * umsvc = [[umsocialcontrollerservice defaultcontrollerservice ] initwithumsocialdata: socialdata];

Umsvc. socialuidelegate = productcontroller;

//[[Umsocialcontrollerservice Defaultcontrollerservice] setsharetext:[nsstring stringwithformat:@ "%@%@", _ Detailmodel.productinfo.info,_detailmodel.productinfo.shareurl] Shareimage:[uiimage ImageWithData:[NSData Datawithcontentsofurl:[nsurl Urlwithstring:_detailmodel.productinfo.info]] [Socialuidelegate:productcontroller];     

// set shared content and callback objects

[umsocialsnsplatformmanager getsocialplatformwithname:umsharetosina]. Snsclickhandler(self, [umsocialcontrollerservice defaultcontrollerservice], YES);

Share to a circle of friends

[umsocialconfig setfinishtoastishidden:YES position: Umsocialitoastpositiontop];

    [umsocialdata Defaultdataextconfig. Wechattimelinedata. Url = _detailmodel. Productinfo. Shareurl

umsocialurlresource * Urlresource = [[umsocialurlresource alloc] initwithsnsresourcetype :umsocialurlresourcetypeimage URL:_detailmodel. ProductInfo. ImageUrl];

UIImage * image = [UIImage imagewithdata: [nsdata datawithcontentsofurl: [ Nsurl urlwithstring:_detailmodel. ProductInfo. Info]];

[[Umsocialdataservice defaultdataservice]  postsnswithtypes: @[umsharetowechattimeline] Content:_detailmodel. Productinfo. Info image:image location:< Span class= "S3" >nil urlresource:urlresource Presentedcontroller:self completion :^ (umsocialresponseentity *response) {

if (response. Responsecode = = umsresponsecodesuccess) {

[[activityremindview loadfromxib] showactivityviewinview:self. View withmsg:@ " sharing success " inseconds:1];

}Else{

[[activityremindview loadfromxib] showactivityviewinview:self. View withmsg:@ " sharing failed " inseconds:1];

}

}];

Key code for custom sharing after integration with the Friends League SDK

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.