iOS-Bug: NSRunloop Mode
来源:互联网 发布:matlab迭代解方程算法 编辑:程序博客网 时间:2024/05/16 15:31
static NSString *CNSDataRunloopMode = @"CNSDataRunloppMode";@implementation CNSData{ NSURLConnection *_connection; NSString *_runLoopMode;}@synthesize data = _data;@synthesize finished = _finished;- (id)initWithUrl:(NSURL *)url { self = [super init]; if (self) { _data = [NSMutableData data]; _runLoopMode = CNSDataRunloopMode; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10.0]; [request setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"]; _connection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:NO]; [_connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:_runLoopMode]; //mark [_connection start]; while (!self.finished) { [[NSRunLoop currentRunLoop] runMode:_runLoopMode beforeDate:[NSDate distantFuture]]; //mark } } return self;}
wrong:
static NSString *CNSDataRunloopMode = @"CNSDataRunloppMode";@implementation CNSData{ NSURLConnection *_connection; NSString *_runLoopMode;}@synthesize data = _data;@synthesize finished = _finished;- (id)initWithUrl:(NSURL *)url { self = [super init]; if (self) { _data = [NSMutableData data]; _runLoopMode = CNSDataRunloopMode; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10.0]; [request setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"]; _connection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES]; while (!self.finished) { [[NSRunLoop currentRunLoop] runMode:NSDefaultMode beforeDate:[NSDate distantFuture]]; } } return self;}
0 0
- iOS-Bug: NSRunloop Mode
- ios:NSRunLoop
- ios:NSRunLoop
- iOS NSRunloop
- iOS----NSRunLoop
- iOS NSRunLoop
- ios NSRunloop
- IOS NSRunLoop
- ios:NSRunLoop
- ios:NSRunLoop
- IOS NSRunLoop
- IOS-NSRunLoop
- ios 进阶 -- NSRunLoop 解析
- iOS run loop NSRunloop
- IOS NSRunloop 的使用
- iOS多线程之NSRunloop
- iOS:.NSRunLoop再理解
- iOS多线程-- NSRunLoop
- hdu 1010 Tempter of the Bone_奇偶剪枝+dfs
- 时间类---友元
- linux下进程间通信的几种主要手段简介
- 23种设计模式(14):解释器模式
- android activity之间跳转 setResult 和 StartActivityForResult
- iOS-Bug: NSRunloop Mode
- 人在做,天在看!人生不可破的28条天规
- 合并 apk和 odex 文件到一个apk中
- Set Matrix Zeroes
- 戏谈cocos2d-x 2.0.4 Touch
- 基于Xmpp openfire asmack 即时通讯开发 传输文件注意事项
- Centos系统使用代理上网时 yum的代理设置
- hadoop学习路线图【hadoop最短学习路线】
- Ios 开发实用工具(持续更新)