我添加了Amplify包,现在当我试图初始化预测插件时,它给了我一个“'AWSPredictionsPlugin'初始化器由于'内部'保护级别而无法访问”错误。(我也在此之前配置了后端资源)
struct FrenchAppApp: App {
init(){
configureAmplify()
}
var body: some Scene { ...///
func configureAmplify() {
let apiPlugin = AWSAPIPlugin(modelRegistration: AmplifyModels())
let dataStorePlugin = AWSDataStorePlugin(modelRegistration: AmplifyModels())
let s3 = AWSS3StoragePlugin()
let cognitoAuth = AWSCognitoAuthPlugin()
let predictions = AWSPredictionsPlugin()
do {
try Amplify.add(plugin: apiPlugin)
try Amplify.add(plugin: dataStorePlugin)
try Amplify.add(plugin: s3)
try Amplify.add(plugin: cognitoAuth)
try Amplify.add(plugin: predictions)
try Amplify.configure()
print("Initialized Amplify");
} catch {
// simplified error handling
print("Could not initialize Amplify: \(error)")
}
}
我试着公开init只是为了测试,但它不起作用,还试过这个:
`class MyAWSPredictionsPlugin: AWSPredictionsPlugin {
override init() {
super.init()
}
}`
但没有成功
1条答案
按热度按时间oknwwptz1#
有一个ticket issue on the repository two weeks ago,并已在PR #3009中修复,第一个修复的版本是2.11.6 version(2023-06-07)。
所以你需要更新你的当前版本。