@@ -322,7 +322,9 @@ - (void)defineActions
322322 withArguments: @[[LPActionArg argNamed: LPMT_ARG_URL withString: LPMT_DEFAULT_URL]]
323323 withResponder: ^BOOL (LPActionContext *context) {
324324 @try {
325- [[UIApplication sharedApplication ] openURL: [NSURL URLWithString: [context stringNamed: LPMT_ARG_URL]]];
325+ dispatch_async (dispatch_get_main_queue (), ^{
326+ [[UIApplication sharedApplication ] openURL: [NSURL URLWithString: [context stringNamed: LPMT_ARG_URL]]];
327+ });
326328 return YES ;
327329 }
328330 @catch (NSException *exception) {
@@ -835,6 +837,15 @@ - (void)deferPush
835837
836838- (BOOL )isPushEnabled
837839{
840+ // Run on main thread.
841+ if (![NSThread isMainThread ]) {
842+ BOOL __block output = NO ;
843+ dispatch_sync (dispatch_get_main_queue (), ^{
844+ output = [self isPushEnabled ];
845+ });
846+ return output;
847+ }
848+
838849 UIApplication *application = [UIApplication sharedApplication ];
839850 BOOL enabled;
840851
@@ -1204,9 +1215,11 @@ - (void)refreshPopupContent
12041215
12051216- (void )appStorePrompt
12061217{
1207- if (NSClassFromString (@" SKStoreReviewController" )) {
1208- [SKStoreReviewController requestReview ];
1209- }
1218+ dispatch_async (dispatch_get_main_queue (), ^{
1219+ if (NSClassFromString (@" SKStoreReviewController" )) {
1220+ [SKStoreReviewController requestReview ];
1221+ }
1222+ });
12101223}
12111224
12121225- (BOOL )hasAlternateIcon
@@ -1218,6 +1231,13 @@ - (BOOL)hasAlternateIcon
12181231
12191232- (void )setAlternateIconWithFilename : (NSString *)filename
12201233{
1234+ if (![NSThread isMainThread ]) {
1235+ dispatch_sync (dispatch_get_main_queue (), ^{
1236+ [self setAlternateIconWithFilename: filename];
1237+ return ;
1238+ });
1239+ }
1240+
12211241 NSString *iconName = [filename stringByReplacingOccurrencesOfString: LPMT_ICON_FILE_PREFIX
12221242 withString: @" " ];
12231243 iconName = [iconName stringByReplacingOccurrencesOfString: @" .png" withString: @" " ];
0 commit comments