Is it possible to read a file (from my normal file system) into a iPhone App running on the iPhone Simulator?
I understand that the iPhone itself has not got a (user accessible) file system but this is simply for testing and will only ever be run in the simulator.
The file will be a text file that can be edited while the application is running, it will be read every-time a method is called.
Yes, you can, and it doesn't matter where it is. Just give it an absolute path name when you load it (Xcode won't recognize a different working directory when running the simulator).
Yes, you can if your file is within your app folder
~/Library/Application Support/iPhone Simulator/User/Applications/ [your app folder] /Documents
No. Your app is running in its own sandbox on the phone. It's not allowed to read or write outside of it.
Edit: I think CiNN is correct. As long as your code stays on the simulator, you shouldn't have problems working with a file on your local drive.
I personally think that the easiest way would be to enter "file:///" in Safari within the simulator, if thats what your looking for.
It should also be noted that you can do this in reverse -- you can grab the files off your hard drive that your application created in the simulator. This is a good way to check out your results (data, images, whatever) without having to build a data "viewer" into the application.
FYI 'newer' sds versions will do this... Search for iPad and you will find it. (for obvious reasons I cannot give more details here) good luck.
Related
I have one task to perform where I have to install one .ipa file on jailbroken iPhone devices. The project is related to jailbroken domain so any solution will work but the entire process should be automatic i.e. through coding only. I have found many solution to this but most of them ask to get the root access for app and this thing never worked for me. So is there any idea how to achieve that. Thanks in advance.
Take a look at the function MobileInstallationInstall
You can find some code how to use it here https://github.com/kryhear/IPAInstaller/blob/master/testMobileInstallationInstall/BSViewController.m
It will required you to add entitlement com.apple.private.mobileinstall.allowedSPI with an array containing "Install".
However, I am not sure whether it will be completely silent or not.
Somebody please help me out. This problem is killing me.
I went through tones of documents and posts. All seems to suggest that simply add a UIFileSharing key into info.plist and set boolean value to YES, files in App's Documents folder (not sub-folder, I know) will show up in iTunes.
However my problem is that I don't have an iPhone, so I really have no clue about what exactly the behaviors of both iPhone or iTunes will be when try to verify this file sharing thing. And what is the right way to verify this.
So when my client try to verify this off my watch (we are on different sides of earth), he keeps reporting back that file sharing feature not work. It is certain that file is properly stored under Documents folder.
In the last attempt, he claimed that he can see the app but not files.
I would like to know the following things, so I can guide him through this and end this pain:
Is it really plain and simple like add one key, no changes to code needed? Or did I miss something?
Are there any special requirements for building (like, only work for release build?), deploying?
What will really happen when plug the iPhone into the computer and sync with iTunes? Will the app show up in the Apps tab anyway, or only show up if file sharing feature are enabled correctly?
Thank you all.
Is it really plain and simple like add one key, no changes to code needed? Or did I miss something?
Yes
Are there any special requirements for building (like, only work for release build?), deploying?
No
What will really happen when plug the iPhone into the computer and sync with iTunes? Will the app show up in the Apps tab anyway, or only show up if file sharing feature are enabled correctly?
It will show up in the app view (on top) all the times. But you will only see them in the file sharing area if you have an app with enabled filesharing.
File sharing is only available on iPhone OS 4 onwards and iPad 3.2
Make sure your client has iOS4 or later.
i developed an app which is meant to read books(pdf book reader).i loaded 25 books(total size of 320MB) into the app using absolute path.all the books are been seen in the simulator and also i can load all the books into my device through xcode(build and run).
my requirement:
when i loaded the above obtained ipa file into the same device or other device which are in ad-hoc distribution using itunes , it is strange that only few books are being seen in the device.
note: i made sure that all the books are present in the .ipa file,i deleted old app in the device which i run via xcode. the device is in ad-hoc distribution.
while code signing i used the iphone developer certificate.
is it necessary to use distribution certificate instead iphone developer certificate which i feel that might be one reason for my problem?
plz anyone suggest me with exact solution to the scenario.
tnx in advance
I know I have seen problems going from simulator to live device. The simulator is not case sensitive, but the device is. Recheck all your actual files in bundle vs what you are requesting when you open the file. They need to match exactly for device, but not so much for simulator.
I would also try seting the apps-Info.plst to have "Application supports iTunes file sharing" on so you could see what is in the documents folder (this is if your moving files in that area).
One problem might be as RAZ suggested that iPhone is case sensitive, but there could be other problems.
For starters I would check the that ipa does contain everything you think should be there. Take the ipa, change the extension to zip and open it. You'll get a folder containing you're app. Right click the .app and choose show package. You'll now see all the files/resources included in your app. If the files that won't load in the app are there then you'll need to provide more information about the problem.
If they're not you need to make sure xCode knows to copy them to the app resources.
You might have resources that you haven't copied into the project, and you're only referencing the files on your hard disk. Then when you make the .ipa file it's not included. Try re-importing all your resources and select "copy to project".
I've created a prototype app which uploads a bunch of photos to a webserver. Everything works fine in the simulator. But when I want to try it on an actual device it does not find the images. I've included them under the resources group in Xcode. Anyone?
Best
–f
Check the filenames. The filesystem on your mac is most likely not case-sensitive, but the filesystem on the actual device is case-sensitive. So make sure the filenames match exactly.
Try cleaning the project with Build->Clean all Targets, and manually remove the app from the device. Then try building again.
Every iPhone/iPad application has its sandbox area, where I can store files. When I use the simulator this area will be somewhere in the hard disk. Is it possible to see this directory and its contents for a given application?
I am debugging an iPad app and it will be a lot easier if I can see the sandbox area contents in real time, as the app runs and creates files there.
Where do I find it?
thanks for any help.
~/Library/Application Support/iPhone Simulator/<framework.version>/Applications/<application.uuid>/Documents