简体   繁体   English

可以轻松扩展iphone应用程序以便在Mac App Store上发布吗?

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

Newby question. 新问题。 We have an existing iPhone / iPad application. 我们有一个现有的iPhone / iPad应用程序。 How should we go about making this app available for the Mac App Store? 我们该怎么做才能将这个应用程序用于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). 我们是分支项目还是单独开发Mac代码,还是我们可以配置现有项目来为所有设备构建(就像目前用于iPhone和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. 嗯,你必须意识到的最重要的事情是iOS和Mac OS X的界面范例是截然不同的。 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. 如果你想移植你的应用程序,它将不仅仅是调整分支代码和为Mac编译基本相同的应用程序。

Your Mac and iOS apps can share the same implementation code because, well, they're the same app! 您的Mac和iOS应用程序可以共享相同的实现代码,因为它们是相同的应用程序! However, the way you present your app to your Mac users and mobile users is going to be different. 但是,向Mac用户和移动用户展示应用的方式将会有所不同。 For example, Mac OS X thinks in sidebars, dialogs, panels, windows (no pun intended) and clicks, while iOS thinks in sheets, views and touches. 例如,Mac OS X在侧边栏,对话框,面板,窗口(没有双关语)和点击中进行思考,而iOS则考虑单张,视图和触摸。

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: 准备将项目移植到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. 您应该尽可能地将数据对象与GUI对象分开,以符合MVC设计模式,这也适用于Mac OS X.这样您就可以重用尽可能多的代码。
  2. Each project should have a target for Mac OS X along with a target for iOS. 每个项目都应该有一个Mac OS X的目标以及iOS的目标。
  3. GUI is different, so you should plan your application in a way the GUI ONLY presents data and doesn't keep it. GUI是不同的,因此您应该以GUI仅提供数据而不保留数据的方式规划应用程序。 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. iOS和Mac OS不同,不能轻易混合。 You can however share the code that powers the iOS app inside a new project that is targeted tot he Mac OS app. 但是,您可以在一个针对Mac OS应用程序的新项目中共享支持iOS应用程序的代码。 So I think most of what you will need to do is Administrative (different project) and UI-based. 所以我认为你需要做的大部分工作是管理(不同的项目)和基于UI的。

Remember that when creating UI elements (XIBs) you canno share those across projects, they must be in the local project's directory structure. 请记住,在创建UI元素(XIB)时,您无法在项目中共享这些元素,它们必须位于本地项目的目录结构中。

Good Luck! 祝好运!

The GUI on the iphone uses UIKit, the GUI on mac os X uses AppKit. iphone上的GUI使用UIKit,mac os X上的GUI使用AppKit。 There is 1 thing they have in common though, and thats Foundation, which contains NSData, NSString and so on. 虽然它们有一个共同点,那就是Foundation,它包含NSData,NSString等等。

The only code that will be re-useable on the mac app store will be the foundation "lower level" code. 唯一可以在mac app store上重用的代码将是基础“低级”代码。 UIKit won't run on Mac os X UIKit不能在Mac OS X上运行

My guess would be you'll need a separate xCode project. 我的猜测是你需要一个单独的xCode项目。 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 祝福,xj1200

http://t-machine.org/index.php/2009/02/26/using-shared-libraries-for-iphone-with-multiple-projects/ 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://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM