ios - Is there way to get list of installed app on device, which is able to share and receive text data -
like sharing text data whatsapp code below. want know installed apps on device able text data, below mention code.
nsstring * msg = @"your msg"; nsstring * urlwhats = [nsstring stringwithformat:@"whatsapp://send?text=%@",msg]; nsurl * whatsappurl = [nsurl urlwithstring:[urlwhats stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]]; if ([[uiapplication sharedapplication] canopenurl: whatsappurl]) { [[uiapplication sharedapplication] openurl: whatsappurl]; } else { uialertview * alert = [[uialertview alloc] initwithtitle:@"whatsapp not installed." message:@"your device has no whatsapp installed." delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil]; [alert show]; }
sharing text,data other social app twitter/facebook. can try code below :
nsstring *sharestring = @"text..."; uiimage *shareimage = [uiimage imagenamed:@"image.png"]; nsurl *shareurl = [nsurl urlwithstring:@"http://www.test.com"]; nsarray *activityitems = [nsarray arraywithobjects:sharestring, shareimage, shareurl, nil]; uiactivityviewcontroller *activityviewcontroller = [[uiactivityviewcontroller alloc] initwithactivityitems:activityitems applicationactivities:nil]; activityviewcontroller.modaltransitionstyle = uimodaltransitionstylecoververtical; [self presentviewcontroller:activityviewcontroller animated:yes completion:nil];
it display activity view showing other text sharing app.
or can create custom uiactivity also. in custom uiactivity subclass have override 1 method:
+ (uiactivitycategory)activitycategory { return uiactivitycategoryshare; }
Comments
Post a Comment