smserver icon indicating copy to clipboard operation
smserver copied to clipboard

Sending messages via iMessage iOS16

Open hek4ek opened this issue 11 months ago • 0 comments

Hi @itsjunetime

I'm trying to figure out what changed in iOS16 when sending messages via iMessage

Before iOS16, this code worked:

IMAccountController *sharedAccountController = [%c(IMAccountController) sharedInstance];

IMAccount *myAccount = [sharedAccountController activeIMessageAccount];

if (myAccount == nil){

myAccount = [sharedAccountController activeSMSAccount];

NSLog(@"WebMessage: Tweak.x sharedAccountController activeSMSAccount %@", myAccount);

}

__NSCFString *handleId = (__NSCFString *)address;

IMHandle *handle = [[%c(IMHandle) alloc] initWithAccount:myAccount ID:handleId alreadyCanonical:YES];

IMChatRegistry *registry = [%c(IMChatRegistry) sharedInstance];

IMChat *chat = [registry chatForIMHandle:handle];

IMMessage* message;

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 14.0){

message = [%c(IMMessage) instantMessageWithText:text flags:1048581 threadIdentifier:nil];

}

else{

message = [%c(IMMessage) instantMessageWithText:text flags:1048581];

}

[chat sendMessage:message];

but in iOS16 messages stopped sending

I tried to get the sending progress via [chat setSendProgressDelegate: self];

I start getting the progress value, it reaches 90% and continues to call the method infinitely

- (void)chat:(id)arg1 progressDidChange:(float)arg2 sendingMessages:(id)arg3 sendCount:(unsigned long long)arg4 totalCount:(unsigned long long)arg5 finished:(bool)arg6

with the value progressDidChange=0.9

I know that iMessage in iOS16 got the ability to edit/cancel/restore messages, but after studying the difference in IMCHat dumps on limneos.net for iOS15.2.1 and iOS16.3, I did not find how this can affect sending

I assume that perhaps some additional nuance with security appeared in iMessage starting with iOS16, but I do not understand where to look for the answer

I will be glad to any idea, thanks in advance for your thoughts

hek4ek avatar Jan 31 '25 14:01 hek4ek