summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Kiley <jmkiley@users.noreply.github.com>2018-11-06 15:54:08 -0800
committerGitHub <noreply@github.com>2018-11-06 15:54:08 -0800
commitda5ab811b673d96441a2d5e44bf9a5a65299a0fc (patch)
tree06d460d4e9b549ea794cdcfd19a5c5d79b12dd97
parente35921e504a94cbe5f8cbc35b15943f1d2e8903f (diff)
downloadqtlocation-mapboxgl-da5ab811b673d96441a2d5e44bf9a5a65299a0fc.tar.gz
[iOS] Move creation of attributed string to global queue (#13298)
-rw-r--r--platform/darwin/src/MGLAttributionInfo.mm14
1 files changed, 10 insertions, 4 deletions
diff --git a/platform/darwin/src/MGLAttributionInfo.mm b/platform/darwin/src/MGLAttributionInfo.mm
index 07d10e852b..5fa121f5f8 100644
--- a/platform/darwin/src/MGLAttributionInfo.mm
+++ b/platform/darwin/src/MGLAttributionInfo.mm
@@ -65,10 +65,16 @@
NSData *htmlData = [styledHTML dataUsingEncoding:NSUTF8StringEncoding];
#if TARGET_OS_IPHONE
- NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithData:htmlData
- options:options
- documentAttributes:nil
- error:NULL];
+
+ __block NSMutableAttributedString *attributedString;
+
+ dispatch_sync(dispatch_get_main_queue() , ^{
+ // This initializer should be called from a global or main queue. https://developer.apple.com/documentation/foundation/nsattributedstring/1524613-initwithdata
+ attributedString = [[NSMutableAttributedString alloc] initWithData:htmlData
+ options:options
+ documentAttributes:nil
+ error:NULL];
+ });
#else
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithHTML:htmlData
options:options