在 Visual Studio 中使用 MonoTouch 开发 iPhone 应用程序有多容易?

发布于 2024-09-19 00:01:10 字数 312 浏览 2 评论 0原文

我了解 Monotouch,并且安装了虚拟 MacOS 和 Monodevelop/Monotouch。

然而,是在 Mac OS X 上的 Monotouch 中构建 iPhone 应用程序更好,还是像在 Visual Studio 中构建 iPhone 应用程序并通过 Monotouch 将其移植到 iPhone 一样简单?

有人尝试过将 c# 项目移植到 iPhone 上吗?它与使用 monodevelop/monotouch 在 Mac 操作系统上构建应用程序有什么不同?

附注我最喜欢的帮助实用程序在 mac 操作系统上不存在,这就是这个问题的原因

I know about Monotouch and I have virtual MacOS and Monodevelop/Monotouch installed.

However, is it better to build an iPhone application in Monotouch on Mac OS X or it's as easy as to build iPhone app in Visual Studio and port it to iPhone via Monotouch?

Is there anyone who tried porting c# project to iPhone? How different was it from building the app on mac os using monodevelop/monotouch?

ps. my favourite helper utilities does not exist on mac os and that's the reason for this Q

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

江湖正好 2024-09-26 00:01:10

如前所述,要编译应用程序并将其上传以供应用商店使用,或使用模拟器进行调试,您需要在 Mac 上使用 MonoDevelop。

不过,可以在 Visual Studio 2008 或 2010 中编写大部分代码。

我主要使用 Visual Studio 编写了 6 个 Monotouch 应用程序,这些应用程序在应用程序商店中销量不佳。我使用 Windows 和 VS2010 的原因是我使用 Mac 键盘的速度要慢得多,我的 Visual Studio 设置是为了提高速度,而 PC 的处理能力大约是它的两倍。

以下是一些问题和提示:

  • 将 monotouch DLL 从 Mac 复制到 Windows(在 Mac 上搜索“monotouch.dll”),将所有 DLL 粘贴到静态位置并在项目中引用它们。然后应该在 VS 中编译。
  • 确保保留 2 个项目文件 - 一个 MonoDevelop 和一个 Visual Studio。我尝试手动转换,还编写了一个转换器来在两者之间进行转换,但它经常中断,因此更容易保留两个文件。
  • 您还可以将 Mono XML 文档(其格式与 Microsoft .NET XML 文档格式不同)转换为 Visual Studio 智能感知。下面的链接提供了我为 Monotouch 2.1 生成的 XML 文档的下载。
  • 避免使用共享驱动器进行开发。这使得 Mac 上的编译速度非常慢 - 坚持使用 USB 记忆棒复制文件,或者最好使用像 bitbucket.org 这样的在线源代码管理
  • 站点个人电脑和苹果机。
  • 对于布局(XIB 或 C#),您将使用 Mac,或者首先在 VS 中编写基本框架。

我在此处。

As mentioned, to compile your applications and upload them for appstore use, or debug using the simulator you'll need to use MonoDevelop on a Mac.

However it is possible to write a large portion of the code in Visual Studio 2008 or 2010.

I've written 6 Monotouch apps that are selling badly in the appstore, using primarily Visual Studio. The reason I use Windows and VS2010 is I'm a lot slower with the Mac keyboard, have my Visual Studio setup for speed, and a PC that is about twice the processing power.

Here's a few gotchas and tips:

  • Copy the monotouch DLLs from your Mac to Windows (search for "monotouch.dll" on the Mac), stick all the DLLs in a static place and reference them in your project. It should then compile in VS.
  • Make sure you keep 2 project files - a MonoDevelop and a Visual Studio one. I tried converting manually and also wrote a converter to go between the two but it breaks so often it's easier to just keep two files.
  • You can also convert the Mono XML documentation (it's in a different format to the Microsoft .NET XML documentation format) for Visual Studio intellisense. The link below has a download for the XML documentation I generated for Monotouch 2.1.
  • Avoid using a shared drive for development. This make compilation on the Mac very slow - stick to copying the files using a USB stick or ideally use an online source control site like bitbucket.org
  • I found it was quite fast with a single keyboard, monitor and mouse and a KVM switch going between PC and Mac.
  • For the layout (either XIB or C#) you'll have use your Mac, or write the bare bones in VS first.

I've written a fair amount on the process here.

新人笑 2024-09-26 00:01:10

仅使用 Visual Studio 无法开发 MonoTouch 应用程序。您必须使用 OSX 工具来构建代码并为手机创建包。没有办法解决这个问题,最简单的方法是使用 MonoDevelop。

我和其他开发人员过去所做的就是使用 Visual Studio 为应用程序开发一些 C# 库,因为尽管 MonoDevelop 相当不错,但它仍然远没有 VS 那么好。例如,使用 Resharper 等工具重构代码会容易得多。

在 Visual Studio 中开发应用程序时,您需要处理很多事情;例如:

  • 您根本无法从 Visual Studio 运行构建:VS 不知道如何构建 iPhone 所需的项目类型,并且它没有 iOS SDK 中存在的所有库。
  • 没有可视化编辑器来创建您可能想要为应用程序创建的 XIB 文件。
  • 您必须在这里或那里做很多额外的工作才能让 VS 打开解决方案(例如将 lib 文件从 OSX 复制到 Windows、创建单独的项目等)(尽管我认为适用于 VS 的 Novell Mono 工具可能会有所帮助)下面

是我过去 6 个月一直在做的事情:

  • 将应用程序分解为业务逻辑和 UI 逻辑的不同项目
  • 您应该能够从 VS 构建、编译甚至测试业务逻辑。请记住不要使用 MonoTouch 中不可用的任何 UI 库或外部库
  • 能够快速运行应用程序进行测试会很有帮助。
  • 使用 MonoDevelop 构建应用程序的 UI 代码部分如果您觉得 您需要进行一次大清理,在 Visual Studio 中打开代码并进行重构;尽管您无法构建任何内容,但 VS 中的代码检查器将有助于确保代码仍然有效,

希望它有所帮助 。 !

You simply can't develop a MonoTouch application just using Visual Studio. You have to use the OSX tools to build the code and create the package for the phone. There's no way to work around that, and the easiest way to do it is using MonoDevelop.

What me and other developers have done in the past is to develop some of the C# libraries for the apps using Visual Studio, because even though MonoDevelop is pretty good, its still far from being as good as VS. Refactoring code, for example, is much easier with tools like Resharper, etc.

When developing the App in Visual Studio, there's a lot of things you'll have to deal with; for example:

  • You simply cannot run a build from Visual Studio: VS doesn't know how to build the kind of project necessary for the iPhone, and it doesn't have all the libraries that exist in the iOS SDK.
  • there's no visual editor to create the XIB files you you probably want to create for your app.
  • You'll have to do a lot of extra work here and there to get the VS to even open the solution (like copy lib files from OSX to Windows, create separate projects, etc) (although I think Novell Mono tools for VS may help a little on this one.

So here's what I've been doing for the last 6 months:

  • Break down the application into different projects for business logic and UI logic
  • You should be able to build, compile and even test the business logic from VS. Just remember not to use any UI libraries, or external libraries not available in MonoTouch
  • Use MonoDevelop to build the UI code part of the app. Being able to quickly run the app to test helps a lot.
  • Every once in a while, if you feel you need to to a big cleanup, open the code in Visual Studio, and do the refactorings; although you won't be able to build anything, the code checker in VS will help to make sure the code is still valid.

Hope it helps!

怪我入戏太深 2024-09-26 00:01:10

实际上,随着新的 MonoTouch 版本更名为 Xamarin.iOS,这种情况已经发生了变化,它提供了紧密的 Visual Studio 集成。您仍然需要一台 Mac 来构建和测试,但您可以在 VS 上工作,没有太多障碍。

他们甚至连接了调试器:

Xamarin.iOSintegrated with Visual Studio

在此屏幕截图中,VS 和 OS X 在同一台计算机上运行计算机,但他们不必这样做,因为它们之间存在本地网络连接。

此处了解更多信息:

Xamarin iOS for Visual Studio 允许在 Windows 计算机上编写和测试 iOS 应用程序,并通过联网的 Mac 提供构建和部署服务。

在 Visual Studio 中进行 iOS 开发具有许多优势:

  • 为 iOS、Android 和 Windows 应用程序创建单一跨平台解决方案。
  • 将 Visual Studio 工具(例如 Resharper 和 Team Foundation Server)用于所有跨平台项目,包括 iOS 源代码。
  • 使用(现有 Visual Studio 开发人员)熟悉的代码编辑器、键盘快捷键等。
  • Xamarin.iOS for Visual Studio 支持 Visual Studio 在 Mac 上的 Windows 虚拟机内运行的配置(例如使用 Parallels 或 VMWare)。

请注意,商业版提供 Visual Studio 集成,每个许可证 999 美元
(该许可证是每人永久的,但您只能获得一年的免费升级。)

This has actually changed with new MonoTouch release rebranded as Xamarin.iOS that offers tight Visual Studio integration. You still need a Mac for building and testing but you can work from VS without much hurdle.

They even hooked up the debugger:

Xamarin.iOS integrated with Visual Studio

In this screenshot, VS and OS X run on the same computer, but they don't have to, given that there is a local network connection between them.

Read more here:

Xamarin iOS for Visual Studio allows iOS applications to be written and tested on Windows computers, with a networked Mac providing the build and deployment service.

Developing for iOS inside Visual Studio provides a number of benefits:

  • Creation of a single cross platform solution for iOS, Android and Windows applications.
  • Using Visual Studio tools (such as Resharper and Team Foundation Server) for all your cross-platform projects, including iOS source code.
  • Using the familiar (for existing Visual Studio developers) code editor, keyboard shortcuts, etc.
  • Xamarin.iOS for Visual Studio supports configurations where Visual Studio is running inside a Windows virtual machine on a Mac (eg. using Parallels or VMWare).

Note that Visual Studio integration is available in Business edition which is $999 per license.
(The license is perpetual per person but you only get free upgrades for a year.)

帅气称霸 2024-09-26 00:01:10

MonoTouch 主站点指出:

请注意,MonoTouch 需要
Mac、Apple 的 iPhone SDK,您必须
成为 Apple iPhone 开发者的一员
用于测试和部署您的程序
设备上的软件并
重新分发您的代码。

The MonoTouch home site states:

Please note that MonoTouch requires a
Mac, Apple's iPhone SDK and you must
be part of Apple's iPhone Developer
Program to test and deploy your
software on a device and to
redistribute your code.

狼亦尘 2024-09-26 00:01:10

我认为使用 Visual Studio 时会遇到的一些问题是,

  • 您不会使用本机 UI 控件进行设计,
  • 用于测试的模拟器会有所不同,
  • 您最终可能会使用 MonoTouch 库中不可用的 API 调用

我会坚持在 Mac 上使用 MonoDevelop。

I think some of the problems you are going to have using Visual Studio are

  • you won't be designing with the native UI controls
  • the emulator used for testing will be different
  • you may end up using API calls that aren't available in the MonoTouch libraries

I would stick with using MonoDevelop on the Mac.

故事还在继续 2024-09-26 00:01:10

由于您需要安装 Apple 的 iPhone SDK(仅适用于 OS X)才能使用 MonoTouch 进​​行开发,因此您将仅限于在 Mac 上进行开发。

MonoDevelop 是一个相当不错的 IDE,它与 Interface Builder 和 iPhone/iPad 模拟器的集成使得可以使用 MonoTouch 为 iPhone 进行开发一次非常好的经历。

Since you need the Apple's iPhone SDK (which is only available for OS X) installed to develop with MonoTouch you will be limited to developing on a Mac.

MonoDevelop is quite a good IDE, and its integration with Interface Builder and the iPhone/iPad simulator makes developing for iPhone with MonoTouch a pretty nice experience.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文