Wednesday, December 11, 2013

Ios new school development, how to import existing files in the iPhone or iPhone Simulator?

posts by bluebohe edited 2012-01-18 01:13:45
Do a small program that reads an existing file,
I'm not sure how to put this file into the iPhone which allows applets to read to first thank you for the

I want to copy the file from top to mac or application inside the iPhone Simulator, and then let the app to read, how to copy?

Or how when the application is installed automatically install these files into a directory inside the application iPhone?
Reply:
Lz to provide an example of my program inside it

/ / Get the app's directory
documnetNSString * documentPath = [NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex: 0];
NSString * realPath = [documentPath stringByAppendingPathComponent: @ "fanmeli.sqlite"];
/ / Program files directory inside
NSString * sourcePath = [[NSBundle mainBundle] pathForResource: @ "fanmeli" ofType: @ "sqlite"];
NSFileManager * fileManager = [NSFileManager defaultManager];
/ / Determine copy path
if ([fileManager fileExistsAtPath: realPath]!) {
NSError * error;
if ([fileManager copyItemAtPath: sourcePath toPath: realPath error: & error]!) {
NSLog (@ "% @", [error localizedDescription]);
}
}

Reply:
realPath is the address you want to use
Reply:
The reply was deleted at the moderator 2012-01-24 12:46:52

Reply:
2nd floor right

Want to make a path to get your files stored procedures, and must have file

By the way into the file to read
Reply:
Do not know if I understand right, I feel lZ not clear sandbox concept
......
If the resource file, resource files directly when handling it.
If the file when running rumor from the App Sandbox come in a little trouble, need the help of iCloud, iTunes, webserver, etc.
Reply:
This stuff is good, we must remember it. Thank you
Reply:
1 jailbreak
2 files into the packed program


Reply:
Drag the file on your screen you can see ios simulator path of the file
This path can be accessed in your code
Reply:
Simulator landlord can find a directory under
Reply:
The reply was deleted at the moderator 2012-02-15 09:48:20

Reply:
references, 5th Floor ybh37 reply:
do not know my understanding is wrong, I feel lZ not clear sandbox concept
......
If the resource file, resource files directly when handling it.
If the file when running rumor from the App Sandbox come in a little trouble, need the help of iCloud, iTunes, webserver, etc.



mark

No comments:

Post a Comment