由于“内部”保护级别,“AWSPredictionsPlugin”初始化器不可访问,Amplify Swift

b5lpy0ml  于 2023-06-28  发布在  Swift
关注(0)|答案(1)|浏览(152)

我添加了Amplify包,现在当我试图初始化预测插件时,它给了我一个“'AWSPredictionsPlugin'初始化器由于'内部'保护级别而无法访问”错误。(我也在此之前配置了后端资源)

  1. struct FrenchAppApp: App {
  2. init(){
  3. configureAmplify()
  4. }
  5. var body: some Scene { ...///
  6. func configureAmplify() {
  7. let apiPlugin = AWSAPIPlugin(modelRegistration: AmplifyModels())
  8. let dataStorePlugin = AWSDataStorePlugin(modelRegistration: AmplifyModels())
  9. let s3 = AWSS3StoragePlugin()
  10. let cognitoAuth = AWSCognitoAuthPlugin()
  11. let predictions = AWSPredictionsPlugin()
  12. do {
  13. try Amplify.add(plugin: apiPlugin)
  14. try Amplify.add(plugin: dataStorePlugin)
  15. try Amplify.add(plugin: s3)
  16. try Amplify.add(plugin: cognitoAuth)
  17. try Amplify.add(plugin: predictions)
  18. try Amplify.configure()
  19. print("Initialized Amplify");
  20. } catch {
  21. // simplified error handling
  22. print("Could not initialize Amplify: \(error)")
  23. }
  24. }

我试着公开init只是为了测试,但它不起作用,还试过这个:

  1. `class MyAWSPredictionsPlugin: AWSPredictionsPlugin {
  2. override init() {
  3. super.init()
  4. }
  5. }`

但没有成功

oknwwptz

oknwwptz1#

有一个ticket issue on the repository two weeks ago,并已在PR #3009中修复,第一个修复的版本是2.11.6 version(2023-06-07)。
所以你需要更新你的当前版本。

相关问题