Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

invano

macrumors newbie
Original poster
Oct 29, 2011
7
0
Hello everybody.
I have a tabBarController project and i put an UIWebView on the first controller.
It's all working except the didFailLoadWithError.

Here it is the code

myappFirstViewController.h



Code:
#import <UIKit/UIKit.h>

@interface myappFirstViewController : UIViewController <UIWebViewDelegate> 

@property (weak, nonatomic) IBOutlet UIWebView *MY_uiwebview;

@end





myappFirstViewController.m



Code:
#import "myappFirstViewController.h"

@interface myappFirstViewController ()
@end

@implementation myappFirstViewController

@synthesize MY_uiwebview;


-(void)MY_uiwebview:(UIWebView *)MY_uiwebview didFailLoadWithError:(NSError *)error {

    NSLog(@"ERROR UIWEBVIEW");

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Connection error" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];

    [alert show];

}


- (void)viewDidLoad

{
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}

- (void)viewDidUnload

{
    [self setMY_uiwebview:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.

}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

{
   return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}



- (IBAction)Play {......etc..... }
@end


i cannot understand why (for example in AereoMode) it does not enter in
Code:
 -(void)MY_uiwebview:(UIWebView *)MY_uiwebview didFailLoadWithError:(NSError *)error


Thank you to everybody :)


p.s I have the same problem with iAd and
Code:
-(void)bannerViewDidLoadAd:(ADBannerView *)banner {
and also
Code:
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
p.s. I am using xCode 4.3
 
here in the .h file

Code:
@interface myappFirstViewController : UIViewController <UIWebViewDelegate>

This code only tells the compiler that "myappFirstViewController" conforms to the UIWebViewDelegate protocol. It does not in anyway actually assign a delegate to the instance of your UIWebView.

I would highly suggest reading the Apple's documentation on Protocols and the Delegate/Data Source patterns before continuing.
 
This code only tells the compiler that "myappFirstViewController" conforms to the UIWebViewDelegate protocol. It does not in anyway actually assign a delegate to the instance of your UIWebView.

I would highly suggest reading the Apple's documentation on Protocols and the Delegate/Data Source patterns before continuing.

oh my god! I forgot the delegates!
now it's working!

thank you! and sorry for the oversight :eek:



p.s. yeah you guessed it, i'm learning ...:)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.