From iPhone Development Wiki
Jump to: navigation, search

Kik is a cross-platform messaging app.

A set of dumped and fixed Kik headers can be found here. Note that these only apply to Kik version 7.2.1

You can send a Kik message programmatically using the following code:

//Declare our variables and helpers
KikStorage* storage;
id network;
id userManager;
id messageManager;
id chatManager;
id accountManager;
id attachmentManager;
id userHelper;
id chatHelper;
id user;
id chat;
id conversation;
CoreDataConversationManager* manager;

%hook CoreDataConversationManager

-(id)initWithStorage:(id)arg1 andNetwork:(id)arg2 andUserManager:(id)arg3 andMessageManager:(id)arg4 andChatManager:(id)arg5 andAccountManager:(id)arg6 andAttachmentManager:(id)arg7 { 
	id r = %orig;
        //Grab valid instances of all the objects we need
	storage = arg1;
	network = arg2;
	userManager = arg3;
	messageManager = arg4;
	chatManager = arg5;
	accountManager = arg6;
	attachmentManager = arg7;
	manager = self;

//Get the objects we need
userHelper = [[%c(KikUserHelper) alloc] initWithManagedObjectContext:storage.managedObjectContext];
chatHelper = [[%c(KikChatHelper) alloc] initWithManagedObjectContext:storage.managedObjectContext];
//Get the user from their username
user = [userHelper userWithUsername:@"codyd55"];
//Get the chat for that user
chat = [chatHelper chatForUser:user];
//Get the conversation
conversation = [[%c(CoreDataConversation) alloc] initWithKikChat:chat];
//Send a message to the conversation
[manager sendTextMessage:@"Hello!" toConversation:conversation];