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 tmiller_vb · Jul 10, 2012 at 06:55 PM · macsandboxcapturescreenshot

Mac Sandboxed Application: CaptureScreenshot Filepath Not Working

Hi there.

I have an issue that I've been working on for the last few days and have found no solution as of yet. I'm not sure if this is a Unity bug or if its just the Sandboxing that is required now for Mac AppStore development screwing things up.

Just as background, I used this Unity Forum post to sandbox my app: link

In my app, I want the user to take screenshot and save it out to their Pictures folder. To do this, I am calling Application.CaptureScreenshot() as follows:

 var picturesPath:String = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures) + "/MyProjectName";
 if (!Directory.Exists(picturesPath)) Directory.CreateDirectory(picturesPath);
 Application.CaptureScreenshot(picturesPath + "/Screen Shot.png");

When I run this in the Unity editor and in a non-appstore-validated, non-sandboxed build, this works correctly; it saves a screenshot to my Pictures folder for my user name. However, when I validate the app and then sandbox it using the process in the link above, this no longer works. I notice that the "System.Environment.GetFolderPath()" call ends up returning a very long, very odd filepath, which I guess kinda makes sense with the sandboxing. However, if I force picturesPath to be "/Users/" + System.Environment.UserName + "/Pictures/MyProjectName", the CaptureScreenshot() function does not work after sandboxing (but it works in the editor and non-validated builds).

Because of this, the Mac AppStore rejects this project. Other similar products of ours have the same exact functionality, and they work correctly because sandboxing wasn't necessary until very recently. I cannot expect my users to go through some really odd (possibly temporary) filepath to find the screenshots they've taken, and Mac AppStore probably would disapprove of this anyways.

Has anyone else tried this and found any results that coincide with mine? Has anyone found any solutions to saving out files for the user? Any help would be appreciated, and I'm willing to try out any suggestions. 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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by tmiller_vb · Jul 11, 2012 at 08:49 PM

Yay! I get to answer my own question. >.

Comment
Add comment · Show 2 · 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 goodhustle · Aug 24, 2012 at 09:11 PM 0
Share

What was your answer?

avatar image sijulis · Oct 09, 2012 at 09:08 AM 0
Share

i hope you post the answer here, because i got the same error here, please...

avatar image
0

Answer by googler · Nov 15, 2013 at 04:39 PM

Have you tried to add com.apple.security.assets.pictures.read-write to the entitlements?

Comment
Add comment · 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

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

7 People are following this question.

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

Related Questions

In-app purchase "Invalid product" on Mac Store build 0 Answers

Mac App Sandbox Adding Capabilities 0 Answers

CodeSigning Sandbox - Unity Build - MacStore 2 Answers

Mac Magic mouse scroll in ever direction? 3 Answers

Do I Need a Mac to Make a Game for the iPhone? 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