Advertisement
Guest User

Untitled

a guest
Sep 27th, 2017
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. @interface NSURLRequest (MyURLRequest)
  3. @end
  4.  
  5. @implementation NSURLRequest (MyURLRequest)
  6.  
  7. - (id) MyMakeRequest:(NSURL *)theURL{
  8.     NSLog(@"WHOA IN HERE");
  9.    
  10.     return [self requestWithURL:theURL];
  11. }
  12.  
  13. @end
  14.  
  15. @implementation MyPlugin
  16.  
  17. + (MyPlugin *)sharedInstance
  18. {
  19.     static MyPlugin* plugin = nil;
  20.    
  21.     if (plugin == nil)
  22.         plugin = [[MyPlugin alloc] init];
  23.    
  24.     return plugin;
  25. }
  26.  
  27. + (void) load
  28. {
  29.     MyPlugin* plugin = [MyPlugin sharedInstance];
  30.      
  31.     Method method = nil;
  32.    
  33.     method = class_getInstanceMethod(NSClassFromString(@"NSURLRequest"),@selector(requestWithURL));
  34.    
  35.     if(method == nil){
  36.        
  37.         NSLog(@"Couldn't find method...");
  38.     } else {
  39.        
  40.         NSLog(@"Found method...");
  41.     }
  42.    
  43.     NSLog(@"DMyPlugin installed");
  44. }
  45.  
  46. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement