TestFlight은 내 응용 프로그램에서 복제 할 수없는 오류를 확인했지만 문제가 해결되어야합니다. 오류는 unrecognized selector sent to instance 0x34a9e0
입니다. GC가 제거한 객체에 locationId를 지정하려고하면 오류가 발생합니다.autorelease가 포함 된 iOS 메모리 관리
-[UIViewAnimationState locationId]: unrecognized selector sent to instance 0x34a9e0
0 CoreFoundation 0x371e488f __exceptionPreprocess + 163
1 libobjc.A.dylib 0x34ee9259 objc_exception_throw + 33
2 CoreFoundation 0x371e7a9b -[NSObject doesNotRecognizeSelector:] + 175
3 CoreFoundation 0x371e6915 ___forwarding___ + 301
4 CoreFoundation 0x37141650 _CF_forwarding_prep_0 + 48
5 Skate Spots 0x0000b9b9 -[DetailViewController handlePhotosButtonClick:] (DetailViewController.m:92)
6 CoreFoundation 0x3713e3fd -[NSObject performSelector:withObject:withObject:] + 53
7 UIKit 0x30ed3e07 -[UIApplication sendAction:to:from:forEvent:] + 63
8 UIKit 0x30ed3dc3 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 31
9 UIKit 0x30ed3da1 -[UIControl sendAction:to:forEvent:] + 45
10 UIKit 0x30ed3b11 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 493
11 UIKit 0x30ed4449 -[UIControl touchesEnded:withEvent:] + 477
12 UIKit 0x30ec6b87 _UIGestureRecognizerUpdate + 5223
13 CoreFoundation 0x371b8b1b __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 19
14 CoreFoundation 0x371b6d57 __CFRunLoopDoObservers + 259
15 CoreFoundation 0x371b70b1 __CFRunLoopRun + 761
16 CoreFoundation 0x3713a4a5 CFRunLoopRunSpecific + 301
17 CoreFoundation 0x3713a36d CFRunLoopRunInMode + 105
18 GraphicsServices 0x338f9439 GSEventRunModal + 137
19 UIKit 0x30ee6cd5 UIApplicationMain + 1081
20 Skate Spots 0x0000325f -[Image willSendWithObjectLoader:] (Image.m:83)
21 Skate Spots 0x00002b18 + 0
원본 코드 :
는 그 오토 릴리즈이 방법의 범위 동안 참조를 유지할 것이라고 가정한다.
-(IBAction)handlePhotosButtonClick:(id)sender
{
PhotosViewController *vc = [[[PhotosViewController alloc] init] autorelease];
vc.locationID = _location.locationId;
[self.navigationController pushViewController:vc animated:YES];
}
내 코드 변경 :
내가 원래 오류를 제거합니다이 같은데요 만이 그 일을의 올바른 방법인가?
-(IBAction)handlePhotosButtonClick:(id)sender
{
NSLog(@"handlePhotosButtonClick");
PhotosViewController *vc = [[[PhotosViewController alloc] init] retain];
vc.locationID = _location.locationId;
[self.navigationController pushViewController:vc animated:YES];
[vc release];
}
편집
너희들은 올바른 _location이 값을 유지하기 위해 설정되지 않은 있습니다.
참고 : iOS에는 가비지 수집기가 없습니다. – Caleb