作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我无法使用已安装的 CocoaPods 成功运行 WatchKit 应用程序,并且收到“dyld:未加载库...原因:未找到图像”错误。
环境如下:Swift 2.0、WatchKit 2.0、CocoaPods 0.38.2、Xcode 7 Beta 4 和一个使用我为带有 WatchKit 扩展的 iPhone 应用程序开发的内部 CocoaPods 的项目。
我已经构建了许多内部使用的 CocoaPods,其中包含我想从我的主应用程序和 WatchKit 扩展中调用的通用代码。下面是 Podfile:
source 'https://github.com/CocoaPods/Specs.git'
source 'http://<local-git>/podspecs.git'
use_frameworks!
target 'Destinations511' do
platform :ios, '9.0'
pod 'GoogleMaps'
pod 'APIKit', :path => '~/Documents/Libraries/APIKit'
pod 'DestinationsKit', :path => '~/Documents/Libraries/DestinationsKit'
end
target 'Destinations511 WatchKit Extension' do
platform :watchos, '2.0'
pod 'APIKit', :path => '~/Documents/Libraries/APIKit'
pod 'DestinationsKit', :path => '~/Documents/Libraries/DestinationsKit'
end
dyld: Library not loaded: @rpath/APIKit.framework/APIKit Referenced from (...) Reason: image not found.
ld: warning: linking against dylib not safe for use in application extensions: /Users/dan/Library/Developer/Xcode/DerivedData/MyProject-dlixiemzyqyquocjthlseirhdxcm/Build/Products/Debug-watchsimulator/Pods_MyProject_WatchKit_Extension.framework/Pods_MyProject_WatchKit_Extension
Pod::Spec.new do |s|
s.name = "APIKit"
s.version = "1.1"
s.summary = "APIKit provides the basic classes and methods common to a number of our apps"
s.homepage = "http://.../apikit.git"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "me" => "me@me.com" }
s.platform = :ios
s.ios.deployment_target = "9.0"
s.watchos.deployment_target = "2.0"
s.source = { :git => "http://my-git-location/apikit.git", :tag => "#{s.version}" }
s.source_files = "APIKit"
s.frameworks = "UIKIt", "CoreLocation"
s.requires_arc = true
end
最佳答案
这有点违反直觉,当您安装/更新 pod 时,会导致 CocoaPods 发出警告,但我通过设置 EMBEDDED_CONTENT_CONTAINS_SWIFT
解决了这个问题。至 NO
在 WatchKit 扩展的build设置中,即使它包含 Swift。该应用程序仍在运行,并且在 App Store 中,但是 CocoaPods 仍然会警告我有关此设置的信息。
关于cocoapods - 无法使用 cocoapods 在 watchKit 2.0 中加载动态库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31734990/
我是一名优秀的程序员,十分优秀!