NSXMLParserDelegate和iPhone SDK 3.1.X [英] NSXMLParserDelegate and iPhone SDK 3.1.X

查看:123
本文介绍了NSXMLParserDelegate和iPhone SDK 3.1.X的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在商店里有一个为3.1.2构建的应用程序,但是在4.0GM下崩溃了。我已经使用Xcode 3.2.3解决了崩溃问题,但也发出警告说这样的类没有实现NSXMLParserDelegate。我添加到标题,一切似乎都很好。我现在已经提交了应用程序,它正在等待审核。这个最新版本使用4.0的基础SDK编译,部署目标为3.1.2。

I have an app on the store which was built for 3.1.2, but which was crashing under 4.0GM. I've fixed the crash problem using Xcode 3.2.3, but was also getting warnings that such-and-such class did not implement NSXMLParserDelegate. I added to the headers and everything seemed fine. I've now submitted the app and it's waiting for review. This latest version was compiled with base SDK of 4.0, and a deployment target of 3.1.2.

我遇到的问题是今天早上我在Xcode中打开了项目3.2.2,当建立3.1.2的基础SDK时,我收到编译错误,说NSXMLParserDelegate不存在。这是否意味着我的等待审核的应用程序将在3.1.2设备下崩溃?这很奇怪,因为我的beta测试者使用3.1.3而我认为3.1.2,该应用程序运行正常。如果它无法针对3.1.2的基础SDK进行编译,它不应该崩溃吗?

The problem I have is that this morning I opened up the project in Xcode 3.2.2, and when building against base SDK of 3.1.2, I'm getting compile errors saying that NSXMLParserDelegate does not exist. Does this mean my app that is waiting for review is going to crash under 3.1.2 devices? This is strange, because my beta testers who are using 3.1.3 and I think 3.1.2, said the app works fine. Shouldn't it crash if it can't compile against base SDK of 3.1.2?

我认为这应该可以讨论4.0 NDA,如我的问题是3.1.X特有的。

I think this should be ok to discuss in regards to the 4.0 NDA, as my problem is specific to 3.1.X.

推荐答案

首先,本周NDA已被解除,所以没问题讨论iOS 4.0 SDK。

First of all, the NDA has been lifted this week, so no problem to discuss the iOS 4.0 SDK.

至于你的问题:编译和运行应用程序之间存在差异。

As for your question: there's a difference between compiling and running an application.

在iOS4 SDK中添加了NSXMLParserDelegate协议。在以前版本的SDK中,XML解析器委托方法在类别中声明。在iOS4中,这些方法已经转移到专用协议,这使它变得更加清晰。在运行时,没有区别。编译完成后,应用程序对协议或类别一无所知。 NSXMLParser只会检查是否实现了特定的委托方法(通过 respondsToSelctor ),因此它运行得很好。

The NSXMLParserDelegate protocol was added in the iOS4 SDK. In previous versions of the SDK, the XML parser delegate methods were declared in a category. In iOS4, these methods have been moved to a dedicated protocol, which makes it a litte cleaner. At runtime, there's no difference. Once compiled, the app doesn't know anything about protocols or categories. The NSXMLParser will simply check if a specific delegate method is implemented (via respondsToSelctor), so it will run just fine.

一般情况下,它是使用iOS4 SDK构建并在3.0上运行不是问题。您必须确保不要调用3.0中不存在的任何方法。通过调用 respondsToSelector 可以很容易地做到这一点。它允许您创建一个在所有操作系统版本上运行的应用程序,但仍然允许您调用4.0特定的方法。

In general, it's not a problem to build with iOS4 SDK and run on 3.0. You do have to make sure you don't call any methods that don't exist in 3.0. This is very easy to do by calling respondsToSelector. It allows you to create a single app that runs on all OS versions, but still allows you to call 4.0-specific methods.

我希望这有意义...

I hope this makes sense ...

这篇关于NSXMLParserDelegate和iPhone SDK 3.1.X的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆