A App developer from
bawn / lcnetwork Goto Github PK
View Code? Open in Web Editor NEW基于AFNetworking的网络库封装
Home Page: http://bawn.github.io/
License: MIT License
基于AFNetworking的网络库封装
Home Page: http://bawn.github.io/
License: MIT License
AFNetworking 4.0 已经更新好久了不知道这个框架还会不会维护
想在请求header里增加一个token,有提供方法么
判断协议是否响应方法之后,应该是通过协议方法得到LCRequestSerializerType 然后比较。作者应该是笔误写错了
if ([request.child respondsToSelector:@selector(requestSerializerType)]) {
if ([request.child respondsToSelector:@selector(requestSerializerType)] == LCRequestSerializerTypeHTTP) {
self.manager.requestSerializer = [AFHTTPRequestSerializer serializer];
}
else{
_manager.requestSerializer = [AFJSONRequestSerializer serializer];
}
}
2015-12-25 12:26:32.811 LCNetworkDemo[2737:89194] -[**NSCFString objectForKeyedSubscript:]: unrecognized selector sent to instance 0x7fc338706b80
2015-12-25 12:26:32.815 LCNetworkDemo[2737:89194] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString objectForKeyedSubscript:]: unrecognized selector sent to instance 0x7fc338706b80'
* First throw call stack:
(
0 CoreFoundation 0x0000000108d91e65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010880adeb objc_exception_throw + 48
2 CoreFoundation 0x0000000108d9a48d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000108ce790a __forwarding + 970
4 CoreFoundation 0x0000000108ce74b8 _CF_forwarding_prep_0 + 120
5 LCNetworkDemo 0x000000010682e8f8 -[ViewController viewDidLoad] + 264
6 UIKit 0x000000010747df98 -[UIViewController loadViewIfRequired] + 1198
7 UIKit 0x000000010747e2e7 -[UIViewController view] + 27
8 UIKit 0x0000000107354ab0 -[UIWindow addRootViewControllerViewIfPossible] + 61
9 UIKit 0x0000000107355199 -[UIWindow _setHidden:forced:] + 282
10 UIKit 0x0000000107366c2e -[UIWindow makeKeyAndVisible] + 42
11 UIKit 0x00000001072df663 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
12 UIKit 0x00000001072e5cc6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1760
13 UIKit 0x00000001072e2e7b -[UIApplication workspaceDidEndTransaction:] + 188
14 FrontBoardServices 0x000000010b06a754 -[FBSSerialQueue _performNext] + 192
15 FrontBoardServices 0x000000010b06aac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
16 CoreFoundation 0x0000000108cbda31 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
17 CoreFoundation 0x0000000108cb395c __CFRunLoopDoSources0 + 556
18 CoreFoundation 0x0000000108cb2e13 __CFRunLoopRun + 867
19 CoreFoundation 0x0000000108cb2828 CFRunLoopRunSpecific + 488
20 UIKit 0x00000001072e27cd -[UIApplication _run] + 402
21 UIKit 0x00000001072e7610 UIApplicationMain + 171
22 LCNetworkDemo 0x000000010683325f main + 111
23 libdyld.dylib 0x000000010981792d start + 1
24 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
怎么加比较合适?
2015-11-05 21:59:37.410 LCNetworkDemo[7399:586126] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[**NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
* First throw call stack:
(
0 CoreFoundation 0x000000010d574f45 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010cfeedeb objc_exception_throw + 48
2 CoreFoundation 0x000000010d477eae -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 318
3 CoreFoundation 0x000000010d48a21b +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59
4 LCNetworkDemo 0x000000010b0200b8 -[Api2 requestArgument] + 136
5 LCNetworkDemo 0x000000010b0209cf -[LCNetworkAgent addRequest:] + 863
6 LCNetworkDemo 0x000000010b0286d8 -[LCBaseRequest start] + 104
7 LCNetworkDemo 0x000000010b02664a -[LCBatchRequest start] + 506
8 LCNetworkDemo 0x000000010b026824 -[LCBatchRequest startWithCompletionBlockWithSuccess:failure:] + 116
9 LCNetworkDemo 0x000000010b02457f -[ViewController api1Press:] + 815
10 UIKit 0x000000010bae8e91 -[UIApplication sendAction:to:from:forEvent:] + 92
11 UIKit 0x000000010bc544d8 -[UIControl sendAction:to:forEvent:] + 67
12 UIKit 0x000000010bc547a4 -[UIControl _sendActionsForEvents:withEvent:] + 311
13 UIKit 0x000000010bc538d4 -[UIControl touchesEnded:withEvent:] + 601
14 UIKit 0x000000010bb56ed1 -[UIWindow _sendTouchesForEvent:] + 835
15 UIKit 0x000000010bb57c06 -[UIWindow sendEvent:] + 865
16 UIKit 0x000000010bb072fa -[UIApplication sendEvent:] + 263
17 UIKit 0x000000010bae1abf _UIApplicationHandleEventQueue + 6844
18 CoreFoundation 0x000000010d4a1011 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
19 CoreFoundation 0x000000010d496f3c __CFRunLoopDoSources0 + 556
20 CoreFoundation 0x000000010d4963f3 __CFRunLoopRun + 867
21 CoreFoundation 0x000000010d495e08 CFRunLoopRunSpecific + 488
22 GraphicsServices 0x0000000110289ad2 GSEventRunModal + 161
23 UIKit 0x000000010bae730d UIApplicationMain + 171
24 LCNetworkDemo 0x000000010b02835f main + 111
25 libdyld.dylib 0x000000010dfff92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
嗨, 没有图片及文件上传的处理。还有一个问题
// 请求时间
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.