views:

195

answers:

1

I have the following setup

webview = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].bounds];

Occasionally I issue the method

[webview goBack]; 

and this sometimes brings my app down in flames with EXC_BAD_ACCESS (SIGBUS). I tried to wrap this around a @try:

@try
{
    [webview goBack];
}
@catch (id theEx)
{
    NSLog(@"%@", theEx);
}

but this still brings tears of grief.

Is there a way I can make sure it does not crash? Perhaps checking if I can in fact go back?

A: 

EXC_BAD_ACCESS usually means that webview was somehow dealloc'd. Why are you using [UIScreen mainScreen].bounds]? You should use Interface Builder or set the frame to the superview's bounds. You're adding the view to a superview controlled by a view controller, right?

lucius
IB is right out. Can't fit in the workflow and philosophy.
John Smith
However, it seems you hit onto something. The way i created webview might have gotten it released somehow. I put a followup question as [stackoverflow](http://stackoverflow.com/questions/2747906/why-does-apple-create-its-views-this-way)
John Smith