Fixed Parse runtime exception for open-source MAPS.ME version.

This commit is contained in:
Alex Zolotarev 2016-02-23 21:51:18 +03:00
parent 07cb0c8b82
commit 181e1028f8
2 changed files with 13 additions and 3 deletions

View file

@ -228,7 +228,12 @@ public class MwmApplication extends Application
*/
private void initParse()
{
Parse.initialize(this, PrivateVariables.parseApplicationId(), PrivateVariables.parseClientKey());
// Do not initialize Parse in default open-source version.
final String appId = PrivateVariables.parseApplicationId();
if (appId.isEmpty())
return;
Parse.initialize(this, appId, PrivateVariables.parseClientKey());
ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback()
{
@Override

View file

@ -111,8 +111,13 @@ void InitLocalizedStrings()
- (void)registerNotifications:(UIApplication *)application launchOptions:(NSDictionary *)launchOptions
{
[Parse enableLocalDatastore];
[Parse setApplicationId:@(PARSE_APPLICATION_ID) clientKey:@(PARSE_CLIENT_KEY)];
// Do not initialize Parse for open-source version due to an error:
// Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: ''applicationId' should not be nil.'
if (!string(PARSE_APPLICATION_ID).empty())
{
[Parse enableLocalDatastore];
[Parse setApplicationId:@(PARSE_APPLICATION_ID) clientKey:@(PARSE_CLIENT_KEY)];
}
[PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:launchOptions];
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound);
if ([application respondsToSelector: @selector(registerUserNotificationSettings:)])