On the tap of a button I am loading in a UIViewController from my storyboard using the following code…
InfoViewController *dst = [self.storyboard instantiateViewControllerWithIdentifier:@"InfoViewIdentifier"];
[self.view insertSubview:dst.view atIndex:0];
dst.view.frame = CGRectMake(0, 480, 320, 480);
[UIView beginAnimations: @"infoAnimation" context: nil];
[UIView animateWithDuration: 1.0f animations: ^{dst.view.frame = CGRectMake(0, 0, 320, 480);}];
[UIView commitAnimations];
Everything loads fine. The resulting view has a few buttons on it with simple actions (dismissing the view, opening URLs in safari, etc.) and as soon as I tap any of them, I receive an exception. The odd thing is, it might throw one of 2 exceptions…
- Thread 1: EXC_BAD_ACCESS (code=1, address=…) – shown with the app still running in an exception break point.
- Missing proxy for identifier UpstreamPlaceholder-2 – shown in log
I have also tried this with custom segues and I have the same result.
EDIT:
After more testing, it appears to be throwing the bad access error randomly (most of the time, 80%+). If that exception is not thrown, the link opening in safari works, but the link to dismiss the view throws the proxy identifier error.
Any help would be greatly appreciated.
Ok, so total noob issue here. The issue was related to the use of a local variable within the method. ARC was killing the view in memory most of the time (my 80% reference). I moved the
dstvariable into my header file and everything works as expected.