我可以将自己的网络框架(依赖于AFNetworking)构建为watchOS2框架吗? [英] Can I build my own networking framework (which is dependent on AFNetworking) as a watchOS2 framework?

查看:297
本文介绍了我可以将自己的网络框架(依赖于AFNetworking)构建为watchOS2框架吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试修改我的项目以支持WatchOS2架构。
目前我有一个基于AFNetworking的网络框架。到目前为止,我一直在使用我的手表应用程序。
现在我正在尝试为watch / watchsimulator平台构建框架。

I've been trying to modify my project to support WatchOS2 architecture. Currently I have a networking framework that is based on AFNetworking. I've been using it with my watch app so far. Now I'm trying to build the framework for watchos/watchsimulator platforms.

我得到的是
'SystemConfiguration / SystemConfiguration.h '某些AFNetworking类的文件未找到
错误。

What I'm getting is 'SystemConfiguration/SystemConfiguration.h' file not found error for some AFNetworking classes.

我知道系统配置不是watchOS2的可用系统框架之一。对于网络苹果

I know that system configuration is not one of the available system frameworks for watchOS2. And for networking apple says:

网络

对基于网络的操作的支持包括以下技术:

WatchKit扩展可以使用NSURLSession对象直接访问网络。 WatchKit扩展可以完全访问NSURLSession功能,包括在后台下载文件的功能。有关如何使用此类的信息,请参阅URL加载系统编程指南。
Watch Connectivity框架支持Watch应用程序和iOS应用程序之间的双向通信。使用此框架来协调两个应用程序之间的活动。有关更多信息,请参阅与您的Companion iOS应用程序通信。

我想为我的网络sdk支持iOS和watch。
有没有办法让这个项目为watchOS平台构建?
或者这是否意味着我只允许在我的手表应用中使用NSURLConnection?

I want to support both iOS and watchos for my networking sdk. Is there a way to make this project built for watchOS platform? Or is that mean I am only allowed to use NSURLConnection inside my watch app?

推荐答案

以下是github上最近提交的AFNetworking支持watchOS的提交。

Here is a recent commit on github for AFNetworking to support watchOS.

  • https://github.com/AFNetworking/AFNetworking/commit/d184833fa015a783742b573cf48a3080b863a900

查看更改日志..

  • https://cocoapods.org/pods/AFNetworking#changelog

版本2.6.0支持watchOS ...

Version 2.6.0 supports watchOS...


此版本现在支持watchOS 2.0,它依赖于仅出现在Xcode 7和iOS 9 / watchOS 2.0 / OS
X 10.10中的目标
条件。如果你使用CocoaPods安装库,AFNetworking将
定义旧平台上的这些目标条件,允许你的
代码进行编译。如果您不使用Cocoapods,则需要将以下代码添加
到PCH文件中。

This release now supports watchOS 2.0, which relys on target conditionals that are only present in Xcode 7 and iOS 9/watchOS 2.0/OS X 10.10. If you install the library using CocoaPods, AFNetworking will define these target conditionals for on older platforms, allowing your code to complile. If you do not use Cocoapods, you will need to add the following code your to PCH file.

这篇关于我可以将自己的网络框架(依赖于AFNetworking)构建为watchOS2框架吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆