ios 如何使用 Windows 开发机器为 iPhone 开发?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22358/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I develop for iPhone using a Windows development machine?
提问by ryan
Is there any way to tinker with the iPhone SDK on a Windows machine? Are there plans for an iPhone SDK version for Windows?
有没有办法在 Windows 机器上修改 iPhone SDK?是否有适用于 Windows 的 iPhone SDK 版本的计划?
The only other way I can think of doing this is to run a Mac VM image on a VMWareserver running on Windows, although I'm not too sure how legal this is.
我能想到的唯一另一种方法是在运行在 Windows上的VMWare服务器上运行Mac VM 映像,尽管我不太确定这有多合法。
回答by Andrew Grant
It's certainly possible to develop on a Windows machine, in fact, my first application was exclusively developed on the old Dell Precision I had at the time :)
当然可以在 Windows 机器上开发,事实上,我的第一个应用程序是专门在我当时拥有的旧 Dell Precision 上开发的:)
There are three routes;
有3条路线;
- Install OSx86(aka iATKOS / Kalyway) on a second partition/disk and dual boot.
- Run Mac OS X Server under VMWare (Mac OS X 10.7 (Lion) onwards, read the update below).
- Use Delphi XE4 and the macincloud service. This is a commercial toolset, but the component and lib support is growing.
- 在第二个分区/磁盘和双引导上安装OSx86(又名 iATKOS/Kalyway)。
- 在 VMWare 下运行 Mac OS X Server(Mac OS X 10.7 (Lion) 以上,阅读下面的更新)。
- 使用 Delphi XE4 和 macincloud 服务。这是一个商业工具集,但组件和库支持正在增长。
The first route requires modifying (or using a pre-modified) image of Leopard that can be installed on a regular PC. This is not as hard as you would think, although your success/effort ratio will depend upon how closely the hardware in your PC matches that in Mac hardware - e.g. if you're running a Core 2 Duo on an Intel Motherboard, with an NVidia graphics card you are laughing. If you're running an AMD machine or something without SSE3 it gets a little more involved.
第一种方法需要修改(或使用预先修改过的)Leopard 映像,该映像可以安装在普通 PC 上。这并不像您想象的那么难,尽管您的成功/努力比率将取决于您的 PC 中的硬件与 Mac 硬件中的匹配程度 - 例如,如果您在 Intel 主板上运行 Core 2 Duo 和 NVidia显卡你笑了。如果您运行的是 AMD 机器或其他没有 SSE3 的机器,则需要更多的参与。
If you purchase (or already own) a version of Leopard then this is a gray area since the Leopard EULA states you may only run it on an "Apple Labeled" machine. As many point out if you stick an Apple sticker on your PC you're probably covered.
如果您购买(或已经拥有)一个 Leopard 版本,那么这是一个灰色区域,因为 Leopard EULA 规定您只能在“Apple Labeled”机器上运行它。正如许多人指出的那样,如果您在 PC 上贴上 Apple 贴纸,您可能会被覆盖。
The second option is more costly. The EULA for the workstation version of Leopard prevents it from being run under emulation and as a result, there's no support in VMWare for this. Leopard server, however, CAN be run under emulation and can be used for desktop purposes. Leopard server and VMWare are expensive, however.
第二种选择成本更高。Leopard 工作站版本的 EULA 阻止它在仿真下运行,因此,VMWare 不支持此操作。然而,Leopard 服务器可以在仿真下运行并且可以用于桌面目的。然而,Leopard 服务器和 VMWare 很昂贵。
If you're interested in option 1) I would suggest starting at Insanelymacand reading the OSx86 sections.
如果您对选项 1) 感兴趣,我建议您从Insanelymac开始并阅读 OSx86 部分。
I do think you should consider whether the time you will invest is going to be worth the money you will save though. It was for me because I enjoy tinkering with this type of stuff and I started during the early iPhone betas, months before their App Store became available.
我确实认为你应该考虑你将投入的时间是否值得你节省的钱。这对我来说是因为我喜欢修补这类东西,而且我是在早期的 iPhone 测试版期间开始的,也就是在他们的 App Store 可用之前的几个月。
Alternatively, you could pick up a low-spec Mac Mini from eBay. You don't need much horsepower to run the SDK and you can always sell it on later if you decide to stop development or buy a better Mac.
或者,您可以从 eBay 购买低规格的 Mac Mini。运行 SDK 不需要很大的马力,如果您决定停止开发或购买更好的 Mac,您可以随时出售它。
Update: You cannot create a Mac OS X Client virtual machine for OS X 10.6 and earlier. Apple does not allow these Client OSes to be virtualized. With Mac OS X 10.7 (Lion) onwards, Apple has changed its licensing agreement in regards to virtualization. Source: VMWare KnowledgeBase
更新:您无法为 OS X 10.6 及更早版本创建 Mac OS X 客户端虚拟机。Apple 不允许对这些客户端操作系统进行虚拟化。从 Mac OS X 10.7 (Lion) 开始,Apple 更改了有关虚拟化的许可协议。来源:VMWare 知识库
回答by jjxtra
Xamarinis a solid choice. It was purchased by Microsoft and is now built directly into Visual Studio. You code in C#. With all the updates and features they are adding, you can do everything but submit to the App Store from Windows, even compile, build and deploy to an iOS device.
Xamarin是一个不错的选择。它由 Microsoft 购买,现在直接内置到 Visual Studio 中。您使用 C# 编写代码。有了他们添加的所有更新和功能,除了从 Windows 提交到 App Store 之外,您可以做任何事情,甚至可以编译、构建和部署到 iOS 设备。
For games, Unity 3Dis a great option. The editor is free to use for development, and even for distribution (if you have less than 100K USD in annual revenue). Unity supports iOS, Android and most other platforms. It may be possible to use Unity's "Cloud Build" feature to avoid having to use a Mac for deployment, although by default Unity actually spits out an Xcode project when building for iOS.
对于游戏,Unity 3D是一个不错的选择。该编辑器可免费用于开发,甚至可用于分发(如果您的年收入低于 10 万美元)。Unity 支持 iOS、Android 和大多数其他平台。可以使用 Unity 的“云构建”功能来避免必须使用 Mac 进行部署,尽管默认情况下 Unity 在为 iOS 构建时实际上会吐出一个 Xcode 项目。
Other options:
其他选项:
PhoneGap(html/javascript) also works. It isn't quite as nice for gaming, but it's pretty decent for regular GUI applications.
PhoneGap(html/javascript) 也有效。它对于游戏来说不是很好,但对于常规 GUI 应用程序来说却是相当不错的。
Flutter(dart) is a free cross platform mobile app development framework from Google. Write your code in Dart.
Flutter(dart) 是来自 Google 的免费跨平台移动应用程序开发框架。在 Dart 中编写代码。
React Native(javascript) is another popular cross-platform framework created by Facebook.
React Native(javascript) 是 Facebook 创建的另一个流行的跨平台框架。
Note that: for all of these options, all or most of the development can be done on Windows, but a MacOS device is still required to build a binary for submission to the App Store. One option is to get a cheap MAC Mini to do your final build.
请注意:对于所有这些选项,所有或大部分开发都可以在 Windows 上完成,但仍需要 MacOS 设备构建二进制文件以提交到 App Store。一种选择是购买便宜的 MAC Mini 来完成您的最终构建。
回答by Josh Hunt
If you have a jailbroken iPhone, you can install the iphone-gcc toolchainonto the iPhone through Cydia and that way you can just compilie the apps on the iPhone. Apps that are developed this way can still be submitted to the App Store.
如果你有一部越狱的 iPhone,你可以通过 Cydia将iphone-gcc 工具链安装到 iPhone 上,这样你就可以在 iPhone 上编译应用程序。以这种方式开发的应用程序仍然可以提交到 App Store。
And although Mr Valdez said it is a grey area (which it is), jailbreaking is incredibly easy and pretty much risk free. Yes, it voids your warrenty but you can just do a restore and they will never know.
尽管瓦尔迪兹先生说这是一个灰色地带(确实如此),但越狱非常容易,而且几乎没有风险。是的,它会使您的保修失效,但您可以进行恢复,他们永远不会知道。
回答by Rachel Henderson
Most of "so called Windows solutions for iOS development without Mac" require Mac at the end just to sign and send to app store. I checked a few, not all though (who has the time?)
大多数“所谓的无需 Mac 的 iOS 开发的 Windows 解决方案”都需要 Mac 最后签名并发送到应用程序商店。我检查了一些,但不是全部(谁有时间?)
At the end it's just too much trouble to learn "their super special easy way to program iOS without Objective-C", they have lots of bugs. Really the goal they are setting is unachievable in my view.
最后,学习“他们在没有Objective-C的情况下对iOS进行编程的超级特别简单方法”太麻烦了,他们有很多错误。在我看来,他们设定的目标确实无法实现。
Also a lot of time they make you use Objective-C equivalent statements simply in another language. They kind of look the same but there are always subtle differences that you have to learn on top of obj-c. Which also makes even less sense, because now instead of learning less you have to learn more. So where is the gain? Also they cost a lot, because they are very hard to develop.
还有很多时候,它们让你在另一种语言中简单地使用 Objective-C 等效语句。它们看起来一样,但总有一些细微的差异,你必须在 obj-c 之上学习。这也更没有意义,因为现在你必须学习更多而不是学得更少。那么收益在哪里呢?而且它们的成本很高,因为它们很难开发。
Many lack any debugging abilities whatsoever.
许多人缺乏任何调试能力。
In my honest opinion, if you are a hard-core iOS developer then for sure buy the best Mac and learn objective-c. It's expensive and takes time, but if it's your path, it's worth it.
老实说,如果您是一名铁杆 iOS 开发人员,那么一定要购买最好的 Mac 并学习 Objective-c。它昂贵且需要时间,但如果这是您的道路,那么值得。
For an occasional use, it's just easier to rent a remote Mac service, like XCodeClub.com
对于偶尔使用,租用远程 Mac 服务更容易,比如 XCodeClub.com
回答by Parand
The SDK is only available on OS X, forcing you to use a mac. If you don't want to purchase a mac you can either run OS X on a virtual machine on your windows box, or you can install OS X on your PC.
SDK 仅在 OS X 上可用,迫使您使用 mac。如果您不想购买 Mac,您可以在 Windows 机器上的虚拟机上运行 OS X,也可以在 PC 上安装 OS X。
In my experience the virtual machine solution is unusably slow (on a core2 duo laptop with 2G ram). If you feel like trying it search for the torrent. It's probably not worthwhile.
根据我的经验,虚拟机解决方案非常慢(在具有 2G 内存的 core2 duo 笔记本电脑上)。如果您想尝试搜索种子。这可能不值得。
The other option is to install OS X on your PC, commonly referred to as a hackintosh. Hackintoshes work quite well - my friend just sold his mac because his Dell quad core hackintosh was actually much faster than the apple hardware (and cost about 1/3). You can find lots of articles on how to do this; here's one on how to install on a Dell Inspirion 1525 laptop: hackbook pro tutorial
另一种选择是在您的 PC 上安装 OS X,通常称为 hackintosh。Hackintosh 工作得很好——我的朋友刚刚卖掉了他的 mac,因为他的戴尔四核 hackintosh 实际上比苹果硬件快得多(成本约为 1/3)。你可以找到很多关于如何做到这一点的文章;这是关于如何在戴尔 Inspirion 1525 笔记本电脑上安装的一个:hackbook pro 教程
Of course both of these options are likely counter to some licensing scheme, so proceed at your own risk.
当然,这两种选择都可能与某些许可计划背道而驰,因此请自行承担风险。
回答by dawnerd
You can use WinChain
您可以使用WinChain
Quoting the project page:
引用项目页面:
It's the easiest way to build the iPhone toolchain on a Windows XP/Vista computer, which in turn, can take Objective-C source code that you write using their UIKit Headers (included with winChain) and compile it into an application that you can use on your iPhone.
这是在 Windows XP/Vista 计算机上构建 iPhone 工具链的最简单方法,反过来,它可以获取您使用其 UIKit 标头(包含在 winChain 中)编写的 Objective-C 源代码,并将其编译为您可以使用的应用程序在你的 iPhone 上。
回答by Maurice
You don't need to own a Mac nor do you need to learn Objective-C. You can develop in different environments and compile into Objective-C later on.
您不需要拥有 Mac,也不需要学习 Objective-C。您可以在不同的环境中进行开发,并在以后编译成 Objective-C。
developing for the iphone and ipad by runing osx 10.6(snow leopard)
通过运行 osx 10.6(snow leopard) 为 iphone 和 ipad 开发
This article one of our developers wrote gives a pretty comprehensive walk through on installing OS X Snow Leopard on Windows using iBoot, then installing Vmware (with instructions), then getting your iPhone dev environment going... and a few extra juicy things. Super helpful for me.
我们的一位开发人员撰写的这篇文章非常全面地介绍了使用 iBoot 在 Windows 上安装 OS X Snow Leopard,然后安装 Vmware(带有说明),然后让您的 iPhone 开发环境运行……以及一些额外的有趣内容。对我超级有帮助。
Hope that helps. It uses Phonegap so you can develop on multiple smart phone platforms at once.
希望有帮助。它使用Phonegap,因此您可以同时在多个智能手机平台上进行开发。
回答by priamos
A devkit that allows one to develop iPhone apps in Objective-C, C++
or just plain C with Visual Studio:
一个开发工具包,允许人们Objective-C, C++
使用 Visual Studio 用 C 语言或仅用 C 语言开发 iPhone 应用程序:
Check it out at iOS build env
在iOS 构建环境中查看
You can build iPhone apps directly within Visual Studio (2008, 2010, Express).
您可以直接在 Visual Studio(2008、2010、Express)中构建 iPhone 应用程序。
Pretty neat, it even builds IPA
files for your app after a successful compilation. The code works as is on jailbroken devices, for the rest of the planet I believe the final compilation & submission to the App Store has to be done on a Mac. But still, it enables you to develop using a well-known IDE.
非常简洁,它甚至可以IPA
在成功编译后为您的应用程序构建文件。代码在越狱设备上工作,对于地球上的其他地方,我相信最终编译和提交到 App Store 必须在 Mac 上完成。但是,它仍然使您能够使用众所周知的 IDE 进行开发。
回答by Mehrdad Afshari
Of course, you can write Objective-C code in notepad or other programs and then move it to a Mac to compile.
当然,你可以在记事本或其他程序中编写Objective-C代码,然后将其移至Mac进行编译。
But seriously, it depends on whether you are developing official applications to put in App Store or developing applications for jailbroken iPhone. To write official applications, Apple iPhone SDK which requires an Intel Mac seems to be the only practical way. However, there is an unofficial toolchain to write applications for jailbroken iPhones. You can run it on Linux and Windows (using Cygwin).
但严重的是,这取决于您是开发官方应用程序以放入 App Store 还是为越狱的 iPhone 开发应用程序。要编写官方应用程序,需要 Intel Mac 的 Apple iPhone SDK 似乎是唯一可行的方法。但是,有一个非官方的工具链可以为越狱的 iPhone 编写应用程序。您可以在 Linux 和 Windows 上运行它(使用 Cygwin)。