Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by oliver-jones · Jun 02, 2015 at 04:46 PM · iosimagesavedata

iOS - Saving Data (Image)

Hello,

I've been looking around to see how its possible to save data such as an image on an iOS. There seems to be many different ways which has brought confusion.

What is the best possible way to save an image, or audio on iOS? For example, lets say I have an Image Editing application that I'm building in Unity for iOS. I want to be able to save the users edited image within the app, on the iOS.

The only true way I know about saving data is PlayerPrefs, so with that, I can just convert the image into byte data, and have PlayerPrefs hold that data for me. But theres got to be a better way.

Could someone please shred some light on this topic for me please?

Thanks.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by abi-kr01 · Jun 02, 2015 at 05:32 PM

You Can see i have done it for ios and android

or use it like this .first convert your image into bytes and then

  IEnumerator save_png_player()
      {
          if (Application.platform == RuntimePlatform.Android)
          { 
              File.WriteAllBytes( Application.persistentDataPath+"/"  +name+".jpg",bytes );
          }
          else
          {
              File.WriteAllBytes( Application.dataPath+"/Resources/save_screen/"+name+".jpg",bytes );
          }
       
   
          yield return null;
  
  
      }





for audio i have this, work on both ios and droid record it and play it [link text][2]

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image oliver-jones · Jun 02, 2015 at 08:37 PM 0
Share

Thanks for this, I tried your save/load script on the link you supplied, and it doesn't work. The save seems to work okay, but the load doesn't:

When I try and load, I get this error:

UnauthorizedAccessException: Access to the path "/private/var/mobile/Containers/Bundle/Application/17484CC4----**/app_name.app/Data/Resources/image_save.png" is denied.

avatar image oliver-jones · Jun 02, 2015 at 08:59 PM 0
Share

There really doesn't seem to be an easy way to save and load files on iOS, which amazes me!...?

avatar image tuanzi88 oliver-jones · Sep 23, 2016 at 09:07 AM 0
Share

have you resolve this issue? since I am looking for the solution for the same problem: how to transfer image from gallery to texture in App, and save it in App for next time use.

avatar image abi-kr01 · Jun 03, 2015 at 04:56 AM 0
Share

click here

update url with new as you already saved data in persistentDataPath

 url=Application.persistentDataPath+"/"+tiger+".jpg";
 
 or 
 
 url=Application.persistentDataPath+"/"+tiger";


after load it is available in "tex" variable

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do you copy PersistentDataFolder between devices? 2 Answers

How do I save and retrieve ordered data? Can I do this with an array? 1 Answer

Loading a list into unity 0 Answers

How can I make this script save and or load what I do in my game?? 2 Answers

XmlException when trying to read/write XML from iOS device 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges