Become a MacRumors Supporter for $25/year with no ads, private forums, and more!
  • Did you order new AirTags? We've opened a dedicated AirTags forum.

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.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,120
5,075
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.
 
Comment

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
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.
 
Comment

xArtx

macrumors 6502a
Mar 30, 2012
764
1
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.
 
Comment

gbenna

macrumors member
Original poster
Jul 27, 2011
62
0
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.
 
Comment

xArtx

macrumors 6502a
Mar 30, 2012
764
1
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.
 
Comment

gbenna

macrumors member
Original poster
Jul 27, 2011
62
0
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.
 
Comment

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
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.
 
Comment

xArtx

macrumors 6502a
Mar 30, 2012
764
1
Mail open images, and displays the picture.
You never see the attachment icon to click on.
 
Comment
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.