2016-12-14 82 views
0

SignInViewController完成用戶名和密碼字段後,當到目前爲止。線程1:信號SIGABRT(無法投類型的值「SignInViewController」到「AWSCognitoIdentityPasswordAuthentication」)

這是代碼的樣子:從SignInViewControllerExtension類

代碼

func startPasswordAuthentication() -> AWSCognitoIdentityPasswordAuthentication { 
     return self as! AWSCognitoIdentityPasswordAuthentication 
} 

SignInViewControllerExtensions拋出一個線程1:信號SIGABRT誤差在調試區以下信息:

無法投射'Elixr.SignIn'類型的值ViewController'(0x1001460a8)轉換爲'AWSCognitoIdentityPasswordAuthentication'(0x100134468)。

回答

0

您可能試圖將Elixr.SignInViewController指定爲AWSCognitoIdentityPasswordAuthentication某處。但是如果不看實際的代碼,我不能說更多。

,但我想它會是這個樣子......

let someVc = SignInViewController(args_here) as! AWSCognitoIdentityPasswordAuthentication 

as!上述正試圖力投東西是不是AWSCognito...所以代碼會崩潰。

+0

好吧,我將我的代碼,我忘了前加入。 –

+0

@TimmyT這裏有什麼'self'?我猜這不是'AWSCognitoIdentityPasswordAuthentication' –

+0

我添加了所有的代碼。 「自我」是指'SignInViewController' –

相關問題