- Because there is no Sina Weibo option in the simulator settings, so choose the real machine debugging, success. Not much code, including header files
- No login information is configured, it is not useful.
- Specific code implementation
1- (void) Touchesbegan: (Nsset *) touches withevent: (Uievent *)Event2 {3 //1. Determine if the platform is available4 if(![Slcomposeviewcontroller Isavailableforservicetype:slservicetypesinaweibo]) {5NSLog (@"The platform is not available, or no associated account is configured");6 return;7 }8 9 //2. Create a shared controllerTenSlcomposeviewcontroller *COMPOSEVC =[Slcomposeviewcontroller Composeviewcontrollerforservicetype:slservicetypesinaweibo]; One A //2.1. Add the shared text -[Composevc Setinitialtext:@"I'm a Codeman ."]; - the //2.2. Add a picture -[Composevc addimage:[uiimage imagenamed:@"xingxing"]]; - - //2.3. Add a shared link +[Composevc addurl:[nsurl urlwithstring:@"www.baidu.com"]]; - + //3. Pop-up sharing controller A [self PRESENTVIEWCONTROLLER:COMPOSEVC animated:yes completion:nil]; at - //4. Listen to the user clicked Cancel or send -Composevc.completionhandler = ^(slcomposeviewcontrollerresult result) { - if(Result = =slcomposeviewcontrollerresultcancelled) { -NSLog (@"Click the Cancel"); -}Else { inNSLog (@"Click the Send"); - } to }; +}
iOS development, the system comes with the sharing simple implementation