3

I am developing a tweak and I wanted to add some in chat functions, and example would be opening a users profile/kicking a user/etc with a command (similar to skype) I have found the method that sends messages within the chat but I cant seem to figure out how to make it trigger anything.

This is what I have written so far.

#import <kik/Pod/Classes/KikClient.h>

%hook CoreDataConversationManager

- (void)sendTextMessage:(id)arg1 withRenderInstructionSet:(id)arg2 toConversation:(id)arg3 isSuggestedResponse:(BOOL)arg4
{

    if ([[arg1 lowercaseString] hasPrefix:@"!u "] && [arg1 length]>3) {
        arg1 = [arg1 substringFromIndex:3];
          // Should open the users profile
        [[KikClient sharedInstance] openProfileForKikUsername:arg1];

        arg1 = @"";

    } else {
        %orig;
    }

}

%end

I get this error while compiling.

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_KikClient", referenced from:
      objc-class-ref in Tweak.xm.0931a6c6.o
ld: symbol(s) not found for architecture armv7
clang-3.7: error: linker command failed with exit code 1 (use -v to see invocation)

I read/saw somewhere that I could call methods from other classes using [%c(Classname) method]; So that is what I tried

[[%c(KikClient) sharedInstance] openProfileForKikUsername:arg1];

This compiles fine, but when I send a message such as "!u niro" nothing happens, when it should open the profile page.

KikClient.h

Also, I should note that KikClient.h is not an existing class within Kik (via ClassDump)

I have also searched for "SharedInstance" within the dumped headers and found these.

C:\Users\niro\Desktop\ObjC\Headers\DDASLLogger.h:
   17  }
   18  
   19: + (id)sharedInstance;
   20  @property(readonly, nonatomic) NSString *loggerName;
   21  - (void)logMessage:(id)arg1;

C:\Users\niro\Desktop\ObjC\Headers\DDLog.h:
   33  + (struct dispatch_queue_s *)loggingQueue;
   34  + (void)initialize;
   35: + (id)sharedInstance;
   36  @property(retain, nonatomic) NSMutableArray *_loggers; // @synthesize _loggers=__loggers;
   37  - (void).cxx_destruct;

C:\Users\niro\Desktop\ObjC\Headers\DDTTYLogger.h:
   27  }
   28  
   29: + (id)sharedInstance;
   30  + (unsigned long long)codeIndexForColor:(struct UIColor *)argSearching 2420 files for "sharedInstance"

C:\Users\niro\Desktop\ObjC\Headers\CameraHelper.h:
   23  }
   24  
   25: + (id)sharedInstance;
   26  @property _Bool testCompressOnSendPicture; // @synthesize testCompressOnSendPicture=_testCompressOnSendPicture;
   27  @property(retain, nonatomic) UIViewController<KikCameraHelperDelegate> *parentController; // @synthesize parentController=_controller;

C:\Users\niro\Desktop\ObjC\Headers\CLSAnalyticsViewControllerTrackingController.h:
   18  
   19  + (_Bool)replaceMethodImplementationForClass:(Class)arg1 selector:(SEL)arg2 withImplementation:(CDUnknownFunctionPointerType)arg3 storingOldImplementation:(CDUnknownFunctionPointerType *)arg4;
   20: + (id)sharedInstance;
   21  @property(nonatomic) __weak id <CLSAnalyticsViewControllerTrackingDelegate> delegate; // @synthesize delegate=_delegate;
   22  - (void)cleanUpUIViewControllerSwizzle;
   ..
   27  - (void)addBlackListViewControllerClass:(Class)arg1;
   28  - (void)startTracking;
   29: - (void)disposeSharedInstance;
   30  - (id)init;
   31  - (void)dealloc;

C:\Users\niro\Desktop\ObjC\Headers\Crashlytics.h:
   43  + (id)kitDisplayVersion;
   44  + (id)bundleIdentifier;
   45: + (id)sharedInstance;
   46  @property(readonly, nonatomic) CLSBe1;
   31  + (void)getRed:(double *)arg1 green:(double *)arg2 blue:(double *)arg3 fromColor:(struct UIColor *)arg4;

C:\Users\niro\Desktop\ObjC\Headers\FXBlurScheduler.h:
   18  }
   19  
   20: + (id)sharedInstance;
   21  @property(nonatomic) _Bool updating; // @synthesize updating=_updating;
   22  @property(nonatomic) _Bool blurEnabled; // @synthesize blurEnabled=_blurEnabled;

C:\Users\niro\Desktop\ObjC\Headers\KikSmiley.h:
   24  }
   25  
   26: + (id)sharedInstance;
   27  @property(retain, nonatomic) NSDictionary *defaultSmileyDictionary; // @synthesize defaultSmileyDictionary=_defaultSmileyDictionary;
   28  @property(nonatomic) _Bool ready; // @synthesize ready=_ready;

C:\Users\niro\Desktop\ObjC\Headers\KMDebugPerfManager.h:
   17  }
   18  
   19: + (id)sharedInstance;
   20  + (id)savePath;
   21  @property(retain, nonatomic) KMDebugPerfOverlayView *overlayView; // @synthesize overlayView=_overlayView;

C:\Users\niro\Desktop\ObjC\Headers\MessageListScreenController.h:
  101  }
  102  
  103: + (id)sharedInstance;
  104  + (void)setCore:(id)arg1;
  105  @property(readonly, nonatomic) Core *core; // @synthesize core=_core;

C:\Users\niro\Desktop\ObjC\Headers\Mixpanel.h:
   60  + (_Bool)inBackground;
   61  + (void)assertPropertyTypes:(id)arg1;
   62: + (id)sharedInstance;
   63: + (id)sharedInstanceWithToken:(id)arg1;
   64: + (id)sharedInstanceWithToken:(id)arg1 launchOptions:(id)arg2;
   65  @property(copy) NSString *switchboardURL; // @synthesize switchboardURL=_switchboardURL;
   66  @property(copy) NSString *decideURL; // @synthesize decideURL=_decideURL;

C:\Users\niro\Desktop\ObjC\Headers\MixpanelMetrics.h:
   27  
   28  + (id)botListForUsers:(id)arg1;
   29: + (id)sharedInstance;
   30  + (void)setCore:(id)arg1;
   31  @property(readonly, nonatomic) NSDictionary *superProperties; // @synthesize superProperties=_superProperties;

C:\Users\niro\Desktop\ObjC\Headers\MPTweakStore.h:
   15  }
   16  
   17: + (id)sharedInstance;
   18  - (void).cxx_destruct;
   19  - (void)reset;

C:\Users\niro\Desktop\ObjC\Headers\NBPhoneNumberUtil.h:
   24  }
   25  
   26: + (id)sharedInstance;
   27  @property(retain, nonatomic) NSRegularExpression *VALID_ALPHA_PHONE_PATTERN; // @synthesize VALID_ALPHA_PHONE_PATTERN=_VALID_ALPHA_PHONE_PATTERN;
   28  @property(retain, nonatomic) NSRegularExpression *CAPTURING_DIGIT_PATTERN; // @synthesize CAPTURING_DIGIT_PATTERN=_CAPTURING_DIGIT_PATTERN;

C:\Users\niro\Desktop\ObjC\Headers\OpenInChromeController.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (_Bool)openInChrome:(id)arg1 withCallbackURL:(id)arg2 createNewTab:(_Bool)arg3;
   15  - (_Bool)openInChrome:(id)arg1;

C:\Users\niro\Desktop\ObjC\Headers\PBJVision.h:
   72  }
   73  
   74: + (id)sharedInstance;
   75  @property(nonatomic) _Bool audioEnabled; // @synthesize audioEnabled=_audioEnabled;
   76  @property(retain, nonatomic) NSString *captureSessionPreset; // @synthesize captureSessionPreset=_captureSessionPreset;

C:\Users\niro\Desktop\ObjC\Headers\Perf.h:
   19  }
   20  
   21: + (id)sharedInstance;
   22  @property(nonatomic) double currentTime; // @synthesize currentTime=_currentTime;
   23  @property(nonatomic) __weak id <PerfDelegate> delegate; // @synthesize delegate=_delegate;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamParserState.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (id)name;
   15  - (_Bool)needKey;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamParserStateArrayGotValue.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (void)parser:(id)arg1 shouldTransitionTo:(int)arg2;
   15  - (_Bool)parser:(id)arg1 shouldAcceptToken:(int)arg2;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamParserStateArrayNeedValue.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (void)parser:(id)arg1 shouldTransitionTo:(int)arg2;
   15  - (_Bool)parser:(id)arg1 shouldAcceptToken:(int)arg2;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamParserStateArrayStart.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (void)parser:(id)arg1 shouldTransitionTo:(int)arg2;
   15  - (_Bool)parser:(id)arg1 shouldAcceptToken:(int)arg2;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamParserStateComplete.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (int)parserShouldReturn:(id)arg1;
   15  - (id)name;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamParserStateError.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (int)parserShouldReturn:(id)arg1;
   15  - (id)name;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamParserStateObjectGotKey.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (void)parser:(id)arg1 shouldTransitionTo:(int)arg2;
   15  - (_Bool)parser:(id)arg1 shouldAcceptToken:(int)arg2;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamParserStateObjectGotValue.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (void)parser:(id)arg1 shouldTransitionTo:(int)arg2;
   15  - (_Bool)parser:(id)arg1 shouldAcceptToken:(int)arg2;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamParserStateObjectNeedKey.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (_Bool)needKey;
   15  - (void)parser:(id)arg1 shouldTransitionTo:(int)arg2;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamParserStateObjectSeparator.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (void)parser:(id)arg1 shouldTransitionTo:(int)arg2;
   15  - (_Bool)parser:(id)arg1 shouldAcceptToken:(int)arg2;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamParserStateObjectStart.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (_Bool)needKey;
   15  - (void)parser:(id)arg1 shouldTransitionTo:(int)arg2;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamParserStateStart.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (id)name;
   15  - (void)parser:(id)arg1 shouldTransitionTo:(int)arg2;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamWriterState.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (void)appendWhitespace:(id)arg1;
   15  - (void)transitionState:(id)arg1;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamWriterStateArrayStart.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (void)transitionState:(id)arg1;
   15  

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamWriterStateArrayValue.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (void)appendSeparator:(id)arg1;
   15  

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamWriterStateComplete.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (_Bool)isInvalidState:(id)arg1;
   15  

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamWriterStateError.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  
   15  @end

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamWriterStateObjectKey.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (void)appendSeparator:(id)arg1;
   15  

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamWriterStateObjectStart.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (_Bool)expectingKey:(id)arg1;
   15  - (void)transitionState:(id)arg1;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamWriterStateObjectValue.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (void)appendWhitespace:(id)arg1;
   15  - (void)transitionState:(id)arg1;

C:\Users\niro\Desktop\ObjC\Headers\SBJsonStreamWriterStateStart.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  - (void)appendSeparator:(id)arg1;
   15  - (void)transitionState:(id)arg1;

C:\Users\niro\Desktop\ObjC\Headers\ScreenshotMonitor.h:
   11  }
   12  
   13: + (id)sharedInstance;
   14  + (void)load;
   15  - (void)userDidTakeScreenshot:(id)arg1;

42 matches across 39 files

Thank you for taking your time to read this! If anyone could help me out with a sample code or even point me in the direction on what I need to read that would be fantastic.

niro
  • 63
  • 2

0 Answers0