I want to create an app which is 开发者_如何学JAVAspecific to the device type.Say my app should work only on iPhone but not on iPad or iPod even if it (the app) has common features.
[[UIDevice currentDevice] model]; would give you the current device model.
Now, compare strings with the isEqualToString: rather than using the comparison operator.
Once done, you should write the functionality that you want to run, after doing the comparison.
If your application is for App Store distribution you may be able to use the UIRequiredDeviceCapabilities
key of Info.plist to produce a sufficiently restrictive set of requirements. Make this entry a dictionary and then for example setting a telephony=false
value would exclude phone devices, still-camera=false
value would exclude (current) iPads etc. The iTunes/App Store will then not allow a user to install the app on an unsupported device
精彩评论