2

canvas preview has an error just like that:

UnknownPreviewProviderError: Unknown preview provider "AboutView_Previews" 买就返.app does not contain a preview provider named "AboutView_Previews". Check your build settings to ensure the preview provider is compiled into your product. Mangled name: 3买就返18AboutView_PreviewsV

Error Domain=com.apple.dt.UITestingAgent Code=-1 "Preview provider "3买就返18AboutView_PreviewsV" does not exist" UserInfo={NSLocalizedDescription=Preview provider "3买就返18AboutView_PreviewsV" does not exist}

ihave check the "build setting" -> "build options" -> "Enable Previews" is Yes

import SwiftUI
struct ContentView: View {

    var body: some View {
        TabView {
            HomeView()
                .tabItem {
                    Image("tabbarHome")
                    Text("首页")
            }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
Asperi
  • 228,894
  • 20
  • 464
  • 690
daniel
  • 23
  • 3
  • It looks like Xcode issue due to 买就返 application name. You can use English product name and [this](https://stackoverflow.com/questions/2871990/how-to-localize-bundle-display-name-in-iphone-app) topic of how to make app name localized. – Asperi Dec 13 '19 at 05:50

3 Answers3

2

just change App name ("Buy back") it will solve your issue

Hardik Bar
  • 1,660
  • 18
  • 27
2

I have the same issue when I modify the Product Name(at Target -> Packing -> Product Name) to Chinese word.

The right way to use Chinese word as App name:

  1. open info.plist
  2. add Bundle display name with the name you want.

Use this way to change app name will not effect SwiftUI Previews.

izayl
  • 470
  • 4
  • 8
1

There was a similar error when the project name started with a digit (for example, 30-project-name). I just renamed the project with a name without numbers at the beginning

Alex F
  • 29
  • 3