在Xcode中构建错误

时间:2015-05-26 20:50:05

标签: cordova ionic-framework ionic cordova-plugins

我的应用在Chrome / Safari网络浏览器中运行正常但是当我尝试从Xcode运行它时出现错误。我通过cordova plugin add https://github.com/apache/cordova-plugin-network-information

添加Ld /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Products/Debug-iphoneos/blankApp.app/blankApp normal arm64 cd "/Users/Default/Sites/MyAppƒ/blankApp/platforms/ios" export IPHONEOS_DEPLOYMENT_TARGET=6.0 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk -L/Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Products/Debug-iphoneos -F/Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Products/Debug-iphoneos -filelist /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/blankApp.LinkFileList -dead_strip -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -ObjC -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -framework AssetsLibrary /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Products/Debug-iphoneos/libCordova.a -framework CoreGraphics -framework MobileCoreServices -framework CoreMotion -framework CoreLocation -weak_framework SystemConfiguration -Xlinker -dependency_info -Xlinker /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/blankApp_dependency_info.dat -o /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Products/Debug-iphoneos/blankApp.app/blankApp duplicate symbol _OBJC_IVAR_$_CDVConnection._callbackId in: /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVConnection-1CADCF0E5137048B.o /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVConnection-8352C031B56FFD70.o duplicate symbol _OBJC_IVAR_$_CDVConnection.connectionType in: /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVConnection-1CADCF0E5137048B.o /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVConnection-8352C031B56FFD70.o duplicate symbol _OBJC_IVAR_$_CDVConnection.internetReach in: /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVConnection-1CADCF0E5137048B.o /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVConnection-8352C031B56FFD70.o duplicate symbol _OBJC_IVAR_$_CDVConnection.type in: /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVConnection-1CADCF0E5137048B.o /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVConnection-8352C031B56FFD70.o duplicate symbol _OBJC_METACLASS_$_CDVConnection in: /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVConnection-1CADCF0E5137048B.o /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVConnection-8352C031B56FFD70.o duplicate symbol _OBJC_CLASS_$_CDVConnection in: /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVConnection-1CADCF0E5137048B.o /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVConnection-8352C031B56FFD70.o duplicate symbol _OBJC_IVAR_$_CDVReachability.reachabilityRef in: /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVReachability-20459C55ECAAB2A7.o /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVReachability-A1ACF8C458D4507A.o duplicate symbol _OBJC_IVAR_$_CDVReachability.localWiFiRef in: /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVReachability-20459C55ECAAB2A7.o /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVReachability-A1ACF8C458D4507A.o duplicate symbol _OBJC_CLASS_$_CDVReachability in: /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVReachability-20459C55ECAAB2A7.o /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVReachability-A1ACF8C458D4507A.o duplicate symbol _OBJC_METACLASS_$_CDVReachability in: /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVReachability-20459C55ECAAB2A7.o /Users/Default/Library/Developer/Xcode/DerivedData/blankApp-hkvrfpembsxtsxdafnzhlomraujc/Build/Intermediates/blankApp.build/Debug-iphoneos/blankApp.build/Objects-normal/arm64/CDVReachability-A1ACF8C458D4507A.o ld: 10 duplicate symbols for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) 插件 网络信息后才开始收到此错误消息

另外,我在cordova 4.3.0和Xcode 6.3.1上。目前有没有办法解决这个问题?

Xcode错误

$ ./platforms/ios/cordova/clean

解决方案

这对我有用:

  1. $ sudo ionic plug remove cordova-plugin-network-information
  2. $ sudo ionic plugin add https://github.com/apache/cordova-plugin-network-information
  3. $ sudo ionic build ios
  4. $('.leftToggle').on('click', function(e) { $(".sidebarleft").toggleClass("sidebarleftactive"); });

1 个答案:

答案 0 :(得分:1)

当你添加一些插件时,ios build开始失败没有明显的原因。大部分时间这与插件无关。

删除平台并再次添加它对我来说一直都很有用。

尝试再次删除并添加平台

ionic platform remove ios

ionic platform add ios

阅读here关于同一个问题之王和解决方案

HTH