This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)load { | |
NSURL *url = [NSURL URLWithString:@”http://www.mywebsite.com/webService”]; | |
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; | |
[request setTimeOutSeconds:10]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)requestFinished:(ASIHTTPRequest *)request { | |
// pull data out of response and act on it | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)requestFailed:(ASIHTTPRequest *)request { | |
NSError *error = [request error]; | |
//show an alert view perhaps | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (BOOL)connected | |
{ | |
Reachability *hostReachability = [Reachability reachabilityForInternetConnection]; | |
NetworkStatus networkStatus = [hostReachability currentReachabilityStatus]; | |
return !(networkStatus == NotReachable); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Called by Reachability whenever status changes. | |
- (void) reachabilityChanged: (NSNotification* )note | |
{ | |
Reachability* curReach = [note object]; | |
NSParameterAssert([curReach isKindOfClass: [Reachability class]]); | |
[self updateInterfaceWithReachability: curReach]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Observe the kNetworkReachabilityChangedNotification. When that | |
//notification is posted, the method "reachabilityChanged" will be called. | |
[[NSNotificationCenter defaultCenter] addObserver: self selector: | |
@selector(reachabilityChanged:) | |
name: kReachabilityChangedNotification object: nil]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reachability *hostReachability = [Reachability reachabilityForInternetConnection]; | |
NetworkStatus networkStatus = [hostReachability currentReachabilityStatus]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (networkStatus == ReachableViaWiFiNetwork) | |
{ | |
[delegate.queue setMaxConcurrentOperationCount:4]; | |
} | |
else if (networkStatus == ReachableViaCarrierDataNetwork) | |
{ | |
[delegate.queue | |
setMaxConcurrentOperationCount:NSOperationQueueDefaultMaxConcurrentOperationCount]; | |
//receiver chooses appropriate # based on system resources | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Setup asynchronous downloading of a resource. | |
progressView.progress = 0.0; | |
NSURL *url = [NSURL URLWithString: resourceUrl]; | |
ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; | |
[queue setDelegate:self]; | |
[queue setRequestDidFinishSelector:@selector(requestDone:)]; | |
[queue setRequestDidFailSelector:@selector(requestWentWrong:)]; | |
[queue setShowAccurateProgress:YES]; | |
[queue setDownloadProgressDelegate:progressView]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="ui-mobile-viewport ui-panel-left ui-border-right" style="width: 25%; min-width: 250px;" | |
data-role="panel" data-id="menu" data-hash="crumbs" data-context="a#default"> |
OlderNewer