2015-02-26 7 views
-3

Когда я запускаю свое приложение на устройстве iOS 8+ или более поздней версии, он работает отлично, без ошибок, но когда я запускаю его на устройстве iOS 7.1, приложение вылетает с этим сообщением:Завершение с неперехваченным исключением типа NSException на iOS 7.1

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[SKLabelNode labelNodeWithText:]: unrecognized selector sent to class 0xedc5fc' 
*** First throw call stack: 
(
    0 CoreFoundation      0x0098a1e4 __exceptionPreprocess + 180 
    1 libobjc.A.dylib      0x004d58e5 objc_exception_throw + 44 
    2 CoreFoundation      0x00a270e3 +[NSObject(NSObject) doesNotRecognizeSelector:] + 275 
    3 CoreFoundation      0x0097a50b ___forwarding___ + 1019 
    4 CoreFoundation      0x0097a0ee _CF_forwarding_prep_0 + 14 
    5 Origami Game      0x0002161f -[GBAGameScene initWithSize:] + 495 
    6 Origami Game      0x000281b4 -[GBAMenuScene touchesBegan:withEvent:] + 500 
    7 SpriteKit       0x00e102bf -[SKView touchesBegan:withEvent:] + 824 
    8 UIKit        0x00f64c0b -[UIWindow _sendTouchesForEvent:] + 386 
    9 UIKit        0x00f659d1 -[UIWindow sendEvent:] + 1117 
    10 UIKit        0x00f375f2 -[UIApplication sendEvent:] + 242 
    11 UIKit        0x00f21353 _UIApplicationHandleEventQueue + 11455 
    12 CoreFoundation      0x0091377f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 
    13 CoreFoundation      0x0091310b __CFRunLoopDoSources0 + 235 
    14 CoreFoundation      0x009301ae __CFRunLoopRun + 910 
    15 CoreFoundation      0x0092f9d3 CFRunLoopRunSpecific + 467 
    16 CoreFoundation      0x0092f7eb CFRunLoopRunInMode + 123 
    17 GraphicsServices     0x025245ee GSEventRunModal + 192 
    18 GraphicsServices     0x0252442b GSEventRun + 104 
    19 UIKit        0x00f23f9b UIApplicationMain + 1225 
    20 Origami Game      0x00026d5d main + 141 
    21 libdyld.dylib      0x02a756d9 start + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
(lldb) 

Я не знаю, что происходит, мое приложение использует структуру Kit Sprite и я не использую раскадровку, только код.

+1

Посмотрите на документы для метода дает вам проблему. – rmaddy

ответ

0

Метод инициализация initWithText: который вызывается методом класса [SKLabelNode labelNodeWithText:] был добавлен только в прошивке 8, так что вы не можете вызвать этот метод прошивки 7. Как использование обходного:

SKLabelNode *lbl=[SKLabelNode labelNodeWithFontNamed: "Arial"]; 
lbl.text="hello world"; 

Чтобы найти, какие методы доступны на которых ОС смотрит на документы.

(извините, если мой Obj-C не является правильным или метод имеет другое имя)