kevin-lyn / stnettaskqueue Goto Github PK
View Code? Open in Web Editor NEWSTNetTaskQueue is a networking queue library for iOS and OS X. It's abstract and can be implemented in different protocols.
License: MIT License
STNetTaskQueue is a networking queue library for iOS and OS X. It's abstract and can be implemented in different protocols.
License: MIT License
在调用STNetTaskChain
的start
方法时判断下queue
属性是否设置。
如果忘记设置queue
了,调用start
方法后,既没有报错,也没有响应。
此行代码不应该使用key来作为文件名称.
这段代码只是把任务队列中移除,并不能停止任务对应的网络操作。
想请问下,有打算支持在取消任务的同时支持中断任务对应的网络操作么
?
- (void)_cancelTask:(STNetTask *)task
{
[self.tasks removeObject:task];
[self.watingTasks removeObject:task];
task.pending = NO;
}
Hi!
First of all I'd like to say thank you for this great lib. I've used it in my recent projects and we love how it works.
Actually, we faced with one issue regarding FormData
request type and Content-Type
header.
I've changes STHTTPNetTaskContentTypeMap
initialization to be like this:
STHTTPNetTaskContentTypeMap = @{ @(STHTTPNetTaskRequestJSON): @"application/json; charset=utf-8", @(STHTTPNetTaskRequestKeyValueString): @"application/x-www-form-urlencoded", @(STHTTPNetTaskRequestFormData) : @"application/x-www-form-urlencoded"};
After that our problem was go away. Maybe you know another workaround regarding this?
Because, we need to set HTTP-header
for Content-Type
for all our requests.
Thanks is advance!
代码干净,逻辑清晰。
请问能否支持按时缓存的功能?
异常类型:NSInvalidArgumentException(SIGABRT)
异常信息:-[__NSCFLocalDataTask setOperation:]: unrecognized selector sent to instance 0x155b3360
关键方法:V2gogo -[STHTTPNetTaskQueueHandlerOperation start] (STHTTPNetTaskQueueHandler.m:172)
NSInvalidArgumentException(SIGABRT)
-[__NSCFLocalDataTask setOperation:]: unrecognized selector sent to instance 0x166c6d40
0 CoreFoundation 0x2d931fd3 ___exceptionPreprocess + 131
1 libobjc.A.dylib 0x381aaccf objc_exception_throw + 31
2 CoreFoundation 0x2d935967 -[NSObject(NSObject) doesNotRecognizeSelector:] + 203
3 CoreFoundation 0x2d934253 ____forwarding___ + 707
4 CoreFoundation 0x2d8837b8 _CF_forwarding_prep_0 + 24
5 V2gogo 0x000e8a3b -[STHTTPNetTaskQueueHandlerOperation start] (STHTTPNetTaskQueueHandler.m:172)
6 V2gogo 0x000ea129 -[STHTTPNetTaskQueueHandler netTaskQueue:handleTask:] (STHTTPNetTaskQueueHandler.m:395)
7 V2gogo 0x000a216b -[STNetTaskQueue _addTask:] (STNetTaskQueue.m:103)
8 Foundation 0x2e31ac73 ___NSThreadPerformPerform + 387
9 CoreFoundation 0x2d8fd25b ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
10 CoreFoundation 0x2d8fc72b ___CFRunLoopDoSources0 + 207
11 CoreFoundation 0x2d8faf1f ___CFRunLoopRun + 623
12 CoreFoundation 0x2d865f0f CFRunLoopRunSpecific + 515
13 CoreFoundation 0x2d865cf3 CFRunLoopRunInMode + 103
14 Foundation 0x2e2581eb -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 255
15 Foundation 0x2e2a90a1 -[NSRunLoop(NSRunLoop) run] + 81
16 V2gogo 0x000a1f21 -[STNetTaskQueue threadEntryPoint] (STNetTaskQueue.m:71)
17 Foundation 0x2e31aa5f ___NSThread__main__ + 1063
18 libsystem_pthread.dylib 0x387d6919 __pthread_body + 141
19 libsystem_pthread.dylib 0x387d688b _pthread_start + 99
20 libsystem_pthread.dylib 0x387d4aa4 thread_start + 4
将注释从/* */
改为/** */
:
就可以在接口名称上按住鼠标左键
+option
键查看注释。
增加个头文件,好一次性将所有类导入,类似UIKit/UIKit.h
这种.
在STNetTaskChain
中增加只读的allTasks属性,用于任务结束后,从allTasks中获取任务对象,避免用户自己保留任务对象.
@property (nonatomic, strong,readonly) NSArray *allTasks
;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.