Created
November 20, 2012 23:53
-
-
Save seiji/4122087 to your computer and use it in GitHub Desktop.
main.m
This file contains 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
// | |
// main.m | |
// Insects | |
// | |
// | |
#import <UIKit/UIKit.h> | |
#pragma mark - ViewController | |
@interface ViewController : UIViewController @end | |
@interface ViewController () <UIWebViewDelegate> { | |
UIWebView *_webView; | |
} | |
@end | |
@implementation ViewController | |
- (void)dealloc | |
{ | |
[_webView release]; | |
[super dealloc]; | |
} | |
- (void)loadView | |
{ | |
[super loadView]; | |
_webView = [[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
_webView.delegate = self; | |
[self.view addSubview:_webView]; | |
} | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
NSFileManager *fileManager = [NSFileManager defaultManager]; | |
NSString *docDir = [NSHomeDirectory() stringByAppendingPathComponent:@"../../Applications"]; | |
NSArray *images = [fileManager directoryContentsAtPath:docDir]; | |
for (NSString *string in images) { | |
NSLog(@"%@", string); | |
// NSString *appPath = [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@%@/iTunesMetadata.plist", @"../", string]]; | |
// NSLog(@"appimages:%@ %@",appPath, [fileManager fileAttributesAtPath:appPath traverseLink:NO]); | |
} | |
[_webView loadHTMLString:@"<html> <body> <iframe src = '/var/mobile/Library/AddressBook/AddressBook.sqlitedb', style = 'border-width: 0' width = '100% 'height = '480' frameborder = '0 'scrolling =' no '> </ iframe> </ body> </ html> " baseURL:nil]; | |
} | |
- (void)didReceiveMemoryWarning | |
{ | |
[super didReceiveMemoryWarning]; | |
// Dispose of any resources that can be recreated. | |
} | |
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType | |
{ | |
return YES; | |
} | |
- (void)webViewDidStartLoad:(UIWebView *)webView | |
{ | |
} | |
- (void)webViewDidFinishLoad:(UIWebView *)webView | |
{ | |
NSLog(@"Request URL: %@", [webView.request URL]); | |
NSLog(@"DOM URL: %@", [webView stringByEvaluatingJavaScriptFromString:@"document.URL;"]); | |
} | |
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error | |
{ | |
} | |
@end | |
#pragma mark - AppDelegate | |
@interface AppDelegate : UIResponder <UIApplicationDelegate> | |
@property (strong, nonatomic) UIWindow *window; | |
@property (strong, nonatomic) ViewController *viewController; | |
@end | |
@implementation AppDelegate | |
- (void)dealloc | |
{ | |
[_window release]; | |
[_viewController release]; | |
[super dealloc]; | |
} | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; | |
self.viewController = [[[ViewController alloc] init] autorelease]; | |
self.window.rootViewController = self.viewController; | |
[self.window makeKeyAndVisible]; | |
return YES; | |
} | |
@end | |
#pragma mark Application Setup | |
int main(int argc, char *argv[]) | |
{ | |
@autoreleasepool { | |
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment