À Ó Ã ios µähook» úöæ µ μ Ï öadobe air ios ane  appdelegate µä¶ ¯ Ì ¬ Ì Æ æ »»

Source: Internet
Author: User

À Ó Ã ios µähook» úöæ µ μ Ï öadobe air ios ane  appdelegate µä¶ ¯ Ì ¬ Ì Æ æ »»

¿ª · ¢ ± ³ ¾ °

& Quot; ********************************************************************* ~~ö§ ~~~í ************************************************************* öios ~~~~~â delegate éú~üööü~ú~~~ö» Ø µ~° ~~~~~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% öé éúµäí*í ¡öö§ ¸ ¹ Ä ämuläó omáè


Hook öª Ê ¶ ± ³ ¾ °

£° Objc À {µämethod Swizzling £;± {~úäúè {× {http: // blog.csdn.net/yiyaaixuexi£


Ô úobjective-cöð μ ÷ Ó Ã Ò» Ö ö½ ·? íï û %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% objective-C µä¶ ¯ Ì Ø %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% µäzäzöözö£;'{µ%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
à ¿ö öà ¶ ¼ óó Ò» ö ö½ · Á · ráð ± í£;;{· Å × Å selector µäã {×ö°í · when? please refer to the following link for more information: how can this problem be solved?



Î Ò Ç çoré Ò À Ó methomethod_exchangeimplementations À 'ment»» 2 ö ööö~µäimp £.
Î Ò Ã çoré Ò À Ó Ã class_replaceMethod À 'Ð Þ ¸ äà £.
Î Ò Ç çoré Ò À Ó methomethod_setimplementation À ö± ½ óréöã ä³ Ö ö¨?
Zookeeper ¡¡
**************************** Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> vcrXESU1Qo6zI58 /CzbzL + cq + o7o8YnI + cda-vcd4kpha + pgltzybzcm9 "http://www.2cto.com/uploadfile/Collfiles/20141111/2014111108225471.png" alt = "\">


Ê μ Ï öë Â ·

1) ~~~úmdchangedelegatehelper À Ó Ô Ø {× · *

2) ~~~~%3 ~ösel £.

Please» ö öappdelegate Ô SEL £° oldSEL £;

Ö» ö ömdchangedelegatehelper microäè È SEL £° defasel SEL £ó Ó úúú?ô Ô appdelegate í Ó áäè È {µäô oldSEL

Ö» ö ömdchangedelegatehelper µä¿ ± SEL £° newSEL

· Copyright · 」 ~~~» copyright ~~â · £°


3) zookeeper» ° ó Ô Ó ¦ µäsel Ø Ï µî ª

OldSEL -- newMethod

NewSEL -- oldMethod

Please refer to the following link for more information :?

OldSEL has been transferred to maid MDChangeDelegateHelper. mäúµähookedxxx

~Únewmethold ö{μ ÷ Ó mááááz newSEL £%newsel ö¸ ò ololdmethod £%%%μ Ö öámá~%%% ****************************


'Úâ ë µï Ö

////  MDChangeDelegateHelper.m//  ChangeDelegateDemo////  Created by ashqal on 14-10-31.//  Copyright (c) 2014Äê moredoo. All rights reserved.//#import "MDChangeDelegateHelper.h"#import 
 
  #import 
  
   void hookMethod(SEL oldSEL,SEL defaultSEL, SEL newSEL){    //CTAppController    Class aClass = objc_getClass("CTAppController");    if ( aClass == 0 )    {        NSLog(@"!!!!!!!!!!!!!did not find adobe class!");        return;    }    Class bClass = [MDChangeDelegateHelper class];    //°Ñ·½·¨¼Ó¸øaClass    class_addMethod(aClass, newSEL, class_getMethodImplementation(bClass, newSEL),nil);    class_addMethod(aClass, oldSEL, class_getMethodImplementation(bClass, defaultSEL),nil);        Method oldMethod = class_getInstanceMethod(aClass, oldSEL);    assert(oldMethod);    Method newMethod = class_getInstanceMethod(aClass, newSEL);    assert(newMethod);    method_exchangeImplementations(oldMethod, newMethod);  }@implementation MDChangeDelegateHelper+ (void)load{    NSLog(@"MDChangeDelegateHelper load");    //[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(createStarterNotificationChecker:)                                                 //name:@"UIApplicationWillFinishLaunchingNotification" object:nil];    //[self changeDelegate];            hookMethod( @selector(application:didFinishLaunchingWithOptions:)               ,@selector(defaultApplication:didFinishLaunchingWithOptions:)               ,@selector(hookedApplication:didFinishLaunchingWithOptions:)               );    hookMethod( @selector(application:handleOpenURL:)               , @selector(defaultApplication:handleOpenURL:)               , @selector(hookedApplication:handleOpenURL:)               );    hookMethod(@selector(application:openURL:sourceApplication:annotation:)               , @selector(defaultApplication:openURL:sourceApplication:annotation:)               , @selector(hookedApplication:openURL:sourceApplication:annotation:));        hookMethod(@selector(application:supportedInterfaceOrientationsForWindow:)               , @selector(defaultApplication:supportedInterfaceOrientationsForWindow:)               , @selector(hookedApplication:supportedInterfaceOrientationsForWindow:)               );    hookMethod(@selector(applicationDidBecomeActive:)               , @selector(defaultApplicationDidBecomeActive:)               , @selector(hookedApplicationDidBecomeActive:)               );        hookMethod(@selector(init)               , @selector(init)               , @selector(hookedInit)               );}-(BOOL)hookedApplication:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)dic{        NSLog(@"hooked didFinishLaunchingWithOptions");    [self hookedApplication:application didFinishLaunchingWithOptions:dic];    return YES;}-(id)hookedInit{    NSLog(@"hooked init!!!");    return [self hookedInit];}- (BOOL)hookedApplication:(UIApplication *)application handleOpenURL:(NSURL *)url {        NSLog(@"hooked handleOpenURL");    [self hookedApplication:application handleOpenURL:url];    return YES;}- (BOOL)hookedApplication:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{    NSLog(@"hooked openURL sourceApplication annotation");    [self hookedApplication:application openURL:url sourceApplication:sourceApplication annotation:annotation];    return YES;}- (NSUInteger) hookedApplication:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{    NSLog(@"hooked supportedInterfaceOrientationsForWindow");    [self hookedApplication:application supportedInterfaceOrientationsForWindow:window ];    return 0;}- (void)hookedApplicationDidBecomeActive:(UIApplication *)application{    [self hookedApplicationDidBecomeActive:application];    NSLog(@"hooked applicationDidBecomeActive");}- (BOOL)defaultApplication:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)dic{ return YES;}- (BOOL)defaultApplication:(UIApplication *)application handleOpenURL:(NSURL *)url{return YES;}- (BOOL)defaultApplication:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{return YES;}- (NSUInteger) defaultApplication:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{return 0;}- (void)defaultApplicationDidBecomeActive:(UIApplication *)application{}- (id)init{    self = [super init];    if (self) {            }    return self;}@end
  
 


×¢ Ò â µã

A) ~úô Ë Ð Ê ± nslog ³ öadobe air µäappdelegate Ã × ×öî ctctappcontroller £;%%%%%%%%%%%%%« '{â ×%%%%%%%%%%%%%%%%%%%» zookeeper

B) Ú ú¶ init ° ¯ Ê ý ø Ð Ì æ» ± · ¢ Ï öctappcontroller û Ó Ê µ μ Ï öinit ° init £ ££ Ë please refer to the following link for more information: «äyangè'' ¨ µà ý áë


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.