2017-02-08 4 views
-3

サインインプロセスを実装するためにすべてのAWS SDKをプロジェクトにロードした後、このエラーが発生します。すべてのファイルが正常に読み込まれます。 私はおそらく不足しているものを知っている誰ですか? cognitoユーザプールのインスタンスを作成する前に、あなたの助けユーザープールが登録されていません

2017-02-08 16:37:05.799 ClientService2[37948:950374] Presenting view controllers on detached view controllers is discouraged <ClientService2.ClientListTableViewController: 0x7fafb3e05040>. 
2017-02-08 16:37:06.495 ClientService2[37948:950374] Unbalanced calls to begin/end appearance transitions for <UINavigationController: 0x7fafb4807a00>. 
2017-02-08 16:37:07.288 ClientService2[37948:950374] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'User Pool not registered. The method `setupUserPoolWithId:cognitoIdentityUserPoolAppClientId:cognitoIdentityUserPoolAppClientSecret:region` has to be called once before accessing the shared instance.' 
*** First throw call stack: 
(
    0 CoreFoundation      0x0000000102d0fd4b __exceptionPreprocess + 171 
    1 libobjc.A.dylib      0x000000010277121e objc_exception_throw + 48 
    2 ClientService2      0x0000000101a213cb +[AWSCognitoUserPoolsSignInProvider sharedInstance] + 171 
    3 ClientService2      0x0000000101a03f65 _TFC14ClientService220SignInViewController18handleCustomSignInfT_T_ + 69 
    4 ClientService2      0x0000000101a04042 _TToFC14ClientService220SignInViewController18handleCustomSignInfT_T_ + 34 
    5 UIKit        0x00000001031358bc -[UIApplication sendAction:to:from:forEvent:] + 83 
    6 UIKit        0x00000001032bbc38 -[UIControl sendAction:to:forEvent:] + 67 
    7 UIKit        0x00000001032bbf51 -[UIControl _sendActionsForEvents:withEvent:] + 444 
    8 UIKit        0x00000001032bae4d -[UIControl touchesEnded:withEvent:] + 668 
    9 UIKit        0x00000001031a3545 -[UIWindow _sendTouchesForEvent:] + 2747 
    10 UIKit        0x00000001031a4c33 -[UIWindow sendEvent:] + 4011 
    11 UIKit        0x00000001031519ab -[UIApplication sendEvent:] + 371 
    12 UIKit        0x000000010393e72d __dispatchPreprocessedEventFromEventQueue + 3248 
    13 UIKit        0x0000000103937463 __handleEventQueue + 4879 
    14 CoreFoundation      0x0000000102cb4761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 
    15 CoreFoundation      0x0000000102c9998c __CFRunLoopDoSources0 + 556 
    16 CoreFoundation      0x0000000102c98e76 __CFRunLoopRun + 918 
    17 CoreFoundation      0x0000000102c98884 CFRunLoopRunSpecific + 420 
    18 GraphicsServices     0x0000000107268a6f GSEventRunModal + 161 
    19 UIKit        0x0000000103133c68 UIApplicationMain + 159 
    20 ClientService2      0x0000000101a20bbf main + 111 
    21 libdyld.dylib      0x000000010539168d start + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
+0

ユーザープールがまだ登録されていないと思われます。これは、setupUserPoolWithId:cognitoIdentityUserPoolAppClientId:cognitoIdentityUserPoolAppClientSecret:共有インスタンスにアクセスする前に一度領域を呼び出すことで解決できます。 – shallowThought

答えて

0

ため

おかげで、あなたはコンソールで提供される情報を使用して、ユーザーのプールを登録する必要があります。この情報は、clientId、poolId、およびclientSecretです。その後、ユーザープールインスタンスを正しく作成できます。

例えば、アプリが起動し、次の操作を行う必要があります。

その後
let poolName = "poolName" 

// You should update the region to be the one where you created the pool 
let serviceConfiguration = AWSServiceConfiguration(region: AWSRegionType.usWest2, credentialsProvider: nil) 

let configuration = AWSCognitoIdentityUserPoolConfiguration(clientId: "Client Id found in the console here", clientSecret: "Client secret found in the console here", poolId: "Pool Id here") 

AWSCognitoIdentityUserPool.register(with: serviceConfiguration, userPoolConfiguration: configuration, forKey: poolName) 

、次の操作を実行して、ユーザー・プールへの参照を取得することができます:

let userPool = AWSCognitoIdentityUserPool(forKey: poolName) 

すべて上記の情報はユーザープールコンソールにあります!

関連する問題