2010-05-22 170 views
0

我有一个带有常规UIWebView的iPhone/iPad应用程序(通用二进制文件),它在Internet上显示网页。当用户按下Youtube嵌入时,iPhone应用程序正常运行 - 打开视频播放器,关闭它时,它会返回到应用程序。然而,在iPad上它当Youtube播放器点击时,iPad应用程序崩溃UIWebView

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIWindow addEventMonitor:]: unrecognized selector sent to instance 0x1219c0' 

#0 0x30c8e0a0 in __kill() 
#1 0x30c8e096 in kill() 
#2 0x30c8e088 in raise() 
#3 0x30ca2210 in abort() 
#4 0x32944a22 in __gnu_cxx::__verbose_terminate_handler() 
#5 0x335657ca in _objc_terminate() 
#6 0x32942df4 in __cxxabiv1::__terminate() 
#7 0x32942e48 in std::terminate() 
#8 0x32942f18 in __cxa_throw() 
#9 0x335646aa in objc_exception_throw() 
#10 0x32c9517a in -[NSObject doesNotRecognizeSelector:]() 
#11 0x32c94b00 in ___forwarding___() 
#12 0x32c316d0 in __forwarding_prep_0___() 
#13 0x32810492 in -[MPInactivityMonitor initForWindow:inactivityDuration:delegate:]() 
#14 0x32831dfe in -[MPFullScreenVideoViewController _createInactivityMonitor]() 
#15 0x328324bc in -[MPFullScreenVideoViewController showOverlayAnimated:]() 
#16 0x32833612 in -[MPAbstractFullScreenVideoViewController setControlsOverlayVisible:animate:]() 
#17 0x3281fca4 in -[UIMoviePlayerController setControlsOverlayVisible:disableAutohide:animate:]() 
#18 0x330bb444 in -[YTMovieView _switchToVideo:]() 
#19 0x330bb028 in -[YTMovieView willShowForVideo:inList:orVideoID:]() 
#20 0x04b8d142 in dyld_stub_time() 
#21 0x04b8b82e in dyld_stub_time() 
#22 0x32c2616c in -[NSObject performSelector:withObject:withObject:]() 
#23 0x3152716c in -[UIApplication sendAction:to:from:forEvent:]() 
#24 0x3152710c in -[UIApplication sendAction:toTarget:fromSender:forEvent:]() 
#25 0x315270de in -[UIControl sendAction:to:forEvent:]() 
#26 0x31526e30 in -[UIControl(Internal) _sendActionsForEvents:withEvent:]() 
#27 0x3152747e in -[UIControl touchesEnded:withEvent:]() 
#28 0x31525e54 in -[UIWindow _sendTouchesForEvent:]() 
#29 0x3152579c in -[UIWindow sendEvent:]() 
#30 0x315213be in -[UIApplication sendEvent:]() 
#31 0x31520d2a in _UIApplicationHandleEvent() 
#32 0x30d62b32 in PurpleEventCallback() 
#33 0x32c23d9c in CFRunLoopRunSpecific() 
#34 0x32c234e0 in CFRunLoopRunInMode() 
#35 0x30d620da in GSEventRunModal() 
#36 0x30d62186 in GSEventRun() 
#37 0x314d54c8 in -[UIApplication _run]() 
#38 0x314d39f2 in UIApplicationMain() 

崩溃(我甚至不看我在堆栈跟踪的应用程序(除了顶级的main.m)

在iPad的移动Safari浏览器,在同网页上,视频将在网页上就地播放。有什么我必须做的,以实现这一目标?或者我忘了启用东西吗?

+0

我在黑暗中拍摄这里,所以忍受着我。你有没有尝试过包括MediaPlayer.Framework?你真的不应该,但它似乎在打破。还要确保iPad上的操作系统版本是最新版本(尽管我不认为他们在iPad第一个版本发布后发布了任何更新) – 2010-05-22 05:23:07

+0

我试过了&没有mediaplayer框架 - 没有区别。 我以同样的方式创建另一个“你好世界”的应用程序(iphone应用程序,升级到ipad)和youtube视频工作正常。所以我已经手动移植代码:-P仍然不知道什么损坏了旧的应用程序 – choonkeat 2010-05-22 09:47:26

回答

0

据我所知这个问题只适用于通用二进制文件,编译在iPhone OS 3.1.3及更低版本下,不仅仅是YouTube视频,还包括加载到UIWebView中的各种媒体文件。 作为解决方案你可以重写UIWindow并添加一些虚拟方法。

@interface MyWindow : UIWindow { 
} 
@end 

@implementation MyWindow { 
- (void)addEventMonitor:(void *)monitor {} 
- (void)pendingMouseUpCount {} 
} 
+0

我该怎么做?在我的视图控制器? – choonkeat 2010-06-02 14:34:22

+0

当您将[window makeKeyAndVisible]调入appDelegate时,您应该使用MyWindow类的对象,该对象在答案中描述。 – FalconSer 2010-06-03 09:50:28

+0

无法编辑您的答案。从你在这里建议的是我用它来改变它。 http://gist.github.com/427258 但是,我没有在我的最终应用中使用这个。我手动重新创建应用程序(仍然iphone应用程序>升级到ipad),它“只是工作”没有这个黑客。所以我不完全确定是什么破坏了旧项目。 – choonkeat 2010-06-06 03:09:41

相关问题