Our application writes logs to a file at a folder called UnityEngine.Application.persistentDataPath.
Now on Android we can open the file browser and open the log file. Not so on iOS. Short of Jailbreaking the phone to access all folders
- Is there a way to access log file in that folder on iOS?
- If not, is there another place where I can create that log file, so that the same is accessible e.g. from the file apps? Would Environment.SpecialFolder.MyDocuments work?
Note I am trying to write the file from C# code within unity environment, and ideally would NOT want to jump into NSLog to do this. Just a plain vanilla FileHelper.AppendAllText(LOG_FILE_NAME, "message"); I seek your help in finding a good value for that LOG_FILE_NAME.
Alternatively, rather than us trying to write the logs in a file, is there something better out there in Unity that works cross platform? Something like an inbuilt log file writer sink?
CodePudding user response:
iOS: Application.persistentDataPath points to /var/mobile/Containers/Data/Application//Documents
You can access the ios containers with xcode. Open xcode, install the app on the device, then open "Window"->"Devices". You can now click on the gear wheel -> "Download Container.."
CodePudding user response:
Niklas has provided you the answer to #1 which is how to access the file on your iOS device.
If you want to make your files accessible to other apps you should check out the UIFaileSharingEnabled functionality for your app.