Skip to content

Commit

Permalink
Fix use of UIKit on background thread in AssetFetcher
Browse files Browse the repository at this point in the history
Change-Id: Ib350e92434fa04721ab034da8a81fbc463b141f1
  • Loading branch information
ewpatton authored and SusanRatiLane committed Dec 19, 2024
1 parent 8cf918e commit 3935ae0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions appinventor/components-ios/src/AssetFetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ class AssetLoadError: Error {
if success {
RetValManager.shared().assetTransferred(asset)
} else if let error = error {
guard let window = UIApplication.shared.keyWindow else {
return
DispatchQueue.main.async {
guard let window = UIApplication.shared.keyWindow else {
return
}
let center = CGPoint(x: window.frame.size.width / 2.0, y: window.frame.size.height / 2.0)
window.makeToast("Unable to load \(asset) with error \(error)", point: center,
title: nil, image: nil, completion: nil)
}
let center = CGPoint(x: window.frame.size.width / 2.0, y: window.frame.size.height / 2.0)
window.makeToast("Unable to load \(asset) with error \(error)", point: center,
title: nil, image: nil, completion: nil)
}
}
}
Expand Down

0 comments on commit 3935ae0

Please sign in to comment.