0
我在我的代碼中有以下錯誤,我很難找出原因。- [NSRecursiveLock dealloc]:鎖理解堆棧跟蹤和ios調試
-[NSRecursiveLock dealloc]: lock (<NSRecursiveLock: 0x1e559730> '(null)') deallocated while still in use
Break on _NSLockError() to debug.
所以,我在NSLock錯誤上放了一個斷點。這裏是堆棧跟蹤。
frame #0: 0x327e5288 Foundation`_NSLockError
frame #1: 0x327e6258 Foundation`-[NSRecursiveLock dealloc] + 108
frame #2: 0x327478ba ExternalAccessory`-[EAInputStream dealloc] + 122
frame #3: 0x32748420 ExternalAccessory`-[EAInputStream _streamEventTrigger] + 448
frame #4: 0x31ebf682 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
frame #5: 0x31ebeee8 CoreFoundation`__CFRunLoopDoSources0 + 212
frame #6: 0x31ebdcb6 CoreFoundation`__CFRunLoopRun + 646
frame #7: 0x31e30ebc CoreFoundation`CFRunLoopRunSpecific + 356
frame #8: 0x31e30d48 CoreFoundation`CFRunLoopRunInMode + 104
frame #9: 0x359e32ea GraphicsServices`GSEventRunModal + 74
frame #10: 0x33d46300 UIKit`UIApplicationMain + 1120
frame #11: 0x0009e93e Checkout`main(argc=1, argv=0x2fd6ad20) + 174 at main.mm:15
frame #12: 0x39fa1b20 libdyld.dylib`start + 4
NSRecursiveLock Deallocated是一個類似的帖子,在那裏他解決了他的問題,更新的Xcode,但是這並沒有爲我工作=(我得到這個錯誤90%的時間和10%,其正常工作
在VC中的問題我.h文件中...
#import <UIKit/UIKit.h>
#import "SignalR.h"
#import "ClientInterface.h"
@class POS;
@interface SignalRVC : UIViewController <UITableViewDelegate, UITableViewDataSource, UIAlertViewDelegate>
@property (nonatomic, strong) NSString *stringFromScan;
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (strong, nonatomic) NSMutableArray *data;
@property (weak, nonatomic) IBOutlet UILabel *errorLabel;
@property (strong, nonatomic, readwrite) SRHubConnection *connection;
@property (strong, nonatomic, readwrite) SRHubProxy *hub;
@property (strong, nonatomic) UIBarButtonItem *backBarButton;
@property (nonatomic, strong) NSMutableArray *registeredUpcs;
-(void)initConnection;
@end
我.m文件崩潰之前得到通過viewDidLoad中......
@interface SignalRVC()
@property (strong,nonatomic) POS *myPOS;
@property (nonatomic, strong) NSString *qrLocation;
@property (nonatomic, strong) NSString *qrStation;
@property (nonatomic, strong) NSString *RPHost;
@property (nonatomic, strong) NSString *RPPort;
@property (nonatomic, strong) NSString *registeredUpc;
@property (nonatomic, strong) NSString *thumbnail;
@property (nonatomic, strong) NSString *productName;
@property (nonatomic, strong) NSString *color;
@property (nonatomic, strong) NSString *alu;
@property (nonatomic, strong) NSString *size;
@property (nonatomic, strong) NSString *upc;
@property (nonatomic, strong) NSDictionary *itemSpecs;
@property (weak, nonatomic) IBOutlet UIButton *checkoutButton;
@property (weak, nonatomic) IBOutlet UILabel *employeeLabel;
@end
@implementation SignalRVC
-(void)viewWillDisappear:(BOOL)animated{
[_myPOS closeConnection];
self.navigationController.toolbarHidden = YES;
}
-(void)viewWillAppear:(BOOL)animated{
self.navigationController.navigationBar.hidden = NO;
NSData *dataFromQR = [self.stringFromScan dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *jsonQR = [NSJSONSerialization JSONObjectWithData:dataFromQR options:NSJSONReadingMutableContainers error:nil];
self.qrLocation = [jsonQR valueForKey:@"loc"];
self.qrStation = [jsonQR valueForKey:@"id"];
self.host = [jsonQR valueForKey:@"host"];
self.port = [jsonQR valueForKey:@"port"];
}
- (void)viewDidLoad{
[super viewDidLoad];
//self.tableView.layer.cornerRadius = 10;
if(!_myPOS){
_myPOS = [[POS alloc] init];
}
_myPOS.mySignalRVC = self;
}
什麼是堆棧跟蹤告訴我,我能做些什麼來更好地理解問題?
具有NSRecursiveLock類是在AFJSONRequestOperation.m並作爲SignalR的一部分AFURLConnectionOperation.m文件,但斷點從來沒有在這些類中被觸發的唯一的地方...
感謝您的幫助。
展望它並希望有一個解決方案。您的評論有助於我更好地理解籌碼。 =) – mattyd