问题
I want to play a m3u8 link on UIWebView (iOS 9.2.1) when the page is loaded the play icon of the quickTime player appears when pressed (only on iPhone devices) the player fills the all screen and the log gives this warning :
This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.
Stack:(
0 CoreFoundation 0x23e74123 <redacted> + 150
1 libobjc.A.dylib 0x2361ae17 objc_exception_throw + 38
2 CoreFoundation 0x23e74051 <redacted> + 0
3 Foundation 0x24754acb <redacted> + 170
4 Foundation 0x245fa3bf <redacted> + 38
5 UIKit 0x280b69d5 <redacted> + 52
6 UIKit 0x280b73bb <redacted> + 222
7 UIKit 0x287d0293 <redacted> + 322
8 UIKit 0x282b155d <redacted> + 148
9 UIKit 0x27facd13 <redacted> + 714
10 QuartzCore 0x260abf99 <redacted> + 128
11 QuartzCore 0x260a7695 <redacted> + 348
12 QuartzCore 0x260a7529 <redacted> + 16
13 QuartzCore 0x260a6a49 <redacted> + 368
14 QuartzCore 0x260a66fb <redacted> + 614
15 WebCore 0x27b7a61b <redacted> + 274
16 CoreFoundation 0x23e3768f <redacted> + 14
17 CoreFoundation 0x23e3727d <redacted> + 452
18 CoreFoundation 0x23e355eb <redacted> + 794
19 CoreFoundation 0x23d88bf9 CFRunLoopRunSpecific + 520
20 CoreFoundation 0x23d889e5 CFRunLoopRunInMode + 108
21 WebCore 0x2713547f <redacted> + 422
22 libsystem_pthread.dylib 0x23bad85b <redacted> + 138
23 libsystem_pthread.dylib 0x23bad7cf _pthread_start + 110
24 libsystem_pthread.dylib 0x23bab724 thread_start + 8
)
This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.
Stack:(
0 CoreFoundation 0x23e74123 <redacted> + 150
1 libobjc.A.dylib 0x2361ae17 objc_exception_throw + 38
2 CoreFoundation 0x23e74051 <redacted> + 0
3 Foundation 0x24754acb <redacted> + 170
4 Foundation 0x245fa3bf <redacted> + 38
5 UIKit 0x280b69d5 <redacted> + 52
6 UIKit 0x287cfc89 <redacted> + 132
7 UIKit 0x280b76bf <redacted> + 86
8 Foundation 0x245fa499 <redacted> + 256
9 UIKit 0x280b69d5 <redacted> + 52
10 UIKit 0x280b73bb <redacted> + 222
11 UIKit 0x287d0293 <redacted> + 322
12 UIKit 0x282b155d <redacted> + 148
13 UIKit 0x27facd13 <redacted> + 714
14 QuartzCore 0x260abf99 <redacted> + 128
15 QuartzCore 0x260a7695 <redacted> + 348
16 QuartzCore 0x260a7529 <redacted> + 16
17 QuartzCore 0x260a6a49 <redacted> + 368
18 QuartzCore 0x260a66fb <redacted> + 614
19 WebCore 0x27b7a61b <redacted> + 274
20 CoreFoundation 0x23e3768f <redacted> + 14
21 CoreFoundation 0x23e3727d <redacted> + 452
22 CoreFoundation 0x23e355eb <redacted> + 794
23 CoreFoundation 0x23d88bf9 CFRunLoopRunSpecific + 520
24 CoreFoundation 0x23d889e5 CFRunLoopRunInMode + 108
25 WebCore 0x2713547f <redacted> + 422
26 libsystem_pthread.dylib 0x23bad85b <redacted> + 138
27 libsystem_pthread.dylib 0x23bad7cf _pthread_start + 110
28 libsystem_pthread.dylib 0x23bab724 thread_start + 8
)
This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.
Stack:(
0 CoreFoundation 0x23e74123 <redacted> + 150
1 libobjc.A.dylib 0x2361ae17 objc_exception_throw + 38
2 CoreFoundation 0x23e74051 <redacted> + 0
3 Foundation 0x24754acb <redacted> + 170
4 Foundation 0x245fe877 <redacted> + 38
5 Foundation 0x245fa503 <redacted> + 362
6 UIKit 0x280b69d5 <redacted> + 52
7 UIKit 0x280b73bb <redacted> + 222
8 UIKit 0x287d0293 <redacted> + 322
9 UIKit 0x282b155d <redacted> + 148
10 UIKit 0x27facd13 <redacted> + 714
11 QuartzCore 0x260abf99 <redacted> + 128
12 QuartzCore 0x260a7695 <redacted> + 348
13 QuartzCore 0x260a7529 <redacted> + 16
14 QuartzCore 0x260a6a49 <redacted> + 368
15 QuartzCore 0x260a66fb <redacted> + 614
16 WebCore 0x27b7a61b <redacted> + 274
17 CoreFoundation 0x23e3768f <redacted> + 14
18 CoreFoundation 0x23e3727d <redacted> + 452
19 CoreFoundation 0x23e355eb <redacted> + 794
20 CoreFoundation 0x23d88bf9 CFRunLoopRunSpecific + 520
21 CoreFoundation 0x23d889e5 CFRunLoopRunInMode + 108
22 WebCore 0x2713547f <redacted> + 422
23 libsystem_pthread.dylib 0x23bad85b <redacted> + 138
24 libsystem_pthread.dylib 0x23bad7cf _pthread_start + 110
25 libsystem_pthread.dylib 0x23bab724 thread_start + 8
)
This doesn't happen on any iPad devices only iPhone ones.
Even tried it on a "skinnier" application still same warning and I'm using the load request of the UIWebView in :
dispatch_async(dispatch_get_main_queue(), ^{
NSString *rec = [_m3u8 string"];
NSURL *url = [NSURL URLWithString:rec];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
self.WebView.allowsInlineMediaPlayback = YES;
[self.WebView loadRequest:request];
});
Thanks to anyone who helps.
回答1:
Well still not much success with UIWebView however there is an object called "WKWebView" that is a part of <WebKit/WebKit.h>
to implement :
#import <WebKit/WebKit.h>
Then to init in your viewDidLoad etc :
WKWebView *w = [[WKWebView alloc]initWithFrame:self.view.bounds];
NSURL *url = [NSURL URLWithString:@"yourLink.m3u8"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[w loadRequest:request];
[self.view addSubview:w];
One more thing add to your .plist file :
App Transport Security Settings - Dictionary.
Allow arbitrary loads = YES.
Its much faster then UIWebView and i don't get the warning mentioned above in the log.
Cheers.
来源:https://stackoverflow.com/questions/35701447/quicktime-player-ios-9-on-uiwebview-giving-warning-after-play-is-pressed