<p>I don't want to take the time to learn Obj-C. I've spent 7+ years doing web application programming. Shouldn't there be a way to use the WebView and just write the whole app in javascript, pulling the files right from the resources of the project?</p>

[{'answer_id': 64493, 'author': 'Sergey Mikhanov', 'author_id': 3894, 'author_profile': 'https://Stackoverflow.com/users/3894', 'pm_score': 2, 'selected': False, 'text': '<p>You should have the native wrapper written in Objective C. This wrapper could contain really few lines of code (like, 10) necessary to create a WebView and navigate it to the given address in the internet (where your application resides). But in this case your application should be a full-featured web application (I mean, use not only the JavaScript, but also some HTML for markup).</p>\n'}, {'answer_id': 64499, 'author': 'dawnerd', 'author_id': 69503, 'author_profile': 'https://Stackoverflow.com/users/69503', 'pm_score': 2, 'selected': False, 'text': '<p>I ran into this same problem. I already have a game written entirely in Javascript. I would love to make an iPhone friendly version, but Obj-C is an overkill. What I ended up doing was using the WebView to point to a special url of the iphone app. After thinking about it, I suppose I could just move those files to the app directory and run them locally.</p>\n'}, {'answer_id': 64506, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': "<p>There not way to do this with the current apple API's. Your closest bet is to write a simple native iPhone app that embeds the webkit browser. That will let you browse your xhtml/js application locally.</p>\n\n<p>If you want to store data, you'll need to take it a step further and include a light weight http server that servers up your app and provides calls to store and retrieve data. Probably not an ideal solution for you, but possibly less work than a full Obj-C app.</p>\n\n<p>As a side note, Obj-C is fairly easy to learn. There are tons of examples in the SDK. The community is strong and will answer well put questions without hesitation.</p>\n"}, {'answer_id': 64763, 'author': 'Jeff', 'author_id': 8597, 'author_profile': 'https://Stackoverflow.com/users/8597', 'pm_score': 7, 'selected': True, 'text': '<p>I found the answer after searching around. Here\'s what I have done:</p>\n\n<ol>\n<li><p>Create a new project in XCode. I think I used the view-based app.</p></li>\n<li><p>Drag a WebView object onto your interface and resize.</p></li>\n<li><p>Inside of your WebViewController.m (or similarly named file, depending on the name of your view), in the viewDidLoad method:</p>\n\n<pre>NSString *filePath = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];  \nNSData *htmlData = [NSData dataWithContentsOfFile:filePath];  \nif (htmlData) {  \n  NSBundle *bundle = [NSBundle mainBundle]; \n  NSString *path = [bundle bundlePath];\n  NSString *fullPath = [NSBundle pathForResource:@"index" ofType:@"html" inDirectory:path];\n  [webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:fullPath]]];\n}</pre></li>\n<li><p>Now any files you have added as resources to the project are available for use in your web app. I\'ve got an index.html file including javascript and css and image files with no problems. The only limitation I\'ve found so far is that I can\'t create new folders so all the files clutter up the resources folder.</p></li>\n<li><p>Trick: make sure you\'ve added the file as a resource in XCode or the file won\'t be available. I\'ve been adding an empty file in XCode, then dragging my file on top in the finder. That\'s been working for me.</p></li>\n</ol>\n\n<p>Note: I realize that Obj-C must not be that hard to learn. But since I already have this app existing in JS and I know it works in Safari this is a much faster dev cycle for me. Some day I\'m sure I\'ll have to break down and learn Obj-C.</p>\n\n<p>A few other resources I found helpful:</p>\n\n<p>Calling Obj-C from javascript: <a href="http://tetontech.wordpress.com/2008/08/14/calling-objective-c-from-javascript-in-an-iphone-uiwebview/" rel="noreferrer">calling objective-c from javascript</a></p>\n\n<p>Calling javascript from Obj-C: <a href="http://dominiek.com/articles/2008/7/19/iphone-app-development-for-web-hackers" rel="noreferrer">iphone app development for web hackers</a></p>\n\n<p>Reading files from application bundle: <a href="http://iphoneincubator.com/blog/tag/uiwebview" rel="noreferrer">uiwebview</a></p>\n'}, {'answer_id': 112537, 'author': 'Robert Sanders', 'author_id': 16952, 'author_profile': 'https://Stackoverflow.com/users/16952', 'pm_score': 3, 'selected': False, 'text': '<p>For those doing this on iPhone 2.1 (maybe 2.0), you do NOT need to create any special services for local data storage.  MobileSafari appears to support the HTML5/WHATWG SQL database API.  This is the same API supported by recent versions of desktop Safari and Firefox.</p>\n\n<p>If you\'re using a toolkit like Dojo or ExtJS that offers a storage abstraction, your code should work on just about any modern browser, including MobileSafari.</p>\n\n<p>To test, open <a href="http://robertsanders.name/dev/stackoverflow/html5.html" rel="nofollow noreferrer">http://robertsanders.name/dev/stackoverflow/html5.html</a> on your iPhone.</p>\n\n<p>If you open that page then look on the filesystem of a Jailbroken iPhone, you should see a database somewhere in /private/var/mobile/Library/WebKit/Databases/.  There\'s even a directory of web-opened DBs there.</p>\n\n<blockquote>\n  <p>root# sqlite3 /private/var/mobile/Library/WebKit/Databases/Databases.db\n  SQLite version 3.5.9 Enter ".help" for\n  instructions</p>\n  \n  <p>sqlite> .databases \n  seq  name             file                                          </p>\n  \n  <hr>\n  \n  <p>0    main            /private/var/mobile/Library/WebKit/Databases/Databases.db</p>\n  \n  <p>sqlite> .tables </p>\n  \n  <p>Databases  Origins  </p>\n  \n  <p>sqlite> select * from Databases;</p>\n  \n  <p>1|http_robertsanders.name_0|NoteTest|Database|API example|20000|0000000000000001.db</p>\n  \n  <p>sqlite> select * from Origins; </p>\n  \n  <p>http_robertsanders.name_0|5242880</p>\n</blockquote>\n'}, {'answer_id': 227821, 'author': 'Chris Samuels', 'author_id': 30342, 'author_profile': 'https://Stackoverflow.com/users/30342', 'pm_score': 5, 'selected': False, 'text': '<p>Check out PhoneGap at <a href="http://www.phonegap.com" rel="noreferrer">http://www.phonegap.com</a> they claim it allows you to embed JavaScript, HTML and CSS into a native iPhone app.</p>\n'}, {'answer_id': 232466, 'author': 'Lee', 'author_id': 31063, 'author_profile': 'https://Stackoverflow.com/users/31063', 'pm_score': 2, 'selected': False, 'text': '<p>You can create an application without knowing any obj-C.  The QuickConnectiPhone framework allows you to do this.  Check out <a href="http://tetontech.wordpress.com" rel="nofollow noreferrer">http://tetontech.wordpress.com</a> for how to use it as well as other ways of doing what you have asked.</p>\n'}, {'answer_id': 1003804, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': '<p>I have been using phonegap for a while and it seems to have the best results for me. I will post my experience in a week or so with a link to my app as well.</p>\n'}, {'answer_id': 1849591, 'author': 'Neo42', 'author_id': 125062, 'author_profile': 'https://Stackoverflow.com/users/125062', 'pm_score': 0, 'selected': False, 'text': '<p>At least 2 others mentioned phonegap, but I thought I\'d post this too and mention that Apple has approved the phonegap framework.  So, now you won\'t get your app rejected by Apple just because you\'re using phonegap.  </p>\n\n<p><a href="http://blogs.nitobi.com/jesse/2009/11/20/phonegapp-store-approval/" rel="nofollow noreferrer">Blog post about phonegap and Apple - http://blogs.nitobi.com/jesse/2009/11/20/phonegapp-store-approval/</a></p>\n\n<p><a href="http://phonegap.com/" rel="nofollow noreferrer">Phone Gap Home</a></p>\n'}, {'answer_id': 2580083, 'author': 'Josh Brown', 'author_id': 2030, 'author_profile': 'https://Stackoverflow.com/users/2030', 'pm_score': 1, 'selected': False, 'text': '<p><a href="http://www.appcelerator.com/products/titanium-mobile-application-development/" rel="nofollow noreferrer">Titanium Mobile</a> is also an option - it allows you to write JavaScript that gets translated into Objective-C.</p>\n'}]
['https://Stackoverflow.com/questions/64420', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8597/']