Apple 接受是否需要在 Xcode 中设置主界面?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9162905/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 23:14:22  来源:igfitidea点击:

Is setting the Main Interface in Xcode necessary for Apple acceptance?

iphoneobjective-cxcode

提问by wayneh

My project is in Xcode 4.2, designed for iOS 4.2 and above. I am not using a Storyboard so in the Summary, both Main Storyboardand Main Interfaceare blank.

我的项目使用 Xcode 4.2,专为 iOS 4.2 及更高版本设计。我没有使用一个Storyboard所以在总结,无论是Main StoryboardMain Interface是空白。

Will this cause problems with my submission to Apple?

这会导致我向 Apple 提交的问题吗?

I ask because when I set the Main interface to my primary View Controller, I get this error when I compile: this class is not key value coding-compliant for the key mainTableView.'and I don't know how to resolve it.

我问是因为当我将主界面设置为我的主视图控制器时,我在编译时收到此错误:this class is not key value coding-compliant for the key mainTableView.'我不知道如何解决它。

回答by ader

From the ViewController Programming Guide:

来自 ViewController 编程指南:

"If a main storyboard is declared in this file, then when your app launches, iOS performs the following steps:

“如果在这个文件中声明了一个主故事板,那么当你的应用程序启动时,iOS 会执行以下步骤:

It instantiates a window for you. It loads the main storyboard and instantiates its initial view controller. It assigns the new view controller to the window's rootViewController property and then makes the window visible on the screen."

它为您实例化一个窗口。它加载主故事板并实例化其初始视图控制器。它将新的视图控制器分配给窗口的 rootViewController 属性,然后使窗口在屏幕上可见。”

The key word being "if". Therefore I don't think it's necessary.

关键词是“如果”。因此我认为没有必要。

I have a universal app that started out as an ios3 app and was updated to universal in the past 6 months - I didn't declare any storyboard (I've not used storyboards at all yet) or Main Interface. I simply add my viewcontroller's view to the window in applicationDidFinishLaunching.

我有一个通用应用程序,它最初是一个 ios3 应用程序,并在过去 6 个月内更新为通用应用程序 - 我没有声明任何故事板(我还没有使用过故事板)或主界面。我只是将我的视图控制器的视图添加到 applicationDidFinishLaunching 的窗口中。

When you state that you "set the Main interface to my primary View Controller" did you mean you set the view (not the view controller)? Is this a Xib file? A View Controller won't work, it needs to be a View/Xib.

当您声明“将主界面设置为我的主视图控制器”时,您的意思是您设置了视图(而不是视图控制器)吗?这是一个Xib文件吗?视图控制器不起作用,它需要是视图/Xib。