mobileconfig file and safari - iphone

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

Related

Gatekeeper Path Randomization for Developer signed DMG?

We are packaging our app for drag and drop installation DMG as following:
Application Name/Application.app
Application Name/Readme
Application Name/Examples/...
Application Name/Documentation/...
And user is supposed to d&d Application Name Folder to /Applications/.
Everything is code signed including DMG.
From most information I read this should be enough to prevent app translocation happening, but for some reason it isn't for some of our Sierra users?
The solution for them would be beside d&d folder to /Applications is to do another drag & drop (move) Application.app somewhere and back to /Applications/Application Name/ or move only Application Name/Application.app overwriting /Applications/Application Name/Application.app.
Now the question is why do only some users have this issue, and shouldn't code signing dmg prevent app translocation from happening?
I verified they have selected Allow apps downloaded from Mac App Store and identified developers.
I had this same problem on my side and had to go get some help via DTS, so I thought I'd repay the favor by replying here:
To avoid translocation, it turns out that not only is the disk image DMG supposed to be signed, but the file format for the image needs to be very specific: UDRO.
You can see more information about UDRO when you look at the man page for the hdiutil command line tool.

Downloading "mobileconfig" file from an App

My org is creating an app, that will have certain wifi hotspots listed in a mobile config file, so that the user does not have to write the password for these wifi when he is in range.
I know this can be done using .mobileconfig file. But I have serious doubts.
Here are few questions regarding the app:
Can .mobileconfig file be created programatically. I cannot find a link to how to cretae this programatically (not using iPCU).
Will Apple allow an app that creates .mobileconfig file and asks the user to download it and install it, so as to change the wifi settings?
Is making the user download this .mobileconfig file only possible via Safari or Mail? Is there any way that this file be opened directly from the app to the settings screen?
Thanks in advance. :)
1) Yes it can. It can be created as an XML file. In fact, you can open and edit an unsigned .mobileconfig file in a text editor and edit the fields. Keep in mind that if it's signed then any edits to the file will require you to re-sign it.
2) Apple will allow an app that downloads and installs a .mobileconfig via Safari, I've seen one on the App Store that does this.
3) Safari + Mail are the only ways to open them(on iOS).

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.

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.

Access user home folder outside sandbox

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.