StoreKit + SwiftUI Previews - No such module '_StoreKit_SwiftUI'

After I added Storekit to my App SwiftUI-Previews doesn't work anymore. The App itself builds like a charm but all the Previews are broken with the following Error Message:
Code Block
No such module '_StoreKit_SwiftUI'


Does anyone else knows this issues and has an idea on how to solve this?
Answered by reed.1325 in 629160022
There's a temporary fix, and hopefully a permanent one is coming in the next version of Xcode.

Add the following build setting to your affected target(s) / project(s).

Code Block
Architectures
Excluded Architectures
Debug
Simulator - iOS 14.0 SDK arm64

Same here on Xcode 12.0 beta 5 (12A8189h) with my App PDF Archiver.
I'm getting this one as well. I filed a feedback for it FB8523578.

To reproduce:

Code Block
import SwiftUI
import StoreKit
struct ContentView: View {
  var body: some View {
    Button(action: {
      SKStoreReviewController.requestReview()
    }, label: {
      Text("Request a review")
    })
  }
}

Accepted Answer
There's a temporary fix, and hopefully a permanent one is coming in the next version of Xcode.

Add the following build setting to your affected target(s) / project(s).

Code Block
Architectures
Excluded Architectures
Debug
Simulator - iOS 14.0 SDK arm64

As a note, this bug is still present on Xcode 12 Beta 6. I believe it was just discovered by Apple Engineers on social media in the last day or so, so maybe it will make it into the next release.
Check your 'Build Active Architecture Only' build settings. You probably want for everything but release configuration to be set to 'Yes'.

Sounds like when you are building for your simulator, (assuming you are on intel Mac), your project is building the App for Intel and arm64 architecture. My guess is that your dependency code, (pod project build settings), has 'Build Active Architecture Only' set to 'Yes', and so is only building for Intel architecture, and hence you get the can't find module because yeah, it's not built for current architecture which is Intel when deploying to simulator.

This might help somebody

StoreKit + SwiftUI Previews - No such module '_StoreKit_SwiftUI'
 
 
Q