Display my app in the UIActionSheet of the default Photos app in iPhone - iphone

My app is registered for certain file types, images + pdf etc, following the guidelines
provided by Apple. My app does show up("open in" option) when pdf files are encountered
in mobile-safari, but it is not the case with image files. In the default "Photos"
app provided by apple, the "open in" option does not show up. Probably this is because
it is implemented without using the document interaction controller. But is there any
way to make my app appear in the UIActionSheet button, which appears at the bottom left
corner ?
I do not want to use the UIImagePickerController for choosing the saved images.

the only thing you can do is add this key-value pair to your info.plist file. iPhone saves pictures in ".JPG", so that's what you should put as the file type.
(if it doesn't appear in Photos action sheet, that means that Apple doesn't want it to appear. You'll just have to hope that some day...)
p.s. more information and detailed instructions here:
Registering the File Types Your App Supports

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.

Opening a File Dialog Box when button is tapped in iphone

I did a cocoa application in which the file dialog box is opening when a button is tapped with the use of NSOpenPanel controller in cocoa applications.For ipad applications we are using UISplitViewController.
I want to know that for developing the applications in iphone,what controller to be used for opening a file dialog box when a button is tapped.
For example in composing a mail.In composing a mail,if we want to attach any files from the local drive,we click the "Attach a File" button. Then it will opens a file open dialog box for selection of file what we want.
Can any one help me or suggest me what controller to be used for opening a file in iphone applications?For opening a file dialog box ,in
cocoa applications --------- Controller used is NSOpenPanel
ipad applications --------- Controller used is UISplitViewController
Like wise for i phone applications ------- ??????
Please help me out of this?
iOS doesn't have a concept of browsing arbitrary local files.
It does have the ability to browse for images from the photo library — for that you can use UIImagePickerController.
Other than photos, the only files you can even open are ones that are inside your own sandbox folder (i.e. ones that you've put there yourself). There isn't a built in view controller that will display them — you'd have to write your own that will read the list of files using something like NSFileManager contentsOfDirectoryAtPath:error:, and display them in an appropriate UI.

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.

Is it possible to change the app icon programmatically?

I want to make two different app icons, and programmatically switch betweem then. When the user quits the app without finishing an workflow-process, then I want to switch to an icon that will indicate that there's something undone when launching the app. Well, just theoretically, just for testing.
I think that the icon file is just a normal file as any other, so if I would just rename it programmatically and then give another icon file the name of the icon file that's named the Info.plist, then the app should show up with another icon, right? Would that be possible? Or do I have no access to that file for renaming it?
icon file stored in "application bundle" folder.
And your application has read-only rights to this folder
There is no oficial way to change/rename thees files.
You can add integer badge to youy icon
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:666]
But it is not official method.
It sounds like a good idea, and I would definitely give it a try, but I get the feeling this isn't possible.
I believe the app icons get stored in another file structure global to the iPhone. I say this because after I installed 3.0 beta 5, I saw a bug where the app icon disappeared from an app I developed. Then after installing two new apps from the app store, the new app's icon appeared on my app, and the 2nd new app's icon appeared on both new apps. Essentially the new app icons shifted to fill in for the missing app icon.
Removing and re-adding the apps, then rebooting the phone, restored the icons properly.
I don't know for a fact how the app icons are managed and stored on the phone, of course, but it would fit to say they are stored in some sort of cached list that gets rebuilt occasionally, perhaps after a reboot. That would mean even if you could change the icon from within your app, it would take more effort to see the effects on the phone.