iPhone/iPad 通用应用程序不会为 iPhone 构建

发布于 2024-09-11 00:49:21 字数 1084 浏览 1 评论 0原文

我从头开始使我的应用程序适用于 iPhone 和 iPad(基于窗口的应用程序;通用)。 首先,我为 iPhone 制作了所有逻辑和视图,并且它起作用了。之后我为 iPad 创建了视图。那行得通。但是当我实现 UISplitViewController 或 UIPopover 时,应用程序将不再为 iPhone 构建。

我这样称呼我的自定义 splitViewController:

MySplitViewController *mySplitViewController = [[MySplitViewController" alloc] init];

类定义如下所示: @interface MySplitViewController : UISplitViewController { 在

构建时(对于 iPhone 3.1.3)它给了我这个错误:

找不到接口声明 'UISplitViewController',超类 'MySplitViewController'

当然,SDK 3.1.3 并不包含 SDK 3.2 中的所有新功能。很清楚。所以我尝试像这样创建我的类的实例:

MySplitViewController *mySplitViewController = [[NSClassFromString(@"MySplitViewController") alloc] init];

它仍然给我同样的错误。

我也尝试过弱链接框架,但这都没有帮助。

我还尝试过将创建类的实例包装在括号中,如下所示:

Class cls = NSClassFromString(@"UIPopoverController");
if (cls != nil) {
    MySplitViewController *mySplitViewController = [[NSClassFromString(@"MySplitViewController") alloc] init];
}

请问有人可以告诉我如何调用特定的类,以便我可以在两个平台上运行我的应用程序吗?

谢谢

I have made my application universal for iPhone and iPad (window-based application; universal) from scratch.
First I made all logic and views for iPhone and it worked. After that I created views for iPad. That worked to. But when I implemented UISplitViewController or UIPopover, the application will not build anymore for iPhone.

I call my custom splitViewController like that:

MySplitViewController *mySplitViewController = [[MySplitViewController" alloc] init];

Class definition looks like that:
@interface MySplitViewController : UISplitViewController {
}

On build (for iPhone 3.1.3) it gives me this error:

cannot find interface declaration for
'UISplitViewController', superclass of
'MySplitViewController'

Afcourse, SDK 3.1.3 does not contain all new features from SDK 3.2. That's clear. So I tried creating instance of my class like that:

MySplitViewController *mySplitViewController = [[NSClassFromString(@"MySplitViewController") alloc] init];

It still gives me the same error.

I also tried to weak-link framework but that helped neither.

What I also tried is that I wrap creating instance of class in parentheses like that:

Class cls = NSClassFromString(@"UIPopoverController");
if (cls != nil) {
    MySplitViewController *mySplitViewController = [[NSClassFromString(@"MySplitViewController") alloc] init];
}

Could please someone tells me how can I call specific classes so I can run my application for both platform ?

Thanks

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

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

发布评论

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

评论(1

柠栀 2024-09-18 00:49:22

我在此处找到了解决方案。

我希望它能帮助别人......

I have found the solution here.

I hope it will helps someone else...

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