Is it possible to add info or help text to an iPhone settings bundle? - iphone

Several of the Apple-provided apps have informational/help text in their settings. For example, the Keyboard settings screen includes, under the “.” shortcut toggle, the help text "Double tapping the space bar will...".
I know I can do this in my app by adding a group footer, but is it possible to do this in the settings app by adding a field to the plist file in my Settings.bundle?

According to recently changed Apple document, a FooterText key is available in PSGroupSpecifier dictionary, which is only available in iOS 4.0 or later.
Reference:
https://developer.apple.com/library/content/documentation/PreferenceSettings/Conceptual/SettingsApplicationSchemaReference/Articles/PSGroupSpecifier.html

The way I do it, and the way I have seen other third parties apps do it is just to use an informative Title as a PSGroupSpecifier
I have only seen the native Apple apps do it in this other, slightly nicer way. I expect the ability is buried deep in the undocumented regions of the SDK.

Using FooterText key in PSGroupSpecifier is what you need to use. And it is documented as xesique already said.

Note that the "FooterText" key is not built into the pop-up menu of the Settings Scheme / plist editor that is part of Xcode. When you select a "Group" and type a keyboard return or press the plus icon you are presented with a choice of either "New item"," "Type" of "Title". You are required to manually edit this key value. Then the text that you enter as the associated string will appear as grey text (rather than the black text used for the Groups members) and which maintains its upper / lowercase.

Related

How to check if any apps are associated with file extension

I want to make "Open in.." function in my iOS application.
Is there any way to check if any app on this device is associated with file extension that i want to share?
If there are no apps on current device to open file with such an extension than UIDocumentInteractionController will not be displayed after clicking on "Open in.." button, but i want not to show this button in such case.
So the question is: how to check if any app on device can open some file with specific extension?
Update:
For example UIDocumentInteractionController has NSArray property icons.
It contains images of all aplications that can open the file with my extension. But if there are no applications it contans image of empty application.
So i can't check it using docInteractionController.icons.count == 0 for example. I am looking for other tricks.'
Thanks, in advance.
Although UIDocumentInteractionController does not offer a way to discover in advance whether there are any applications that can handle a document, -presentOpenInMenuFromRect: will return a flag indicating whether there were any applications that could open a document. This requires you to have already set up and presented the controller, which is not optimal.
There is a workaround for this, a little hacky but is functional: Before you invoke the "real" interaction controller, create a dummy one using a dummy document, and present it from the rect of the window's bounds. This guarantees that it will "appear" offscreen, so your user won't see it. At that point, you have the flag returned from -present, and you can immediately dismiss the dummy controller, and the proceed to show your UI appropriately.
On OSX, you can get a list of application bundle identifiers capable of handling a specific content type using LSCopyAllRoleHandlersForContentType. But on iOS, I don't think there is such a way.
If I find, I'll edit my answer.
Considering you are looking for other tricks, you can check if that one image in the icons array is the generic document icon.
If it is then you know that there is no app associated to handle that file type. But this approach will be OS version dependent as generic file icon may change.
From the official documentation:
To declare its support for file types, your app must include the
CFBundleDocumentTypes key in its Info.plistproperty list file. (See
“Core Foundation Keys”.) The system adds this information to a
registry that other apps can access through a document interaction
controller.
To me this indicates that the registry can only be accessed through UIDocumentInteractionController and so no, you would not be able to know in advance if there are any available apps for the file format (which would be totally in line with Apple's philosophy of not letting apps interact directly with each other).
UPDATE:
as you said the icons property contains an image even with no applications present. I checked and all the other methods and properties of the controller do not give an hint about the apps that may open the current file format.
You said in case that no app can open the specified file format there is an "image of empty application". Maybe you can extract that icon and when the array icons only has one image check if the extracted image and the icon are the same?

Xcode: URL Types: Icon?

The Xcode docs, explain that the CFBundleURLIconFile key contains the name of the icon image file (minus the extension) to be used for displaying URLs of this type.
My remaining questions are:
What icon image should I use? Like, if the URL type is for another app, should I use that app's app icon?
What size(s)? If many sizes, how do I name them so that the sizes are used correctly?
Where is it displayed? I'm wondering for an iPhone app.
Apple does not specify this specifically, but my interpretation is that it should be an Icon representing the application which should/will open/handle URLs of this type.
On OS X, the normal approach would be to use an Icon File (.icns). I suspect you should try that on your iOS app. If that doesn't work, duplicate the naming scheme of the the standard app icon files.
Try viewing a PDF in Safari on iOS. If you have iBooks, it should show a button saying "Open in iBooks" and shows an icon next to it. This icon is the icon you would be setting.
I hope this is thorough enough to answer your questions. If not, please explain what needs clarification.

Can InAppSettingsKit be used just for Settings.app

I would like to use InAppSettingsKit only for displaying the settings in the Settings.app of the iPhone. I have different custom settings for in-app settings. Is this possible and how can this be achieved ?
To support traditional Settings.app panes, the app must include a Settings.bundle with at least a Root.plist to specify the connection of settings UI elements with NSUserDefaults keys. InAppSettingsKit basically just uses the same Settings.bundle to do its work. This means there's no additional work when you want to include a new settings parameter. It just has to be added to the Settings.bundle and it will appear both in-app and in Settings.app. All settings types like text fields, sliders, toggle elements, child views etc. are supported.
The plists are searched in this order:
InAppSettings.bundle/FILE~DEVICE.inApp.plist - InAppSettings.bundle/FILE.inApp.plist
InAppSettings.bundle/FILE~DEVICE.plist
InAppSettings.bundle/FILE.plist
Settings.bundle/FILE~DEVICE.inApp.plist
Settings.bundle/FILE.inApp.plist Settings.bundle/FILE~DEVICE.plist
Settings.bundle/FILE.plist
I hope it helps!!
EDIT:
The InAppSettingsKit library searches automatically on all your settings bundles, in that order I wrote before. However, the settings.app only searches into the Settings.bundle. So, if you want a separated settings file for your app (using InAppSettingsKit) you can create a Settings.bundle for your settings app and a, e.g., InAppSettings.bundlefor your in-app settings.

How do I change the text directly beneath the icon of my iphone app

There is small text beneath the icon names when you are in the home screen of the ipod.
My text is much too long and it looks like "Cedr..egg"
I was wondering if there was a way to change that text to a shorter name?
I think what you're looking for is Bundle Display Name in the info.plist file.
You can change the name of the app by renaming the app in the Applications folder in iTunes.
If you are looking to do this in Xcode you are looking for the LocalizedApplicationNames.strings file.
NOTE: This may prevent automatic upgrades in the future.

How to Show a GPL licence in iphone application bundle

i am making an app for iphone and for that i am using certain free libraries.My problem is that i want to show their complete license of nearly 4-5 pages in my application bundle so that a user can open settings in iphone and see that licensing page at one time but i am unable to do it.I have read these Specifiers for making an application bundle .
PSGroupSpecifier
PSTitleValueSpecifier
PSTextFieldSpecifier
PSSliderSpecifier
PSToggleSwitchSpecifier
PSMultiValueSpecifier
PSChildPaneSpecifier
but i want to show a page full of text like Settings->General->About->Leagl
just like in iphone through PSChildPaneSpecifier .Please help me how to do this>???
Thanks
You can create the same effect as used by Apple's iWorks apps for the license > section of the settings, without using any custom preference controller. Note this works for iOS 5 on the iPad, I have not tried it elsewhere. Use a PSChildPaneSpecifier for the initial control in the root plist. This points to the name of another plist file which will be the displayed child pane. You do not add .plist to the name within the root.plist file, it is implied. This plist file must be within the settings bundle. Next, use PSGroupSpecifiers in the child pane as the controls. For each paragraph use another PSGroupSpecifier - so the thing will scroll. Only use the Title section of the PSGroupSpecifier. The next gotcha that I found, was that by putting the strings in the plist file, the text was clipped in portrait orientation, so a placeholder string needs to go in the plist file and a StringTable used to point to a strings file. Text read from the strings file is properly kerned and displays without clipping.
The iPhone's "Legal" page is a custom preference controller which you can't use (not even with undocumented methods – you need to write a preference bundle in system locations which AppStore apps can't reach at all).
If you'd like to display the license, show it in the app.
I think you are going to need to use something like a UITextView, just make it non-editable. You can make in unobtrusive in your app but I think that is the only way to have 4-5 pages.
I don't think there is a nice way of displaying this in the preferences bundle. Personally I would either provide a series of url links or bring the preferences into the app itself. There is a good framework on github here that you may be able to modify.