我正在尝试构建一个控制Belkin的WeMo Switch的应用程序。他们发布了自己的SDK来控制他们的产品,并且我将它们包含在“图书馆”搜索路径以及“链接的图书馆和框架”工作区域中。

首先,我尝试为所有体系结构(包括arm64)进行编译,并获得以下Mach-O Linker错误

ld: warning: ignoring file /Users/khwaab/src/enimai/iOS/House Control/-
iphoneos/BelkinSDKLibrary.a, missing required architecture arm64 in file
/Users/khwaab/src/enimai/iOS/House Control/-iphoneos/BelkinSDKLibrary.a (3 slices)

ld: warning: ignoring file /Users/khwaab/src/enimai/iOS/House Control/-
iphoneos/WeMoLocalControl.a, missing required architecture arm64 in file
/Users/khwaab/src/enimai/iOS/House Control/-iphoneos/WeMoLocalControl.a (3 slices)

ld: warning: ignoring file /Users/khwaab/src/enimai/iOS/House Control/-
iphoneos/Cybergarage.a, missing required architecture arm64 in file
/Users/khwaab/src/enimai/iOS/House Control/-iphoneos/Cybergarage.a (3 slices)

ld: warning: ignoring file /Users/khwaab/src/enimai/iOS/House Control/-
iphoneos/Reachability.a, missing required architecture arm64 in file
/Users/khwaab/src/enimai/iOS/House Control/-iphoneos/Reachability.a (3 slices)

Undefined symbols for architecture arm64:

"_OBJC_CLASS_$_WeMoDiscoveryManager", referenced from:

  objc-class-ref in LightControlViewController.o

ld: symbol(s) not found for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

接下来,我假设库不是64位,尝试禁用arm64(如果我输入错了,请更正我)
Undefined symbols for architecture armv7s:
  "_xmlGetPredefinedEntity", referenced from:
      _cg_libxml2_get_entity in Cybergarage.a(cxml_parser_libxml2.o)
  "_xmlCreateMemoryParserCtxt", referenced from:
      _cg_libxml2_parsewrapper in Cybergarage.a(cxml_parser_libxml2.o)
  "_CNCopyCurrentNetworkInfo", referenced from:
      +[NetworkUtilities getCurrentWifiAccessPointName] in
BelkinSDKLibrary.a(NetworkUtilities.o)
  "_xmlFreeDoc", referenced from:
      _cg_libxml2_parsewrapper in Cybergarage.a(cxml_parser_libxml2.o)
  "_SCNetworkReachabilityCreateWithAddress", referenced from:
      +[Reachability reachabilityWithAddress:] in Reachability.a(Reachability.o)
  "_xmlFreeParserCtxt", referenced from:
      _cg_libxml2_parsewrapper in Cybergarage.a(cxml_parser_libxml2.o)
  "_xmlParseDocument", referenced from:
      _cg_libxml2_parsewrapper in Cybergarage.a(cxml_parser_libxml2.o)
  "_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
      -[Reachability stopNotifier] in Reachability.a(Reachability.o)
  "_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
      -[Reachability startNotifier] in Reachability.a(Reachability.o)
 "_SCNetworkReachabilitySetCallback", referenced from:
      -[Reachability startNotifier] in Reachability.a(Reachability.o)
  "_SCNetworkReachabilityGetFlags", referenced from:
      -[Reachability description] in Reachability.a(Reachability.o)
      -[Reachability currentReachabilityStatus] in Reachability.a(Reachability.o)
      -[Reachability isReachable] in Reachability.a(Reachability.o)
      -[Reachability isConnectionRequired] in Reachability.a(Reachability.o)
      -[Reachability isConnectionOnDemand] in Reachability.a(Reachability.o)
      -[Reachability isInterventionRequired] in Reachability.a(Reachability.o)
      -[Reachability isReachableViaWWAN] in Reachability.a(Reachability.o)
      ...
  "_CNCopySupportedInterfaces", referenced from:
      +[NetworkUtilities getCurrentWifiAccessPointName] in

BelkinSDKLibrary.a(NetworkUtilities.o)
  "_SCNetworkReachabilityCreateWithName", referenced from:
      +[Reachability reachabilityWithHostName:] in Reachability.a(Reachability.o)
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

不知道从何处去,我怀疑这个库已经过时了,不是不是针对armv7 / 7s(它也不会在模拟器下的i386中构建),但是如果有人对此运气或任何想法感到幸运的话,任何东西都会受到欢迎。

最佳答案

这是我从此问题中恢复的解决方案。

  • 将文件夹-iphonesos中提供的库包括到您的项目中。
  • 将以下框架添加到Project。
    1. libxml2.dylib
    2. CFNetwork.framework
    3. MobileCoreServices.framework
    4. Security.framework
    5. SystemConfiguration.framework
    
  • 然后转到您的构建设置并搜索架构。
  • 通过单击其他...添加新值并添加此$(ARCHS_STANDARD_32_BIT)
  • 如果您还可以选择,$(ARCHS_STANDARD)表示Standard architectures (armv7, armv7s)
  • 构建项目,您将摆脱所有链接器错误。
  • 关于ios - iOS WeMo SDK架构问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21792893/

    10-11 21:32