diff options
author | jmkiley <jordan.kiley@mapbox.com> | 2018-11-06 15:48:47 -0800 |
---|---|---|
committer | jmkiley <jordan.kiley@mapbox.com> | 2018-11-06 15:48:47 -0800 |
commit | 4c7eeffa7e4a5cfea11431de8d1f55740c34a715 (patch) | |
tree | 54d89de02f1679fa814073e2cf53ced3da7665c0 | |
parent | bb55bae76db4454affa2cacca956e726a2b43a4b (diff) | |
download | qtlocation-mapboxgl-4c7eeffa7e4a5cfea11431de8d1f55740c34a715.tar.gz |
[ios] move creation of attributed string to global queue]
-rw-r--r-- | platform/darwin/src/MGLAttributionInfo.mm | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/platform/darwin/src/MGLAttributionInfo.mm b/platform/darwin/src/MGLAttributionInfo.mm index e8d6a203d0..07b9195942 100644 --- a/platform/darwin/src/MGLAttributionInfo.mm +++ b/platform/darwin/src/MGLAttributionInfo.mm @@ -65,10 +65,15 @@ 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 |