I need to know how to copy resources (help files, images, pLists) to the iOS simulator and ultimately device. I recall this was done through Xcode but what is the exact procedure?
只需将文件拖到您的模拟器
For iOS 6, the directory seems to be a bit different. I'm seeing: ~/Library/Application Support/iPhone Simulator/6.0/Applications/your app here/Documents, where 'your app here' is a long string. Fortunately, if you click on each directory, you'll see the name of the app you're building in the child directory. From there, it's straightforward to find the Documents folder.
You can drag your file to simulator or you can right click to file then send->Simulator. Both work for me.
Just drag your file to the project. It will be copied to your app bundle when the app is installed (on the simulator).
Alternatively, put the file into ~/Library/Application Support/iPhone Simulator/User/Applications/...
(if you have the 3.2 SDK.)
From the XCode docs.
A Copy Files build phase allows you to copy files and resources of any type to specific locations as part of the build process. It complements the build phases that copy specific types of files. An example is the Copy Headers build phase, which deals only with header files. You can have as many Copy Files build phases as you need in a target.
For example, using a Copy Files build phase, you can copy fonts to/Library/Fonts. Or, if you're developing a plug-in, a Copy Files build phase can copy the generated plug-in to the appropriate location. You can have as many Copy Files build phases in a target as you need.
To create a Copy Files build phase:
In the project window, open the target to which you want to add the build phase, and select the build phase after which to add the new build phase. Choose Project > New Build Phase > New Copy Files Build Phase. Xcode adds the new Copy Files build phase after the build phase selected in the Groups & Files list. Drag the files you want to copy from the Groups & Files list to the Copy Files build phase. To configure the new Copy Files build phase, select it and open the Copy Files build phase editor, shown in Figure 2-5.
Just copy files to iCloud Drive. Then open the files app on the simulator and sign into your iCloud account.
Get the folder in the Mac Finder and make an Alias
Yes getting the Path by Xcode, but using the Mac Finder and an Alias to get there, doing the file copy operations, is very smooth and solid.
I get my files into my Simulator units by:
Getting the path by putting a breakpoint in Xcode at (anywhere you like in the app code):
let FilePathName: String = NSTemporaryDirectory()
The advantage is that you are dealing with the regular tool of Mac Finder folder/Alias and it is quite capable of handling large volumes of files, very smoothly.
By some upgrades of Xcode the simulator units are rest and the data has to be re-copied into the units.
The other suggestions are not that bad
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.