LoginSignup
0
0

More than 5 years have passed since last update.

gtm-oauth2でサインイン時エラーになる現象の回避

Posted at

GoogleのOAuth2ライブラリ「gtm-oauth2」ですが、なぜかログインでエラーになります。
(自分の環境だけかもしれませんが)

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString unsignedLongValue]: unrecognized selector sent to instance 0x71ae470'

コードを追いかけていたらここでエラーになっているのがわかりました。

GTMOAuth2Authentication.m
- (void)updateExpirationDate {
  NSDate *date = nil;

  // NSNumber *expiresIn = self.expiresIn;
  NSNumber *expiresIn = @86400;

  if (expiresIn) {
    // ここでエラーになっていた
    unsigned long deltaSeconds = [expiresIn unsignedLongValue];
    if (deltaSeconds > 0) {
      date = [NSDate dateWithTimeIntervalSinceNow:deltaSeconds];
    }
  }
  self.expirationDate = date;
}

上記のように、[expiresIn unsignedLongValue] でエラーになっていたのですが、expiresInの中身が「86400」だったので直接入力したらエラーを回避することができました。

もっとちゃんとした回答があると思うのですが、ひとまずの回避法ということで。
ご存じの方は情報くださいませ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0