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

Patoma16

macrumors member
Original poster
May 19, 2010
45
0
I submitted an application I made a couple days ago and it was rejected due to the fact of it not having an internet connection error, so if u weren't connected to the internet, it would not display an error. And, all the tutorials that i fin don't apply for my application. It doesn't WORK!!! my application has four tabs, with each tab displaying a UIWebView. I am trying for an alert view to pop up at the boot-up of the application that warns the user of having an internet connection, rather than adding the actual error once it doesn't load, but if any of you know to do the error message on a tab bar app like mine, that would be preferable! Thanks, and please help me, I am desperate!!!!!!!!!!

Peace, Love, :apple: !!!!!!!
 
Look at the Reachability sample code from Apple. It shows how to check for internet connects.

Yah... I've done it, but it doesn't work! I suppose it due to it being a tab bar based application it has like 5 tabs. I've practically tried everything... But it doesn't work, like my guess is that the it doesn't know where to display it even though I placed the code in the FirstViewController.m Should I place the code in all the ViewControllers. But, really all I want is a little alert view to pop up on bootup (of the app) telling u to make sure u have an Internet connection.... So please someone help!
 
UIAlertView's are not tied to any view / viewController. They just pop-up. So, maybe you should be more explicit about what you've tried and what isn't working.
 
UIAlertView's are not tied to any view / viewController. They just pop-up. So, maybe you should be more explicit about what you've tried and what isn't working.

Well, I tried doing all the tutorials I can find on how to implement the Internet access check, but for some reason it doesn't work. But in the tutorial they would use a simple view based app, I created a tab bar based app, so, no tutorial worked. In the tutorials they would add the code in the view controller (the only view controller) but since I have a tab bar based app, I have 5 view controllers!!!!! So then I decided to just add a simple warning UIAlertView in the start of the app. So I added the alert view code, the one I used in the Internet checker, and again no results. I don't know where to add the code, or if I have the wrong code. But what would you do if you where in the same dispute as me, and please help me.... I need my app in the AppStore!!!
 
No, what I meant was that if I were you, I'd post some code so that we can try to help you out. That is, you should post some code!

Okay, this is the code I used for the UIAlertView:

Code:
- (void)viewDidLoad {
    [super viewDidLoad];
	UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning!" message:@"This application requires an internet connection! If there is none present, all tabs will remain white" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
	[alert show];
	[alert release];
	
}
Note: I added this under the viewDidLoad, and in the FirstViewController of my five view controllers. So, now please help, the alert won't pop up, and as a reminder I want it to come up on the app's startup. Thanks in advance once again.
 
Note: I added this under the viewDidLoad, and in the FirstViewController of my five view controllers. So, now please help, the alert won't pop up, and as a reminder I want it to come up on the app's startup. Thanks in advance once again.
I created a Tab Bar Application and changed the viewDidLoad to match yours. The alert pops up right upon app startup just fine. So, there must be something else you're doing that's causing this issue.

By the way, I also added the alert to the app delegate's didFinishLaunching and it worked there too.
 
Be careful with this solution. It may possibly cause the alert to appear much more frequently than once.

Yah I noticed, every time I go to the tab, the alert view pops up. But, since u said u where able to crerate the tab bar application with the alert view, I'll give u more details of how the app works. Every tab view has a UIWebView in it, two navigation bars (one at the top and one at the bottom) and a tool bar with the controls to go back, forward, refresh, and cancel refresh. And there are five tabs with the same layout. And the other way of doing through ViewDidLoad didn't work, so... Hopefully you can make something put of this?
 
Have you tried putting it in your app delegate?

Edit: P.S. Two navBars and a toolbar, all inside a tab view? Is there even any room for content? :confused: ;)

What code do I put in the app delegate, the ViewDidLoad or ViewWillAppear? I tried both... And none worked. Still the only one that works is the ViewWillAppear on the FirstViewController... But it repeats the message every time you tap on the tab, it gets annoying.
 
For app delegate:
Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
    // Add the tab bar controller's current view as a subview of the window
    [window addSubview:tabBarController.view];
    [window makeKeyAndVisible];
    
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning!" message:@"This application requires an internet connection! If there is none present, all tabs will remain white" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    [alert release];
	
    return YES;
}

For FirstViewController.m:
Code:
- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning!" message:@"This application requires an internet connection! If there is none present, all tabs will remain white" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    [alert release];
}

Of course, all this is oversimplified to just invoke the alert. You'll still need all the smarts to check for an internet connection, once you get past this issue.
 
For app delegate:
Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
    // Add the tab bar controller's current view as a subview of the window
    [window addSubview:tabBarController.view];
    [window makeKeyAndVisible];
    
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning!" message:@"This application requires an internet connection! If there is none present, all tabs will remain white" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    [alert release];
	
    return YES;
}

For FirstViewController.m:
Code:
- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning!" message:@"This application requires an internet connection! If there is none present, all tabs will remain white" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    [alert release];
}

Of course, all this is oversimplified to just invoke the alert. You'll still need all the smarts to check for an internet connection, once you get past this issue.

Wow thanks! It finally worked without the annoying message! I can't thank you enough for taking your time to help me!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.