Closed TomDoes closed 10 years ago
thanks @TomDoes, which xcode / ios version are you using? is there a difference passing NULL or nil object? (also, i've updated the setButtonTitles function with some more defensive code, which should handle null pointers a bit better. would be fun to chase this down though.)
Hey this is in xcode 5 ios 7.0.x tried it on devices and simulator. I figured it might have something to with NULL or nil, however both result in a bad access. I tested your more defensive code and it doesn't fix the BAD ACCESS When i remove the setButtons line it works fine again, but with a close button.
getting weirder. if you want, you can try to change the CustomIOS7AlertView's init function to be
buttonTitles = nil;
(instead of buttonTitles = @[@"Close"];), that would do the same as setting it to nil with setButtonTitles. perhaps that gives you more insight in the problem. if not, feel free to share some more code, i'll try to look at it. in private, you can find me on twitter by the @wimagguc handle.)
Well, setting buttonTitles = nil in the init fixes the bad access problem.
is it an arc project? in any ways, we are using @sythesize for the getters/setters - so if a project clean doesn't solve your problem, please feel free to send some more code. (i tried to run the one you have in place, and it works all fine in emulator and on the device as well.)
Yes, it's an arc project. It's weird, for now i'll leave it like this. If I encounter similar problems later on, or the source of the bad access i'll let you know.
Thanks for looking into it!
haha no worries. i'll close this for now, but just fire up a new ticket if you have more details on this.
I'm using a custom alertView to indicate the loading of a UIWebView but it crashes with a bad access message. Without the setButtonTitles line it works fine.
-(void)webViewDidStartLoad:(UIWebView )webView { alert = [[CustomIOS7AlertView alloc]initWithParentView:self.view]; UIActivityIndicatorView spinner = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0,10,240,100)]; [spinner startAnimating]; UIView demoView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 240, 100)]; UILabel label =[[UILabel alloc]initWithFrame:CGRectMake(0, -30, 240, 100)];
}