Reputation: 1502
I'm trying to build a Swift WatchKit app for WatchOS 2 with Xcode 7.0, using Cocoapods and including AFNetworking which, I gather, supports watchOS2 from version 2.6.0...
I've reverted all the way back to an empty project which just includes a watch extension target and tries to import AFNetworking:
Podfile:
source 'https://github.com/CocoaPods/Specs.git'
workspace 'AFNetworkingTest.xcworkspace'
target "WatchApp Extension" do
use_frameworks!
platform :watchos, '2.0'
pod 'AFNetworking'
end
Configure 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 {
}
Build fails in Pods > AFNetworking > AFNetworking.h, with error:
AFURLSessionManager.h file not found
Looking at the generated Pods project, it seems that the AFNetworking pod only includes a handful of files (and, as reported, is missing AFURLSessionManager, along with what looks like a lot of other files):
Am I missing something here?
Thanks in advance.
Upvotes: 2
Views: 1144
Reputation: 413
There is an issue with the podspec (https://github.com/CocoaPods/CocoaPods/issues/4208)
The easiest fix for this would be to use the repo directly until 2.6.1 podspec is pushed.
pod 'AFNetworking', :git => 'https://github.com/AFNetworking/AFNetworking.git', branch: 'master'
Upvotes: 0
Reputation: 1502
From what I've managed to figure out, it looks like this is a bug in the 2.6.0 pod spec.
I was able to fix the build issue by updating ~/.cocoapods/repos/master/Specs/AFNetworking/2.6.0/AFNetworking.podspec.json, adding "watchos" to the list of platforms under NSURLSession, i.e:
...
{
"name": "NSURLSession",
"platforms": {
"ios": "7.0",
"osx": "10.9",
"watchos": "2.0"
},
...
Running pod install again fixed the issue.
I can see the same commit was made to the AFNetworking source code a month ago, so hopefully the pod will be updated to a new version soon.
Upvotes: 0