[SOLVED] Is it a good idea to use shared KMP module in NotificationServiceExtension on iOS?NotificationServiceExtension is used for handling remote notifications in case an app is in background. Important is, that extension code is spinned not only in a new thread but even in a new process. I tested naive approach to use a shared module for the extension target with cocoapod and it compiles fine, but crashes badly with kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared
OK, I’ve made some progress, so I can I answer my question. It is indeed possible to use shared module with NotificationServiceExtension, probably as well with any other service defined as additional iOS target. Additionally to all multithreading issues, you have to keep in mind, that an extension is running in its own process. Luckily for me, I didn’t have to deal with sharing of data or state with the main app, what even can’t be possible, because app may not even run.