使用 AWSAppSync ios sdk,尝试配置 AWSAppSyncClient,模拟器在尝试创建 Reachability 实例时崩溃(尝试获取 UserPoolsAuthProvider 时):
let appSyncConfig = try AWSAppSyncClientConfiguration(appSyncServiceConfig: AWSAppSyncServiceConfig(),
userPoolsAuthProvider: {
class MyCognitoUserPoolsAuthProvider : AWSCognitoUserPoolsAuthProviderAsync {
func getLatestAuthToken(_ callback: @escaping (String?, Error?) -> Void) {
AWSMobileClient.default().getTokens { (tokens, error) in
if error != nil {
callback(nil, error)
} else {
callback(tokens?.idToken?.tokenString, nil)
}
}
}
}
return MyCognitoUserPoolsAuthProvider()}(),
cacheConfiguration: cacheConfiguration)
以下是完整的错误消息:
dyld:惰性符号绑定失败:找不到符号:_$sSo18NSNotificationNamea12ReachabilityE19reachabilityChangedABvau 引用自:/Users/user/Library/Developer/CoreSimulator/Devices/5BD6D58E-C91E-4737-AD3B-547E9D77770B/data/Containers/Bundle/Application/F8307EF9- 70B5-4834-BFC4-D340DCF4D3DD/nano-staging.app/Frameworks/AWSAppSync.framework/AWSAppSync 预期在:/Users/user/Library/Developer/CoreSimulator/Devices/5BD6D58E-C91E-4737-AD3B-547E9D77770B/data/Containers /Bundle/Application/F8307EF9-70B5-4834-BFC4-D340DCF4D3DD/nano-staging.app/Frameworks/Reachability.framework/Reachability
使用 aws-mobile-appsync-sdk-ios v3.1.11 和 Reachability v5.1.0,非常感谢任何帮助!