- Home /
Iphone: How to read a file created by another application ?
Hi everyone, I have a problem: i'm trying to save a .txt file with an app and read it with another one.
But it doesn't work. I tried to use Application.persistentdatapath but when i try to access to the persistentdatapath of another application the access is just locked.
I heard on iphone there are some paths/directories where i can write and read files but i don't know wich one i can use :/ Maybe there are some tips to share a file between 2 apps on Iphone ?
On android it works perfectly but on iphone i just don't understand..
If someone can help me please ?
Answer by iwaldrop · Jul 06, 2017 at 03:01 AM
This is not possible on the iOS platform by design. Each app runs in a sandbox and so only has access to the data that it creates. You'd need some external storage solution, like integrating dropbox or google drive to make this work. Another option may be to use a custom url scheme to pass data between the apps, but application A cannot access the contents of application B's data; sorry.
An app is generally prohibited from accessing or creating files outside its container directories. One exception to this rule is when an app uses public system interfaces to access things such as the user’s contacts or music. In those cases, the system frameworks use helper apps to handle any file-related operations needed to read from or modify the appropriate data stores.
Thank you very much for your answer ! I lost a lot of time with that.
Url scheme seems to be a good solution because i just need to send a data from an app 'A' wich will launch my application 'B' and sending it a data. But i admit i don't know how to use it... $$anonymous$$aybe have you a link for a good tutorial to use Url sheme with unity ?
I think Apple allows an app developer/publisher to share/access files between THEIR OWN APPS. So the question to the OP is whether they have control of BOTH apps being talked about here?
Actually, as of iOS 8 there is a mechanism to share to any apps: https://www.engadget.com/2014/06/02/apple-ios-apps-extensibility-share-data-features/
So the question is more about how to do it with Unity.
I found this tutorial concerning the URL SCHE$$anonymous$$E : http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
But now my problem it's I don't understand how i can link this native iOS code with unity... This tutorial talks about that : http://blog.ashwanik.in/2014/04/ios-plugin-for-unity3d.html
If anyone can help me :/
@Tatchou Hi, did you find a way to implement this?
Your answer
Follow this Question
Related Questions
,HELP -- iOS Empty project exceeds iphone size limit ! 1 Answer
Access Unity assets natively on Android and iPhone? 0 Answers
iPhone log files? 1 Answer
Are there some restrictions of filename on Unity(, Android, or iPhone) ? 0 Answers
[help]How can I read the file in StreamingAssets on iPad/iPhone platform??? 0 Answers