残念ながら、Google をいくら検索しても、これで私のハイドを救うことはできませんでした。どのUIViewでも、電話の画面に触れるたびにSIGABRTエラーが発生しているようです。デバッガー コンソールは、SIGABRT の前に次のエラーをポストします。
.... [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
。)
喜んでコードを投稿しますが、実際には、この問題がどこから発生しているのかを見つける (または推測する) ことはできません。これは、1 つの UIView では発生していませんが、スタック内のすべての UIView で発生しています。ただし、表示ロジックを要約することはできますが、おそらくそれでいくらかの光が当たるでしょう。
したがって、アプリケーションが作成され、UIWindow が割り当てられます。次に、単一のビューコントローラーが割り当てられ、それが独自の空白の self.view を作成して追加します。これには、さまざまなゲームの状態を表す他の UIView がアタッチされます。
興味深いことに、このエラーはシミュレーターでは発生しませんが、デバイスでは一貫して発生します。また、アプリケーションがまだ 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