iOS WeMo SDK 架构问题

标签 ios linker

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

首先,我尝试为所有架构(包括 arm64)进行编译并得到以下 Mach-O Linker Error

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)

接下来我尝试禁用 arm64 假设库不是 64 位(如果我错了,请纠正我)
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
    
  • 然后转到您的build设置并搜索架构。
  • 通过单击其他...添加新值并添加 $(ARCHS_STANDARD_32_BIT)
  • 如果您也可以选择,$(ARCHS_STANDARD)表示 Standard architectures (armv7, armv7s)
  • 构建项目,您将摆脱所有链接器错误。
  • 关于iOS WeMo SDK 架构问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21792893/

    相关文章:

    c++ - 链接器是做什么的?

    android - 抖动中是否有任何应用交互检测器?

    c++ - 为什么在匿名命名空间中定义模板时出现内部链接错误?

    c# - 如何将 C# 和 C++ 程序集链接到单个可执行文件中?

    visual-c++ - 如何在 Visual Studio 2008 C++ 中链接 .lib

    linux - execve如何调用动态链接器/加载器(ld-linux.so.2)

    ios - 一旦有完整的行,如何删除 SKSpriteNode? (像俄罗斯方 block )

    iphone - 有没有办法在通用应用程序中共享(高分辨率)图形?

    objective-c - 使用 Parse.com 查询数组中的 2 个值

    ios - 如何使用coremotion计算手机的前后运动