恐怕沒有任何數量的谷歌搜索已經能夠保存我的海德了。我在任何時候在任何UIView上觸摸手機的屏幕時,似乎都會收到SIGABRT錯誤。調試器控制檯的帖子這個錯誤的SIGABRT前:SIGABRT在任何UIView觸摸上
.... [310:207] *** -[UIView _exclusiveTouchView]: unrecognized selector sent to instance 0x14c0c0
.... [310:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIView _exclusiveTouchView]: unrecognized selector sent to instance 0x14c0c0'
(這不是我要_exclusiveTouchView
特定的呼叫,當然)。
我會很高興地發佈一些代碼,但事實是我無法找到(或猜測)這個問題可能來自哪裏。這不會發生在任何一個UIView上,而是在我的堆棧中的所有UIViews上。不過,我可以總結一下顯示邏輯,也許這樣會顯露出一些亮點。
所以創建應用程序並分配UIWindow。然後分配一個單獨的viewcontroller,這會創建並添加自己的空白self.view,其中附加了代表不同遊戲狀態的其他UIViews。
有趣的是,這個錯誤不會發生在模擬器上,但會一直髮生在設備上。我還應該提到應用程序尚未覆蓋/使用任何touchesBegan:/ Ended:/ Moved:等等......換言之,在代碼中發生這種錯誤而沒有這些方法。
我真的不知道這個錯誤來自哪裏......任何建議?
EDIT這裏請求碼是仍然生成觸摸SIGABRT的簡化狀態:
#import <UIKit/UIKit.h>
#import "WPGame.h"
@class WPGame;
extern WPGame *theGame;
#import "WPGameState.h"
@class IntroView;
@interface IntroStateView : WPGameState {
NSTimer *introTimer;
}
+(IntroStateView*)instance;
@end
。
#import "IntroStateView.h"
#import "StartMenuStateView.h"
static IntroStateView *theOnlyIntro = nil;
@implementation IntroStateView
+(IntroStateView*)instance {
@synchronized(self) {
if (!theOnlyIntro) {
theOnlyIntro = [[IntroStateView alloc] init];
}
}
return theOnlyIntro;
}
- (void)excuseYourself {
[self changeStateOf:theGame toState:[StartMenuStateView instance]];
}
- (void)startUp {
[super startUp];
introTimer = [NSTimer scheduledTimerWithTimeInterval:[theGame introLength]
target:self
selector:@selector(excuseYourself)
userInfo:NULL
repeats:NO];
}
- (void)cleanUp {
[super cleanUp];
}
- (void)handleEvents:(WPGame*)game {
[super handleEvents:game];
}
- (void)dealloc {
theOnlyIntro = nil;
[super dealloc];
}
@end
,如果你需要看到的UIView的WPGameState子類的部分,它可以在這裏找到了節省一些後長度:http://tinypaste.com/732bb
請提供重現問題的最簡單的UIView子類代碼。我們將能夠從那裏提供幫助。 – 2010-04-23 15:24:02
不知道它是否直接相關,但使用單身視圖絕對是單身濫用。意見應該是愚蠢和可互換的。每個視圖應該只有足夠的邏輯來處理其即時顯示需求。他們不應該有關鍵的應用程序邏輯,以便每個應用程序只有一個存在。你需要重新考慮你的設計。 – TechZen 2010-04-23 16:32:59
@TechZen - 在設計方面,這些獨特的視圖負責代表各個遊戲狀態的大部分自己的環境。他們意味着有重要的邏輯,但不是應用邏輯。不過,我同意非遊戲應用程序應該遠離單例視圖。 – bitcruncher 2010-04-23 17:45:03