我有几个视图控制器,它们可以展开到根视图控制器。对于大多数的视图控制器,松开的segue工作得很好,不会破坏这个应用程序。只有使用CLlocationmanager的视图控制器才不能对根视图控制器执行解压。这些行在我的代码中起着重要作用:
//Init the location Manager
locationManager = [[CLLocationManager alloc] init];
[locationManager requestWhenInUseAuthorization];
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
locationManager.delegate = self;通过注释我的代码的这一部分,展开工作。特别是最后一行的区别。我试着在松绑前释放位置经理。有时候很管用。有时候没有。调试控制台说:
0x10bfe1005: movq (%rdi), %r11
0x10bfe1008: movq %rsi, %r10
0x10bfe100b: andl 0x18(%r11), %r10d<---Thread 1: EXC Bad_Access(code=1, adress=0x18)
0x10bfe100f: shlq $0x4, %r10
0x10bfe1013: addq 0x10(%r11), %r10不管那意味着什么。我不知道该怎么办。
编辑
在加上这个之后
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
[locationManager stopUpdatingLocation];
[locationManager release];
}挺管用的。我试过5次了。然后它又坠毁了:(真奇怪。不确定,但错误消息似乎已经更改。上面写着"WebThread“(见下文)。我确实有一个webview,它也有委托方法。我也会尝试发布webview。
libobjc.A.dylib`objc_msgSend:
0x32f9af60: cbz r0, 0x32f9af9e ; objc_msgSend + 62
0x32f9af62: ldr.w r9, [r0]
0x32f9af66: ldrh.w r12, [r9, #12] <-----WebThread(10):EXC_bad_access(code=1, address=0x100000c)
0x32f9af6a: ldr.w r9, [r9, #8]
0x32f9af6e: and.w r12, r12, r1
0x32f9af72: add.w r9, r9, r12, lsl #3
0x32f9af76: ldr.w r12, [r9]
0x32f9af7a: teq.w r12, r1
0x32f9af7e: bne 0x32f9af86 ; objc_msgSend + 38
0x32f9af80: ldr.w r12, [r9, #4]
0x32f9af84: bx r12
0x32f9af86: cmp.w r12, #0x1
0x32f9af8a: blo 0x32f9af98 ; objc_msgSend + 56
0x32f9af8c: it eq
0x32f9af8e: ldreq.w r9, [r9, #4]
0x32f9af92: ldr r12, [r9, #8]!
0x32f9af96: b 0x32f9af7a ; objc_msgSend + 26
0x32f9af98: ldr.w r9, [r0]
0x32f9af9c: b 0x32f9b1e0 ; _objc_msgSend_uncached
0x32f9af9e: mov.w r1, #0x0
0x32f9afa2: bx lr
0x32f9afa4: nop
0x32f9afa6: nop
0x32f9afa8: nop
0x32f9afaa: nop
0x32f9afac: nop
0x32f9afae: nop
0x32f9afb0: nop
0x32f9afb2: nop
0x32f9afb4: nop
0x32f9afb6: nop
0x32f9afb8: nop
0x32f9afba: nop
0x32f9afbc: nop
0x32f9afbe: nop EDIT2
好的,在发布了位置管理器和webview的prepareforsegue方法后,它可以工作。
发布于 2015-01-30 12:03:55
你需要在放松前阻止位置经理。
当您正在展开时,您实际上正在卸载和释放您正在解压的ViewController。
但是,因为它是locationManager的委托,所以位置管理器试图将信息传递给它。
你应该能用.
[locationManager stopUpdatingLocation];在你放松之前。(可能在prepareForSegue方法中)。
https://stackoverflow.com/questions/28235478
复制相似问题