2015-04-08 26 views
15

Bir soru sormak çok geniş görünüyor, ancak bu hatayı düzeltmek için çok can sıkıcı ve zordur.WebThread MPVolumeSlider'da iPhone uygulaması çöküyor

İşte Crashlytics'ten aldığım WebThread için kilitlenme günlüğü.

Ben geliştirme sırasında çökmesi bu tür görmemiştim
Thread : Crashed: WebThread 
0 libobjc.A.dylib    0x0000000193e97bd0 objc_msgSend + 16 
1 UIKit       0x0000000187f65dd8 +[UIViewAnimationState popAnimationState] + 332 
2 MediaPlayer     0x0000000185953358 -[MPVolumeSlider volumeController:volumeValueDidChange:] + 92 
3 MediaPlayer     0x00000001859c5fc4 -[MPVolumeController updateVolumeValue] + 260 
4 MediaPlayer     0x0000000185952cb0 -[MPVolumeSlider didMoveToSuperview] + 144 
5 UIKit       0x0000000187f2c1dc -[UIView(Hierarchy) _postMovedFromSuperview:] + 484 
6 UIKit       0x0000000187f37cbc -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1764 
7 MediaPlayer     0x0000000185955f54 -[MPVolumeView _createSubviews] + 264 
8 MediaPlayer     0x00000001859549d4 -[MPVolumeView _initWithStyle:] + 240 
9 MediaPlayer     0x0000000185954a60 -[MPVolumeView initWithFrame:style:] + 88 
10 WebCore      0x0000000191ba4684 -[WebMediaSessionHelper initWithCallback:] + 132 
11 WebCore      0x0000000191ba3db8 WebCore::MediaSessionManageriOS::MediaSessionManageriOS() + 96 
12 WebCore      0x0000000191ba3d28 WebCore::MediaSessionManager::sharedManager() + 56 
13 WebCore      0x0000000191ba2890 WebCore::MediaSession::MediaSession(WebCore::MediaSessionClient&) + 44 
14 WebCore      0x00000001916e8604 WebCore::HTMLMediaSession::create(WebCore::MediaSessionClient&) + 36 
15 WebCore      0x00000001916d0fb0 WebCore::HTMLMediaElement::HTMLMediaElement(WebCore::QualifiedName const&, WebCore::Document&, bool) + 1100 
16 WebCore      0x000000019170a2b4 WebCore::HTMLVideoElement::create(WebCore::QualifiedName const&, WebCore::Document&, bool) + 68 
17 WebCore      0x00000001916bdd9c WebCore::videoConstructor(WebCore::QualifiedName const&, WebCore::Document&, WebCore::HTMLFormElement*, bool) + 92 

(I Kırılma noktası ve konsol günlüğü ile alabildiğimde çok mutlu olurdu), ancak canlı açıkken yalnızca kullanıcılara görünür.

Sadece crashlytics tarafından bildirilebilir.

Olası sebep;

Uygulama, MagicalRecord kullanır ve başlatıldığında arka planda sunucudan veri alır. Bu, çoklu iş parçacığı kullanır ve webkit UIKit parçasını ve kilitlemeyi kullandığında, başka bir ana iş parçacığı ona erişmek gibi görünüyor. Bu nedenle, tüm dispatch_sync öğelerini kaldırmayı denedim ve dispatch_async olarak değiştirdim ancak birkaç işlev çağrısı yaptıktan sonra çökmeler yeniden meydana geliyor.

Bilmek istediğim, neden WebCore çalışıyor ve UIWebView üzerinde MPVolumeController istemedim.

Herhangi bir nedenle arka planda çalışabilirler, neden çöküyor? Sık sık oluyor ve kullanıcılar şikayet ediyor.

Diğerleri aynı sorunu yaşıyor mu?

+0

aynı ve iOS 8. görünmeye başladı ....:

böyle düzelttim – cujo30227

+0

Ayrıca, Apple'ın dev forumlarında veya başka bir şeyde bir şey görmüyorum. – bpapa

+0

UIWebView'den WKWebView'e geçiş yapmanın yardımcı olacağını ama henüz denemediğini merak ediyorum. – bpapa

cevap

2

Bu hata audio veya video unsurları içeren HTML rasgele çökecek edecek yükler iOS 8. beri

UIWebView oluştu. Ben boşuna, bir çözüm arayan gün geçirdi Benim en sık kilitlenme var ... Burada

@interface H5WebKitBugsManager : NSObject 

+ (void)fixAllBugs; 

@end 


#import "H5WebKitBugsManager.h" 
#import <objc/runtime.h> 

void H5Swizzle(Class c, SEL orig, SEL new) 
{ 
    Method origMethod = class_getInstanceMethod(c, orig); 
    Method newMethod = class_getInstanceMethod(c, new); 
    if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))) { 
     class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod)); 
    } else { 
     method_exchangeImplementations(origMethod, newMethod); 
    } 
} 

@implementation H5WebKitBugsManager 

+ (void)fixAllBugs 
{ 
    [self fixBug_MediaPlayerVolumeView]; 
} 

+ (void)fixBug_MediaPlayerVolumeView 
{ 
    CGFloat systemVersion = [UIDevice currentDevice].systemVersion.floatValue; 

    if (systemVersion < 8.0f || systemVersion > 9.1) { 
    // below ios version 8.0 has no VolumeView 
     return; 
    } 

    Class cls = NSClassFromString(@"WebMediaSessionHelper"); 
    NSString *allocateVolumeView = @"allocateVolumeView"; 
    SEL orig = NSSelectorFromString(allocateVolumeView); 
    SEL new = @selector(H5WKBMAllocateVolumeView); 
    Method newMethod = class_getInstanceMethod(self, new); 

    if(class_addMethod(cls, new, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))) { 
     H5Swizzle(cls, orig, new); 
    } 
} 

- (void)H5WKBMAllocateVolumeView 
{ 
    // WebKit's MediaSessionManageriOS is a singleton,in MediaSessionManageriOS.m. svn version181,859. 
    static dispatch_once_t onceToken; 
    dispatch_once(&onceToken, ^{ 
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 
      // must be dispatch in background thread 
      [self H5WKBMAllocateVolumeView]; 
     }); 
    }); 
} 

@end 
+0

açmak için bir sebep yok Bu görünüyor MPVolumeView '' 'init 'init' bg iş parçacığı sorunu neden olur. WebThread'de (bg iş parçacığı) "allocateVolumeView" zaten var. – ooops

İlgili konular