PhoneGap/Cordova + iOS7 + XCode 5

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

PhoneGap/Cordova + iOS7 + XCode 5

iosxcodecordova

提问by FlyingLemon

I wast just in the process of finishing an app, then iOS7 was published. I am using Cordova 3.0.

正好在做一个app,然后iOS7就发布了。我正在使用 Cordova 3.0。

Before I update to XCode 5, compile for iOS7 and nothing is working... I wanted to know if they are working well together?

在我更新到 XCode 5 之前,针对 iOS7 进行编译,但没有任何效果……我想知道它们是否可以很好地协同工作?

And are the Cordova plugins (connection, splashscreen, notification, storage) still working or do we have to wait for the Cordova Apache Software Foundationto bring out a new version?

Cordova 插件(连接、启动画面、通知、存储)是否仍在工作,还是我们必须等待Cordova Apache 软件基金会推出新版本?

Thank you very much.

非常感谢。

采纳答案by Kendolein

I was wondering this myself, so I backed up xcode4 (copied it from the Applications folder to a backup folder) and then updated to xcode5 today. (This might be helpful: Can you install the Xcode 5 Developer Preview in parallel with Xcode 4.6.2?)

我自己也在想这个,所以我备份了 xcode4(从 Applications 文件夹复制到备份文件夹),然后今天更新到 xcode5。(这可能会有所帮助:您能否在 Xcode 4.6.2 的同时安装 Xcode 5 Developer Preview?

My Phonegap application compiled successfully and runs on the iOS7 simulator. So from what I can see, Phonegap 3.0.0 and xcode5 work well together.

我的 Phonegap 应用程序编译成功并在 iOS7 模拟器上运行。因此,据我所知,Phonegap 3.0.0 和 xcode5 可以很好地协同工作。

Other than that, I believe there are some iOS7 specific configurations that I need to be tweaked, such as:

除此之外,我认为还有一些 iOS7 特定配置需要调整,例如:

  • different icon sizes for retina displays in iOS7
  • adding icons for spotlight and settings
  • iOS7 中视网膜显示的不同图标大小
  • 为聚光灯和设置添加图标

回答by Vivek Srivastav

If you are getting compilation error after upgrading to iOS 7 and XCode 5 then in this case you need to change your Valid Architecture value under the Build Settings.

如果您在升级到 iOS 7 和 XCode 5 后遇到编译错误,那么在这种情况下,您需要更改 Build Settings 下的 Valid Architecture 值。

change your Architectures value to "armv7" only and delete others after that build you project all the compilation errors will resolve.

仅将您的 Architectures 值更改为“armv7”,并在构建您的项目后删除其他人,所有编译错误都将解决。

This fix will work for the Cordova Application only

此修复程序仅适用于 Cordova 应用程序

回答by Solomon

I'm using cordova 3.0 and xcode 5 too. It seems not any compile error and can run successfully. Problem is iOS7's screen length. Can use below method to solve the screen length problem. (this is also mentioned as a statusbar hide main ui problem)

我也在使用cordova 3.0 和xcode 5。似乎没有任何编译错误并且可以成功运行。问题是 iOS7 的屏幕长度。可以使用下面的方法来解决屏幕长度问题。(这也被称为状态栏隐藏主用户界面问题)

0, not sure whether the margin-top=20px solution whether work good, because in my environment, I'm also using jquery mobile, so simple set margin-top has no effect.

0,不确定margin-top=20px的方案是否好用,因为在我的环境下,我也是用jquery mobile的,所以简单的设置margin-top没有效果。

My solution is:

我的解决办法是:

1, Set View controller-based status bar appearance to NO in info.plist file.

1、在info.plist文件中将View controller-based status bar外观设置为NO。

2, Use this code for iOS 7

2、iOS 7 使用此代码

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
    [application setStatusBarStyle:UIStatusBarStyleLightContent];
    self.window.clipsToBounds =YES;
    self.window.frame =  CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
}

Till now, the status bar shows back to like iOS 6 or earlier. But you can find bottom a little hidden under the device scree. To solve this problem,

到现在为止,状态栏显示回到像 iOS 6 或更早版本。但是你会发现底部有点隐藏在设备屏幕下。为了解决这个问题,

3, Set all jquery mobile and iscrollview footer element padding-bottom=20px.

3、设置所有jquery mobile和iscrollview页脚元素padding-bottom=20px。

onDeviceReady: function() {
    console.log("onDeviceReady");
    if( parseInt(device.version) >= 7){
        $("footer").css("padding-bottom","20px");
    }
    app.receivedEvent('deviceready');

},

That's all for me to port my Cordova 3.0 + jQuery Mobile + iscrollview app to Xcode 5 + iOS7 . Hope it helpful to you.

这就是我将 Cordova 3.0 + jQuery Mobile + iscrollview 应用程序移植到 Xcode 5 + iOS7 的全部内容。希望对你有帮助。

回答by Carlos487

I'm using Cordova 2.9 and XCode 5 and are working "almost" perfect, the code compiles and even deploy to the phone.

我正在使用 Cordova 2.9 和 XCode 5 并且工作“几乎”完美,代码编译甚至部署到手机。

The only problem I've found are that the status bar now shows over the app, because the new fullscreen mode.

我发现的唯一问题是状态栏现在显示在应用程序上,因为新的全屏模式。

For more info you could see PhoneGap and Cordova with iOS 7

有关更多信息,您可以在 iOS 7 中查看PhoneGap 和 Cordova