xcode - 包含cocoapods库时的库链接问题

时间:2017-02-16 22:19:22

标签: ios xcode cocoapods

我已经在线检查过试图解决这个问题,但到目前为止还没有一个有效。

很少有人建议删除../Xcode/DerivedData/下的文件,但没有做任何事情。我尝试使用Library Search PathsOther Linker Flags

进行游戏

Linker Flags:

//:configuration = Debug OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaAsyncSocket" -framework -l"GHODictionary" -l"MDWamp" -l"MPMessagePack" -l"SocketRocket" -framework -l"icucore" -framework "Security"

//:configuration = Release OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaAsyncSocket" -framework -l"GHODictionary" -l"MDWamp" -l"MPMessagePack" -l"SocketRocket" -framework -l"icucore" -framework "Security"

//:completeSettings = some OTHER_LDFLAGS

我想把它包含在xcode MDWamp中。我在podfile中做了pod init并包含了MDWamp

Podfile:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'Example' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for Example
  pod "MDWamp"
end

我一直在清理和重建,希望它自己解决。 希望这将是一个简单的包含,但还没有工作。

编辑:

错误:

ld: warning: directory not found for option '-L/Users/user/Library/Developer/Xcode/DerivedData/Example-fvftguwrkfoqgvaswdscaatwogtt/Build/Products/Debug-iphonesimulator/CocoaAsyncSocket'
ld: warning: directory not found for option '-L/Users/user/Library/Developer/Xcode/DerivedData/Example-fvftguwrkfoqgvaswdscaatwogtt/Build/Products/Debug-iphonesimulator/GHODictionary'
ld: warning: directory not found for option '-L/Users/user/Library/Developer/Xcode/DerivedData/Example-fvftguwrkfoqgvaswdscaatwogtt/Build/Products/Debug-iphonesimulator/MDWamp'
ld: warning: directory not found for option '-L/Users/user/Library/Developer/Xcode/DerivedData/Example-fvftguwrkfoqgvaswdscaatwogtt/Build/Products/Debug-iphonesimulator/MPMessagePack'
ld: warning: directory not found for option '-L/Users/user/Library/Developer/Xcode/DerivedData/Example-fvftguwrkfoqgvaswdscaatwogtt/Build/Products/Debug-iphonesimulator/SocketRocket'
ld: library not found for -lCocoaAsyncSocket
clang: error: linker command failed with exit code 1 (use -v to see invocation)

来自pod install的结果:

Analyzing dependencies
Downloading dependencies
Using CocoaAsyncSocket (7.5.1)
Using GHODictionary (1.1.0)
Using MDWamp (2.2.4)
Using MPMessagePack (1.3.13)
Using SocketRocket (0.5.1)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 5 total pods installed.

通过制作相应的目录解决了警告,我不确定将来会产生什么负面影响。只留下遗留问题的是链接器错误。

2 个答案:

答案 0 :(得分:0)

所以我真的只能在事故中使用Cocoapods的GUI版本并从GUI安装它。

答案 1 :(得分:0)

我遇到了同样的问题。我尝试了很多解决方案,但发现效果很好。

项目->构建设置->(搜索-> Library_search_path)

将其打开并删除所有引号

喜欢

“ $(TOOLCHAIN_DIR)/ usr / lib / swift / $(PLATFORM_NAME)” TO $(TOOLCHAIN_DIR)/ usr / lib / swift / $(PLATFORM_NAME)

对于所有三个。