开发者

Can iphone apps be easily extended for release on the Mac App Store?

Newby question. We have an existing iPhon开发者_运维知识库e / iPad application. How should we go about making this app available for the Mac App Store? Do we branch the project and develop Mac code separately or can we configure the existing project to build for all devices (as it currently does for iPhone and iPad).

Your help and comments are appreciated.


Well, the most important thing you have to realize is that the interface paradigms of iOS and Mac OS X are vastly different. If you want to port your app, it's going to be more than a matter of tweaking branched code and compiling essentially the same app for Mac.

Your Mac and iOS apps can share the same implementation code because, well, they're the same app! However, the way you present your app to your Mac users and mobile users is going to be different. For example, Mac OS X thinks in sidebars, dialogs, panels, windows (no pun intended) and clicks, while iOS thinks in sheets, views and touches.

I realize this is more theoretical than other answers, but it's just a little tip to get you thinking :)


To prepare your projects to be ported to Mac OS X:

  1. You should separate your data objects from the GUI objects as much as possible to comply with MVC design pattern, which will work for you on Mac OS X either.This way you will be able reuse as much code as you can.
  2. Each project should have a target for Mac OS X along with a target for iOS.
  3. GUI is different, so you should plan your application in a way the GUI ONLY presents data and doesn't keep it. Use delegate, protocols, notifications etc. to pass the data between your objects.
  4. Make your project as modular as you can

Hope it helps


The iOS and Mac OS are different and cannot be easily mixed. You can however share the code that powers the iOS app inside a new project that is targeted tot he Mac OS app. So I think most of what you will need to do is Administrative (different project) and UI-based.

Remember that when creating UI elements (XIBs) you canno share those across projects, they must be in the local project's directory structure.

Good Luck!


The GUI on the iphone uses UIKit, the GUI on mac os X uses AppKit. There is 1 thing they have in common though, and thats Foundation, which contains NSData, NSString and so on.

The only code that will be re-useable on the mac app store will be the foundation "lower level" code. UIKit won't run on Mac os X


My guess would be you'll need a separate xCode project. You could probably do it all in one project but it would be a pain configuring the settings when you want to switch target platform.

You could create shared libraries for the common code.

I hope these links might be useful.

Best wishes, xj1200

http://t-machine.org/index.php/2009/02/26/using-shared-libraries-for-iphone-with-multiple-projects/

http://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html

http://www.clintharris.net/2009/iphone-app-shared-libraries/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜