Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

gbenna

macrumors member
Original poster
Jul 27, 2011
62
0
I am trying to import email attachments into my iphone app. I am placing code in my info.plist with uti etc. I have successfully imported audio attachments (caf, aifc, aif, m4a, and mp3). But I am not being successful at all with image files. I want to import jpg, jp2, pic, tif, and png files.

I have written this code in my info.plist for the audio files.


Code:
<dict>
		<key>LSItemContentTypes</key>
		<array>
			<string>com.apple.coreaudio-format</string>
		</array>
		<key>CFBundleTypeRole</key>
		<string>Viewer</string>
		<key>CFBundleTypeName</key>
		<string>.caf</string>
		<key>LSHandlerRank</key>
		<string>Alternate</string>
	</dict>

as I said this works fine for all the audio types I want.

But when I enter this code

Code:
<dict>
		<key>LSItemContentTypes</key>
		<array>
			<string>public.png</string>
		</array>
		<key>CFBundleTypeRole</key>
		<string>Viewer</string>
		<key>CFBundleTypeName</key>
		<string>.png</string>
		<key>LSHandlerRank</key>
		<string>Alternate</string>
	</dict>

for the images, nothing happens. The app icon doesn't show up in the modal view to tap and "open in" my app.

can anyone see any thing I am doing wrong here?

I appreciate any and all help.
 
Can any third party app take in pictures via the open in button? It seems to me only built in apps can...

My thoughts on how you might be able to open other images in your app:
- have a paste button in your app that grabs the latest image the user has copied off of the system pasteboard.
- get pictures through the camera roll

I know neither of those are ideal, but they might be the best you can do. (IDK, I've never tried to make an app capable of having pictures "open in" it.
 
Works fine for me in one of my apps. png, jpeg, gif, tiff, pdf and others. You don't include the . in the CFBundleTypeName, just the extension. Don't know if that's your problem though.

I would try to delete the app from the device, reboot, and reinstall. Might help.
 
I only got it by giving the image a fake extension, and using that extension for
my App's open in feature.
Didn't try removing the period front he real extension though.
 
xArtx
I don't see this as a valid option as I don't want to rename every image in my app and then how do you get other people that email you to use that file extension?

PhoneyDeveloper
I tried to erase my app completely and do a restart and then reinstall but no go. I am going to try to try the LSHandlerRank as Owner and see what that does.

What did you put for your code in the app delegate. I put.



Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
    
    NSURL *url = (NSURL *)[launchOptions valueForKey:UIApplicationLaunchOptionsURLKey];
    if (url != nil && [url isFileURL]) { }


did you include any thing else in you info.plist.

Would like to know what you did to make this work. Are your images loaded into the email page?

Anyway thanks for the help and let me know.
 
xArtx
I don't see this as a valid option as I don't want to rename every image in my app and then how do you get other people that email you to use that file extension?

It's not supposed to be an option. Just information.
If you can get that working you could go from there.
I would try removing the period from the extension as suggested, if you haven't.
I haven't tried yet, but it might be a solution for one of my Apps where I import images.
 
Sorry about the misunderstanding. I just don't get why this works for audio but not images. I even took code out of app delegate and audio worked. I think I got image to load once when I used <key>UTImpprtedTypeDeclarations</key>
In plist. In mail the image didn't load but showed the attachment bar. I have tried to replicate but no go. Has anyone done this with an image successfully.
 
Does it work from DocInteraction, can you import an image from DocInteraction? If so then you've shown that your registration is valid. Some of Apple's apps don't share every file type. I'm not sure if Mail shares images. If not then it will never work. I'm sure that DocInteraction shares images.
 
Mail open images, and displays the picture.
You never see the attachment icon to click on.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.