如何在 iphone os 2.0 以及 3.0 及以上操作系统中运行我的 iphone 2.0 应用程序

发布于 2024-08-05 17:45:16 字数 700 浏览 2 评论 0原文

我有 iphone,操作系统版本。 2.0 我读到,对于应用程序商店,所有应用程序都必须运行 3.0 操作系统。那么我怎样才能使我的应用程序在两个固件中运行。有没有一种方法可以检测操作系统版本是否>3.0,然后运行不同的语句,也可以运行语句低于 3.0 os。目前我正在使用这个。

#if __IPHONE_3_0
cell.textLabel.text=cellValue;
[cell.textLabel setFont:[UIFont systemFontOfSize:15.0]];
[cell.textLabel setLineBreakMode:UILineBreakModeTailTruncation];
#else
cell.text=cellValue;    
[cell setFont:[UIFont systemFontOfSize:15.0]];
[cell setLineBreakMode:UILineBreakModeTailTruncation];  
#endif

它会在两个固件上运行吗

我想让我的应用程序在> = 3.0操作系统和低于此的操作系统上运行...请帮助我

如何检查我的应用程序是否已弃用的方法...我只能看到这一行已弃用 cell.text=cellValue;

有什么需要改变的吗?我已经安装了名为 iphone_sdk_3.0__leopard__9m2736__final.dmg 的新 sdk

i have iphone with os ver. 2.0 i read that for app store all appplication must be run 3.0 os.so how could i make my application to run in both firmware.is there a way i can detect if os ver.>3.0 then run different statments alse run statments for lower than 3.0 os.currently i am using this.

#if __IPHONE_3_0
cell.textLabel.text=cellValue;
[cell.textLabel setFont:[UIFont systemFontOfSize:15.0]];
[cell.textLabel setLineBreakMode:UILineBreakModeTailTruncation];
#else
cell.text=cellValue;    
[cell setFont:[UIFont systemFontOfSize:15.0]];
[cell setLineBreakMode:UILineBreakModeTailTruncation];  
#endif

will it run on both firmware

i want to make my app to be run on >=3.0 os and lower than this...please help me

how do i check my application for deprecated methods...i can only see this line as deprecated
cell.text=cellValue;

is there anything to change.i have installed new sdk named iphone_sdk_3.0__leopard__9m2736__final.dmg

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

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

发布评论

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

评论(4

耶耶耶 2024-08-12 17:45:16

您上面的代码将无法在两组操作系统上运行。当您使用 #if 语句时,您基本上会排除该特定构建的操作系统的一个版本的代码。换句话说,您构建的每个版本(一个在您定义 __IPHONE_3_0 时,一个在您未定义时)都会排除另一个版本的代码。

您正在做的是构建两个可执行文件,一个是为 __IPHONE_3_0 构建的,另一个是为 ! __IPHONE_3_0。

如果您想构建一个可执行文件,即一个应用程序,在两者上运行,那么您需要将 #if 语句替换为运行时 ifs,而不是编译时 #ifs,例如:

if (theOS >= kiPhone3)
   ....
else
   ....

您还可以链接仅 3.0 的库,但在运行时测试框架的可用性,然后在方法不可用时跳过调用。您需要使用不同的调用,一个用于检查方法是否可用,另一个用于检查类是否可用:

Class newClass = (NSClassFromString(@"NewClassName"));
    if (newClass != nil)

最后一件事,SDK 的版本比您提到的版本更高。

祝你好运!

Your code above will not run on both sets of OSes. When you use #if statements, you are basically excluding code for one version of the OS for that particular build. In other words, each version that you build, one when you define __IPHONE_3_0 and one when you don't, will exclude the code for the other.

What you are doing is building two executables, one that is built for __IPHONE_3_0 and another for ! __IPHONE_3_0.

If you want to build one executable, that is one app, that runs on both, then you need to replace the #if statements with runtime ifs, not compile time #ifs, like:

if (theOS >= kiPhone3)
   ....
else
   ....

You can also link in libraries that are 3.0 only, but test for the availability of the framework at runtime, and then skip the call if the methods aren't available. There are different calls you'll need to use, one for checking to see if a method is available, and one for if a class is available:

Class newClass = (NSClassFromString(@"NewClassName"));
    if (newClass != nil)

Last thing, there is a later version of the SDK than the one you mentioned.

Good luck!

那片花海 2024-08-12 17:45:16

有一个 类似的帖子不久前。查看 Apple 的 MailComposer 示例,了解支持 3.0 和 2.x 固件的应用程序示例

There was a similar post some time ago. Have a look at Apple's MailComposer sample to see en example of an app that supports both 3.0 and 2.x firmware

春风十里 2024-08-12 17:45:16

如果您针对 2.0(或 2.1、2.2.1 等)SDK 构建它,它将在该 SDK 和任何更高版本上运行,除非 Apple 明确停止对该 SDK 的支持。我在 App Store 中看到很多应用程序声称它们可以在 iPhone OS 2.x 或更高版本上运行,并且在运行 3.1 的 iPhone 3G 上运行良好。

If you build it against the 2.0 (or 2.1, or 2.2.1, etc) SDK, it will run on that SDK and any later version unless Apple specifically discontinue support for that SDK. I see plenty of apps in the App Store that say they work with iPhone OS 2.x or later and they run fine on my iPhone 3G running 3.1.

等待圉鍢 2024-08-12 17:45:16

if-else 指令将对编译器隐藏一部分代码,因此它不会在这两种软件上运行。

The if-else directives will hide one part of the code from the compiler so it won't run on both software.

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