App Store Review Request error Swift 6

I'm fairly new to Swift, so I'm unsure as to what's going wrong with my code and how to fix it.

After switching to Swift 6, the view I have with requestReview throws: "Cannot form key path to main actor-isolated property 'requestReview'"

As I understand it, this is potentially due to the changes made to @MainActor. However, I am unsure how to go about fixing this error.

Answered by joeycarmello in 792497022

It's a known issue and has been reported.

See:

You'll have to comment it out for now or not enable Swift 6 complete concurrency checking.

We are also unsure how to go about fixing this error because you haven't given us any code.

This is my first post and I was unsure of what was needed exactly.

Here is my code:

import StoreKit
import SwiftData
import SwiftUI

struct AddItemView: View {
    @Environment(\.requestReview) var requestReview`

var body: some View {
        NavigationStack {
            VStack {
                Form {
                   ...
                }
            }
        }
    }
    
    @MainActor 
    func showReview() {
        itemsCreated += 1
        
        if itemsCreated == 10 {
            requestReview()
        }
    }
}

If anything else is needed, please let me know and I will do my best to include it.

Accepted Answer

It's a known issue and has been reported.

See:

You'll have to comment it out for now or not enable Swift 6 complete concurrency checking.

App Store Review Request error Swift 6
 
 
Q