How to browse NSDocumentDirectory on iPhone as a user - iphone

My app exports a file that I want the user to access on the Directory:
/Users/aris/Library/Developer/CoreSimulator/Devices/{deviceid}/data/Containers/Data/Application/{appid}/Documents.
I can see the file on my Mac but I can't find it anywhere on the iPhone simulator.

Related

How to see the result of sqlite database file in firefox plugin when the app is run on iPhone device

I am using sqlite database in my app. When I run the application from simulator then I am able to see the result in firefox sqlite plugin in my .sqlite file. But when I run on real device then I am not able to see the result so can you tell me how can I see the result and from where I can get that sqlite file.
Short and Simple answer is "You Can't"
When you run on Simulator the generated applicationa nd Document files can be accessed in Library so you can easily check the sqlite file But
When you run on real device the sqlite file is in the document directory inside the device. and Apple does not allow to access the directory from device directly.
1)Enable Application supports iTunes file sharing when editing the info.plist file in Xcode
2)Connect your device to system then open iTunes then click device(such as iPad) then click apps in that you can see file sharing choose your app from that now you can see your sqlite file download that and open using firefox
If you are using Xcode version 6.1 the devices list has moved out of the Organizer. I was able to view the files for my app by:
Clicking Window->Devices and selecting my attached device on the left.
Highlight the application I wanted to view.
Click the settings gear icon below the list and select Download Container.
You are asked where you would like to save the container archive.
In Finder, left click the container archive and select view Show Package Contents.
Navigate to the file/folder you want to view.

iPhone - which location the crash log is saved in iPhone app

I'd like to access the crash log in iPhone app without Third Party library.
Do you know where the crash log is saved in iPhone app?
I know the iPhone app folder structure is as followed:
Documents/
Library/
Preferences/
MyApp.app/
Default.png
icon.png
Info.plist
tmp/
EDIT:
If the crashes are not stored in Application folder,
do you know how UKCrashReporter and other third party library do that?
You need to be connected to iPhone device and Select Window -> Organizer -> Device Logs.
I have a jailbroken iOS device, so I can answer the first part of your question easily (although you may have already done so yourself). The standard crash logs are stored on the device in the following folder:
/private/var/mobile/Library/Logs/CrashReporter/
If you don't have a jailbroken device and the logs aren't visible in Xcode, you should be able to access the files with a iOS file explorer like i-FunBox, which should be able to access the file system even without jailbreak.
As for the second part of your question, I would think that at least some third party crash reporters save the crash data in the app's folder itself, judging by the following directories (which were empty as the app has not yet crashed on my device):
// ... was the identifier for the app path, removed for readability
/private/var/mobile/Applications/.../Library/Caches/com.plausiblelabs.crashreporter.data
/private/var/mobile/Applications/.../Library/Caches/com.plausiblelabs.crashreporter.data/SkobblerUS
/private/var/mobile/Applications/.../Library/Caches/com.plausiblelabs.crashreporter.data/SkobblerUS/queued_reports
/private/var/mobile/Applications/.../Library/Caches/crashes
Again this is something you could verify with an iOS file browser.

Where file downloads in iPhone?

If i will download file in iPhone from my custom Application, where it will save file and how to get list of downloaded files before, if i will restart my app? Is there any named app storage or global storage like in Windows Phone 7?
It is your responsibility as a developer to save the file in the folder you like.
However you will only be only be able to save files and create folders in your application writeable path:
+ (NSString*) applicationWriteablePath
{
NSArray *aPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *aWritablePath = [aPaths objectAtIndex:0];
return aWritablePath;
}
Then, you can save files by using the NSFileManager. Please refer to the Apple Documentation to create your folders and save your files accordingly.
You can save user files in your app's Documents folder. You can construct an absolute path to your Documents folder with:
`NSString *docDir = [NSHomeDirectory() stringByAppendingPathComponent: #"Documents"];`
You will then need to enable iTunes File Sharing in your App's Info.plist.
To transfer files back and forth between Mac OS X or Windows, tether your device with its USB cable, launch iTunes, click on the icon of your device in the list on the left, click on the Apps tab in the pane on the right, scroll all the way to the bottom then click on your App's icon. The box to the right of your App's icon will list all the files in your Documents folder. There are buttons to transfer files back and forth.
This is how my App Warp Life deals with user documents, but I find it to be a huge PITA to have to use iTunes for this, and that it only works if my device is tethered - it won't work via wireless or BlueTooth. The UI for file transfer in iTunes is really clunky and hard-to-find for users who aren't incredibly clueful.
For that reason I am contemplating implementing some other way to transfer files. One way would be to run a small HTTP server within my App that would have just a single page listing the files, that could be downloaded by clicking their links, with a simple form for uploading files to the user's device.
Not only would that work wirelessly, but it would work with any operating system. I am quite certain that many of my target users run Linux and wouldn't be caught dead running Windows or Mac OS X if it weren' required that one use iTunes to configure one's device.
I never studied about it, but in the e-books provided by Apple is said that each app has its share of the file system.
so if you decide to download to a folder you, no matter where you download
check here if you want more information: Important Application Directories

What is the simplest way to get log files off of an iPhone?

I have logged my NSLog statements to a file in my iPhone app.
What is the simplest way to grab this data off the phone?
Is there a way to copy the file from Xcode's organizer or some other GUI interface/CLI utility like that or do I need to grab the contents of the file programmatically?
Using the Xcode Organizer, you can "Download" all of your app's files.
1) Open the Organizer.
2) Connect your device.
3) Select "Applications" under that device.
4) Click the Download button for the application.
5) Save the folder to your Desktop.
Your app's Documents folder will be in the folder that you save, along with the Library and tmp folders for that app.
inside of Xcode (in the organizer) you can click your application, expand it and copy the logs to your local machine
As the file is in your apps docs folder you can switch on iTunes filesharing in your plist
UIFileSharingEnabled
and copy it off the device via the iTunes interface.

iTunes Documents Directory in my app

how can I setup my app to accept documents via iTunes, like the Air Sharing or VLC app?
I mean, I want to allow users to get content from the app using iTunes.
Anyone know how?
Thanks
Copied from http://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniPhoneOS/Articles/iPhoneOS3_2.html#//apple_ref/doc/uid/TP40009337-SW11.
To enable file sharing for your application, do the following:
Add the UIFileSharingEnabled key to your application’s Info.plist file and set the value of the key to YES.
Put whatever files you want to share in your application’s Documents directory.
When the device is plugged into the user’s computer, iTunes displays a File Sharing section in the Apps tab of the selected device.
The user can add files to this directory or move files to the desktop.