├── RuntimeLearn.xcodeproj ├── xcuserdata │ ├── dave.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── RuntimeLearn.xcscheme │ └── MIMO.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── RuntimeLearn.xcscheme ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ ├── MIMO.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── dave.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── project.pbxproj ├── RuntimeLearn ├── Monkey.h ├── Bird.h ├── TestClass.h ├── Bird.m ├── ViewController.h ├── AppDelegate.h ├── UIButton+ClickBlock.h ├── NSObject+KeyValues.h ├── main.m ├── TestModel.h ├── TestClass.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── UIButton+ClickBlock.m ├── Info.plist ├── TestModel.m ├── Monkey.m ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.storyboard ├── AppDelegate.m ├── NSObject+KeyValues.m └── ViewController.m ├── RuntimeLearnTests ├── Info.plist └── RuntimeLearnTests.m └── RuntimeLearnUITests ├── Info.plist └── RuntimeLearnUITests.m /RuntimeLearn.xcodeproj/xcuserdata/dave.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /RuntimeLearn.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RuntimeLearn.xcodeproj/project.xcworkspace/xcuserdata/MIMO.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daiweiping/RuntimeLearn/HEAD/RuntimeLearn.xcodeproj/project.xcworkspace/xcuserdata/MIMO.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /RuntimeLearn.xcodeproj/project.xcworkspace/xcuserdata/dave.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daiweiping/RuntimeLearn/HEAD/RuntimeLearn.xcodeproj/project.xcworkspace/xcuserdata/dave.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /RuntimeLearn/Monkey.h: -------------------------------------------------------------------------------- 1 | // 2 | // Monkey.h 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Monkey : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RuntimeLearn/Bird.h: -------------------------------------------------------------------------------- 1 | // 2 | // Bird.h 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Bird : NSObject 12 | -(void)fly; 13 | @end 14 | -------------------------------------------------------------------------------- /RuntimeLearn/TestClass.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestClass.h 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestClass : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RuntimeLearn/Bird.m: -------------------------------------------------------------------------------- 1 | // 2 | // Bird.m 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import "Bird.h" 10 | 11 | @implementation Bird 12 | -(void)fly{ 13 | NSLog(@"Hi, I can fly ~~~"); 14 | } 15 | @end 16 | -------------------------------------------------------------------------------- /RuntimeLearn/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /RuntimeLearn/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /RuntimeLearn/UIButton+ClickBlock.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+ClickBlock.h 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import 10 | typedef void(^clickBlock)(void); 11 | 12 | @interface UIButton (ClickBlock) 13 | @property (nonatomic,copy) clickBlock click; 14 | @end 15 | -------------------------------------------------------------------------------- /RuntimeLearn/NSObject+KeyValues.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+KeyValues.h 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject (KeyValues) 12 | 13 | +(id)objectWithKeyValues:(NSDictionary *)aDictionary; 14 | 15 | -(NSDictionary *)keyValuesWithObject; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /RuntimeLearn/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /RuntimeLearn/TestModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestModel.h 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestModel : NSObject 12 | @property (nonatomic, copy) NSString *name; 13 | @property (nonatomic, strong) NSNumber *age; 14 | @property (nonatomic, copy) NSNumber *phoneNumber; 15 | @property (nonatomic, copy) NSNumber *height; 16 | @property (nonatomic, strong) NSDictionary *info; 17 | @property (nonatomic, strong) TestModel *son; 18 | @end 19 | -------------------------------------------------------------------------------- /RuntimeLearn/TestClass.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestClass.m 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import "TestClass.h" 10 | 11 | @implementation TestClass 12 | 13 | -(void)showAge{ 14 | NSLog(@"24"); 15 | } 16 | 17 | -(void)showName:(NSString *)aName{ 18 | NSLog(@"name is %@",aName); 19 | } 20 | 21 | -(void)showSizeWithWidth:(float)aWidth andHeight:(float)aHeight{ 22 | NSLog(@"size is %.2f * %.2f",aWidth, aHeight); 23 | } 24 | 25 | -(float)getHeight{ 26 | return 187.5f; 27 | } 28 | 29 | -(NSString *)getInfo{ 30 | return @"Hi, my name is Dave Ping, I'm twenty-four years old in the year, I like apple, nice to meet you."; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /RuntimeLearn/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /RuntimeLearnTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /RuntimeLearnUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /RuntimeLearn.xcodeproj/xcuserdata/MIMO.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RuntimeLearn.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 55D7CD8E1CCFB04400E3E830 16 | 17 | primary 18 | 19 | 20 | 55D7CDA71CCFB04400E3E830 21 | 22 | primary 23 | 24 | 25 | 55D7CDB21CCFB04400E3E830 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /RuntimeLearn.xcodeproj/xcuserdata/dave.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RuntimeLearn.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 55D7CD8E1CCFB04400E3E830 16 | 17 | primary 18 | 19 | 20 | 55D7CDA71CCFB04400E3E830 21 | 22 | primary 23 | 24 | 25 | 55D7CDB21CCFB04400E3E830 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /RuntimeLearn/UIButton+ClickBlock.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+ClickBlock.m 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import "UIButton+ClickBlock.h" 10 | #import 11 | 12 | static const void *associatedKey = "associatedKey"; 13 | 14 | @implementation UIButton (ClickBlock) 15 | 16 | //Category中的属性,只会生成setter和getter方法,不会生成成员变量 17 | 18 | -(void)setClick:(clickBlock)click{ 19 | objc_setAssociatedObject(self, associatedKey, click, OBJC_ASSOCIATION_COPY_NONATOMIC); 20 | [self removeTarget:self action:@selector(buttonClick) forControlEvents:UIControlEventTouchUpInside]; 21 | if (click) { 22 | [self addTarget:self action:@selector(buttonClick) forControlEvents:UIControlEventTouchUpInside]; 23 | } 24 | } 25 | 26 | -(clickBlock)click{ 27 | return objc_getAssociatedObject(self, associatedKey); 28 | } 29 | 30 | -(void)buttonClick{ 31 | if (self.click) { 32 | self.click(); 33 | } 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /RuntimeLearnTests/RuntimeLearnTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // RuntimeLearnTests.m 3 | // RuntimeLearnTests 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RuntimeLearnTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation RuntimeLearnTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /RuntimeLearn/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /RuntimeLearnUITests/RuntimeLearnUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // RuntimeLearnUITests.m 3 | // RuntimeLearnUITests 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RuntimeLearnUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation RuntimeLearnUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /RuntimeLearn/TestModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestModel.m 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import "TestModel.h" 10 | #import 11 | #import 12 | 13 | @implementation TestModel 14 | - (void)encodeWithCoder:(NSCoder *)aCoder{ 15 | unsigned int outCount = 0; 16 | Ivar *vars = class_copyIvarList([self class], &outCount); 17 | for (int i = 0; i < outCount; i ++) { 18 | Ivar var = vars[i]; 19 | const char *name = ivar_getName(var); 20 | NSString *key = [NSString stringWithUTF8String:name]; 21 | 22 | // 注意kvc的特性是,如果能找到key这个属性的setter方法,则调用setter方法 23 | // 如果找不到setter方法,则查找成员变量key或者成员变量_key,并且为其赋值 24 | // 所以这里不需要再另外处理成员变量名称的“_”前缀 25 | id value = [self valueForKey:key]; 26 | [aCoder encodeObject:value forKey:key]; 27 | } 28 | free(vars); 29 | } 30 | 31 | - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder{ 32 | if (self = [super init]) { 33 | unsigned int outCount = 0; 34 | Ivar *vars = class_copyIvarList([self class], &outCount); 35 | for (int i = 0; i < outCount; i ++) { 36 | Ivar var = vars[i]; 37 | const char *name = ivar_getName(var); 38 | NSString *key = [NSString stringWithUTF8String:name]; 39 | id value = [aDecoder decodeObjectForKey:key]; 40 | [self setValue:value forKey:key]; 41 | } 42 | free(vars); 43 | } 44 | return self; 45 | } 46 | @end 47 | -------------------------------------------------------------------------------- /RuntimeLearn/Monkey.m: -------------------------------------------------------------------------------- 1 | // 2 | // Monkey.m 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import "Monkey.h" 10 | #import "Bird.h" 11 | #import 12 | 13 | @implementation Monkey 14 | 15 | -(void)jump{ 16 | NSLog(@"monkey can not fly, but! monkey can jump"); 17 | } 18 | 19 | +(BOOL)resolveInstanceMethod:(SEL)sel{ 20 | 21 | /* 22 | 如果当前对象调用了一个不存在的方法 23 | Runtime会调用resolveInstanceMethod:来进行动态方法解析 24 | 我们需要用class_addMethod函数完成向特定类添加特定方法实现的操作 25 | 返回NO,则进入下一步forwardingTargetForSelector: 26 | */ 27 | 28 | #if 0 29 | return NO; 30 | #else 31 | class_addMethod(self, sel, class_getMethodImplementation(self, sel_registerName("jump")), "v@:"); 32 | return [super resolveInstanceMethod:sel]; 33 | #endif 34 | } 35 | 36 | -(id)forwardingTargetForSelector:(SEL)aSelector{ 37 | 38 | /* 39 | 在消息转发机制执行前,Runtime 系统会再给我们一次重定向的机会 40 | 通过重载forwardingTargetForSelector:方法来替换消息的接受者为其他对象 41 | 返回nil则进步下一步forwardInvocation: 42 | */ 43 | 44 | #if 0 45 | return nil; 46 | #else 47 | return [[Bird alloc] init]; 48 | #endif 49 | } 50 | 51 | -(NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector{ 52 | 53 | /* 54 | 获取方法签名进入下一步,进行消息转发 55 | */ 56 | 57 | return [NSMethodSignature signatureWithObjCTypes:"v@:"]; 58 | } 59 | 60 | -(void)forwardInvocation:(NSInvocation *)anInvocation{ 61 | 62 | /* 63 | 消息转发 64 | */ 65 | 66 | return [anInvocation invokeWithTarget:[[Bird alloc] init]]; 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /RuntimeLearn/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /RuntimeLearn/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /RuntimeLearn/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /RuntimeLearn/NSObject+KeyValues.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+KeyValues.m 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import "NSObject+KeyValues.h" 10 | #import 11 | #import 12 | 13 | @implementation NSObject (KeyValues) 14 | 15 | //字典转模型 16 | +(id)objectWithKeyValues:(NSDictionary *)aDictionary{ 17 | id objc = [[self alloc] init]; 18 | for (NSString *key in aDictionary.allKeys) { 19 | id value = aDictionary[key]; 20 | 21 | /*判断当前属性是不是Model*/ 22 | objc_property_t property = class_getProperty(self, key.UTF8String); 23 | unsigned int outCount = 0; 24 | objc_property_attribute_t *attributeList = property_copyAttributeList(property, &outCount); 25 | objc_property_attribute_t attribute = attributeList[0]; 26 | NSString *typeString = [NSString stringWithUTF8String:attribute.value]; 27 | if ([typeString isEqualToString:@"@\"TestModel\""]) { 28 | value = [self objectWithKeyValues:value]; 29 | } 30 | /**********************/ 31 | 32 | //生成setter方法,并用objc_msgSend调用 33 | NSString *methodName = [NSString stringWithFormat:@"set%@%@:",[key substringToIndex:1].uppercaseString,[key substringFromIndex:1]]; 34 | SEL setter = sel_registerName(methodName.UTF8String); 35 | if ([objc respondsToSelector:setter]) { 36 | ((void (*) (id,SEL,id)) objc_msgSend) (objc,setter,value); 37 | } 38 | free(attributeList); 39 | } 40 | return objc; 41 | } 42 | 43 | //模型转字典 44 | -(NSDictionary *)keyValuesWithObject{ 45 | unsigned int outCount = 0; 46 | objc_property_t *propertyList = class_copyPropertyList([self class], &outCount); 47 | NSMutableDictionary *dict = [NSMutableDictionary dictionary]; 48 | for (int i = 0; i < outCount; i ++) { 49 | objc_property_t property = propertyList[i]; 50 | 51 | //生成getter方法,并用objc_msgSend调用 52 | const char *propertyName = property_getName(property); 53 | SEL getter = sel_registerName(propertyName); 54 | if ([self respondsToSelector:getter]) { 55 | id value = ((id (*) (id,SEL)) objc_msgSend) (self,getter); 56 | 57 | /*判断当前属性是不是Model*/ 58 | if ([value isKindOfClass:[self class]] && value) { 59 | value = [value keyValuesWithObject]; 60 | } 61 | /**********************/ 62 | 63 | if (value) { 64 | NSString *key = [NSString stringWithUTF8String:propertyName]; 65 | [dict setObject:value forKey:key]; 66 | } 67 | } 68 | 69 | } 70 | free(propertyList); 71 | return dict; 72 | } 73 | @end 74 | -------------------------------------------------------------------------------- /RuntimeLearn/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // RuntimeLearn 4 | // 5 | // Created by 戴尼玛 on 16/4/26. 6 | // Copyright © 2016年 MIMO. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import 11 | #import "UIButton+ClickBlock.h" 12 | #import "NSObject+KeyValues.h" 13 | #import "TestModel.h" 14 | #import "Monkey.h" 15 | #import "TestClass.h" 16 | 17 | @interface ViewController () 18 | 19 | @end 20 | 21 | @implementation ViewController{ 22 | NSDictionary *dictionary; 23 | } 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | 28 | dictionary = @{ 29 | @"name":@"Dave Ping", 30 | @"age":@24, 31 | @"phoneNumber":@18718871111, 32 | @"height":@180.5, 33 | @"info":@{ 34 | @"address":@"Guangzhou", 35 | }, 36 | @"son":@{ 37 | @"name":@"Jack", 38 | @"info":@{ 39 | @"address":@"London", 40 | }, 41 | } 42 | }; 43 | 44 | 45 | // [self categoryTest]; 46 | 47 | 48 | // [self keyValuesTest]; 49 | 50 | 51 | // [self keyedArchiverTest]; 52 | 53 | 54 | // [self forwardingTest]; 55 | 56 | 57 | [self msgSendTest]; 58 | 59 | } 60 | 61 | -(void)categoryTest{ 62 | UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 63 | button.frame = self.view.bounds; 64 | [self.view addSubview:button]; 65 | button.click = ^{ 66 | NSLog(@"buttonClicked"); 67 | }; 68 | } 69 | 70 | -(void)keyValuesTest{ 71 | 72 | TestModel *model = [TestModel objectWithKeyValues:dictionary]; 73 | NSLog(@"name is %@",model.name); 74 | NSLog(@"son name is %@",model.son.name); 75 | 76 | NSDictionary *dict = [model keyValuesWithObject]; 77 | NSLog(@"dict is %@",dict); 78 | } 79 | 80 | -(void)keyedArchiverTest{ 81 | 82 | TestModel *model = [TestModel objectWithKeyValues:dictionary]; 83 | 84 | NSString *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).lastObject; 85 | path = [path stringByAppendingPathComponent:@"test"]; 86 | [NSKeyedArchiver archiveRootObject:model toFile:path]; 87 | 88 | TestModel *m = [NSKeyedUnarchiver unarchiveObjectWithFile:path]; 89 | NSLog(@"m.name is %@",m.name); 90 | NSLog(@"m.son name is %@",m.son.name); 91 | } 92 | 93 | -(void)forwardingTest{ 94 | Monkey *monkey = [[Monkey alloc] init]; 95 | ((void (*) (id, SEL)) objc_msgSend) (monkey, sel_registerName("fly")); 96 | } 97 | 98 | -(void)msgSendTest{ 99 | TestClass *objct = [[TestClass alloc] init]; 100 | 101 | ((void (*) (id, SEL)) objc_msgSend) (objct, sel_registerName("showAge")); 102 | 103 | ((void (*) (id, SEL, NSString *)) objc_msgSend) (objct, sel_registerName("showName:"), @"Dave Ping"); 104 | 105 | ((void (*) (id, SEL, float, float)) objc_msgSend) (objct, sel_registerName("showSizeWithWidth:andHeight:"), 110.5f, 200.0f); 106 | 107 | float f = ((float (*) (id, SEL)) objc_msgSend_fpret) (objct, sel_registerName("getHeight")); 108 | NSLog(@"height is %.2f",f); 109 | 110 | NSString *info = ((NSString* (*) (id, SEL)) objc_msgSend) (objct, sel_registerName("getInfo")); 111 | NSLog(@"%@",info); 112 | } 113 | 114 | @end 115 | -------------------------------------------------------------------------------- /RuntimeLearn.xcodeproj/xcuserdata/MIMO.xcuserdatad/xcschemes/RuntimeLearn.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /RuntimeLearn.xcodeproj/xcuserdata/dave.xcuserdatad/xcschemes/RuntimeLearn.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /RuntimeLearn.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 55D7CD941CCFB04400E3E830 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D7CD931CCFB04400E3E830 /* main.m */; }; 11 | 55D7CD971CCFB04400E3E830 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D7CD961CCFB04400E3E830 /* AppDelegate.m */; }; 12 | 55D7CD9A1CCFB04400E3E830 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D7CD991CCFB04400E3E830 /* ViewController.m */; }; 13 | 55D7CD9D1CCFB04400E3E830 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 55D7CD9B1CCFB04400E3E830 /* Main.storyboard */; }; 14 | 55D7CD9F1CCFB04400E3E830 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 55D7CD9E1CCFB04400E3E830 /* Assets.xcassets */; }; 15 | 55D7CDA21CCFB04400E3E830 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 55D7CDA01CCFB04400E3E830 /* LaunchScreen.storyboard */; }; 16 | 55D7CDAD1CCFB04400E3E830 /* RuntimeLearnTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D7CDAC1CCFB04400E3E830 /* RuntimeLearnTests.m */; }; 17 | 55D7CDB81CCFB04400E3E830 /* RuntimeLearnUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D7CDB71CCFB04400E3E830 /* RuntimeLearnUITests.m */; }; 18 | 55D7CDC71CCFB0FC00E3E830 /* UIButton+ClickBlock.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D7CDC61CCFB0FC00E3E830 /* UIButton+ClickBlock.m */; }; 19 | 55D7CDCA1CCFB2ED00E3E830 /* NSObject+KeyValues.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D7CDC91CCFB2ED00E3E830 /* NSObject+KeyValues.m */; }; 20 | 55D7CDCD1CCFB9A000E3E830 /* TestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D7CDCC1CCFB9A000E3E830 /* TestModel.m */; }; 21 | 55D7CDD01CCFBB4100E3E830 /* Monkey.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D7CDCF1CCFBB4100E3E830 /* Monkey.m */; }; 22 | 55D7CDD31CCFBB4900E3E830 /* Bird.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D7CDD21CCFBB4900E3E830 /* Bird.m */; }; 23 | 55D7CDD61CCFBEB800E3E830 /* TestClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D7CDD51CCFBEB800E3E830 /* TestClass.m */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | 55D7CDA91CCFB04400E3E830 /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = 55D7CD871CCFB04400E3E830 /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = 55D7CD8E1CCFB04400E3E830; 32 | remoteInfo = RuntimeLearn; 33 | }; 34 | 55D7CDB41CCFB04400E3E830 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 55D7CD871CCFB04400E3E830 /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = 55D7CD8E1CCFB04400E3E830; 39 | remoteInfo = RuntimeLearn; 40 | }; 41 | /* End PBXContainerItemProxy section */ 42 | 43 | /* Begin PBXFileReference section */ 44 | 55D7CD8F1CCFB04400E3E830 /* RuntimeLearn.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RuntimeLearn.app; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 55D7CD931CCFB04400E3E830 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 46 | 55D7CD951CCFB04400E3E830 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 47 | 55D7CD961CCFB04400E3E830 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 48 | 55D7CD981CCFB04400E3E830 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 49 | 55D7CD991CCFB04400E3E830 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 50 | 55D7CD9C1CCFB04400E3E830 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 51 | 55D7CD9E1CCFB04400E3E830 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 52 | 55D7CDA11CCFB04400E3E830 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 53 | 55D7CDA31CCFB04400E3E830 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | 55D7CDA81CCFB04400E3E830 /* RuntimeLearnTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RuntimeLearnTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 55D7CDAC1CCFB04400E3E830 /* RuntimeLearnTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RuntimeLearnTests.m; sourceTree = ""; }; 56 | 55D7CDAE1CCFB04400E3E830 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | 55D7CDB31CCFB04400E3E830 /* RuntimeLearnUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RuntimeLearnUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 58 | 55D7CDB71CCFB04400E3E830 /* RuntimeLearnUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RuntimeLearnUITests.m; sourceTree = ""; }; 59 | 55D7CDB91CCFB04400E3E830 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | 55D7CDC51CCFB0FC00E3E830 /* UIButton+ClickBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIButton+ClickBlock.h"; sourceTree = ""; }; 61 | 55D7CDC61CCFB0FC00E3E830 /* UIButton+ClickBlock.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIButton+ClickBlock.m"; sourceTree = ""; }; 62 | 55D7CDC81CCFB2ED00E3E830 /* NSObject+KeyValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+KeyValues.h"; sourceTree = ""; }; 63 | 55D7CDC91CCFB2ED00E3E830 /* NSObject+KeyValues.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+KeyValues.m"; sourceTree = ""; }; 64 | 55D7CDCB1CCFB9A000E3E830 /* TestModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestModel.h; sourceTree = ""; }; 65 | 55D7CDCC1CCFB9A000E3E830 /* TestModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestModel.m; sourceTree = ""; }; 66 | 55D7CDCE1CCFBB4100E3E830 /* Monkey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Monkey.h; sourceTree = ""; }; 67 | 55D7CDCF1CCFBB4100E3E830 /* Monkey.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Monkey.m; sourceTree = ""; }; 68 | 55D7CDD11CCFBB4900E3E830 /* Bird.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bird.h; sourceTree = ""; }; 69 | 55D7CDD21CCFBB4900E3E830 /* Bird.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Bird.m; sourceTree = ""; }; 70 | 55D7CDD41CCFBEB800E3E830 /* TestClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestClass.h; sourceTree = ""; }; 71 | 55D7CDD51CCFBEB800E3E830 /* TestClass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestClass.m; sourceTree = ""; }; 72 | /* End PBXFileReference section */ 73 | 74 | /* Begin PBXFrameworksBuildPhase section */ 75 | 55D7CD8C1CCFB04400E3E830 /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | 55D7CDA51CCFB04400E3E830 /* Frameworks */ = { 83 | isa = PBXFrameworksBuildPhase; 84 | buildActionMask = 2147483647; 85 | files = ( 86 | ); 87 | runOnlyForDeploymentPostprocessing = 0; 88 | }; 89 | 55D7CDB01CCFB04400E3E830 /* Frameworks */ = { 90 | isa = PBXFrameworksBuildPhase; 91 | buildActionMask = 2147483647; 92 | files = ( 93 | ); 94 | runOnlyForDeploymentPostprocessing = 0; 95 | }; 96 | /* End PBXFrameworksBuildPhase section */ 97 | 98 | /* Begin PBXGroup section */ 99 | 55D7CD861CCFB04400E3E830 = { 100 | isa = PBXGroup; 101 | children = ( 102 | 55D7CD911CCFB04400E3E830 /* RuntimeLearn */, 103 | 55D7CDAB1CCFB04400E3E830 /* RuntimeLearnTests */, 104 | 55D7CDB61CCFB04400E3E830 /* RuntimeLearnUITests */, 105 | 55D7CD901CCFB04400E3E830 /* Products */, 106 | ); 107 | sourceTree = ""; 108 | }; 109 | 55D7CD901CCFB04400E3E830 /* Products */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 55D7CD8F1CCFB04400E3E830 /* RuntimeLearn.app */, 113 | 55D7CDA81CCFB04400E3E830 /* RuntimeLearnTests.xctest */, 114 | 55D7CDB31CCFB04400E3E830 /* RuntimeLearnUITests.xctest */, 115 | ); 116 | name = Products; 117 | sourceTree = ""; 118 | }; 119 | 55D7CD911CCFB04400E3E830 /* RuntimeLearn */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 55D7CD951CCFB04400E3E830 /* AppDelegate.h */, 123 | 55D7CD961CCFB04400E3E830 /* AppDelegate.m */, 124 | 55D7CD981CCFB04400E3E830 /* ViewController.h */, 125 | 55D7CD991CCFB04400E3E830 /* ViewController.m */, 126 | 55D7CDD71CCFC13100E3E830 /* 给Category添加属性 */, 127 | 55D7CDD81CCFC14E00E3E830 /* 字典与模型互转 */, 128 | 55D7CDD91CCFC16300E3E830 /* 自动归档 */, 129 | 55D7CDDA1CCFC17B00E3E830 /* 动态方法解析 */, 130 | 55D7CDDB1CCFC18F00E3E830 /* objc_msgSend使用 */, 131 | 55D7CD9B1CCFB04400E3E830 /* Main.storyboard */, 132 | 55D7CD9E1CCFB04400E3E830 /* Assets.xcassets */, 133 | 55D7CDA01CCFB04400E3E830 /* LaunchScreen.storyboard */, 134 | 55D7CDA31CCFB04400E3E830 /* Info.plist */, 135 | 55D7CD921CCFB04400E3E830 /* Supporting Files */, 136 | ); 137 | path = RuntimeLearn; 138 | sourceTree = ""; 139 | }; 140 | 55D7CD921CCFB04400E3E830 /* Supporting Files */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | 55D7CD931CCFB04400E3E830 /* main.m */, 144 | ); 145 | name = "Supporting Files"; 146 | sourceTree = ""; 147 | }; 148 | 55D7CDAB1CCFB04400E3E830 /* RuntimeLearnTests */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | 55D7CDAC1CCFB04400E3E830 /* RuntimeLearnTests.m */, 152 | 55D7CDAE1CCFB04400E3E830 /* Info.plist */, 153 | ); 154 | path = RuntimeLearnTests; 155 | sourceTree = ""; 156 | }; 157 | 55D7CDB61CCFB04400E3E830 /* RuntimeLearnUITests */ = { 158 | isa = PBXGroup; 159 | children = ( 160 | 55D7CDB71CCFB04400E3E830 /* RuntimeLearnUITests.m */, 161 | 55D7CDB91CCFB04400E3E830 /* Info.plist */, 162 | ); 163 | path = RuntimeLearnUITests; 164 | sourceTree = ""; 165 | }; 166 | 55D7CDD71CCFC13100E3E830 /* 给Category添加属性 */ = { 167 | isa = PBXGroup; 168 | children = ( 169 | 55D7CDC51CCFB0FC00E3E830 /* UIButton+ClickBlock.h */, 170 | 55D7CDC61CCFB0FC00E3E830 /* UIButton+ClickBlock.m */, 171 | ); 172 | name = "给Category添加属性"; 173 | sourceTree = ""; 174 | }; 175 | 55D7CDD81CCFC14E00E3E830 /* 字典与模型互转 */ = { 176 | isa = PBXGroup; 177 | children = ( 178 | 55D7CDC81CCFB2ED00E3E830 /* NSObject+KeyValues.h */, 179 | 55D7CDC91CCFB2ED00E3E830 /* NSObject+KeyValues.m */, 180 | ); 181 | name = "字典与模型互转"; 182 | sourceTree = ""; 183 | }; 184 | 55D7CDD91CCFC16300E3E830 /* 自动归档 */ = { 185 | isa = PBXGroup; 186 | children = ( 187 | 55D7CDCB1CCFB9A000E3E830 /* TestModel.h */, 188 | 55D7CDCC1CCFB9A000E3E830 /* TestModel.m */, 189 | ); 190 | name = "自动归档"; 191 | sourceTree = ""; 192 | }; 193 | 55D7CDDA1CCFC17B00E3E830 /* 动态方法解析 */ = { 194 | isa = PBXGroup; 195 | children = ( 196 | 55D7CDCE1CCFBB4100E3E830 /* Monkey.h */, 197 | 55D7CDCF1CCFBB4100E3E830 /* Monkey.m */, 198 | 55D7CDD11CCFBB4900E3E830 /* Bird.h */, 199 | 55D7CDD21CCFBB4900E3E830 /* Bird.m */, 200 | ); 201 | name = "动态方法解析"; 202 | sourceTree = ""; 203 | }; 204 | 55D7CDDB1CCFC18F00E3E830 /* objc_msgSend使用 */ = { 205 | isa = PBXGroup; 206 | children = ( 207 | 55D7CDD41CCFBEB800E3E830 /* TestClass.h */, 208 | 55D7CDD51CCFBEB800E3E830 /* TestClass.m */, 209 | ); 210 | name = "objc_msgSend使用"; 211 | sourceTree = ""; 212 | }; 213 | /* End PBXGroup section */ 214 | 215 | /* Begin PBXNativeTarget section */ 216 | 55D7CD8E1CCFB04400E3E830 /* RuntimeLearn */ = { 217 | isa = PBXNativeTarget; 218 | buildConfigurationList = 55D7CDBC1CCFB04400E3E830 /* Build configuration list for PBXNativeTarget "RuntimeLearn" */; 219 | buildPhases = ( 220 | 55D7CD8B1CCFB04400E3E830 /* Sources */, 221 | 55D7CD8C1CCFB04400E3E830 /* Frameworks */, 222 | 55D7CD8D1CCFB04400E3E830 /* Resources */, 223 | ); 224 | buildRules = ( 225 | ); 226 | dependencies = ( 227 | ); 228 | name = RuntimeLearn; 229 | productName = RuntimeLearn; 230 | productReference = 55D7CD8F1CCFB04400E3E830 /* RuntimeLearn.app */; 231 | productType = "com.apple.product-type.application"; 232 | }; 233 | 55D7CDA71CCFB04400E3E830 /* RuntimeLearnTests */ = { 234 | isa = PBXNativeTarget; 235 | buildConfigurationList = 55D7CDBF1CCFB04400E3E830 /* Build configuration list for PBXNativeTarget "RuntimeLearnTests" */; 236 | buildPhases = ( 237 | 55D7CDA41CCFB04400E3E830 /* Sources */, 238 | 55D7CDA51CCFB04400E3E830 /* Frameworks */, 239 | 55D7CDA61CCFB04400E3E830 /* Resources */, 240 | ); 241 | buildRules = ( 242 | ); 243 | dependencies = ( 244 | 55D7CDAA1CCFB04400E3E830 /* PBXTargetDependency */, 245 | ); 246 | name = RuntimeLearnTests; 247 | productName = RuntimeLearnTests; 248 | productReference = 55D7CDA81CCFB04400E3E830 /* RuntimeLearnTests.xctest */; 249 | productType = "com.apple.product-type.bundle.unit-test"; 250 | }; 251 | 55D7CDB21CCFB04400E3E830 /* RuntimeLearnUITests */ = { 252 | isa = PBXNativeTarget; 253 | buildConfigurationList = 55D7CDC21CCFB04400E3E830 /* Build configuration list for PBXNativeTarget "RuntimeLearnUITests" */; 254 | buildPhases = ( 255 | 55D7CDAF1CCFB04400E3E830 /* Sources */, 256 | 55D7CDB01CCFB04400E3E830 /* Frameworks */, 257 | 55D7CDB11CCFB04400E3E830 /* Resources */, 258 | ); 259 | buildRules = ( 260 | ); 261 | dependencies = ( 262 | 55D7CDB51CCFB04400E3E830 /* PBXTargetDependency */, 263 | ); 264 | name = RuntimeLearnUITests; 265 | productName = RuntimeLearnUITests; 266 | productReference = 55D7CDB31CCFB04400E3E830 /* RuntimeLearnUITests.xctest */; 267 | productType = "com.apple.product-type.bundle.ui-testing"; 268 | }; 269 | /* End PBXNativeTarget section */ 270 | 271 | /* Begin PBXProject section */ 272 | 55D7CD871CCFB04400E3E830 /* Project object */ = { 273 | isa = PBXProject; 274 | attributes = { 275 | LastUpgradeCheck = 0730; 276 | ORGANIZATIONNAME = MIMO; 277 | TargetAttributes = { 278 | 55D7CD8E1CCFB04400E3E830 = { 279 | CreatedOnToolsVersion = 7.3; 280 | }; 281 | 55D7CDA71CCFB04400E3E830 = { 282 | CreatedOnToolsVersion = 7.3; 283 | TestTargetID = 55D7CD8E1CCFB04400E3E830; 284 | }; 285 | 55D7CDB21CCFB04400E3E830 = { 286 | CreatedOnToolsVersion = 7.3; 287 | TestTargetID = 55D7CD8E1CCFB04400E3E830; 288 | }; 289 | }; 290 | }; 291 | buildConfigurationList = 55D7CD8A1CCFB04400E3E830 /* Build configuration list for PBXProject "RuntimeLearn" */; 292 | compatibilityVersion = "Xcode 3.2"; 293 | developmentRegion = English; 294 | hasScannedForEncodings = 0; 295 | knownRegions = ( 296 | en, 297 | Base, 298 | ); 299 | mainGroup = 55D7CD861CCFB04400E3E830; 300 | productRefGroup = 55D7CD901CCFB04400E3E830 /* Products */; 301 | projectDirPath = ""; 302 | projectRoot = ""; 303 | targets = ( 304 | 55D7CD8E1CCFB04400E3E830 /* RuntimeLearn */, 305 | 55D7CDA71CCFB04400E3E830 /* RuntimeLearnTests */, 306 | 55D7CDB21CCFB04400E3E830 /* RuntimeLearnUITests */, 307 | ); 308 | }; 309 | /* End PBXProject section */ 310 | 311 | /* Begin PBXResourcesBuildPhase section */ 312 | 55D7CD8D1CCFB04400E3E830 /* Resources */ = { 313 | isa = PBXResourcesBuildPhase; 314 | buildActionMask = 2147483647; 315 | files = ( 316 | 55D7CDA21CCFB04400E3E830 /* LaunchScreen.storyboard in Resources */, 317 | 55D7CD9F1CCFB04400E3E830 /* Assets.xcassets in Resources */, 318 | 55D7CD9D1CCFB04400E3E830 /* Main.storyboard in Resources */, 319 | ); 320 | runOnlyForDeploymentPostprocessing = 0; 321 | }; 322 | 55D7CDA61CCFB04400E3E830 /* Resources */ = { 323 | isa = PBXResourcesBuildPhase; 324 | buildActionMask = 2147483647; 325 | files = ( 326 | ); 327 | runOnlyForDeploymentPostprocessing = 0; 328 | }; 329 | 55D7CDB11CCFB04400E3E830 /* Resources */ = { 330 | isa = PBXResourcesBuildPhase; 331 | buildActionMask = 2147483647; 332 | files = ( 333 | ); 334 | runOnlyForDeploymentPostprocessing = 0; 335 | }; 336 | /* End PBXResourcesBuildPhase section */ 337 | 338 | /* Begin PBXSourcesBuildPhase section */ 339 | 55D7CD8B1CCFB04400E3E830 /* Sources */ = { 340 | isa = PBXSourcesBuildPhase; 341 | buildActionMask = 2147483647; 342 | files = ( 343 | 55D7CD9A1CCFB04400E3E830 /* ViewController.m in Sources */, 344 | 55D7CD971CCFB04400E3E830 /* AppDelegate.m in Sources */, 345 | 55D7CDD31CCFBB4900E3E830 /* Bird.m in Sources */, 346 | 55D7CDD61CCFBEB800E3E830 /* TestClass.m in Sources */, 347 | 55D7CDC71CCFB0FC00E3E830 /* UIButton+ClickBlock.m in Sources */, 348 | 55D7CDD01CCFBB4100E3E830 /* Monkey.m in Sources */, 349 | 55D7CDCD1CCFB9A000E3E830 /* TestModel.m in Sources */, 350 | 55D7CDCA1CCFB2ED00E3E830 /* NSObject+KeyValues.m in Sources */, 351 | 55D7CD941CCFB04400E3E830 /* main.m in Sources */, 352 | ); 353 | runOnlyForDeploymentPostprocessing = 0; 354 | }; 355 | 55D7CDA41CCFB04400E3E830 /* Sources */ = { 356 | isa = PBXSourcesBuildPhase; 357 | buildActionMask = 2147483647; 358 | files = ( 359 | 55D7CDAD1CCFB04400E3E830 /* RuntimeLearnTests.m in Sources */, 360 | ); 361 | runOnlyForDeploymentPostprocessing = 0; 362 | }; 363 | 55D7CDAF1CCFB04400E3E830 /* Sources */ = { 364 | isa = PBXSourcesBuildPhase; 365 | buildActionMask = 2147483647; 366 | files = ( 367 | 55D7CDB81CCFB04400E3E830 /* RuntimeLearnUITests.m in Sources */, 368 | ); 369 | runOnlyForDeploymentPostprocessing = 0; 370 | }; 371 | /* End PBXSourcesBuildPhase section */ 372 | 373 | /* Begin PBXTargetDependency section */ 374 | 55D7CDAA1CCFB04400E3E830 /* PBXTargetDependency */ = { 375 | isa = PBXTargetDependency; 376 | target = 55D7CD8E1CCFB04400E3E830 /* RuntimeLearn */; 377 | targetProxy = 55D7CDA91CCFB04400E3E830 /* PBXContainerItemProxy */; 378 | }; 379 | 55D7CDB51CCFB04400E3E830 /* PBXTargetDependency */ = { 380 | isa = PBXTargetDependency; 381 | target = 55D7CD8E1CCFB04400E3E830 /* RuntimeLearn */; 382 | targetProxy = 55D7CDB41CCFB04400E3E830 /* PBXContainerItemProxy */; 383 | }; 384 | /* End PBXTargetDependency section */ 385 | 386 | /* Begin PBXVariantGroup section */ 387 | 55D7CD9B1CCFB04400E3E830 /* Main.storyboard */ = { 388 | isa = PBXVariantGroup; 389 | children = ( 390 | 55D7CD9C1CCFB04400E3E830 /* Base */, 391 | ); 392 | name = Main.storyboard; 393 | sourceTree = ""; 394 | }; 395 | 55D7CDA01CCFB04400E3E830 /* LaunchScreen.storyboard */ = { 396 | isa = PBXVariantGroup; 397 | children = ( 398 | 55D7CDA11CCFB04400E3E830 /* Base */, 399 | ); 400 | name = LaunchScreen.storyboard; 401 | sourceTree = ""; 402 | }; 403 | /* End PBXVariantGroup section */ 404 | 405 | /* Begin XCBuildConfiguration section */ 406 | 55D7CDBA1CCFB04400E3E830 /* Debug */ = { 407 | isa = XCBuildConfiguration; 408 | buildSettings = { 409 | ALWAYS_SEARCH_USER_PATHS = NO; 410 | CLANG_ANALYZER_NONNULL = YES; 411 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 412 | CLANG_CXX_LIBRARY = "libc++"; 413 | CLANG_ENABLE_MODULES = YES; 414 | CLANG_ENABLE_OBJC_ARC = YES; 415 | CLANG_WARN_BOOL_CONVERSION = YES; 416 | CLANG_WARN_CONSTANT_CONVERSION = YES; 417 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 418 | CLANG_WARN_EMPTY_BODY = YES; 419 | CLANG_WARN_ENUM_CONVERSION = YES; 420 | CLANG_WARN_INT_CONVERSION = YES; 421 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 422 | CLANG_WARN_UNREACHABLE_CODE = YES; 423 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 424 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 425 | COPY_PHASE_STRIP = NO; 426 | DEBUG_INFORMATION_FORMAT = dwarf; 427 | ENABLE_STRICT_OBJC_MSGSEND = YES; 428 | ENABLE_TESTABILITY = YES; 429 | GCC_C_LANGUAGE_STANDARD = gnu99; 430 | GCC_DYNAMIC_NO_PIC = NO; 431 | GCC_NO_COMMON_BLOCKS = YES; 432 | GCC_OPTIMIZATION_LEVEL = 0; 433 | GCC_PREPROCESSOR_DEFINITIONS = ( 434 | "DEBUG=1", 435 | "$(inherited)", 436 | ); 437 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 438 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 439 | GCC_WARN_UNDECLARED_SELECTOR = YES; 440 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 441 | GCC_WARN_UNUSED_FUNCTION = YES; 442 | GCC_WARN_UNUSED_VARIABLE = YES; 443 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 444 | MTL_ENABLE_DEBUG_INFO = YES; 445 | ONLY_ACTIVE_ARCH = YES; 446 | SDKROOT = iphoneos; 447 | }; 448 | name = Debug; 449 | }; 450 | 55D7CDBB1CCFB04400E3E830 /* Release */ = { 451 | isa = XCBuildConfiguration; 452 | buildSettings = { 453 | ALWAYS_SEARCH_USER_PATHS = NO; 454 | CLANG_ANALYZER_NONNULL = YES; 455 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 456 | CLANG_CXX_LIBRARY = "libc++"; 457 | CLANG_ENABLE_MODULES = YES; 458 | CLANG_ENABLE_OBJC_ARC = YES; 459 | CLANG_WARN_BOOL_CONVERSION = YES; 460 | CLANG_WARN_CONSTANT_CONVERSION = YES; 461 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 462 | CLANG_WARN_EMPTY_BODY = YES; 463 | CLANG_WARN_ENUM_CONVERSION = YES; 464 | CLANG_WARN_INT_CONVERSION = YES; 465 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 466 | CLANG_WARN_UNREACHABLE_CODE = YES; 467 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 468 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 469 | COPY_PHASE_STRIP = NO; 470 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 471 | ENABLE_NS_ASSERTIONS = NO; 472 | ENABLE_STRICT_OBJC_MSGSEND = YES; 473 | GCC_C_LANGUAGE_STANDARD = gnu99; 474 | GCC_NO_COMMON_BLOCKS = YES; 475 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 476 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 477 | GCC_WARN_UNDECLARED_SELECTOR = YES; 478 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 479 | GCC_WARN_UNUSED_FUNCTION = YES; 480 | GCC_WARN_UNUSED_VARIABLE = YES; 481 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 482 | MTL_ENABLE_DEBUG_INFO = NO; 483 | SDKROOT = iphoneos; 484 | VALIDATE_PRODUCT = YES; 485 | }; 486 | name = Release; 487 | }; 488 | 55D7CDBD1CCFB04400E3E830 /* Debug */ = { 489 | isa = XCBuildConfiguration; 490 | buildSettings = { 491 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 492 | INFOPLIST_FILE = RuntimeLearn/Info.plist; 493 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 494 | PRODUCT_BUNDLE_IDENTIFIER = com.mimo520.www.RuntimeLearn; 495 | PRODUCT_NAME = "$(TARGET_NAME)"; 496 | }; 497 | name = Debug; 498 | }; 499 | 55D7CDBE1CCFB04400E3E830 /* Release */ = { 500 | isa = XCBuildConfiguration; 501 | buildSettings = { 502 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 503 | INFOPLIST_FILE = RuntimeLearn/Info.plist; 504 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 505 | PRODUCT_BUNDLE_IDENTIFIER = com.mimo520.www.RuntimeLearn; 506 | PRODUCT_NAME = "$(TARGET_NAME)"; 507 | }; 508 | name = Release; 509 | }; 510 | 55D7CDC01CCFB04400E3E830 /* Debug */ = { 511 | isa = XCBuildConfiguration; 512 | buildSettings = { 513 | BUNDLE_LOADER = "$(TEST_HOST)"; 514 | INFOPLIST_FILE = RuntimeLearnTests/Info.plist; 515 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 516 | PRODUCT_BUNDLE_IDENTIFIER = com.mimo520.www.RuntimeLearnTests; 517 | PRODUCT_NAME = "$(TARGET_NAME)"; 518 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RuntimeLearn.app/RuntimeLearn"; 519 | }; 520 | name = Debug; 521 | }; 522 | 55D7CDC11CCFB04400E3E830 /* Release */ = { 523 | isa = XCBuildConfiguration; 524 | buildSettings = { 525 | BUNDLE_LOADER = "$(TEST_HOST)"; 526 | INFOPLIST_FILE = RuntimeLearnTests/Info.plist; 527 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 528 | PRODUCT_BUNDLE_IDENTIFIER = com.mimo520.www.RuntimeLearnTests; 529 | PRODUCT_NAME = "$(TARGET_NAME)"; 530 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RuntimeLearn.app/RuntimeLearn"; 531 | }; 532 | name = Release; 533 | }; 534 | 55D7CDC31CCFB04400E3E830 /* Debug */ = { 535 | isa = XCBuildConfiguration; 536 | buildSettings = { 537 | INFOPLIST_FILE = RuntimeLearnUITests/Info.plist; 538 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 539 | PRODUCT_BUNDLE_IDENTIFIER = com.mimo520.www.RuntimeLearnUITests; 540 | PRODUCT_NAME = "$(TARGET_NAME)"; 541 | TEST_TARGET_NAME = RuntimeLearn; 542 | }; 543 | name = Debug; 544 | }; 545 | 55D7CDC41CCFB04400E3E830 /* Release */ = { 546 | isa = XCBuildConfiguration; 547 | buildSettings = { 548 | INFOPLIST_FILE = RuntimeLearnUITests/Info.plist; 549 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 550 | PRODUCT_BUNDLE_IDENTIFIER = com.mimo520.www.RuntimeLearnUITests; 551 | PRODUCT_NAME = "$(TARGET_NAME)"; 552 | TEST_TARGET_NAME = RuntimeLearn; 553 | }; 554 | name = Release; 555 | }; 556 | /* End XCBuildConfiguration section */ 557 | 558 | /* Begin XCConfigurationList section */ 559 | 55D7CD8A1CCFB04400E3E830 /* Build configuration list for PBXProject "RuntimeLearn" */ = { 560 | isa = XCConfigurationList; 561 | buildConfigurations = ( 562 | 55D7CDBA1CCFB04400E3E830 /* Debug */, 563 | 55D7CDBB1CCFB04400E3E830 /* Release */, 564 | ); 565 | defaultConfigurationIsVisible = 0; 566 | defaultConfigurationName = Release; 567 | }; 568 | 55D7CDBC1CCFB04400E3E830 /* Build configuration list for PBXNativeTarget "RuntimeLearn" */ = { 569 | isa = XCConfigurationList; 570 | buildConfigurations = ( 571 | 55D7CDBD1CCFB04400E3E830 /* Debug */, 572 | 55D7CDBE1CCFB04400E3E830 /* Release */, 573 | ); 574 | defaultConfigurationIsVisible = 0; 575 | }; 576 | 55D7CDBF1CCFB04400E3E830 /* Build configuration list for PBXNativeTarget "RuntimeLearnTests" */ = { 577 | isa = XCConfigurationList; 578 | buildConfigurations = ( 579 | 55D7CDC01CCFB04400E3E830 /* Debug */, 580 | 55D7CDC11CCFB04400E3E830 /* Release */, 581 | ); 582 | defaultConfigurationIsVisible = 0; 583 | }; 584 | 55D7CDC21CCFB04400E3E830 /* Build configuration list for PBXNativeTarget "RuntimeLearnUITests" */ = { 585 | isa = XCConfigurationList; 586 | buildConfigurations = ( 587 | 55D7CDC31CCFB04400E3E830 /* Debug */, 588 | 55D7CDC41CCFB04400E3E830 /* Release */, 589 | ); 590 | defaultConfigurationIsVisible = 0; 591 | }; 592 | /* End XCConfigurationList section */ 593 | }; 594 | rootObject = 55D7CD871CCFB04400E3E830 /* Project object */; 595 | } 596 | --------------------------------------------------------------------------------