请教 @sycx 老师一个MKNetworkKit的问题
小菜鸟写代码
由 小菜鸟写代码
发布于 2014年05月12日
| 更新于 2016年10月11日
无人欣赏。
情况是这样的,每次请求总是时好时坏,要么成功,要么就报这个方法里面的错误
-(void) reachabilityChanged:(NSNotification*) notification
{
if([self.reachability currentReachabilityStatus] == ReachableViaWiFi)
{
DLog(@"Server [%@] is reachable via Wifi", self.hostName);
[_sharedNetworkQueue setMaxConcurrentOperationCount:6];
[self checkAndRestoreFrozenOperations];
}
else if([self.reachability currentReachabilityStatus] == ReachableViaWWAN)
{
if(self.wifiOnlyMode) {
DLog(@" Disabling engine as server [%@] is reachable only via cellular data.", self.hostName);
[_sharedNetworkQueue setMaxConcurrentOperationCount:0];
} else {
DLog(@"Server [%@] is reachable only via cellular data", self.hostName);
[_sharedNetworkQueue setMaxConcurrentOperationCount:2];
[self checkAndRestoreFrozenOperations];
}
}
else if([self.reachability currentReachabilityStatus] == NotReachable)
{
DLog(@"Server [%@] is not reachable", self.hostName);
[self freezeOperations];
}
if(self.reachabilityChangedHandler) {
self.reachabilityChangedHandler([self.reachability currentReachabilityStatus]);
}
}
请教 @sycx 老师之前用MKNetworkKit的时候碰到过这种奇怪的问题吗?
共9条回复
2楼
·
sycx
回复于 2014年05月12日
首先, 你贴的这段代码是哪个类的?
然后,出错是哪行错了? 错误信息是什么?
3楼
·
yuan3344
回复于 2014年06月20日
我也遇到那个问题,经常崩溃,是MKNetworkEngine这个类,-(void) reachabilityChanged:(NSNotification*) notification 这个方法,[self.reachability currentReachabilityStatus] 这个判断。
4楼
·
5楼
·
琥珀先知
回复于 2014年07月11日
同问啊!!
6楼
·
itachi
回复于 2014年12月24日
哥也和你们一样,看来阿三写的东西还是不靠谱啊,不用了,改用AFN。
7楼
·
625328597
回复于 2015年04月27日
我也遇到了 郁闷 换一个框架吧
8楼
·
brucewangzhihua
回复于 2016年10月11日
有没有人已经解决了这个问题的?
9楼
·
qq3421923
回复于 2016年10月11日
MKNetworkKit? 没用过,到github上问吧....