开发者

Do iPhone libraries work on iPads and Macs too?

开发者 https://www.devze.com 2023-02-14 02:49 出处:网络
I am creating 开发者_开发问答a library for iphone. Will the libraries I create for iphone work for ipad and macs too?As for existing libraries, the iOS frameworks UIkit, Foundation, CoreGraphics, Medi

I am creating 开发者_开发问答a library for iphone. Will the libraries I create for iphone work for ipad and macs too?


As for existing libraries, the iOS frameworks UIkit, Foundation, CoreGraphics, MediaPlayer, etc. can be used on iPhone, iPad, and iPod touch. However, not all classes can be used on all devices. Some methods must be employed to check if a particular hardware service is available. (i.e., isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera)

The use of Foundation and UIKit in iOS is collectively known as Cocoa Touch. But Mac OS X is done in Cocoa, which leverages the Foundation framework with AppKit.

Probably not exactly what you're looking for, but hope this helps.


Depends. For example, if your library uses UIKit it will not be compatible with Mac. Finally consider that the library must be provided as source and not binary, as the two architectures are different (arm vs. x86).

What should you do in your XCode project used to develop the library (and Unit Tests) is to create two targets, targeting the two different environments, and then compile each time for both in order to check compatibility.


There are differences between the devices, however your code will be mostly compatible with the ipad.

0

精彩评论

暂无评论...
验证码 换一张
取 消