开发者

programmatically retrieve project directory in xcode objective-C project

开发者 https://www.devze.com 2023-01-11 13:19 出处:网络
How do I retrieve the project directory of an xcode project targeted for the ipad? Or if it isn\'t possible, then how do it retrieve the home directory of the user?

How do I retrieve the project directory of an xcode project targeted for the ipad? Or if it isn't possible, then how do it retrieve the home directory of the user?

something like:

NSString *path = [NSProject getPath];//could be absolute or relative

or

NSString *homeDir = [NSURL getUserDi开发者_运维知识库rectory];


The user directory is not publicly writable in iOS. Where to store files depends on your goal, but it will always be within your app sandbox. Apple sets out guidelines in their iOS Application Programming Guide:

<Application_Home>/AppName.app
<Application_Home>/Documents/
<Application_Home>/Library/Preferences    
<Application_Home>/Library/Caches
<Application_Home>/tmp/

If you would like to expose files in /Documents to other applications, including iTunes on the desktop, then enable file sharing.

0

精彩评论

暂无评论...
验证码 换一张
取 消