ios - How to share photos to Twitter app from my app? -


i build app, when share photos twitter app app (by ios shared-button), can display links, display picture. how can achieve it?

try first need import social framework

if ([slcomposeviewcontroller isavailableforservicetype:slservicetypetwitter]) {     slcomposeviewcontroller *composeviewcontroller = [slcomposeviewcontroller composeviewcontrollerforservicetype:slservicetypetwitter];     if (composeviewcontroller) {         [composeviewcontroller addimage:[uiimage imagenamed:@"your image"]];         [composeviewcontroller addurl:[nsurl urlwithstring:@"your url"]];         nsstring *initialtextstring = @"tour tweet";         [composeviewcontroller setinitialtext:initialtextstring];         [composeviewcontroller setcompletionhandler:^(slcomposeviewcontrollerresult result) {             if (result == slcomposeviewcontrollerresultdone) {                 nslog(@"posted");             } else if (result == slcomposeviewcontrollerresultcancelled) {                 nslog(@"post cancelled");             } else {                 nslog(@"post failed");             }         }];         [self presentviewcontroller:composeviewcontroller animated:yes completion:nil];     } } 

please go through https://developer.apple.com/library/ios/documentation/networkinginternet/reference/slcomposeviewcontroller_class/ more information slcomposeviewcontroller


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -