对于WatchOS 2扩展,AFNetworking cocoapods构建失败

时间:2015-09-27 15:33:58

标签: ios swift afnetworking cocoapods watchkit

我正在尝试使用Xoco 7.0为WatchOS 2构建一个Swift WatchKit应用程序,使用Cocoapods并包括AFNetworking,我认为它支持2.6.0版本的watchOS2 ...

我已经恢复到一个空项目,该项目只包含一个手表扩展目标并尝试导入AFNetworking:

enter image description here

Podfile:

source 'https://github.com/CocoaPods/Specs.git'

workspace 'AFNetworkingTest.xcworkspace'

target "WatchApp Extension" do
use_frameworks!
platform :watchos, '2.0'
pod 'AFNetworking'
end

配置cocoapods:

$ pod --version
0.38.2

$ pod install
Updating local specs repositories

CocoaPods 0.39.0.beta.4 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.

Analyzing dependencies
Downloading dependencies
Installing AFNetworking (2.6.0)
Generating Pods project
Integrating client project
Sending stats

ExtensionDelegate.swift:

import WatchKit
import AFNetworking

class ExtensionDelegate: NSObject, WKExtensionDelegate {

}

在Pods中构建失败> AFNetworking> AFNetworking.h,错误:

  

找不到AFURLSessionManager.h文件

enter image description here

查看生成的Pods项目,似乎AFNetworking pod只包含少量文件(据报道,它缺少AFURLSessionManager,以及看起来像很多其他文件):

enter image description here

我在这里遗漏了什么吗?

  • 这是pod中的错误还是我错过了Podfile中的内容?
  • 我是否遗漏了构建设置中的内容? (我在现有项目中遇到了同样的问题,所以尝试了一个带有默认构建设置的全新项目,并得到了同样的错误)。

提前致谢。

2 个答案:

答案 0 :(得分:0)

从我设法弄清楚,看起来这是2.6.0 pod规范中的一个错误。

我能够通过更新〜/ .cocoapods / repos / master / Specs / AFNetworking / 2.6.0 / AFNetworking.podspec.json 来修复构建问题,并在列表中添加“watchos” NSURLSession下的平台,即:

...
{
  "name": "NSURLSession",
  "platforms": {
    "ios": "7.0",
    "osx": "10.9",
    "watchos": "2.0"
  },
...

再次运行pod安装修复了问题。

我可以看到一个月前对AFNetworking源代码进行了同样的commit,所以希望pod很快就会更新到新版本。

答案 1 :(得分:0)

podspec(https://github.com/CocoaPods/CocoaPods/issues/4208

存在问题

对此最简单的解决方法是直接使用repo,直到推送2.6.1 podspec。

(?!^)(?=[a-zA-Z]\d?)

相关问题