Installation file path problem for iOS simulator and real machine debugging

Source: Internet
Author: User
Tags tmp folder

Excerpt from: http://zhidao.baidu.com/question/1605787265227542067.html

Xcode6 released, there have been a lot of changes, functional changes, here do not do too much to repeat, in the WWDC Apple has been told, there are many articles on the Internet, here to introduce some is not too easy to find, but very important small places.

1, the Xcode6 simulator path change

In Xcode5 and previous releases, the Xcode path to the emulator is:/users/username/library/application support/iphone
Simulator. Under this folder, you can view all of the emulator versions, and then click to view the application sandbox.
In development, it is recommended that you drag the file shortcut path to the Finder's left personal collection to easily open the view application sandbox.

In the Xcode6, the position of the simulator is changed, the address is as follows:/users/username/library/developer/coresimulator, when opened, you will find the following:

Here, Apple encodes the simulator, not naming and classifying it in the simulator system version, but a distinction between all the simulators in the Xcode6, with 16 of the 16 folders corresponding to the Xcode6 in each.
, then how to according to this seemingly garbled folder, to determine what kind of simulator it is.

When you select a file, you will see a folder named Data, and a device.plist configuration file, and after you open the Device.plist profile, you will see the emulator's Udid, device type, system version, name, and so on. This allows you to know the device and system version of the simulator. Open, you will find that the front of the seemingly garbled file name, in fact, is the simulator device Udid, although from here can get the simulator Udid, Apple also used it for classification simulator, but in the actual programming, if you want to finally publish to the app
Store words, or give up udid it, this is the Apple more overbearing point, of course, is also in the protection of user privacy to make.

2, the application of the sandbox address changes
After getting the emulator path, or using a lot of different, the application of the sandbox address is also different from before.

In the XCODE5 and previous versions, the sandbox address is as follows:/users/username/library/application SUPPORT/IP Hone
Simulator/7.0.3/applications, in applications, will find the application sandbox.

After you open the application sandbox, there will be an application file, a document folder, a library folder, and a TMP folder. The role of these folders is not to be summarized here.

In Xcode6, the four files in the application file, document folder, library folder, and TMP folder are placed in different directories. Application file path:/users/username/library/developer/coresimulator/devices/emulator udid/data/containers/bundle/, Application Folder; Document folder, Library folder, tmp folder path:/users/username/library/developer/coresimulator/devices/ Simulator udid/data/containers/data/,application under File. Unfortunately, the names of the two paths open are still encoded, and the file name of the same application file and the folder where the D, L and T folders are located are different. You can only find it yourself.

3, Nsuserdefault file storage location changes

Nsuserdefault is a localized data storage method provided by iOS that automatically creates a. plist configuration file in the sandbox, saves the data, and receives it in a nsdictionary dictionary when read.

In XCODE5 and prior versions, the specific path is:/users/shifengwei/library/application Support/iphone
Under the Simulator/7.0.3/applications/c9588981-3d82-49bc-92b8-f5ba72185629/library,preferences folder, the name is program bundle
Identifier's plist file. After you delete a program in the emulator, the plist file in the Library folder is deleted accordingly.

In Xcode6, the program replaces the location of the plist file that was created using the Nsuserdefault method, as follows:/users/username/library/developer/coresimulator/devices/ Emulator Udid/data/library,preferences folder.

In particular, if you look at the road in the Finder, this is not the case, but by
Finder, go to folder, find through this path can be found. The path address above is obtained by looking at the display profile of the Preferences folder.

Through the above path can be seen, through the Nsuserdefault created by the Plist folder or under the library file, but the difference is that the real location changed, into the simulator in the database folder, such a change in the resulting change is, When we delete an application in the emulator, the Plist file remains and is not deleted.

So, since the position in the simulator has changed, what difference does it have after upgrading to iOS8? Here is the difference between debugging in the real machine.

1, in the organizer, in the XCODE5, is the devices, Projects, archives three columns, and in the Xcode6, separate devices took out, became and organizer lateral, in the Xcode menu bar, window. If you know Xcode from 4.X to 5 o'clock, you will know that organizer changed at that time, from the original four columns into three columns, to remove the help document.

2, in the real machine debugging, will open the application sandbox in the real machine, to view, in the Xcode,
In the devices application, you can download the sandbox of the application and view the sandbox information by right-clicking the contents of the package. But there was a difference between iOS8 and iOS7.

The image above shows the same application in different systems, the left image is iOS8, download down the sandbox content, the right picture for iOS7.0.4, download down the sandbox content, it is clear that under the IOS8, the contents of the sandbox can not be viewed through the devices download.

We use the third party software, here is the Ifunbox, find the application, open discovery can see the contents of the sandbox, copied to the local, found that the original 5 files, only 3, that is, the document folder, library folder, tmp folder three.

Here specifically, mentioned above, in the simulator, through the Nsuserdefault automatically created plist files, after the deletion of software, but also retained, but in the real machine, it will be deleted, The path to the corresponding plist file is not preserved after the application is removed from the Preferences folder under the exported Library folder. This is the difference between a real machine and a simulator.

This difference creates a situation in which nsuserdefault can also be used. At present, the author is not to discard Nsuserdefault, after all, it is only in the simulator will be deleted application retention, in the real machine will not, and nsuserdefault in development, as data persistence, in the preservation of data, still very good. Of course, there are also developers will not adapt to this situation, worry about in the real machine will appear, if the developers think it is not adapt, you can create a plist file in the sandbox, instead, but if the application of the use of Nsuserdefault more, do not recommend this, After all, the nsuserdefault of Apple encapsulation is still very useful. You can delete the file after the emulator, in the folder to save the plist file, the plist file will be deleted, more than one step, at least for now, in the real machine or the same as before.

Of course, in iOS, in addition to Nsuserdefault will automatically generate files for data storage, archiving is the same, because the author did not test, in order to avoid misleading, here is not said, to be tested after the summary release.

PS: Finally, add the command to turn on or off the Mac's hidden files.
Turn on the Mac hidden file command: Defaults
Write Com.apple.finder Appleshowallfiles-bool True
Turn off the Mac hidden file command: Defaults
Write Com.apple.finder Appleshowallfiles-bool
False
Method: In the terminal, enter the command, return, and then in the forced exit, restart the Finder.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.