missing some folders in iPhone simulator? - ios

I am developing an iOS project. There, I am having to upload images to to PHP server. So I choose some images from gallery in simulator for check up. Selected image is stored inside simulator. But I couldn't find that folder. So image is going empty to server. How to find that folders?
That image stored path is below
User/Guest/Library/developer/core simulator/devices/1ABD8156-4A55-4189--BDCD-DA6F7CSB2229/data/containers/data/applications/1559E24-9738-447D-8888-EEC9E29D4D39/Documents/Photo.jpg
But here I can found until
User/Guest/Library/developer/core simulator/devices/1ABD8156-4A55-4189--BDCD-DA6F7CSB2229/data/containers/data/applications/
How can I solve this. Please help me.
Note: i am using xamarin studio for development.

This would get u the simulator directory.
[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];

Related

Where I find the saved file in iphone?

I have a problem for saving pdf file on iPhone.
I have used the following objective c code to save pdf file:
NSURL *pathURL = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
NSString *filePath = [pathURL.path
stringByAppendingPathComponent:#"filname.pdf"];
[[NSFileManager defaultManager] createFileAtPath:filePath
contents:pdfdata
attributes:nil];
I can check whether the file is saved or not correctly using webview.
I can check the contents of the saved pdf file using webview.
But I can't find the saved file on both simulator and device.
Where can I find my saved file on iPhone?
If anyone knows the solution for my issue then please advise me.
Thanks.
Your .pdf file was saved in your application document folder. So, You can easily check on simulator. Like below
Print a downloaded file path
print(filePath)
then go to
Finder -> Go Menu -> Go to folder
and paste the filePath
This is the path of your application document folder

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.

I can't find ios simulator files

I need to look my application's database file.I found this question:
How view data stored in Core Data?
In answer he said:
Your app will be folder inside (~ is your home directory):
~/Library/Application Support/iPhone Simulator/User/Applications/
I opened the Application Support folder but there is no iPhone Simulator folder inside this folder.
What should I do ? Here is the screenshot:
Edit:I am using xCode 6 and Yosemite.
The iPhone Simulator files have moved and can be a bit of a pain to find now. Each simulated device has a folder in ~/Library/Developer/CoreSimulator/Devices. You can root around in there until you find the simulator you're looking for. I wrote a tool to help locate the sandbox for each simulated device on which you've installed an app, but it's not perfect. You can find it here: https://github.com/somegeekintn/SimDirs
There is also an app called SimPholders2 that may be able to help you with this problem - http://simpholders.com/
for me it it is Library/Developer/CoreSimulator/Devices/C7E8D457-BFAB-43DA-8B0C-D9010BBB1D88/data/Containers/Data/Application/6B7DC6FA-2379-468C-A74B-60910A1CDCD1/Documents
device id and application id will be different for you though. this would give you documents directory for your app.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSLog (#"documentsDirectory %#",documentsDirectory);
OK The whole Problem lies in the fact that you need to open the Finder >> View >> Show View Options and then click to turn on Library.
Why would someone hide this so deep and obscurely?
You can use Core Data Lab to automatically find and view the database files of any Core Data app running in the simulator.
Info page: https://betamagic.nl/products/coredatalab.html
Free 14-trial: https://betamagic.nl/downloads/Core%20Data%20Lab%20Trial.zip
Diclaimer: I'm the creator of this tool.

Link to iOS Simulator file system from Xcode

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

IOS 5.1 Backup / Restore App file from Documents Directory to / from iCloud

I have created a database (IOS 5.1) with XCode 4.3.3 for the iPad and have set it up so that the user can backup and restore the database file (*.sqlite) to DropBox. Everything works fine...
Now I would like to do the same process but, set it up for iCloud. Looking for the following function:
Tap a button to backup the *.sqlite file from the Apps Document Directory up to iCloud at users preference.
Tap a button to copy the *.sqlite file down from iCloud to the Apps Document Directory.
I have been struggling trying to find the solution, any help will be greatly appreciated.
For moving any file to and from icloud you can use this code below.
[[[NSFileManager alloc]init] setUbiquitous:YES itemAtURL:your iCloudURL destinationURL:localDirectoryURL error:&errorsss];
only thing is if you are moving to icloud the code should be :
[[[NSFileManager alloc]init] setUbiquitous:YES itemAtURL:localDirectoryURL destinationURL:your_iCloudURL error:&errorsss];
and if you are getting it from iCloud to Apps Documents directory
[[[NSFileManager alloc]init] setUbiquitous:NO itemAtURL:your_iCloudURL destinationURL:localDirectoryURL error:&errorsss];

Resources