Created
January 25, 2019 03:24
-
-
Save xuyecan/8108e321bcb718352ba397a8ec3c6a5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
// BarModel.h | |
#import <Foundation/Foundation.h> | |
NS_ASSUME_NONNULL_BEGIN | |
@interface BarModel : NSMutableDictionary<NSString *, NSString *> | |
@end | |
NS_ASSUME_NONNULL_END | |
--- | |
// BarModel.m | |
#import "BarModel.h" | |
@implementation BarModel | |
@end | |
--- | |
// FooModel.h | |
#import <Foundation/Foundation.h> | |
#import <JSONModel/JSONModel.h> | |
#import "BarModel.h" | |
NS_ASSUME_NONNULL_BEGIN | |
@interface FooModel : JSONModel | |
@property (nonatomic, strong) BarModel *barModel; | |
@property (nonatomic, strong) NSMutableDictionary *dict; | |
@end | |
NS_ASSUME_NONNULL_END | |
--- | |
// FooModel.m | |
#import "FooModel.h" | |
@implementation FooModel | |
@end | |
--- | |
// call | |
FooModel *fooModel = [[FooModel alloc] init]; | |
fooModel.barModel = [BarModel new]; | |
fooModel.dict = [NSMutableDictionary dictionaryWithDictionary:@{@"k1": @"v1"}]; | |
NSString *json = [fooModel toJSONString]; | |
NSLog(@"json: %@", json); | |
--- | |
error: | |
-[FooModel setBarModel:]: unrecognized selector sent to instance 0x600000070190 | |
2019-01-25 11:20:03.534573+0800 APIGatewayTest[23346:6835067] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FooModel setBarModel:]: unrecognized selector sent to instance 0x600000070190' | |
*** First throw call stack: | |
( | |
0 CoreFoundation 0x00000001036201bb __exceptionPreprocess + 331 | |
1 libobjc.A.dylib 0x00000001022a8735 objc_exception_throw + 48 | |
2 CoreFoundation 0x000000010363ef44 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 | |
3 CoreFoundation 0x0000000103624ed6 ___forwarding___ + 1446 | |
4 CoreFoundation 0x0000000103626da8 _CF_forwarding_prep_0 + 120 | |
5 APIGatewayTest 0x0000000100c49dd2 -[ViewController sendRequest:] + 146 | |
6 UIKitCore 0x0000000106ec2ecb -[UIApplication sendAction:to:from:forEvent:] + 83 | |
7 UIKitCore 0x00000001068fe0bd -[UIControl sendAction:to:forEvent:] + 67 | |
8 UIKitCore 0x00000001068fe3da -[UIControl _sendActionsForEvents:withEvent:] + 450 | |
9 UIKitCore 0x00000001068fd31e -[UIControl touchesEnded:withEvent:] + 583 | |
10 UIKitCore 0x0000000106efe0a4 -[UIWindow _sendTouchesForEvent:] + 2729 | |
11 UIKitCore 0x0000000106eff7a0 -[UIWindow sendEvent:] + 4080 | |
12 UIKitCore 0x0000000106edd394 -[UIApplication sendEvent:] + 352 | |
13 UIKitCore 0x0000000106fb25a9 __dispatchPreprocessedEventFromEventQueue + 3054 | |
14 UIKitCore 0x0000000106fb51cb __handleEventQueueInternal + 5948 | |
15 CoreFoundation 0x0000000103585721 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 | |
16 CoreFoundation 0x0000000103584f93 __CFRunLoopDoSources0 + 243 | |
17 CoreFoundation 0x000000010357f63f __CFRunLoopRun + 1263 | |
18 CoreFoundation 0x000000010357ee11 CFRunLoopRunSpecific + 625 | |
19 GraphicsServices 0x000000010aac81dd GSEventRunModal + 62 | |
20 UIKitCore 0x0000000106ec181d UIApplicationMain + 140 | |
21 APIGatewayTest 0x0000000100c4aa70 main + 112 | |
22 libdyld.dylib 0x00000001033b5575 start + 1 | |
23 ??? 0x0000000000000001 0x0 + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment