Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xcode 快速错误-“;已将无法识别的选择器发送到实例";_Xcode_Swift_Uilabel_Nsexception - Fatal编程技术网

Xcode 快速错误-“;已将无法识别的选择器发送到实例";

Xcode 快速错误-“;已将无法识别的选择器发送到实例";,xcode,swift,uilabel,nsexception,Xcode,Swift,Uilabel,Nsexception,我正在Xcode v6.1.1中进行一个Swift项目,我遇到了以下我不理解的错误。我相信Main.storyboard中的几个标签和/或我连接它们的UILabel变量有问题。 我已经尝试了我能找到的一切来修复它,但没有任何效果 任何帮助都将不胜感激 2015-03-02 19:43:14.854 Final Project[7380:250494] -[UILabel longValue]: unrecognized selector sent to instance 0x7b8e1810

我正在Xcode v6.1.1中进行一个Swift项目,我遇到了以下我不理解的错误。我相信Main.storyboard中的几个标签和/或我连接它们的UILabel变量有问题。 我已经尝试了我能找到的一切来修复它,但没有任何效果

任何帮助都将不胜感激

2015-03-02 19:43:14.854 Final Project[7380:250494] -[UILabel longValue]:  unrecognized selector sent to instance 0x7b8e1810  
2015-03-02 19:43:14.876 Final Project[7380:250494] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILabel longValue]: unrecognized selector sent to instance 0x7b8e1810'  
*** First throw call stack:  
(
    0   CoreFoundation                      0x00686946 __exceptionPreprocess + 182  
    1   libobjc.A.dylib                     0x02062a97 objc_exception_throw + 44  
    2   CoreFoundation                      0x0068e5c5 -[NSObject(NSObject)   doesNotRecognizeSelector:] + 277  
    3   CoreFoundation                      0x005d73e7 ___forwarding___ + 1047  
    4   CoreFoundation                      0x005d6fae _CF_forwarding_prep_0 + 14  
    5   Foundation                          0x00b0b6dc _NSSetLongValueForKeyWithMethod + 69  
    6   Foundation                          0x00a691c6 _NSSetUsingKeyValueSetter + 257  
    7   Foundation                          0x00a690bd -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267  
    8   Foundation                          0x00a9e9a6 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 386  
    9   UIKit                               0x011cf649 -[UIRuntimeOutletConnection connect] + 106  
    10  libobjc.A.dylib                     0x02078724 -[NSObject performSelector:] + 62  
    11  CoreFoundation                      0x005c05dc -[NSArray makeObjectsPerformSelector:] + 316  
    12  UIKit                               0x011ce10a -[UINib instantiateWithOwner:options:] + 1775  
    13  UIKit                               0x00ff0624 -[UIViewController _loadViewFromNibNamed:bundle:] + 270  
    14  UIKit                               0x00ff0dbb -[UIViewController loadView] + 295  
    15  UIKit                               0x00ff0fef -[UIViewController loadViewIfRequired] + 78  
    16  UIKit                               0x00ff1595 -[UIViewController view] + 35  
    17  UIKit                               0x01664707 -[_UIFullscreenPresentationController _setPresentedViewController:] + 75  
    18  UIKit                               0x00fc6a81 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 113  
    19  UIKit                               0x00ffea61 -[UIViewController _presentViewController:withAnimationController:completion:] + 2102  
    20  UIKit                               0x010015d2 __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 345  
    21  UIKit                               0x01001424 -[UIViewController presentViewController:animated:completion:] + 224  
    22  UIKit                               0x010060be -[UIViewController _showViewController:withAction:sender:] + 213  
    23  UIKit                               0x012423b5 -[UIStoryboardShowSegue perform] + 143  
    24  UIKit                               0x014b6b49 -[UIStoryboardSegueTemplate _perform:] + 217  
    25  UIKit                               0x014b6bc5 -[UIStoryboardSegueTemplate perform:] + 116  
    26  libobjc.A.dylib                     0x020787cd -[NSObject performSelector:withObject:withObject:] + 84  
    27  UIKit                               0x00e9b23d -[UIApplication sendAction:to:from:forEvent:] + 99  
    28  UIKit                               0x00e9b1cf -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64  
    29  UIKit                               0x00fcee86 -[UIControl sendAction:to:forEvent:] + 69  
    30  UIKit                               0x00fcf2a3 -[UIControl _sendActionsForEvents:withEvent:] + 598  
    31  UIKit                               0x00fce50d -[UIControl touchesEnded:withEvent:] + 660  
    32  UIKit                               0x00eeb60a -[UIWindow _sendTouchesForEvent:] + 874  
    33  UIKit                               0x00eec0e5 -[UIWindow sendEvent:] + 791  
    34  UIKit                               0x00eb1549 -[UIApplication sendEvent:] + 242  
    35  UIKit                               0x00ec137e _UIApplicationHandleEventFromQueueEvent + 20690  
    36  UIKit                               0x00e95b19 _UIApplicationHandleEventQueue + 2206  
    37  CoreFoundation                      0x005aa1df __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15  
    38  CoreFoundation                      0x0059fced __CFRunLoopDoSources0 + 253  
    39  CoreFoundation                      0x0059f248 __CFRunLoopRun + 952  
    40  CoreFoundation                      0x0059ebcb CFRunLoopRunSpecific + 443  
    41  CoreFoundation                      0x0059e9fb CFRunLoopRunInMode + 123  
    42  GraphicsServices                    0x0441a24f GSEventRunModal + 192  
    43  GraphicsServices                    0x0441a08c GSEventRun + 104  
    44  UIKit                               0x00e998b6 UIApplicationMain + 1526  
    45  Final Project                       0x000e904e top_level_code + 78  
    46  Final Project                       0x000e908b main + 43  
    47  libdyld.dylib                       0x027cfac9 start + 1  
)  
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)   

您是否在字符串名称中忘记了a:


您的类是否用@objc标记?

只需查看
-[UILabel longValue]:发送到实例0x7b8e1810的未识别选择器就会给出答案。您将
UILabel
视为
NSString

您的代码中有
[label longValue]
,您的意思是
[label.text longValue]


在查看了更多调用堆栈之后。我可以看到它是在从故事板初始化视图控制器时发生的


您是否对任何视图进行了子类化?看起来您可能无意中将属性的类型从
NSString
更改为
UILabel

,因此。。。我解决了这个问题。结果证明答案一直就在我面前(通常是这样)。无法初始化的标签与我在同一个类中声明的Int变量同名,只是第一个字母大写。出于某种原因,我认为它是区分大小写的,所以这无关紧要