mirror of
https://github.com/scratchfoundation/scratchjr.git
synced 2024-11-28 18:15:37 -05:00
Fix Runtime Issues:
ScratchJr.m: runtime: UI API called from background thread: -[UIView removeFromSuperview] must be used from main thread only IO.m: runtime: UI API called from background thread: -[UIWebView stringByEvaluatingJavaScriptFromString:] must be used from main thread only
This commit is contained in:
parent
6f59d224e7
commit
2da2fad26c
2 changed files with 10 additions and 6 deletions
|
@ -280,12 +280,14 @@ NSMutableDictionary *soundtimers;
|
|||
}
|
||||
|
||||
+ (void)soundEnded:(NSTimer*)timer {
|
||||
NSString *soundName = [[timer userInfo] objectForKey:@"soundName"];
|
||||
if (sounds[soundName] == nil) return;
|
||||
NSString *callback = [NSString stringWithFormat:@"iOS.soundDone('%@');", soundName];
|
||||
UIWebView *webview = [ViewController webview];
|
||||
NSString *soundName = [[timer userInfo] objectForKey:@"soundName"];
|
||||
if (sounds[soundName] == nil) return;
|
||||
NSString *callback = [NSString stringWithFormat:@"iOS.soundDone('%@');", soundName];
|
||||
UIWebView *webview = [ViewController webview];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[webview stringByEvaluatingJavaScriptFromString:callback];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+ (NSString *)stopSound :(NSString*)name {
|
||||
AVAudioPlayer *snd = sounds[name];
|
||||
|
|
|
@ -19,7 +19,9 @@ NSString *oncomplete;
|
|||
|
||||
+ (NSString *) hideSplash :(NSString *)body{
|
||||
UIImageView* splashScreen = [ViewController splashScreen];
|
||||
[splashScreen removeFromSuperview];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[splashScreen removeFromSuperview];
|
||||
});
|
||||
return @"1";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue