- (BOOL) connectedToInternet

{

    NSString *URLString = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.google.com"]];

    return ( URLString != NULL ) ? YES : NO;

}





stringWithContentsOfURL <- 요놈이 deprecated됨.


NSError* error = nil;
NSString* text = [NSString stringWithContentsOfURL:TheUrl encoding:NSASCIIStringEncoding error:&error];
if( text )
{
    NSLog(@"Text=%@", text);
}
else 
{
    NSLog(@"Error = %@", error);
}


http://stackoverflow.com/questions/2039203/what-is-the-stringwithcontentsofurl-replacement-for-objective-c

Posted by tenn
,

NSObject에 <UIWebViewDelegate>선언하고

웹뷰의 델레게이트에 연결해도 안먹길래..

뭔가 수상해서.

UIViewController에 <UIWebViewDelegate> 선언하고,

거기에 델레게이트 연결하니까 먹더라.


... 델레게이트 구현하는 곳이 뷰컨트롤러여야되나?...


Posted by tenn
,

[objc] UIWebView, cache

iPhone 2013. 5. 30. 18:46

NSURLRequest initWithURL:cachePolicy:timeoutInterval

cachePolicy: NSURLCacheStorageNotAllowed


하거나

[[NSURLCache sharedURLCacheremoveCachedResponseForRequest:targetRequest];


하면 된다고 하는데?

Posted by tenn
,