Why is it that when I change to code in MessagesViewController in an iMessage extension the old compiled code runs instead on my connected iPhone device?
I have tried to fix the problem by deleting the DerivedData folder in the Xcode folder on my Mac mini that runs Xcode. I have run Option + Product->Clean Build Folder in the Xcode menu. I have completely removed the containing app on the iPhone device, which also removes the iMessage extension. I have done all of those things combined, and it doesn't fix the problem.
This is the old compiled code that the device actually runs:
guard let conversation = activeConversation else { fatalError("Expected a conversation") }
// Create a new message with the same session as any currently selected message.
let message = composeMessage(with: sticker, caption: "messageCaption", session: conversation.selectedMessage?.session)
// Add the message to the conversation.
conversation.insert(message) { error in
if let error = error {
print(error)
}
}
This is the new code that the device is supposed to run in debug mode in Xcode:
guard let conversation = activeConversation else { fatalError("Expected a conversation") }
conversation.insertText("Hello there!") {
(error: Error?) in
print("completionHandler insert(text:_:)")
}