objective c - How to share Text on viber , Facebook messenger and Instagram from iOS application? -
if 1 has idea how share text viber facebook messenger , instagram please give reference.
i have try defultcanopenurl
method viber , facebook-messenger below:
code:
nsurl *fburl = [nsurl urlwithstring:@"fb-messenger://user-thread/user-id/"]; if ([[uiapplication sharedapplication] canopenurl: fburl]) { [[uiapplication sharedapplication] openurl: fburl]; } nsstring * urlviber = [nsstring stringwithformat:@"viber://send? text=text"]; nsurl * viberurl = [nsurl urlwithstring:[urlviber stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]]; if ([[uiapplication sharedapplication] canopenurl: viberurl]) { [[uiapplication sharedapplication] openurl: viberurl]; } else { alert(@"viber not installed.", @"your device has no viber installed.") }
but above code redirects application. doesnt pass text application textfield.
waiting helpful guideline experts.. :)
for viber:
[nsurl urlwithstring:@"viber://forward?text=sdlmfkkanfj"]
for instagram: have share image text, text cant share.
nsurl *instagramurl = [nsurl urlwithstring:@"instagram://app"]; if ([[uiapplication sharedapplication] canopenurl:instagramurl]) { nsstring *jpgpath = [nshomedirectory() stringbyappendingpathcomponent:@"documents/image.igo"]; nsstring *urlstring = [[nsstring alloc] initwithformat:@"file://%@", jpgpath]; nsurl *imageurl = [[nsurl alloc] initwithstring: urlstring]; self.doccontroller = [self setupcontrollerwithurl:imageurl usingdelegate:self]; self.doccontroller.uti = @"com.instagram.exclusivegram"; self.doccontroller.annotation = [nsdictionary dictionarywithobject:@"i_want_to_share_this_text" forkey:@"instagramcaption"]; [self.doccontroller presentopeninmenufromrect: self.view.frame inview: self.view animated: yes ]; }
Comments
Post a Comment