Make app available only on iphone/ipod


#1

Hi ionicers, I’d like to make my app available on iphone/ipod only (not on ipads). What’s the best way to do that? xcode? config.xml?

Thanks for helping out, I’m ready to submit my app to the store. It keeps asking for ipad screenshots in itunes connecti when I only want it to be available on iphone/ipod, but that may be unrelated.


#2

Something like this would be setup in xcode.

Navigate to project/platform/ios/ and open the xcode project. You should be able to deployment info.
There you can switch it to either universal, iphone or ipad


#3

I tried adding this to my config.xml:

<preference name="target-device" value="handset" />

But it didn’t work. I think it only works for Phonegap Build actually. Would be nice if it worked for command line builds too but its more of a cordova rather than an ionic issue.


#4

Thanks, I found the setting in xcode indeed. Also thought it was something we had to do in config.xml but that’s not the case.


#5

Would you be able to share where you found this setting? I can’t seem to find it.
Edit: I found it ! Silly me. Its at build settings. I had to navigate to my project to see those options.


#6

You can also avoid having to set this setting over and over by using an after_prepare hook. Here is the contents of my hooks/after_prepare/modify_plist.sh:

#!/bin/bash

PLIST=platforms/ios/*/*-Info.plist

cat << EOF |
Delete :NSPhotoLibraryUsageDescription
Add :NSPhotoLibraryUsageDescription string "For meal photos"
Delete :NSCameraUsageDescription
Add :NSCameraUsageDescription string "For meal photos"
Delete :NSMicrophoneUsageDescription
Add :NSMicrophoneUsageDescription string "For voice notes"
Delete :UIDeviceFamily
Add :UIDeviceFamily string "1" # iPhone only
EOF
while read line
do
  /usr/libexec/PlistBuddy -c "$line" $PLIST
done

true

Note that I’m setting more than just the UIDevice family, but that is the one you want. 1 = iPhone, 2 = iPad.