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

Cub

macrumors member
Original poster
Feb 16, 2011
38
0
Australia
Hi all
I have nearly finished making my UIWebView app, and when reading over the app store requiements it says if the app will require a network it should have a popup or notification saying that there is no network or connection. I would just like a popup to say 'there is currently no network' and an ok(close) button. I have tried to implement the reachability sample into my app but I received many errors and warnings. Is it as simple as just copying and pasting or is there more to it?
Thanks for any input.
David
BTW I am a newbie when it comes to xcode so you may have to put in step by step or simple terms, if you know of a good tutorial please post it up.
Thanks
 

Sykte

macrumors regular
Aug 26, 2010
223
0
Hi all
I have nearly finished making my UIWebView app, and when reading over the app store requiements it says if the app will require a network it should have a popup or notification saying that there is no network or connection. I would just like a popup to say 'there is currently no network' and an ok(close) button. I have tried to implement the reachability sample into my app but I received many errors and warnings. Is it as simple as just copying and pasting or is there more to it?
Thanks for any input.
David
BTW I am a newbie when it comes to xcode so you may have to put in step by step or simple terms, if you know of a good tutorial please post it up.
Thanks

Yes, it's that easy. Copy Reachability into your project, then implement per apples documentation. You will always get better results by posting your errors.
 

Cub

macrumors member
Original poster
Feb 16, 2011
38
0
Australia
Ok I did all that, ran the simulator and no errors does this code seem right to you.
Code:
//
//  Allboutnuts_comAppDelegate.m
//  Allboutnuts.com
//
//  Created by David z on 12/04/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "Allboutnuts_comAppDelegate.h"

@implementation Allboutnuts_comAppDelegate

@synthesize window;
@synthesize webView;

#pragma mark -
#pragma mark Application lifecycle

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
	[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://allboutnuts.hostzi.com/index.html"]]];
	
    // Override point for customization after application launch.
    
    [self.window makeKeyAndVisible];
    
    return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application {
    /*
     Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
     Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
     */
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
    /*
     Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
     If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
     */
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
    /*
     Called as part of  transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
     */
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
    /*
     Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
     */
}


- (void)applicationWillTerminate:(UIApplication *)application {
    /*
     Called when the application is about to terminate.
     See also applicationDidEnterBackground:.
     */
}


#pragma mark -
#pragma mark Memory management

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
    /*
     Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
     */
}


- (void)dealloc {
    [window release];
    [super dealloc];
}


@end
 
Last edited:

Sykte

macrumors regular
Aug 26, 2010
223
0
Quick overview it looks fine, however from the code posted I do not see reachability being used to test a proper network connection.
 

North Bronson

macrumors 6502
Oct 31, 2007
395
1
San José
Is importing a whole batch of source code and running a preflight check really the best approach? What if you just try to connect the web view without the preflight check and tell the user if something goes wrong?
 

Cub

macrumors member
Original poster
Feb 16, 2011
38
0
Australia
Hi everyone, thanks for the feedback, well in my xcode project I went to poject and add to project up the top and selected the reachability file. I would assume this would then check for an internet connection. The code above is after I added the reachability file. So should this all work properly?

Also is there a way to put an app link on a website for users to download without having to pay for the developer program?, because I am with the free program, and I rarely use xcode.
Thanks everyone
David
 

Sykte

macrumors regular
Aug 26, 2010
223
0
Is importing a whole batch of source code and running a preflight check really the best approach? What if you just try to connect the web view without the preflight check and tell the user if something goes wrong?

Not sure what you mean "a whole bunch", reachability is a header and implementation file.... It only takes importing it into your project and either register for notifications or send a message asking about the network and it only takes a few lines of code.
 

Cub

macrumors member
Original poster
Feb 16, 2011
38
0
Australia
Hi
Just asking should the code I posted work including the network check?
Also is there a way I can share my app on a website since this is for a school assignemnt it would only be downloaded or used maybe 1 to 5 times?
Thanks
David
 

Cub

macrumors member
Original poster
Feb 16, 2011
38
0
Australia
Hi
Thanks for the response, I know this may sound silly but how do I do that is there any publish sections or do I just drag and drop the whole file into their itunes app section?
Thanks
David
 

Cub

macrumors member
Original poster
Feb 16, 2011
38
0
Australia
Hi
Sadly no they don't :eek: , I really want it to make it look somewhat professional so they click on link or file on site and they can just download it to their itunes. Is this possible? Would anyone be willing to add it to their adhoc page, it'll only be for a while and I'll let you know when you can remove it ? Thanks
David
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.