cannot synthesize weak property because the current deployment target does not support weak references

在用 pod 依赖 dsBridge 项目后报错如下:

Error:(72, 13) cannot synthesize weak property because the current deployment target does not support weak references  

猜测原因是dsBridge没有指定运行最低版本,导致不支持 weak 属性。 https://github.com/wendux/DSBridge-IOS/blob/master/dsBridge.podspec

解决方案:

Podfile 下面添加如下代码:

post_install do |installer|  
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if target.name == 'dsBridge'
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '7.0'
      end
    end
  end
end