标签:style blog http io ar color os 使用 sp
当你的项目中有IOS 8 的Today Extension项目时,执行
$ pod install不会报错,也能生成项目workspace,但是在Today Extension项目里引用头文件
#import "AFNetworking.h"<pre name="code" class="objc">#import "UALogger.h"
修改 viewDidLoad函数如下:
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. AFNetworkReachabilityManager *afNetworkReachabilityManager = [AFNetworkReachabilityManager sharedManager]; [afNetworkReachabilityManager startMonitoring]; //开启网络监视器; [afNetworkReachabilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { switch (status) { case AFNetworkReachabilityStatusNotReachable:{ break; } case AFNetworkReachabilityStatusReachableViaWiFi:{ break; } case AFNetworkReachabilityStatusReachableViaWWAN:{ break; } default: break; } UALog(@"网络状态数字返回:%i", status); UALog(@"网络状态返回: %@", AFStringFromNetworkReachabilityStatus(status)); }]; }
"${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/MBProgressHUD" "${PODS_ROOT}/Headers/Public/ReactiveCocoa" "${PODS_ROOT}/Headers/Public/ReactiveCocoa/ReactiveCocoa" "${PODS_ROOT}/Headers/Public/ReactiveViewModel" "${PODS_ROOT}/Headers/Public/UALogger"到<Header Search Paths>里,并拉到最下面定义<User-Defined>如:key:PODS_ROOT value:${SRCROOT}/Pods
好了,再编译,这次报的是
"_AFStringFromNetworkReachabilityStatus", referenced from:
___34-[TodayViewController viewDidLoad]_block_invoke in TodayViewController.o
即找不到pod lib库,回到项目配置文件 将
-ObjC -l"Pods-AFNetworking" -l"Pods-MBProgressHUD" -l"Pods-ReactiveCocoa" -l"Pods-ReactiveViewModel" -l"Pods-UALogger" -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"添加到<Other Linker Flags>的value中,然后点击Xcode的Build Phases,在下面的<link Binary With Libraries>的选项点+号选择
LibPods.aAdd .然后编译
相关代码已传到code.csdn
IOS笔记(2)20141212 [项目环境搭建之CocoaPods的安装和使用(二)之IOS8 TodayExtension挂件]
标签:style blog http io ar color os 使用 sp
原文地址:http://blog.csdn.net/woashizhangsi/article/details/41895421