Alright so I'm having one of the weirder issues I've ever had, So I had my ios build working fine 2-3 weeks ago, have made some changes (to the code, not the build) since, and now that I tried building it again I'm getting some really weird behavior. Details are below:
• Initially, I was getting a vague error saying that one of my actual vars (platform expect class) didn't exist. This var was just the iOS actual for the SQLlite Database object. Desktop and android were fine, the IDE recognized the class, etc. I cleared cache, regenerated the sqldelight interfaces, no change.
◦ The even stranger thing - is this
exact line of code - same object same method call etc appears in multiple places in my code, however it only complained about that one single call.
• I temporarily commented out that single section, and the build proceeded a bit further (remember - there were still other instances of the same var and call) and it eventually failed complaining about missing linked libraries from sqlite. I did some googling and came across some older slack chats about changing the linking from static to dynamic & manually adding the linker flag for sqlite. Didn't have to do that before, but whatever I did it and the build proceeded and the app launched. (old thread -
https://slack-chats.kotlinlang.org/t/522582/hi-all-i-am-using-issue-integrating-sqldelight-with-kmm-with)
• I still can't get it to not error any time this single method call (remember, that happens in multiple places) exists in this one specific file. I cannot for the life of me figure out whats different between this class and the other six places it appears. Specific error message it gives:
error: This declaration needs opt-in. Its usage must be marked with @kotlin.experimental.ExperimentalNativeApi or @OptIn(kotlin.experimental.ExperimentalNativeApi::class)
error: Unresolved reference: database