pod小问题

CocoaPods中一些问题的解决


最近想模仿某个项目中的某个功能做个Demo,用到CocoaPods管理第三方库,期间出现了一些小问题。

问题一:

通过CocoaPods去导入AFNetworking,执行 pod install –verbose –no-repo-update 终端会有相应的警告:

[!] The `aikaaikaComic [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `aikaaikaComic [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

解决办法:

  • 选择程序 xxx -> TARGETS -> Build Settings
  • 找到 Other Linker Flags 如果里面有配置参数先删除,添加 $(inherited)
  • 然后执行 pod update –verbose –no-repo-update

问题二:

编译程序提示错误:Undefined symbols for architecture i386 或 Undefined symbols for architecture armv7
解决方法:

  • 编辑 Podfile
  • 添加
    post_install do |installer_representation|
        installer_representation.project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings['ARCHS'] = 'armv7 armv7s'
            end
        end
    end
    

注意 config.build_settings[‘ARCHS’] = ‘armv7 armv7s’ 和项目的 xxx -> TARGETS -> Build Settings 中的 Valid Architectures 的内容对应。

问题三:

再次编译提示错误:lb: library not found for -lPods 或者 lb: library not found for -libPods-AFNetworking.a
解决方法:

  • 编辑 Podfile
  • 在上面添加的内容中再加上 config.build_settings[‘ONLY_ACTIVE_ARCH’] = ‘NO’
    post_install do |installer_representation|
        installer_representation.project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings['ARCHS'] = 'armv7 armv7s'
                config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
            end
        end
    end
    

这是因为 64 位下项目中的 Build Active Architecture Only 默认是 NO,而 CocoaPods 中的是 YES

问题四:


通过 CocoaPods 引入 BaiduMapAPI ,执行 pod update 终端提示如下:

[!] The `YYW [Debug]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `YYW [Release]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

解决办法:

  • 选择程序 xxx -> TARGETS -> Build Settings
  • 找到 Library Search Path 添加 $(inherited)
  • 编译运行通过
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值