iOS Import settings into app from file - iphone

I know it's possible to make your app open files by changing the info.plist in xcode
Is it possible to have your app open for example a .properties file, which is a plist containing personal user settings i.e. a login username and password, and get your app to read and import this?

Yes you can.
Your iOS app can handle some file extension you want to, but take care about the security issue!
Take a look to this tutorial:
http://www.raywenderlich.com/1980/how-to-import-and-export-app-data-via-email-in-your-ios-app

You can always read a plist file and import them, provided the plist is part of your app's sandbox. If you want to have settings and preferences, you can prefer settings bundle which also is a plist file.

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.

access iphone settings

I have saved an musicfile in the iphone path called-"/var/mobile/Applications/92B12BF1-88E1-4FD5-93DC-8311EC3B072A/Music" programmatically .Can I see those files in the iphone ?.Please tell me ,thanks in advance
Yes, you can set in your Info.plist the itunes file sharing property, which will make all files in your app's Documents directory visible to users, both to copy to the desktop and to save files from the desktop to the phone: "Application supports itunes file sharing" and check the box.
Not unless you jailbreak the phone. Other options are
1) store your file under <Application_Home>/Documents, then you can fetch the file from iTunes. You need to set UIFileSharingEnabled key in your Info.plist to YES.
2) run your program in your iOS simulator and examine the file.
92B12BF1-88E1-4FD5-93DC-8311EC3B072A is a GUID, which means it will change.
Second, the only way for you to "view" files outside of your applications sandbox is to be jailbroken.

How does "Open With" some app in iPhone work?

As far as I know, from iOS SDK 3.2, file type handling is added and an iOS application can associate itself with some file type so that other applications can open this kind of file with the application.
Because of the sandbox mechanism in iOS, I wonder when a file in appA is opened with appB, which registered itself with this kind of file, what will happen? Is this file copied to appB and both appA and appB keep a copy of this file? If the answer is yes, is it possible to make appB open the file under appA's document folder? I cannot find any Apple documentation on this.
For example, appA stores a Keynote document in it, if I open this Keynote document with the Keynote app, is it possible to let Keynote app to edit this document in place so that after editing, appA can see the updated document?
Any help is appreciated.
There are a few different questions in here.
When you register your app to handle types of files using the info.plist entry Document types your app will be on the list of apps that are shown when you perform an action with that file (for example tapping a file attachment in an email). Then when your app is launched, the method application:didFinishLaunchingWithOptions: is run as normal, and the launchOptions dictionary will contain the path to the file that was sent to your app. What you do with the file from there is up to you, but it is a copy of the file, not a link to it. So if the user makes changes to the file in the original app they must 'launch' your app again, with the new file.
See here for more info: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIApplicationDelegate/application:didFinishLaunchingWithOptions:
You can't access any other app's document folder with the current SDK.
Also, for sharing documents in iTunes (like Pages, Numbers etc), look into the two info.plist entries Document types and UIFileSharingEnabled. (Apples docs: http://developer.apple.com/library/ios/#documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW20) Basically, by setting UIFileSharingEnabled to YES you will expose the /Documents directory of your app in iTunes. Then again it's up to your to show the user once they are back in your app what's in that directory.
Sndbox implemented over standard unix permissions control. All applications are stored in folders with unique name (actually, GUIDs), however owner for them is the same mobile:mobile.
So it looks like they just sends full file path to application which opens the corresponding file.

IPhone App Settings: Settings.bundle vs plist file?

I'm a bit confused. I'd like to implement some simple settings for my app. I was thinking of just creating a simple plist file. But now I see that there's something called "Settings.bundle" (that also has a plist in there but some other stuff too).
What I'm wondering, which one should I use? (I'm looking for the easiest way)
Thanks!!
I would suggest looking into NSUserDefaults to store basic app settings.
The settings bundle is for having settings that show up in the system Settings.app. You can use a plist (or easier, NSUserDefaults, which handles the plist for you) to store settings that you change within the app itself.
See the Displaying Application Settings section in the iOS Application Programming Guide.

How do I change my iPhone App binary filename

I get the following error when I try to upload the application on iTunes Connect:
"Binary file names cannot contain a space. Please rename your binary file and try again."
If I try to Validate the Application in XCode, I get:
"My Application.ipa: filename may not contain whitespace"
So I guess I have to find a way to rename this .ipa file. I don't want to change my product name which has to stay "My Application". How can I do that?
Thanks!
This works very well (taken from here: http://developer.appcelerator.com/question/82971/filename-may-not-contain-whitespace-in-xcode-325-is-back):
1) In Xcode Organizer right click on the build date of the app and select "Reveal Archived App in Finder"
2) Open ArchiveInfo.plist in a text editor (i used Coda)
3) For me at line 12 it was creating the application with a space:
<key>XCApplicationName</key>
<string>Example Name</string>
Change that to ExampleName and save the file.
4) Once you get back to Xcode Organizer, you should be able to go through fine.
Since Xcode or the Application Loader is the only way to submit apps now, renaming the file before using the web interface isn't an option.
However, there is a workaround. From Xcode Organizer, choose Save to Disk, pick a file name without a space, and then use Application Loader (not the Xcode Organizer) to send the archive to Apple.
I ran into this and another issue when I wanted to submit an app with whitespace and a + in the name.
Application Loader did not work well for me - cryptic errors that required deleting the IPA and rebuilding.
My final solution was to set the PRODUCT_NAME to something sane, e.g. instead of My App+ it was MyAppPro. Then I set CFBundleDisplayName in Info.plist to the name I wanted, e.g. My App+.
This is in my opinion a better solution than renaming the IPA every time and using Application Loader.
I just had to rename the zip file before uploading it in the web interface. This is really silly...
Use Xcode 4.
The problem is solved in this version.
There's no need to change anything in XCode. Just rename the resulting .zip File from "My Application.zip" to "My_Application.zip". This does not affect your application name its just a way to bypass the Application Loader filename checks (which do not allow whitespaces in the uploaded zip filename).
My_Application.zip should be fine
I was able to use the Organizer, select Share, Save to disk. The went to the file and told Finder to open it with Application Loader v1.4. This is with XCode 3.2.5. I've previously used Application Loader to upload apps to the Mac app store.