2016-10-18 2 views
0

Firebase RemoteConfigから情報を取得できません。アプリケーションのインストール時に、MainControllerビューコントローラの前に言語選択画面があります。 MainController Viewコントローラでは、RemoteConfigフェッチを実行しています。 MainControllerビューコントローラの前に言語選択画面が表示されるのは初めてです。しかし、次回から、それは、この特定の行にクラッシュ:Firebase Remote Config Crashing(目的のiOS)

[self.remoteConfig fetchWithExpirationDuration:expirationDuration completionHandler:^(FIRRemoteConfigFetchStatus status, NSError *error) { 

次の例外を除いて:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString firstObject]: unrecognized selector sent to instance 0xa0000000000616a2' 
*** First throw call stack: 
(
    0 CoreFoundation      0x000000010d20134b __exceptionPreprocess + 171 
    1 libobjc.A.dylib      0x000000010cc6221e objc_exception_throw + 48 
    2 CoreFoundation      0x000000010d270f34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 
    3 CoreFoundation      0x000000010d186c15 ___forwarding___ + 1013 
    4 CoreFoundation      0x000000010d186798 _CF_forwarding_prep_0 + 120 
    5 English        0x0000000107f44e1b -[GIPLocale googleLanguageWithAppleLanguages:] + 33 
    6 English        0x0000000107f45396 -[GIPLocale recalculateLocale] + 54 
    7 English        0x0000000107f44c26 -[GIPLocale initWithLanguageMappings:] + 99 
    8 English        0x0000000107f44b77 __25+[GIPLocale googleLocale]_block_invoke + 41 
    9 libdispatch.dylib     0x000000010da900cd _dispatch_client_callout + 8 
    10 libdispatch.dylib     0x000000010da751fc dispatch_once_f + 501 
    11 English        0x0000000107f44b4c +[GIPLocale googleLocale] + 42 
    12 English        0x0000000107f42d06 +[RCNDevice deviceLocale] + 31 
    13 English        0x0000000107f43344 +[RCNDevice hasDeviceContextChanged:projectIdentifier:] + 325 
    14 English        0x0000000107f3e133 -[RCNConfigFetch fetchAllConfigsWithExpirationDuration:completionHandler:] + 150 
    15 English        0x0000000107f3577f -[FIRRemoteConfig fetchWithExpirationDuration:completionHandler:] + 77 

UPDATE:私は言語選択画面を表示するかどうかは問題ではありません。ない。それは常に新しいインストールで動作し、次の起動から作業を停止します。

これは私が使用している完全なコードです。

-(void)viewDidAppear:(BOOL)animated{ 
    //Display select language settings 
    if (![[NSUserDefaults standardUserDefaults] boolForKey:DISPLAY_LANGUAGE_SETTING]) 
    { 
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
     [defaults setBool:TRUE forKey:DISPLAY_LANGUAGE_SETTING]; 
     [defaults synchronize]; 
     //Display Language Screen 
     AGSelectLanguageViewController *languageViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"AGSelectLanguageViewController"]; 
     self.modalPresentationStyle = UIModalPresentationFullScreen; 
     [self presentViewController:languageViewController animated:NO completion:nil]; 
    } 

    [self configFireBase]; 

} 
    -(void)configFireBase{ 
     // Firebase Configuration 
     self.remoteConfig = [FIRRemoteConfig remoteConfig]; 
     //Enabling development mode 
     FIRRemoteConfigSettings *remoteConfigSettings = [[FIRRemoteConfigSettings alloc] initWithDeveloperModeEnabled:YES]; 
     self.remoteConfig.configSettings = remoteConfigSettings; 

     //Set default Remote Config values 
     [self.remoteConfig setDefaultsFromPlistFileName:@"RemoteConfigDefaults"]; 

     [self fetchConfig]; 
    } 

- (void)fetchConfig { 
    _discount_percentage = self.remoteConfig[DISCOUNT_PERCENTAGE].numberValue.floatValue; 

    long expirationDuration = 3600; 

    if (self.remoteConfig.configSettings.isDeveloperModeEnabled) { 
     expirationDuration = 0; 
    } 


    [self.remoteConfig fetchWithExpirationDuration:expirationDuration completionHandler:^(FIRRemoteConfigFetchStatus status, NSError *error) { 
     if (status == FIRRemoteConfigFetchStatusSuccess) { 
      NSLog(@"Config fetched!"); 
      [self.remoteConfig activateFetched]; 
     } else { 
      NSLog(@"Config not fetched"); 
      NSLog(@"Error %@", error.localizedDescription); 
     } 
    }]; 
} 

どこが間違っていますか?助けてください。

答えて

2

GIPLocaleクラスは、ロケールのためのGoogleとAppleの名前の間にいくつかのマッピングを行い、それがNSUserDefaultsからアプリのロケールを引くことの一環として:

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
NSArray *languages = [defaults objectForKey:@"AppleLanguages"]; 

を私はデフォルトのエントリに設定取得されてどこかということを推測しています配列ではなく文字列またはそれに類するもの - アプリケーションの任意の場所でその文字列を参照しているかどうかを確認します。

+0

ありがとうございました:) AppleLanguagesにこの値を挿入しました。 - [デフォルトのsetObject:[localeList objectForKey:languageChoosen] forKey:@ "AppleLanguages"];すべてのトラブルを引き起こしていた。 – Pria

関連する問題