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
Related
there's a way to access a real device (iphone/ipad) document folder? I realized an app that store some data in that folder and i wanted to check if all is going in the right way.
You can do this without iTunes and even if the file is somewhere else in the sandbox other than Documents.
Go to Window/Devices in Xcode.
Next, select your device, and find the app in the list.
Now, look at the little gear icon at the bottom of the devices window. Click that bad boy.
See "Download Container..." in the list. Guess what that does? You got it. It downloads the whole sandbox with all the folders in the app's sandbox. Right click and "Show Package Contents".
This should let you see the sandbox of apps that have not yet been released. So, good for testing on a real device.
If you're testing on a simulator life is way easier. Just download the free app OpenSim here . Update: These days I prefer SimSim, also free here.
To anyone looking out for the exact answer:-
1.Go to plist file of your project.
2.Add one row.
3.Then set the Boolean value of the property "Application supports iTunes file sharing" to "YES". (the key name is UIFileSharingEnabled)
And you are good to go.
Also note that you have to plugin the device in order to access the copied files (Programmatically). If you happen to go and try to access it on computer .. you wont be able to find the files.
Your question is a bit unclear, but I can see three interpretations:
You can plug your iPhone into iTunes to see your documents folder for any app with iTunesFileSharing enabled, including any apps you have written or are writing.
If this is your own app, and you need help reading files from the documents folder, take a look at this question.
If this is someone else's app, and you want to access the app's documents folder without iTunes and the app does not have implementation for what you want, then I am afraid some sort of jailbreaking and hacking is necessary.
iExplorer can help in figuring out for an iOS app. :)
Edit:
You are right, give a try to iMazing
Quick Solution
Just add this key in our plist and you're good to go
<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
Visit this link for detailed explanation
You can access documents directory from code using:
+ (NSString *) applicationDocumentsDirectory {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
return basePath;
}
And you can then go to terminal for the same path and check all the files.
e.g on my system its like this:
~/Library/Developer/CoreSimulator/Devices/<deviceID>
If you are looking for a tool that import file from iOS app document folder to Mac, install Apple configurator 2 (https://apps.apple.com/us/app/apple-configurator-2/id1037126344?mt=12)
Connect your device to Mac and in Apple configurator follow below steps
Double click on the Device
Choose Actions > Export > Documents.
Select the file inside app to export, then click Choose. Save the items to the desired location in Mac.
If you have a physical device you can add the UIFileSharingEnabled
key in info.plist and set its value to YES
then run your app
open iTunes select device and goto file sharing and select your app
you will be shown files created by your app
Applications like iPhone Explorer can show the contents for each installed iPhone application on Mac OS X (even on non-jailbroken devices) when iPhone is connected using USB-cable. I'm trying to do something similar, programmatically copy some files from my iPhone app's folder.
I have done some experiments with open-source frameworks/products built to use iTunes-framework, like iPhoneBrowser and MobileDevice Library. I can connect to iPhone, now the problem is how to enumerate Apps folder items? iPhoneBrowser or MobileDevice Library don't support or provide any easy way for that. Even when hardcoding my application path to iPhoneBrowser it still refuses to display the folder. iPhone Explorer can read the folder without any trouble on the very same device, so it is definitely possible.
Second problem is getting path to apps, on each device they have different path with some hash number folder names. How to 'decrypt' the paths so that I can access my app folder on every device?
the app enumerate use another protocol, you may find some in this https://github.com/phildrip/fruitstrap
I wrote a open source program that works on Windows, here is the github project url:
https://github.com/Moligaloo/iPhoneFS
It can access files on jailbroken iPhone/iPod/iPad (non-jailbroken devices files are limited accessible).
It can also enumerate apps on iDevice.
I want to transfer file from system (mac/Pc), which is present on my iPhone wifi network, to the document folder of my iPhone App.The scenario of my App is this, it will browse the system which are present in it's network. select any file(such as .pdf or ,docx) from that system(mac/Pc), copy it into the document folder of the APP and than use it with in the APP.During my search i come across the link iPhone : Transfer of files from Mac/Pc to app i have not found the detail instruction document, how to use it. Is Apple support any API or farm work to do this ? Please guide me
This is called iTunes file sharing. In the most simple way, you simply set the UIFileSharingEnabled key in your Info.plist file to YES. See for example this tutorial.
Rewriting itunes is not a simple task but I recommend you a clever and easier solution:
Implement a simple webserver on your iOS app. Write a windows application which will connect to your iOS app through wifi network. Then transfer the necessary files this way: you will send a file to you app, then your app should save it in documents directory.
I have a question that most of you might find a little odd. I am making an application for OS X, but I need it to write text files into an iPhone folder. I know the iPhone will have to be connected to the computer, and I do not think that emailing will work.
I thought it would be as simple as finding a path to the iPhone while it was connected (such as /iPhone/Documents), but I cannot figure out what the path is. If anybody can tell me how to find the path, or can give me a link to some useful information, I will be very greatful
EDIT: although it was not the answer I wanted, I got what I needed. I think all of these answers gave me an equal amount of information, so I had a hard time choosing which answer to accept. I accepted the one that provided me with an alternative way to get the files onto the iPhone. Thanks for all of the help, everyone!
You will only be able to transfer files to and from your application using iTunes.
In order to get this to work your app must register for sharing documents in the Info.plist file by setting the UIFileSharingEnabled key to YES. When this is done your app will when installed and the device in connected show up on the "Application" tab in iTunes at the bottom. Highlight the app in the list to the left, and drag and drop files to the list on the right.
This way any file stored in the applications documents folder will be visible to iTunes, and any file copied to the device in iTunes will show up in the documents folder. You find the documents folder in your app like this:
NSArray* paths = NSSearchPathForDirectoriesInDomains(
NSDocumentDirectory, NSUserDomainMask, YES);
NSString* path = [paths lastObject];
That's not going to be possible. The iPhone connects over a proprietary(-ish) connection to iTunes, so you don't have any access into the iPhone's filesystem in your custom app. Besides which, apps in the iPhone have separate document folders so there isn't a single "documents" location on the device.
If you're writing your own iPhone app and want to support sharing documents with the Mac, you can either implement a Bonjour-based syncing service, sync via DropBox or iDisk, or use iTunes File Sharing. The options and trade-offs are well documented in this technote.
The iPhone doesn't have a mass storage mode, as Apple wants iTunes to be the ONLY method of transferring files to/from the iPhone. Maybe iTunes has an API for this that you can exploit, but otherwise the only way to get access to the file system in there is on jailbroken devices or via apps
I need a copy of the store that is saved as Core Data sqlite file inside a test app installed on my device.
I know how to get files out of the the simulator at path: ~/Library/Application Support/iPhone Simulator/[Version]/Applications/[AppID]/Documents
...but i need get the .sqlite file from the app on the device itself.
Unless the app itself has file sharing built in, you can't access the documents folder from outside the app. It is a security precaution and part of the sandbox.
Update:
I misunderstood the context of the question. To get files off a developers iPhone, connect the device and open Xcode>Window>Organizer. Select the device in the lefthand pane. In the righthand pane will be a list of applications. Your custom apps will have an arrow next to it. Hit the arrow and you will see "Application Data" hit the down arrow icon and it will let you download the data to folder. That folder will contain the apps Document, Library and tmp folders.
I wrote an application specifically for this to distribute to my customers and testers of my applications when they have problems. iPhoneRescue is free and allows you to get at all of the backup information in your iPhone; this includes any sqlite files.
All the users have to do is find their device backup, find the application, and then save the application files or just a specific file. (This does not work if they have encrypted their backups).