├── README.md ├── _objc_msgForward_demo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── _objc_msgForward_demo.xccheckout │ └── xcuserdata │ │ └── yemingyu.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── yemingyu.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── _objc_msgForward_demo.xcscheme │ └── xcschememanagement.plist ├── _objc_msgForward_demo ├── Animals.h ├── Animals.m ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── ForwardingTarget.h ├── ForwardingTarget.m ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── Monkey.h ├── Monkey.m ├── ViewController.h ├── ViewController.m └── main.m └── _objc_msgForward_demoTests ├── Info.plist └── _objc_msgForward_demoTests.m /README.md: -------------------------------------------------------------------------------- 1 | # _objc_msgForward_demo用来测试消息转发机制 2 | 3 | 4 | # 对象查找selector时,先查找cachelist,如果没有则查找methodlist,如果还没有就查找父类的methodlist 5 | 6 | # 都没有是还有三次机会可以处理这次selector访问 7 | # 1. + (BOOL)resolveInstanceMethod:(SEL)sel; 在此方法中添加相应selector以及IMP即可 8 | # 2. - (id)forwardingTargetForSelector:(SEL)aSelector 在此方法中可以指定处理的对象,在该对象中实现selector即可 9 | # 3. - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector; - (void)forwardInvocation:(NSInvocation *)anInvocation; 在第一个方法中reture signal,这样runtime就会产生一个NSInvocation给第二个方法,anInvocation中有target和selector,可以修改,然后让target进行调用,不调用也可以,只是什么都不发生 10 | 11 | # 如果以上三次机会都不把握,则会调用- (void)doesNotRecognizeSelector:(SEL)aSelector; 默认的实现是抛出异常 12 | -------------------------------------------------------------------------------- /_objc_msgForward_demo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D632A49E1BCB734C001353B2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D632A49D1BCB734C001353B2 /* main.m */; }; 11 | D632A4A11BCB734C001353B2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D632A4A01BCB734C001353B2 /* AppDelegate.m */; }; 12 | D632A4A41BCB734C001353B2 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D632A4A31BCB734C001353B2 /* ViewController.m */; }; 13 | D632A4A71BCB734C001353B2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D632A4A51BCB734C001353B2 /* Main.storyboard */; }; 14 | D632A4A91BCB734C001353B2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D632A4A81BCB734C001353B2 /* Images.xcassets */; }; 15 | D632A4AC1BCB734C001353B2 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = D632A4AA1BCB734C001353B2 /* LaunchScreen.xib */; }; 16 | D632A4B81BCB734C001353B2 /* _objc_msgForward_demoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D632A4B71BCB734C001353B2 /* _objc_msgForward_demoTests.m */; }; 17 | D632A4C31BCB736D001353B2 /* ForwardingTarget.m in Sources */ = {isa = PBXBuildFile; fileRef = D632A4C21BCB736D001353B2 /* ForwardingTarget.m */; }; 18 | D632A4C61BCB7378001353B2 /* Monkey.m in Sources */ = {isa = PBXBuildFile; fileRef = D632A4C51BCB7378001353B2 /* Monkey.m */; }; 19 | D632A4C91BCB7A0D001353B2 /* Animals.m in Sources */ = {isa = PBXBuildFile; fileRef = D632A4C81BCB7A0D001353B2 /* Animals.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | D632A4B21BCB734C001353B2 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = D632A4901BCB734C001353B2 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = D632A4971BCB734C001353B2; 28 | remoteInfo = _objc_msgForward_demo; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | D632A4981BCB734C001353B2 /* _objc_msgForward_demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = _objc_msgForward_demo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | D632A49C1BCB734C001353B2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | D632A49D1BCB734C001353B2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | D632A49F1BCB734C001353B2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | D632A4A01BCB734C001353B2 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | D632A4A21BCB734C001353B2 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 39 | D632A4A31BCB734C001353B2 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 40 | D632A4A61BCB734C001353B2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | D632A4A81BCB734C001353B2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 42 | D632A4AB1BCB734C001353B2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 43 | D632A4B11BCB734C001353B2 /* _objc_msgForward_demoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = _objc_msgForward_demoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | D632A4B61BCB734C001353B2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | D632A4B71BCB734C001353B2 /* _objc_msgForward_demoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = _objc_msgForward_demoTests.m; sourceTree = ""; }; 46 | D632A4C11BCB736D001353B2 /* ForwardingTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ForwardingTarget.h; sourceTree = ""; }; 47 | D632A4C21BCB736D001353B2 /* ForwardingTarget.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ForwardingTarget.m; sourceTree = ""; }; 48 | D632A4C41BCB7378001353B2 /* Monkey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Monkey.h; sourceTree = ""; }; 49 | D632A4C51BCB7378001353B2 /* Monkey.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Monkey.m; sourceTree = ""; }; 50 | D632A4C71BCB7A0D001353B2 /* Animals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Animals.h; sourceTree = ""; }; 51 | D632A4C81BCB7A0D001353B2 /* Animals.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Animals.m; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | D632A4951BCB734C001353B2 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | D632A4AE1BCB734C001353B2 /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | /* End PBXFrameworksBuildPhase section */ 70 | 71 | /* Begin PBXGroup section */ 72 | D632A48F1BCB734C001353B2 = { 73 | isa = PBXGroup; 74 | children = ( 75 | D632A49A1BCB734C001353B2 /* _objc_msgForward_demo */, 76 | D632A4B41BCB734C001353B2 /* _objc_msgForward_demoTests */, 77 | D632A4991BCB734C001353B2 /* Products */, 78 | ); 79 | sourceTree = ""; 80 | }; 81 | D632A4991BCB734C001353B2 /* Products */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | D632A4981BCB734C001353B2 /* _objc_msgForward_demo.app */, 85 | D632A4B11BCB734C001353B2 /* _objc_msgForward_demoTests.xctest */, 86 | ); 87 | name = Products; 88 | sourceTree = ""; 89 | }; 90 | D632A49A1BCB734C001353B2 /* _objc_msgForward_demo */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | D632A4C71BCB7A0D001353B2 /* Animals.h */, 94 | D632A4C81BCB7A0D001353B2 /* Animals.m */, 95 | D632A4C41BCB7378001353B2 /* Monkey.h */, 96 | D632A4C51BCB7378001353B2 /* Monkey.m */, 97 | D632A4C11BCB736D001353B2 /* ForwardingTarget.h */, 98 | D632A4C21BCB736D001353B2 /* ForwardingTarget.m */, 99 | D632A49F1BCB734C001353B2 /* AppDelegate.h */, 100 | D632A4A01BCB734C001353B2 /* AppDelegate.m */, 101 | D632A4A21BCB734C001353B2 /* ViewController.h */, 102 | D632A4A31BCB734C001353B2 /* ViewController.m */, 103 | D632A4A51BCB734C001353B2 /* Main.storyboard */, 104 | D632A4A81BCB734C001353B2 /* Images.xcassets */, 105 | D632A4AA1BCB734C001353B2 /* LaunchScreen.xib */, 106 | D632A49B1BCB734C001353B2 /* Supporting Files */, 107 | ); 108 | path = _objc_msgForward_demo; 109 | sourceTree = ""; 110 | }; 111 | D632A49B1BCB734C001353B2 /* Supporting Files */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | D632A49C1BCB734C001353B2 /* Info.plist */, 115 | D632A49D1BCB734C001353B2 /* main.m */, 116 | ); 117 | name = "Supporting Files"; 118 | sourceTree = ""; 119 | }; 120 | D632A4B41BCB734C001353B2 /* _objc_msgForward_demoTests */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | D632A4B71BCB734C001353B2 /* _objc_msgForward_demoTests.m */, 124 | D632A4B51BCB734C001353B2 /* Supporting Files */, 125 | ); 126 | path = _objc_msgForward_demoTests; 127 | sourceTree = ""; 128 | }; 129 | D632A4B51BCB734C001353B2 /* Supporting Files */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | D632A4B61BCB734C001353B2 /* Info.plist */, 133 | ); 134 | name = "Supporting Files"; 135 | sourceTree = ""; 136 | }; 137 | /* End PBXGroup section */ 138 | 139 | /* Begin PBXNativeTarget section */ 140 | D632A4971BCB734C001353B2 /* _objc_msgForward_demo */ = { 141 | isa = PBXNativeTarget; 142 | buildConfigurationList = D632A4BB1BCB734C001353B2 /* Build configuration list for PBXNativeTarget "_objc_msgForward_demo" */; 143 | buildPhases = ( 144 | D632A4941BCB734C001353B2 /* Sources */, 145 | D632A4951BCB734C001353B2 /* Frameworks */, 146 | D632A4961BCB734C001353B2 /* Resources */, 147 | ); 148 | buildRules = ( 149 | ); 150 | dependencies = ( 151 | ); 152 | name = _objc_msgForward_demo; 153 | productName = _objc_msgForward_demo; 154 | productReference = D632A4981BCB734C001353B2 /* _objc_msgForward_demo.app */; 155 | productType = "com.apple.product-type.application"; 156 | }; 157 | D632A4B01BCB734C001353B2 /* _objc_msgForward_demoTests */ = { 158 | isa = PBXNativeTarget; 159 | buildConfigurationList = D632A4BE1BCB734C001353B2 /* Build configuration list for PBXNativeTarget "_objc_msgForward_demoTests" */; 160 | buildPhases = ( 161 | D632A4AD1BCB734C001353B2 /* Sources */, 162 | D632A4AE1BCB734C001353B2 /* Frameworks */, 163 | D632A4AF1BCB734C001353B2 /* Resources */, 164 | ); 165 | buildRules = ( 166 | ); 167 | dependencies = ( 168 | D632A4B31BCB734C001353B2 /* PBXTargetDependency */, 169 | ); 170 | name = _objc_msgForward_demoTests; 171 | productName = _objc_msgForward_demoTests; 172 | productReference = D632A4B11BCB734C001353B2 /* _objc_msgForward_demoTests.xctest */; 173 | productType = "com.apple.product-type.bundle.unit-test"; 174 | }; 175 | /* End PBXNativeTarget section */ 176 | 177 | /* Begin PBXProject section */ 178 | D632A4901BCB734C001353B2 /* Project object */ = { 179 | isa = PBXProject; 180 | attributes = { 181 | LastUpgradeCheck = 0640; 182 | ORGANIZATIONNAME = yemingyu; 183 | TargetAttributes = { 184 | D632A4971BCB734C001353B2 = { 185 | CreatedOnToolsVersion = 6.4; 186 | }; 187 | D632A4B01BCB734C001353B2 = { 188 | CreatedOnToolsVersion = 6.4; 189 | TestTargetID = D632A4971BCB734C001353B2; 190 | }; 191 | }; 192 | }; 193 | buildConfigurationList = D632A4931BCB734C001353B2 /* Build configuration list for PBXProject "_objc_msgForward_demo" */; 194 | compatibilityVersion = "Xcode 3.2"; 195 | developmentRegion = English; 196 | hasScannedForEncodings = 0; 197 | knownRegions = ( 198 | en, 199 | Base, 200 | ); 201 | mainGroup = D632A48F1BCB734C001353B2; 202 | productRefGroup = D632A4991BCB734C001353B2 /* Products */; 203 | projectDirPath = ""; 204 | projectRoot = ""; 205 | targets = ( 206 | D632A4971BCB734C001353B2 /* _objc_msgForward_demo */, 207 | D632A4B01BCB734C001353B2 /* _objc_msgForward_demoTests */, 208 | ); 209 | }; 210 | /* End PBXProject section */ 211 | 212 | /* Begin PBXResourcesBuildPhase section */ 213 | D632A4961BCB734C001353B2 /* Resources */ = { 214 | isa = PBXResourcesBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | D632A4A71BCB734C001353B2 /* Main.storyboard in Resources */, 218 | D632A4AC1BCB734C001353B2 /* LaunchScreen.xib in Resources */, 219 | D632A4A91BCB734C001353B2 /* Images.xcassets in Resources */, 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | }; 223 | D632A4AF1BCB734C001353B2 /* Resources */ = { 224 | isa = PBXResourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | ); 228 | runOnlyForDeploymentPostprocessing = 0; 229 | }; 230 | /* End PBXResourcesBuildPhase section */ 231 | 232 | /* Begin PBXSourcesBuildPhase section */ 233 | D632A4941BCB734C001353B2 /* Sources */ = { 234 | isa = PBXSourcesBuildPhase; 235 | buildActionMask = 2147483647; 236 | files = ( 237 | D632A4C61BCB7378001353B2 /* Monkey.m in Sources */, 238 | D632A4A41BCB734C001353B2 /* ViewController.m in Sources */, 239 | D632A4A11BCB734C001353B2 /* AppDelegate.m in Sources */, 240 | D632A4C91BCB7A0D001353B2 /* Animals.m in Sources */, 241 | D632A49E1BCB734C001353B2 /* main.m in Sources */, 242 | D632A4C31BCB736D001353B2 /* ForwardingTarget.m in Sources */, 243 | ); 244 | runOnlyForDeploymentPostprocessing = 0; 245 | }; 246 | D632A4AD1BCB734C001353B2 /* Sources */ = { 247 | isa = PBXSourcesBuildPhase; 248 | buildActionMask = 2147483647; 249 | files = ( 250 | D632A4B81BCB734C001353B2 /* _objc_msgForward_demoTests.m in Sources */, 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | /* End PBXSourcesBuildPhase section */ 255 | 256 | /* Begin PBXTargetDependency section */ 257 | D632A4B31BCB734C001353B2 /* PBXTargetDependency */ = { 258 | isa = PBXTargetDependency; 259 | target = D632A4971BCB734C001353B2 /* _objc_msgForward_demo */; 260 | targetProxy = D632A4B21BCB734C001353B2 /* PBXContainerItemProxy */; 261 | }; 262 | /* End PBXTargetDependency section */ 263 | 264 | /* Begin PBXVariantGroup section */ 265 | D632A4A51BCB734C001353B2 /* Main.storyboard */ = { 266 | isa = PBXVariantGroup; 267 | children = ( 268 | D632A4A61BCB734C001353B2 /* Base */, 269 | ); 270 | name = Main.storyboard; 271 | sourceTree = ""; 272 | }; 273 | D632A4AA1BCB734C001353B2 /* LaunchScreen.xib */ = { 274 | isa = PBXVariantGroup; 275 | children = ( 276 | D632A4AB1BCB734C001353B2 /* Base */, 277 | ); 278 | name = LaunchScreen.xib; 279 | sourceTree = ""; 280 | }; 281 | /* End PBXVariantGroup section */ 282 | 283 | /* Begin XCBuildConfiguration section */ 284 | D632A4B91BCB734C001353B2 /* Debug */ = { 285 | isa = XCBuildConfiguration; 286 | buildSettings = { 287 | ALWAYS_SEARCH_USER_PATHS = NO; 288 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 289 | CLANG_CXX_LIBRARY = "libc++"; 290 | CLANG_ENABLE_MODULES = YES; 291 | CLANG_ENABLE_OBJC_ARC = YES; 292 | CLANG_WARN_BOOL_CONVERSION = YES; 293 | CLANG_WARN_CONSTANT_CONVERSION = YES; 294 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 295 | CLANG_WARN_EMPTY_BODY = YES; 296 | CLANG_WARN_ENUM_CONVERSION = YES; 297 | CLANG_WARN_INT_CONVERSION = YES; 298 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 299 | CLANG_WARN_UNREACHABLE_CODE = YES; 300 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 301 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 302 | COPY_PHASE_STRIP = NO; 303 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 304 | ENABLE_STRICT_OBJC_MSGSEND = YES; 305 | GCC_C_LANGUAGE_STANDARD = gnu99; 306 | GCC_DYNAMIC_NO_PIC = NO; 307 | GCC_NO_COMMON_BLOCKS = YES; 308 | GCC_OPTIMIZATION_LEVEL = 0; 309 | GCC_PREPROCESSOR_DEFINITIONS = ( 310 | "DEBUG=1", 311 | "$(inherited)", 312 | ); 313 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 314 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 315 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 316 | GCC_WARN_UNDECLARED_SELECTOR = YES; 317 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 318 | GCC_WARN_UNUSED_FUNCTION = YES; 319 | GCC_WARN_UNUSED_VARIABLE = YES; 320 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 321 | MTL_ENABLE_DEBUG_INFO = YES; 322 | ONLY_ACTIVE_ARCH = YES; 323 | SDKROOT = iphoneos; 324 | TARGETED_DEVICE_FAMILY = "1,2"; 325 | }; 326 | name = Debug; 327 | }; 328 | D632A4BA1BCB734C001353B2 /* Release */ = { 329 | isa = XCBuildConfiguration; 330 | buildSettings = { 331 | ALWAYS_SEARCH_USER_PATHS = NO; 332 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 333 | CLANG_CXX_LIBRARY = "libc++"; 334 | CLANG_ENABLE_MODULES = YES; 335 | CLANG_ENABLE_OBJC_ARC = YES; 336 | CLANG_WARN_BOOL_CONVERSION = YES; 337 | CLANG_WARN_CONSTANT_CONVERSION = YES; 338 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 339 | CLANG_WARN_EMPTY_BODY = YES; 340 | CLANG_WARN_ENUM_CONVERSION = YES; 341 | CLANG_WARN_INT_CONVERSION = YES; 342 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 343 | CLANG_WARN_UNREACHABLE_CODE = YES; 344 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 345 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 346 | COPY_PHASE_STRIP = NO; 347 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 348 | ENABLE_NS_ASSERTIONS = NO; 349 | ENABLE_STRICT_OBJC_MSGSEND = YES; 350 | GCC_C_LANGUAGE_STANDARD = gnu99; 351 | GCC_NO_COMMON_BLOCKS = YES; 352 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 353 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 354 | GCC_WARN_UNDECLARED_SELECTOR = YES; 355 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 356 | GCC_WARN_UNUSED_FUNCTION = YES; 357 | GCC_WARN_UNUSED_VARIABLE = YES; 358 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 359 | MTL_ENABLE_DEBUG_INFO = NO; 360 | SDKROOT = iphoneos; 361 | TARGETED_DEVICE_FAMILY = "1,2"; 362 | VALIDATE_PRODUCT = YES; 363 | }; 364 | name = Release; 365 | }; 366 | D632A4BC1BCB734C001353B2 /* Debug */ = { 367 | isa = XCBuildConfiguration; 368 | buildSettings = { 369 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 370 | INFOPLIST_FILE = _objc_msgForward_demo/Info.plist; 371 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 372 | PRODUCT_NAME = "$(TARGET_NAME)"; 373 | }; 374 | name = Debug; 375 | }; 376 | D632A4BD1BCB734C001353B2 /* Release */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 380 | INFOPLIST_FILE = _objc_msgForward_demo/Info.plist; 381 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 382 | PRODUCT_NAME = "$(TARGET_NAME)"; 383 | }; 384 | name = Release; 385 | }; 386 | D632A4BF1BCB734C001353B2 /* Debug */ = { 387 | isa = XCBuildConfiguration; 388 | buildSettings = { 389 | BUNDLE_LOADER = "$(TEST_HOST)"; 390 | FRAMEWORK_SEARCH_PATHS = ( 391 | "$(SDKROOT)/Developer/Library/Frameworks", 392 | "$(inherited)", 393 | ); 394 | GCC_PREPROCESSOR_DEFINITIONS = ( 395 | "DEBUG=1", 396 | "$(inherited)", 397 | ); 398 | INFOPLIST_FILE = _objc_msgForward_demoTests/Info.plist; 399 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 400 | PRODUCT_NAME = "$(TARGET_NAME)"; 401 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/_objc_msgForward_demo.app/_objc_msgForward_demo"; 402 | }; 403 | name = Debug; 404 | }; 405 | D632A4C01BCB734C001353B2 /* Release */ = { 406 | isa = XCBuildConfiguration; 407 | buildSettings = { 408 | BUNDLE_LOADER = "$(TEST_HOST)"; 409 | FRAMEWORK_SEARCH_PATHS = ( 410 | "$(SDKROOT)/Developer/Library/Frameworks", 411 | "$(inherited)", 412 | ); 413 | INFOPLIST_FILE = _objc_msgForward_demoTests/Info.plist; 414 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 415 | PRODUCT_NAME = "$(TARGET_NAME)"; 416 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/_objc_msgForward_demo.app/_objc_msgForward_demo"; 417 | }; 418 | name = Release; 419 | }; 420 | /* End XCBuildConfiguration section */ 421 | 422 | /* Begin XCConfigurationList section */ 423 | D632A4931BCB734C001353B2 /* Build configuration list for PBXProject "_objc_msgForward_demo" */ = { 424 | isa = XCConfigurationList; 425 | buildConfigurations = ( 426 | D632A4B91BCB734C001353B2 /* Debug */, 427 | D632A4BA1BCB734C001353B2 /* Release */, 428 | ); 429 | defaultConfigurationIsVisible = 0; 430 | defaultConfigurationName = Release; 431 | }; 432 | D632A4BB1BCB734C001353B2 /* Build configuration list for PBXNativeTarget "_objc_msgForward_demo" */ = { 433 | isa = XCConfigurationList; 434 | buildConfigurations = ( 435 | D632A4BC1BCB734C001353B2 /* Debug */, 436 | D632A4BD1BCB734C001353B2 /* Release */, 437 | ); 438 | defaultConfigurationIsVisible = 0; 439 | defaultConfigurationName = Release; 440 | }; 441 | D632A4BE1BCB734C001353B2 /* Build configuration list for PBXNativeTarget "_objc_msgForward_demoTests" */ = { 442 | isa = XCConfigurationList; 443 | buildConfigurations = ( 444 | D632A4BF1BCB734C001353B2 /* Debug */, 445 | D632A4C01BCB734C001353B2 /* Release */, 446 | ); 447 | defaultConfigurationIsVisible = 0; 448 | defaultConfigurationName = Release; 449 | }; 450 | /* End XCConfigurationList section */ 451 | }; 452 | rootObject = D632A4901BCB734C001353B2 /* Project object */; 453 | } 454 | -------------------------------------------------------------------------------- /_objc_msgForward_demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /_objc_msgForward_demo.xcodeproj/project.xcworkspace/xcshareddata/_objc_msgForward_demo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | B63248A1-33F0-4F9D-8A10-8124FAFB7E44 9 | IDESourceControlProjectName 10 | _objc_msgForward_demo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | C391DC404FA7AD5263CFD8391343EA099910E20E 14 | https://github.com/yemingyu/_objc_msgForward_demo.git 15 | 16 | IDESourceControlProjectPath 17 | _objc_msgForward_demo.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | C391DC404FA7AD5263CFD8391343EA099910E20E 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/yemingyu/_objc_msgForward_demo.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | C391DC404FA7AD5263CFD8391343EA099910E20E 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | C391DC404FA7AD5263CFD8391343EA099910E20E 36 | IDESourceControlWCCName 37 | _objc_msgForward_demo 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /_objc_msgForward_demo.xcodeproj/project.xcworkspace/xcuserdata/yemingyu.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hong4cong/_objc_msgForward_demo/d2c0cfc00c9188d7ad2b83b8f56846e1677d03cf/_objc_msgForward_demo.xcodeproj/project.xcworkspace/xcuserdata/yemingyu.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /_objc_msgForward_demo.xcodeproj/xcuserdata/yemingyu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 40 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /_objc_msgForward_demo.xcodeproj/xcuserdata/yemingyu.xcuserdatad/xcschemes/_objc_msgForward_demo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /_objc_msgForward_demo.xcodeproj/xcuserdata/yemingyu.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | _objc_msgForward_demo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D632A4971BCB734C001353B2 16 | 17 | primary 18 | 19 | 20 | D632A4B01BCB734C001353B2 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /_objc_msgForward_demo/Animals.h: -------------------------------------------------------------------------------- 1 | // 2 | // Animals.h 3 | // _objc_msgForward_demo 4 | // 5 | // Created by luguobin on 15/9/21. 6 | // Copyright © 2015年 XS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Animals : NSObject 12 | 13 | //- (void)sel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /_objc_msgForward_demo/Animals.m: -------------------------------------------------------------------------------- 1 | // 2 | // Animals.m 3 | // _objc_msgForward_demo 4 | // 5 | // Created by luguobin on 15/9/21. 6 | // Copyright © 2015年 XS. All rights reserved. 7 | // 8 | 9 | #import "Animals.h" 10 | 11 | @implementation Animals 12 | 13 | //- (void)sel 14 | //{ 15 | // NSLog(@"Animal"); 16 | //} 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /_objc_msgForward_demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // _objc_msgForward_demo 4 | // 5 | // Created by yemingyu on 10/12/15. 6 | // Copyright (c) 2015 yemingyu. 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 | -------------------------------------------------------------------------------- /_objc_msgForward_demo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // _objc_msgForward_demo 4 | // 5 | // Created by yemingyu on 10/12/15. 6 | // Copyright (c) 2015 yemingyu. 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 | -------------------------------------------------------------------------------- /_objc_msgForward_demo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /_objc_msgForward_demo/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 | -------------------------------------------------------------------------------- /_objc_msgForward_demo/ForwardingTarget.h: -------------------------------------------------------------------------------- 1 | // 2 | // ForwardingTarget.h 3 | // _objc_msgForward_demo 4 | // 5 | // Created by luguobin on 15/9/21. 6 | // Copyright © 2015年 XS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ForwardingTarget : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /_objc_msgForward_demo/ForwardingTarget.m: -------------------------------------------------------------------------------- 1 | // 2 | // ForwardingTarget.m 3 | // _objc_msgForward_demo 4 | // 5 | // Created by luguobin on 15/9/21. 6 | // Copyright © 2015年 XS. All rights reserved. 7 | // 8 | 9 | #import "ForwardingTarget.h" 10 | #import 11 | 12 | 13 | @implementation ForwardingTarget 14 | 15 | - (void)sel 16 | { 17 | NSLog(@"ForwardingTarget"); 18 | } 19 | 20 | - (void)invocationTest 21 | { 22 | NSLog(@"invocationTest"); 23 | } 24 | 25 | 26 | id dynamicMethod(id self, SEL _cmd) 27 | { 28 | NSLog(@"%s:动态添加的方法",__FUNCTION__); 29 | return @"1"; 30 | } 31 | 32 | 33 | + (BOOL)resolveInstanceMethod:(SEL)sel __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) { 34 | 35 | class_addMethod(self.class, sel, (IMP)dynamicMethod, "@@:"); 36 | BOOL result = [super resolveInstanceMethod:sel]; 37 | result = YES; 38 | return result; 39 | } 40 | 41 | - (id)forwardingTargetForSelector:(SEL)aSelector __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) { 42 | id result = [super forwardingTargetForSelector:aSelector]; 43 | return result; 44 | } 45 | 46 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector { 47 | id result = [super methodSignatureForSelector:aSelector]; 48 | return result; 49 | } 50 | 51 | - (void)forwardInvocation:(NSInvocation *)anInvocation { 52 | [self performSelector:anInvocation.selector withObject:nil]; 53 | // [super forwardInvocation:anInvocation]; 54 | } 55 | 56 | - (void)doesNotRecognizeSelector:(SEL)aSelector { 57 | 58 | [super doesNotRecognizeSelector:aSelector]; // crash 59 | } 60 | @end 61 | -------------------------------------------------------------------------------- /_objc_msgForward_demo/Images.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 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /_objc_msgForward_demo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | yeyu.$(PRODUCT_NAME:rfc1034identifier) 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 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /_objc_msgForward_demo/Monkey.h: -------------------------------------------------------------------------------- 1 | // 2 | // Monkey.h 3 | // _objc_msgForward_demo 4 | // 5 | // Created by luguobin on 15/9/21. 6 | // Copyright © 2015年 XS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "Animals.h" 11 | 12 | @interface Monkey : Animals 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /_objc_msgForward_demo/Monkey.m: -------------------------------------------------------------------------------- 1 | // 2 | // Monkey.m 3 | // _objc_msgForward_demo 4 | // 5 | // Created by luguobin on 15/9/21. 6 | // Copyright © 2015年 XS. All rights reserved. 7 | // 8 | 9 | #import "Monkey.h" 10 | #import "ForwardingTarget.h" 11 | #import 12 | 13 | @interface Monkey() 14 | @property (nonatomic, strong) ForwardingTarget *target; 15 | @end 16 | 17 | @implementation Monkey 18 | 19 | - (instancetype)init 20 | { 21 | self = [super init]; 22 | if (self) { 23 | _target = [ForwardingTarget new]; 24 | [self performSelector:@selector(sel:) withObject:@"yeyu"]; 25 | } 26 | 27 | return self; 28 | } 29 | 30 | 31 | id dynamicMethodIMP(id self, SEL _cmd, NSString *str) 32 | { 33 | NSLog(@"%s:动态添加的方法",__FUNCTION__); 34 | NSLog(@"%@", str); 35 | return @"1"; 36 | } 37 | 38 | 39 | + (BOOL)resolveInstanceMethod:(SEL)sel __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) { 40 | 41 | class_addMethod(self.class, sel, (IMP)dynamicMethodIMP, "@@:"); 42 | BOOL result = [super resolveInstanceMethod:sel]; 43 | result = YES; 44 | return result; // 1 45 | } 46 | 47 | - (id)forwardingTargetForSelector:(SEL)aSelector __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) { 48 | id result = [super forwardingTargetForSelector:aSelector]; 49 | result = self.target; 50 | return result; // 2 51 | } 52 | 53 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector 54 | { 55 | id result = [super methodSignatureForSelector:aSelector]; 56 | NSMethodSignature *sig = [NSMethodSignature signatureWithObjCTypes:"v@:"]; 57 | result = sig; 58 | return result; // 3 59 | } 60 | 61 | - (void)forwardInvocation:(NSInvocation *)anInvocation 62 | { 63 | // [super forwardInvocation:anInvocation]; 64 | anInvocation.selector = @selector(invocationTest); 65 | [self.target forwardInvocation:anInvocation]; 66 | } 67 | 68 | - (void)doesNotRecognizeSelector:(SEL)aSelector { 69 | [super doesNotRecognizeSelector:aSelector]; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /_objc_msgForward_demo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // _objc_msgForward_demo 4 | // 5 | // Created by yemingyu on 10/12/15. 6 | // Copyright (c) 2015 yemingyu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /_objc_msgForward_demo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // _objc_msgForward_demo 4 | // 5 | // Created by yemingyu on 10/12/15. 6 | // Copyright (c) 2015 yemingyu. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "Monkey.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | Monkey *test = [[Monkey alloc] init]; 22 | } 23 | 24 | - (void)didReceiveMemoryWarning { 25 | [super didReceiveMemoryWarning]; 26 | // Dispose of any resources that can be recreated. 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /_objc_msgForward_demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // _objc_msgForward_demo 4 | // 5 | // Created by yemingyu on 10/12/15. 6 | // Copyright (c) 2015 yemingyu. 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 | -------------------------------------------------------------------------------- /_objc_msgForward_demoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | yeyu.$(PRODUCT_NAME:rfc1034identifier) 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 | -------------------------------------------------------------------------------- /_objc_msgForward_demoTests/_objc_msgForward_demoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // _objc_msgForward_demoTests.m 3 | // _objc_msgForward_demoTests 4 | // 5 | // Created by yemingyu on 10/12/15. 6 | // Copyright (c) 2015 yemingyu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface _objc_msgForward_demoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation _objc_msgForward_demoTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | --------------------------------------------------------------------------------