简体   繁体   English

无法使用Xcode构建/运行iOS应用,但是“ cordova run ios”可以正常运行

[英]Can't build/run iOS app using Xcode however 'cordova run ios' works fine

I used to build and run it for test on iPhone 4s on the same setup I have now and it was working fine, now I'm trying to run it for test on iPhone 5S, but it doesn't work. 我曾经使用现在的相同设置在iPhone 4s上构建和运行该软件以进行测试,并且运行良好,现在我正尝试在iPhone 5S上运行该软件以进行测试,但它不起作用。

There is a known problem with Phonegap GAplugin and the arm64, which I used to remove the arm64 from valid architectures in target. Phonegap GAplugin和arm64存在一个已知问题,我曾使用该问题从目标中的有效体系结构中删除了arm64。

First time I tried, I got the following error: 第一次尝试,出现以下错误:

No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=arm64, VALID_ARCHS=armv7 armv7s).

I changed "Build Active Architectures ONLY" on targets to "No", then I got the following error: 我将目标上的“仅构建活动体系结构”更改为“否”,然后出现以下错误:

Undefined symbols for architecture armv7:
  "_CDVPageDidLoadNotification", referenced from:
      -[CDVSplashScreen pluginInitialize] in CDVSplashScreen.o
  "_OBJC_CLASS_$_CDVWebViewDelegate", referenced from:
      objc-class-ref in CDVInAppBrowser.o
  "_OBJC_METACLASS_$_CDVPlugin", referenced from:
      _OBJC_METACLASS_$_GAPlugin in GAPlugin.o
      _OBJC_METACLASS_$_IonicKeyboard in IonicKeyboard.o
      _OBJC_METACLASS_$_CDVBarcodeScanner in CDVBarcodeScanner.o
      _OBJC_METACLASS_$_DFPPlugin in DFPPlugin.o
      _OBJC_METACLASS_$_PushNotification in PushNotification.o
      _OBJC_METACLASS_$_SocialSharing in SocialSharing.o
      _OBJC_METACLASS_$_CDVDevice in CDVDevice.o
      ...
  "_CDVLocalNotification", referenced from:
      -[AppDelegate application:didReceiveLocalNotification:] in AppDelegate.o
  "_OBJC_CLASS_$_CDVViewController", referenced from:
      _OBJC_CLASS_$_MainViewController in MainViewController.o
      objc-class-ref in CDVDevice.o
      l_OBJC_$_CATEGORY_CDVViewController_$_StatusBar in CDVStatusBar.o
  "_OBJC_METACLASS_$_CDVCommandDelegateImpl", referenced from:
      _OBJC_METACLASS_$_MainCommandDelegate in MainViewController.o
  "_OBJC_CLASS_$_CDVUserAgentUtil", referenced from:
      objc-class-ref in CDVInAppBrowser.o
  "_CDVRemoteNotification", referenced from:
      -[AppDelegate application:didRegisterForRemoteNotificationsWithDeviceToken:] in AppDelegate.o
  "_OBJC_CLASS_$_CDVCommandQueue", referenced from:
      _OBJC_CLASS_$_MainCommandQueue in MainViewController.o
  "_OBJC_CLASS_$_CDVPlugin", referenced from:
      _OBJC_CLASS_$_GAPlugin in GAPlugin.o
      _OBJC_CLASS_$_IonicKeyboard in IonicKeyboard.o
      _OBJC_CLASS_$_CDVBarcodeScanner in CDVBarcodeScanner.o
      _OBJC_CLASS_$_DFPPlugin in DFPPlugin.o
      _OBJC_CLASS_$_PushNotification in PushNotification.o
      _OBJC_CLASS_$_SocialSharing in SocialSharing.o
      _OBJC_CLASS_$_CDVDevice in CDVDevice.o
      ...
  "_CDVRemoteNotificationError", referenced from:
      -[AppDelegate application:didFailToRegisterForRemoteNotificationsWithError:] in AppDelegate.o
  "_OBJC_METACLASS_$_CDVViewController", referenced from:
      _OBJC_METACLASS_$_MainViewController in MainViewController.o
  "_OBJC_METACLASS_$_CDVCommandQueue", referenced from:
      _OBJC_METACLASS_$_MainCommandQueue in MainViewController.o
  "_CDVPluginHandleOpenURLNotification", referenced from:
      -[AppDelegate application:openURL:sourceApplication:annotation:] in AppDelegate.o
      -[CDVInAppBrowser openInSystem:] in CDVInAppBrowser.o
      -[FacebookConnectPlugin initWithWebView:] in FacebookConnectPlugin.o
  "_OBJC_CLASS_$_CDVPluginResult", referenced from:
      objc-class-ref in GAPlugin.o
      objc-class-ref in CDVBarcodeScanner.o
      objc-class-ref in DFPPlugin.o
      objc-class-ref in PushNotification.o
      objc-class-ref in SocialSharing.o
      objc-class-ref in CDVDevice.o
      objc-class-ref in CDVNotification.o
      ...
  "_OBJC_CLASS_$_CDVCommandDelegateImpl", referenced from:
      _OBJC_CLASS_$_MainCommandDelegate in MainViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The strange thing that I still can test the app on the new setup using "cordova run ios" but I can't build it for release! 奇怪的是,我仍然可以使用“ cordova run ios”在新设置上测试该应用程序,但是我无法为其构建发行版! What should I do? 我该怎么办?

Cordova version: 4.1.2 科尔多瓦版本:4.1.2

Xcode Version: 6.1 Xcode版本:6.1

Test device: iPhone 5S with iOS 8 测试设备:具有iOS 8的iPhone 5S

Cordova plugins Cordova插件

  • com.adobe.plugins.GAPlugin 2.3.1 "GAPlugin" com.adobe.plugins.GAPlugin 2.3.1“ GAPlugin”
  • com.google.playservices 18.0.0 "Google Play Services for Android" com.google.playservices 18.0.0“ Android版Google Play服务”
  • com.ionic.keyboard 1.0.3 "Keyboard" com.ionic.keyboard 1.0.3“键盘”
  • com.phonegap.plugins.barcodescanner 2.0.0 "BarcodeScanner" com.phonegap.plugins.barcodescanner 2.0.0“ BarcodeScanner”
  • com.phonegap.plugins.facebookconnect 0.10.0 "Facebook Connect" com.phonegap.plugins.facebookconnect 0.10.0“ Facebook Connect”
  • com.postmedia.DFPPlugin 0.0.4 "DFPPlugin" com.postmedia.DFPPlugin 0.0.4“ DFPPlugin”
  • com.pushwoosh.plugins.pushwoosh 3.3.0 "Pushwoosh" com.pushwoosh.plugins.pushwoosh 3.3.0“ Pushwoosh”
  • nl.x-services.plugins.socialsharing 4.3.8 "SocialSharing" nl.x-services.plugins.socialsharing 4.3.8“社交共享”
  • org.apache.cordova.device 0.2.12 "Device" org.apache.cordova.device 0.2.12“设备”
  • org.apache.cordova.dialogs 0.2.10 "Notification" org.apache.cordova.dialogs 0.2.10“通知”
  • org.apache.cordova.geolocation 0.3.10 "Geolocation" org.apache.cordova.geolocation 0.3.10“地理位置”
  • org.apache.cordova.globalization 0.2.8 "Globalization" org.apache.cordova.globalization 0.2.8“全球化”
  • org.apache.cordova.inappbrowser 0.5.3 "InAppBrowser" org.apache.cordova.inappbrowser 0.5.3“ InAppBrowser”
  • org.apache.cordova.network-information 0.2.10 "Network Information" org.apache.cordova.network-information 0.2.10“网络信息”
  • org.apache.cordova.splashscreen 0.3.3 "Splashscreen" org.apache.cordova.splashscreen 0.3.3“启动画面”
  • org.apache.cordova.statusbar 0.1.8 "StatusBar" org.apache.cordova.statusbar 0.1.8“ StatusBar”
  • org.pushandplay.cordova.apprate 1.1 "AppRate" org.pushandplay.cordova.apprate 1.1“ AppRate”

Had the same issue… probably a outdated Xcode project. 也有同样的问题……可能是过时的Xcode项目。 I simply ran these commands: 我只运行了以下命令:

cordova platform remove ios
cordova platform add ios

Then, open the new Xcode project and run.It worked for me! 然后打开新的Xcode项目并运行,它对我有用!

I used the iPhone 4s emulator, and everything worked fine. 我使用了iPhone 4s模拟器,并且一切正常。 Then I disconnected my iPhone 5s and archived the app. 然后,我断开了iPhone 5s的连接并存档了该应用程序。

So, I think there is no way to run ARMV7 architecture only on iPhone 5S in development through Xcode, but you can do that through "cordova run ios" 因此,我认为无法通过Xcode在开发中的iPhone 5S上仅运行ARMV7架构,但是您可以通过“ cordova run ios”来实现

I think your problem is that you are writing code in myapp/www/index.html (that is the path for cordova run android or cordova run ios etc). 我认为您的问题是您正在myapp / www / index.html中编写代码(这是cordova运行android或cordova运行ios等的路径)。

If you want to build through XCode or Eclipse (Android) you should write your code in myapp/platforms/ios/www/index.html 如果要通过XCode或Eclipse(Android)进行构建,则应在myapp / platforms / ios / www / index.html中编写代码

OBVIOUSLY copy all the necessary files (js and css and images, all!) to run your app and then create a project in XCode 明显地复制所有必需的文件(js,css和图像,全部!)以运行您的应用程序,然后在XCode中创建一个项目

Those are the 2 approaches of Phonegap (Cli based and multiplatform or Platform specific) 这些是Phonegap的2种方法(基于Cli和多平台或特定于平台的)

Hope it helps! 希望能帮助到你!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM