ios - how to send file from from one app to another app using url scheme? -


summary (ios 8, xcode 6.4)

first question:- can share app's documents directory's data other app?

if yes, i've seen many questions related this; move data/images between 2 ios apps using custom url handler, http://code.tutsplus.com/tutorials/ios-sdk-working-with-url-schemes--mobile-6629

but found these example send text or urls. tried myself below:

nsstring* path = [nsstring stringwithformat:@"my_url_scheme://"]; nsurl* url = [nsurl urlwithstring:path]; if([[uiapplication sharedapplication]canopenurl:url]) {     [[uiapplication sharedapplication]openurl:url]; } 

the above code works open other app. when try below, can't open other app.

nsarray* mainpath = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *sourcepath = [mainpath objectatindex:0]; nsstring* path = [nsstring stringwithformat:@"my_url_scheme://%@",sourcepath]; nsurl* url = [nsurl fileurlwithpath:path isdirectory:yes]; if([[uiapplication sharedapplication]canopenurl:url]) {     [[uiapplication sharedapplication]openurl:url]; } 

so, please me, missing?
edit:-
forgot mention that,ios7 support important in app.so, think extension might not work.

use nsuserdefaults app group share data between apps

nsuserdefaults *defaults=[[nsuserdefaults  alloc]initwithsuitename:@"app group name"]; [defaults setobject:filedata forkey:@"keyfordata"]; [defaults synchronize]; 

in app delegate of consuming app fetch data nsuserdefaults

another way use share extension- http://easynativeextensions.com/how-to-launch-your-app-from-the-ios-8-share-menu/


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -