Link to iOS Simulator file system from Xcode - ios

I seem to remember a way to get to the iOS Simulator file system from within the Xcode 6.0 or iOS Simulator GUI, but I can not find this anywhere any more. Anyone know if such a link still exists in beta 5 or later?
BTW I know the simulated file system is now located in ~/Library/Developer/CoreSimulator/Devices/*/data/Containers/Data/Application/*/ (previously ~/Library/Application Support/iPhone Simulator/*/Applications/*/). I'm looking for a link directly from Xcode, e.g. on some Schemes page.

The location of the iOS 8 Simulator has changed from previous versions. Plus, every time you run the app from Xcode the location changes.
The easiest way to beta direct URL in Xcode is perhaps like this:
#if TARGET_IPHONE_SIMULATOR
// where are you?
NSLog(#"Documents Directory: %#", [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]);
#endif
When you open a Finder window to that location and keep it open, it updates automatically to the new location when you run your app again.
Further reading: http://pinkstone.co.uk/where-is-the-documents-directory-for-the-ios-8-simulator/

As the previous answer explains the location changes all the time so it's not possible to have a link.
You can use the method above to print it to the console or save a small file upon start up that you can then search for.
Because I missed the convenience of the link I wrapped this into a small OS X app Simulator Data Finder and made it available. The website should be self explanatory how to use either for objective c or swift

Related

iOS run on Apple Silicon - Mail to open file is NOT placed in "Documents/Inbox"

From Apple's iOS development document:
https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html
So in native IOS environment, when I used Mail to open some file attachment and chose my iOS app to open it, I can find the file copied to "Documents/Inbox" directory.
But when I run iOS in Apple Silicon - the same above scenario, the file is NOT copied to "Documents/Inbox". In fact, there is no "Inbox" sub-directory under "Documents".
Does anyone know where the file copied to?
Got answer from Apple Developer Forum:
"From your app delegate's [application:openURL:options:] method, you can NSLog the [url path]."
Getting the original file path from [url path] and then copy to "Documents" which now I can manipulate this mail attachment file. So have to do this and cannot hard code the file path: "Documents/InBox" which only work reliably in iOS device..

Xcode Device Simulator Files

I have been clearing some space from my drive and noticed that there are 183 folders inside my Developer>CoreSimulator>Devices folder. Are all of these required or are some of these simulators for older versions of iOS. When I look inside some of the folders they contain a file called device.plist that says the Sim Runtime is iOS-8-4. Is there any way to remove these old files?
Thanks
~/Library/Developer/CoreSimulator
Core Simulator folder is familiar for many Xcode users. It’s simulator’s territory; thats where it stores app data. It’s obvious that you can toss the older version simulator folder/folders if you no longer support your apps for those versions. And, it’s safer to use ‘Reset content and Settings’ option from menu to delete all of your app data in a Simulator.
Tip:
Objective-C
[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
Swift
NSFileManager.defaultManager().URLsForDirectory(NSDocumentDirectory, inDomains: NSUserDomainMask).lastObject()
Will print the full path to the document directory folder.

iTunesMetadata.plist location on ios8

I want to identify if the current version of an app using my SDK was downloaded from the AppStore, till now I used this code:
[[NSFileManager defaultManager] fileExistsAtPath:[NSHomeDirectory() stringByAppendingPathComponent:#"iTunesMetadata.plist"]]
Since ios8 I get false even if the version is from the AppStore.
Do you know where did the file move to? Any other mechanism you propose?
Hope this helps you:
In iOS8, the application bundle has been moved. According to #silyevsk, the plist is now one level above [the new application main bundle path], at /private/var/mobile/Containers/Bundle/Application/4A74359F-E6CD-44C9-925D-AC82E‌‌​​B5EA837/iTunesMetadata.plist, and unfortunately, this can't be accessed from the app (permission denied)
Please refer here for more details: How can I detect if the currently running app was installed from the app store?

iCloud documents no longer in Mobile Documents folder?

I have an app that creates a file in the iCloud documents folder. It is working fine, in that the devices that the app is installed on can access and update the file successfully. In my code, a NSLog of the file path gives me:
///private/var/mobile/Library/Mobile%20Documents/iCloud~my-company-name~appname/Documents/document_name
As part of my testing, I need to be able to view this file from my mac. Previously, I was able to do this by looking in my library/Mobile documents folder at the respective app folder.
However, I can't see the app folder in there. Any ideas why this would now not be showing up or pointers to configuration settings I could check? (I'm on Xcode 6.1, mac is Yosemite and all devices are iOS8).
Finder now treats this as a 'special' folder, so actively prevents you browsing the structure. You can do this if you use Terminal instead.

Xcode not transferring app to iPhone (Successfully)

I've built a starter app for myself and wanted to transfer it to my iPhone 4 but unfortunately when it's transferred from Xcode to my iPhone, Xcode throws an error which terminates the app (of sorts) and I get nothing on the screen except the app logo. All of which is beyond my understanding.
The debugger shows an error in the main.m file highlighting the following line:
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
whilst labelling the above line with the following words:
Thread 1: signal SIGABRT
I would like to point out that my device is jailbroken also. Please let me know what I need to do to get my app running on my device successfully.
The correct way to fix this depends on which way you're expecting to upload and run your code - i.e. do you upload your code via ssh in a user-specified script, or do you use the apple-provided way with provisioning profiles? Your question is currently lacking the information needed for answering this.
Since you're jailbroken, you should always be able to add a post-build hook which signs the binary using ldid -S, uploads the binary to the iPhone, and runs it.
(You won't be able to use the debugger integrated into XCode without major hackery if you use this way, and there's probably a simpler way of achieving this.)
Probably the device recognizes your Apple certificate isn't valid (if you even have one) or the software refuses to run the app on a device that isn't fully legit according to Apple's standards.
That is one reason but that's something I'm fully certain. I searched stackoverflow and found another possible explanation. This topic states that a new xcode project only runs on the newest OS. At the moment iOS 7 is still in beta so a startup project launches default in iOS 6.1.
To make it run on an older version you'll just need to adjust the deployment target to the version you prefer. Ofcourse working in an older OS will take effect in the language and "set you back". And here is how to change your deployment target. Hope this helped?

Resources