geolaw geolaw - 4 months ago 109
Objective-C Question

Unity iOS making saved image show in photos

I have an image saved from my game at

Application.persistentDataPath + @"/p.png"
I am trying to make this visible in iOS, I have managed it in android using the Android wrappers in Unity C# but I have no idea where to start with iOS.

Is it possible for me to pass the path to my Image to iOS so that it will show up in the Photos app? If I need to write my own plugin does anyone have any decent documentation on how it's done?

Answer

If I need to write my own plugin does anyone have any decent documentation on how it's done?

That seems like the only way. Make a plugin that can read and write byte array to Picture folder on the iOS. You can also use already made one from here that cost $10. This plugins works with iOS, Android and Windows Phone 8 and I recommend you got with it.

The fact is that I can't write the whole process here. You first need to know how to write and read from the photo folder. Here is a link for that.

Now you need to know how to call a C# function fro Objective-C and vice versa. Many tutorials for this.

http://twnkls.com/2016/04/11/creating-native-plugins-for-unity3d/ http://alexanderwong.me/post/29861010648/call-objective-c-from-unity-call-unity-from https://www.quora.com/How-do-you-call-native-iOS-functions-from-Unity http://stackoverflow.com/a/30946257/3785314