Я пишу игру для iphone на C ++ и 100% OpenGL.
Мне нужно добавить gamecenter, чтобы показать UIViews, что я должен был сделать что-то хакерское.
void sb_socialShowAchievementsView(){
SocialDelegate* del = [[[SocialDelegate alloc] init] autorelease];
GKAchievementViewController *achievements = [[GKAchievementViewController alloc] init];
if (achievements != nil) {
achievements.achievementDelegate = del;
HelperViewController* hvc = [[[HelperViewController alloc] init] autorelease];
[globalGLView addSubview:hvc.view];
[hvc presentModalViewController: achievements animated: YES];
}
[achievements release];
}
SocialDelegate реализует протоколы GKAchievementViewControllerDelegate
и GKLeaderboardViewControllerDelegate
.
globalGLView
- это мой EAGLView
экземпляр.
и HelperViewController
- это просто подкласс UIViewController
.
Проблема в том, что когда я звоню sb_socialShowAchievementsView()
, приложение получает SIGABRT со следующим стеком вызовов и сообщением:
*** Assertion failure in -[UIButtonLabel setTextColor:], /SourceCache/UIKit_Sim/UIKit-1262.60.3/UILabel.m:312
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: color'
#0 0x98ece156 in __kill
#1 0x98ece148 in kill$UNIX2003
#2 0x98f60899 in raise
#3 0x98f769b8 in abort
#4 0x961a2fda in __gnu_cxx::__verbose_terminate_handler
#5 0x03022333 in _objc_terminate
#6 0x961a117a in __cxxabiv1::__terminate
#7 0x961a11ba in std::terminate
#8 0x961a12b8 in __cxa_throw
#9 0x03022481 in objc_exception_throw
#10 0x02e8b238 in +[NSException raise:format:arguments:]
#11 0x022c6e37 in -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
#12 0x0052260f in -[UILabel setTextColor:]
#13 0x005ec3d3 in -[UIButton layoutSubviews]
#14 0x002a0481 in -[CALayer layoutSublayers]
#15 0x002a01b1 in CALayerLayoutIfNeeded
#16 0x004bd976 in __-[UINavigationController _positionNavigationBarHidden:edge:]_block_invoke_1
#17 0x0043698f in +[UIView(Animation) _performWithoutAnimation:]
#18 0x004c1e26 in -[UINavigationController _positionNavigationBarHidden:edge:]
#19 0x004bd9ae in -[UINavigationController _positionNavigationBarHidden:]
#20 0x004bc0c3 in -[UINavigationController _updateBarsForCurrentInterfaceOrientation]
#21 0x004b99b1 in -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]
#22 0x004c0bfd in -[UINavigationController viewDidMoveToWindow:shouldAppearOrDisappear:]
#23 0x0044217f in -[UIView(Internal) _didMoveFromWindow:toWindow:]
#24 0x00440d94 in -[UIView(Hierarchy) _postMovedFromSuperview:]
#25 0x00439c30 in -[UIView(Internal) _addSubview:positioned:relativeTo:]
#26 0x00437f83 in -[UIView(Hierarchy) addSubview:]
#27 0x0049355b in -[UITransitionView transition:fromView:toView:]
#28 0x006a3a16 in -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:]
#29 0x004b710d in -[UIViewController presentModalViewController:withTransition:]
#30 0x0007ee96 in sb_socialShowAchievementsView at social-bindings-iphone.mm:184
Я просто не могу понять, что я делаю не так ...