iOS Settings app integration - ios

I've got an Alloy app and I'm trying to put some configuration into the Settings app in iOS.
I've added the Root.plist file here:
/app/platform/iphone/Settings.Bundle
The file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>StringsTable</key>
<string>Root</string>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>Service</string>
</dict>
<dict>
<key>DefaultValue</key>
<string></string>
<key>Key</key>
<string>username</string>
<key>Title</key>
<string>Email address</string>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
</dict>
</array>
But nothing appears in the settings app for me. Any suggestions?

There used to be an iOS bug in the simulator where if your app was running, even in background, when a new version was installed, the settings were not updated until you completed closed the app and relaunched it. Closing the simulator with the app running did NOT resolve the issue. TBH, I have not tested this lately, I am just in the habit of closing my app before I rebuild. Try completely closing your app, then relaunching it and see if the settings update.

Related

How to keep settings if app was reinstalled

If application has been reinstalled through xcode all kept settings are cleaned. How to avoid such behaviour?
More detailed: An app has been installed, then I made changes in settings ( settings bundle) and they were stored. After I reinstalled the application through xcode (I didn't remove the app) and all my settings have been cleaned that I made before . I would like to keep my settings after installing application or perhaps there is another way to keep settings of app after installing of it.
Example:
I created Settings Bundle ( File -> New -> File -> Resourses -> Settings bundle)
Changed Root.plist and added there new dict for address value. See below.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>StringsTable</key>
<string>Root</string>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>Server</string>
</dict>
<dict>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>Title</key>
<string>Address</string>
<key>Key</key>
<string>server_address_preference</string>
<key>KeyboardType</key>
<string>Alphabet</string>
<key>IsSecure</key>
<false/>
<key>AutocapitalizationType</key>
<string>None</string>
<key>AutocorrectionType</key>
<string>No</string>
</dict>
</array>
To keep the settings of your app use UserDefaults, it's the same concept as SharedPreferences in Android development. So, you can store there user related settings as well as everything else which should remain untouched after updating (Xcode reinstallation) of the app.
UserDefaults Apple doc
Example of usage.
Setting value:
UserDefaults.standard.set(true, forKey: "someValue")
Retrieving value:
let boolValue = UserDefaults.standard.bool(forKey: "someValue")

Distributing an enterprise (in-house) iOS app can't be downloaded by some devices

The plist file:
<?xml version="1.0" encoding= "UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>https://www.pushyo.com/mylike/MyLike.ipa</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.MyLike.CRM</string>
<key>bundle-version</key>
<string>1.6.20150226</string>
<key>kind</key>
<string>software</string>
<key>subtitle</key>
<string>crm</string>
<key>title</key>
<string>CRM V1.6.20150226</string>
</dict>
</dict>
</array>
</dict>
</plist>
Most devices can download and install it successfully, but I find my iPhone5(iOS 8.1.3) and an iPad 2(ios 8) can't download it any more.
I've a link on the website:
<a id="download_url" href="itms-services://?action=download-manifest&url=https://www.pushyo.com/mylike/MyLike.plist">
When I click "install" in the alert window, nothing happened on my iPhone5. How to let it be downloaded by all the iPhone and iPad devices?
After click install in the alert, go back to your springboard to see if your iDevice downloads the application or not. I have the same problem with iOS 8.2, it just does not close safari to show installation process but application will be installed after clicking "Install"

iOS 8 app download issue

I have built the application in Xcode 6.1. It is not downloading in ios 8, showing the error LoadExternalDownloadManifestOperation: Ignore manifest download, already have bundleID: com....... I have tried many solutions:
Postfixing some character in the bundle-id of the plist.
Downloaded the provisioning profile again.
List item
Changed the plist by adding display-image and full-size-image tags.
When I implement these solutions, first 2-3 times it's getting downloaded, but after sometime it's failing.
I guess this can be an issue of plist.
I would like to know how to create a plist from Xcode 6.1?
Got a plist from .xarchive in XCode 6.1(shown below) but not working.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList- 1.0.dtd">
<plist version="1.0">
<dict>
<key>ApplicationProperties</key>enter code here
<dict>
<key>ApplicationPath</key>
<string>https://....../App.ipa</string>
<key>CFBundleIdentifier</key>
<string>com.abc.xyz.efg</string>
<key>CFBundleShortVersionString</key>
<string>1.0.40</string>
<key>CFBundleVersion</key>
<string>1.0.40</string>
<key>IconPaths</key>
<array>
<string>https://....../icon-76.png</string>
<string>https://....../icon-60.png</string>
</array>
<key>SigningIdentity</key>
<string>Company Limited</string>
</dict>
<key>ArchiveVersion</key>
<integer>2</integer>
<key>CreationDate</key>
<date>2014-12-11T06:46:25Z</date>
<key>Name</key>
<string>App</string>
<key>SchemeName</key>
<string>App</string>
</dict>
</plist>

MonoTouch: Settings.bundle file issue

I've been trying to setup settings for my app but I can't seem to get this working even though I've looked over it over and over again and compared it to an example in a book and the example on Craig Dunn's blog.
I understand that the syntax has to be perfect and this file is pretty simple at the moment I am just trying to display one textfield for now. I did get this working briefly on a brand new project however I haven't managed to get it to work since.
Here is the XML of my Root.plist file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Root</key>
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Title</key>
<string>Group Name</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>AutocapitalizationType</key>
<string>None</string>
<key>AutocorrectionType</key>
<string>No</string>
<key>Key</key>
<string>usernameTextField</string>
<key>Title</key>
<string>Username</string>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
</dict>
</array>
</dict>
</dict>
</plist>
As I said I've looked over it quite a lot of times and I can't see any problems with it. The file build action is set to Content and the Copy to Output Directory is set to Always Copy. The version of MonoTouch that I'm using is 6.0.7.
I'd appreciate any help with this issue. Thanks
Make sure that the Settings.bundle directory is included at the top level of the project. By top-level, I mean that on the file system, the Settings.bundle directory should be in the same directory as your ProjectName.csproj file. In MonoDevelop, it will appear as one of the top-level folders under the project node.
Set the Root.plist Build Action to BundleResource (do not enable "Copy to Output Directory". Hint: if you find yourself setting "Copy to Output Directory", don't do it - it's almost always the wrong thing to do - we've actually discussed removing the option altogether.)
Now, for the plist file format - here's what it should look like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>Group Name</string>
</dict>
<dict>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>Title</key>
<string>Username</string>
<key>AutocapitalizationType</key>
<string>None</string>
<key>AutocorrectionType</key>
<string>No</string>
<key>KeyboardType</key>
<string>Alphabet</string>
<key>IsSecure</key>
<false/>
<key>Key</key>
<string>usernameTextField</string>
<key>DefaultValue</key>
<string></string>
</dict>
</array>
<key>StringsTable</key>
<string>Root</string>
</dict>
</plist>
Looking at your Root.plist file, it appears that the PreferenceSpecifiers key is not in the top-level dict node (it needs to be). In other words:
get rid of the following lines at the top of the file:
<dict>
<key>Root</key>
...and one of the following lines at the end of your file:
</dict>
That should do it...
Now... all that said, I just recently figured this out myself while trying to add settings to my personal side project and decided that we, at Xamarin, need to make this easier. I've already fixed a few minor issues in the upcoming MonoDevelop 3.1, but I hope to get the time I need to add templates for Settings.bundle to MonoDevelop's "Add New File" wizard. I'd also like to add plist key/value hinting like we do for Info.plist and Entitlements.plist so that MonoDevelop's plist editor can better guide you when editing these plist files.
For starters, you are missing your closing plist </plist> tag. My current one only has one setting in it, but it works. You can compare to yours to see the differences:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Stay Signed-In</string>
<key>Key</key>
<string>staySignedIn</string>
<key>DefaultValue</key>
<true/>
</dict>
</array>
</dict>
</plist>
I hope this helps.

itms-services://?action=download-manifest Not Work in IIS

I have created an ios apps and let selected devices download&install on idevices browser safari.So make a link like this:
<a href="itms-services://?action=download-manifest&url=http://myserver.com/Info.plist">
and when i click it was popup a message "cannot connect to myserver.com".
Then i figure out IIS missing MimeType so i add back to it.
.ipa application/octet-stream
.plist text/xml
But finally when i click on it no response at all,why?
i doubt info.plist setting was wrong or something.
Here are my info.plist setting:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppStoreFileSize</key>
<integer>4329818</integer>
<key>ApplicationProperties</key>
<dict>
<key>ApplicationPath</key>
<string>http://myserver.com/Apps.ipa</string>
<key>CFBundleIdentifier</key>
<string>com.app.app</string>
<key>IconPaths</key>
<array>
<string>http://myserver.com/icon.png</string>
<string>http://myserver.com/icon.png</string>
<string>http://myserver.com/icon#2x.png</string>
<string>http://myserver.com/icon-72.png</string>
</array>
<key>SigningIdentity</key>
<string>CSR Certificate</string>
</dict>
<key>ArchiveVersion</key>
<integer>2</integer>
<key>CreationDate</key>
<date>2012-10-10T09:02:39Z</date>
<key>Name</key>
<string>AppName</string>
<key>SchemeName</key>
<string>AppName</string>
You code needs to look like this
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>http://www.example.com/test.ipa</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.name.name</string>
<key>bundle-version</key>
<string>1.0</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>Name</string>
</dict>
</dict>
</array>
</dict>
</plist>
Remember to change:
Bundle Identifier= <string>com.company.name</string>
Installer Name= <string>Name</string>
Ipa Download= <string>http://www.example.com/test.ipa</string>
Change the <string>http://www.example.com/test.ipa</string> to where ever you located you ipa for install.
Create you Install.plist or Start.plist what ever and go into mobile safari and type: itms-services://?action=download-manifest&url=http://www.example.com/whatever.plist
And it should go a head and download it there may be some bugs when downloading.
Remember that the ipa needs a valid UDID= unique device identification.
Hope this helped.
Best Regards Silas.
Since iOS8, un-encrypted plist downloads are not accepted anymore.
So you need a valid ssl certificate and change the scheme to https. You can test this with amazon s3 for example.
you have to use Https for all urls in .plist file

Resources