我提交了我的应用程序以供审核并收到错误
2.10 - iPhone Apps must also run on iPad without modification, at iPhone resolution, and at 2X iPhone 3GS resolution. We noticed that your app did not run at iPhone resolution when reviewed on iPad running iOS 9.1, which is a violation of the App Store Review Guidelines. We’ve attached screenshot(s) for your reference. Specifically, when we tap to login with Facebook on the iPad no action is produced and we are unable to get the app to advance.
我已经为 ipad 复制了第二个 Storyboard,其中包含信息 plist 和常规设置等。我还需要为不同的 iphone 设备制作不同的 Storyboard,正如您从图像中看到的那样,我的设计无法使用自动约束。
我的问题是:我是像在 Storyboard 1 上那样对旧的 View Controller 进行 IB 并在每个 VC 上复制代码,还是我必须为新的创建所有新的 VC Storyboard包括应用程序委托(delegate)?其次,我是否必须在我的应用程序委托(delegate)中编写代码来说明根据屏幕尺寸使用哪个 Storyboard ,或者 xcode 7 在信息 plist 中执行此操作?我似乎只能找到我只知道 swift 的 objc 代码。
最佳答案
由于我的设计限制,我无法为所有设备尺寸使用一个 Storyboard,因此为了解决我的问题,我将这段代码添加到我的应用程序委托(delegate)中:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
var bounds: CGRect = UIScreen.mainScreen().bounds
var screenHeight: NSNumber = bounds.size.height
var deviceFamily: String
var mainView: UIStoryboard!
mainView = UIStoryboard(name: "iphone35Storyboard", bundle: nil)
let viewcontroller : UIViewController = mainView.instantiateViewControllerWithIdentifier("iphone35") as UIViewController
self.window!.rootViewController = viewcontroller
if screenHeight == 480 {
deviceFamily = "iPhoneOriginal"
// Load Storyboard with name: iPhone4
var mainView: UIStoryboard!
mainView = UIStoryboard(name: "Main", bundle: nil)
let viewcontroller : UIViewController = mainView.instantiateViewControllerWithIdentifier("iphone4") as UIViewController
self.window!.rootViewController = viewcontroller
} else {
var mainView: UIStoryboard!
mainView = UIStoryboard(name: "IpadStoryboard", bundle: nil)
let viewcontroller : UIViewController = mainView.instantiateViewControllerWithIdentifier("ipad") as UIViewController
self.window!.rootViewController = viewcontroller
if screenHeight == 920 {
deviceFamily = "Pad"
// Load Storyboard with name: ipad
var mainView: UIStoryboard!
mainView = UIStoryboard(name: "IpadStoryboard", bundle: nil)
let viewcontroller : UIViewController = mainView.instantiateViewControllerWithIdentifier("ipad") as UIViewController
self.window!.rootViewController = viewcontroller
}
}
}
然后创建一个新的 Storyboard,将主 Storyboard复制并粘贴到第二个 Storyboard上并调整大小。它起作用了,我对不同的 iPhone 尺寸做了同样的事情。希望这对其他人有帮助。
关于ios - 针对不同的屏幕尺寸使用不同的 Storyboard?通用 xcode 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34048543/