Access user home folder outside sandbox - iphone

I'm working on a app which will not be submitted to the AppStore and am trying to open a file which the user has downloaded using Safari Download Manager.
This plugin mentions all files are downloaded inside ~/Media/Downloads.
I've tried just using NSString's stringByExpandingTildeInPath, but it will map to /Media/Downloads inside the application sandbox.
Question is: how can I tilde-expand that path so it maps to the actual folder?
Thanks!

I assume that by "Safari Download Manager" you mean that you already have a jailbroken phone. If so, the easiest way is to just install something like iFile and find out what the path is.
I'm assuming that it's something like /var/mobile/Media/Downloads. Then, there are two easy things you can do:
Hard-code "/var/mobile" to expand a tilde at the beginning of the string.
Find out the username you want the homedir for (probably "mobile") and try expanding ~mobile/Media/Downloads.
Find the username, and get the homedir with a call to getpwnam() or so (assuming it exists on iOS).

The sandbox isn't just a necessity for App Store submission, it's a feature of the device. Without jailbreaking, you're out of luck.

Related

Launch app without knowing the url scheme

I want to launch another app which is programmed by other programmer in my own app. I know the method of url scheme but the problem is that I do not know the URL scheme of the app that I want to launch. Also, I googled some website to search the URL scheme yet got nothing. I think it's because the app is not used widely.
Is there any way to get the URL scheme??
Or is there another way to launch the app??
You can inspect the Info.plist file of the app by extracting the .ipa file:
Sync the App to iTunes, if necessary.
Ctrl-Click on the App in iTunes, and use "Show in Finder" to locate the "OtherApp.ipa" file.
Copy "OtherApp.ipa" to a temporary directory, and use "unzip OtherApp.ipa" on the command line to extract the archive.
Open "Info.plist" inside the "Payload/OtherApp" folder.
First of all, you have to know that not every app uses URL schemes. It's possible the app you're trying to launch doesn't use them and in that case you're out of luck.
Take a look at the Info.plist file inside the app bundle and search for the CFBundleURLSchemes key to know if URL schemes are supported.
If you don't find anything I would suggest you to contact the developer directly and telling him what you're trying to achieve.

How to convert a normal application icon into a downloading icon on iPhone's SpringBoard?

I'm writing a jailbroken app in iPhone, I'd like to add a updating mechanism for this app and it works like the updating via App Store.
I know that every icon on SpringBoard is a SBApplicationIcon object, while the icon with a progress bar for updating is SBDownloadingIcon object. My problem is that I can not find any method to convert.
If I understand correctly, you want to update apps like it does when via App Store with the Progress Bar on it.
Try using the itms-services (Wireless ad-hoc distribution). For that you need to create a simple plist file and the ipa and upload it to a server. It'll help you download the app in the same way App Store does.
I understand since it's for jailbroken filesystem, it's not on the App Store. That's why I'm saying, upload the two files (IPA and PLIST file) to a free web server space, you can get easily.
If you can build an ipa for the app, then follow the link I mentioned above.
If it's a .deb package, then it can't be done that way, AFAIK.
Hope this helps.
If you want to do this, you have to use a itms-services url. Since your code can't make itself writable, you will not be able to change the object from a SBApplicationIcon to a SBDownloadingIcon object (and back again to a SBApplicationIcon so that users can use the app).

Browsing an apps folder structure on an iDevice

When I plug my iPhone into the computer can I access an apps folder structure that's on the phone? Either programatically or manually with a tool that doesn't involve jailbreaking.
Have you tried iExplorer? See if that satisfies your requirements.(It doesn't need the device to be jailbroken).
It cant be done without jailbreaking, you basically must create your app folder structure with xcode.

Downloading files for UIWebView to specific folder on IPhone

I have made an app that displays my website from a UIWebView and it takes you to a store that you can download files. My question is that I need to download a '.zip'file from my website using the app to the IPhone. Heres is my problem. I don't want the file to goto the App's Document folder, I want it to goto a folder that is outside of my applications folder. Here is an example path I might want my file to goto EX:'var/mobile/Library/Downloads'. If there is not a way to download the files to a path outside of the app's folder, is there a way to transfer the specific file that I have downloaded from my website using the my app to another folder that is not located in my app's folders? I know this can be done because I have used apps that have done this, of course they were apps only available on Cydia. This is also an app that will be used for Jail-broken users just for your information!
Thanks for any help!
Any "regular" iphone app runs in a sandbox that prevents access to system wide directories. Practically, you only have access to the app Home Directory.
Unless you go for a jailbroken app, you have no other options than storing to the App docs folder.
Read "The Application Sandbox" and "The File System" [here] for more details1.
EDIT:
I am not an expert on cydia, but the general idea is gaining access as root and then write to where you need to. This can be done by replacing your app with a suid shell script that will in turn exec your app (which will have root privileges now and then be able to go out of the sandbox).
For more info look at this.

mobileconfig file and safari

I've created a mobileconfig file and deployed it to webstore. To install mobileconfig file on iPhone i need to either send it in a mail or user can type webstore URL on iphone safari to install it. But my question here is: Will it be possible to create a webview interface or something else and install mobileconfig file silently on the phone? I am asking this because i already have an app where i would like to integrate this rather ask user to go to a URL and install the file. Will it be possible?
I'd be concerned if there was no user consent when installing a mobileconfig file - sounds like a very bad idea incase someone where to implant some rogue settings.
Its good that a user can inspect what the mobileconfig file does before they accept it.
--
dp