uiwebview

massive memory leak in ios UIWebView

末鹿安然 提交于 2019-12-17 09:40:43
问题 looking for mem leaks elsewhere in our system, I created a 20 MB web page with a meta refresh tag. the idea was to move a lot data through our datapath code to confirm mem stability. <html> <meta http-equiv="refresh" content="1"> <body> <div style="border: 1px solid red"> Content loading </div><!-- 20mb worth of comments --> </body> </html> what I found was the uiwebview displaying that meta refresh page leaks memory very, very fast. the app memory hits 300mb in about 2 minutes and gets shot

How to Load Local PDF in UIWebView in Swift

吃可爱长大的小学妹 提交于 2019-12-17 09:16:32
问题 So I am currently trying to display a local PDF I have in UIWebview and this is the code I'm using: @IBOutlet weak var webView:UIWebView! override func viewDidLoad() { super.viewDidLoad() var pdfLoc = NSURL(fileURLWithPath:NSBundle.mainBundle().pathForResource("Sample", ofType:"pdf")!) var request = NSURLRequest(URL: pdfLoc); self.webView.loadRequest(request); } The code will successfully build, but when I run the app, it will crash with the error: Thread 1: EXC_BAD_INSTRUCTION(code=EXC-I386

iPhone Dev: UIWebView baseUrl to resources in Documents folder not App bundle

断了今生、忘了曾经 提交于 2019-12-17 08:59:26
问题 Greetings! Can anyone please kindly assist me finding a way around the following: load an html into a UIWebView using loadHTMLString and include(using baseURL ) the resources such as the CSS, image files from folders within user's Documents directory - and not from the MainBundle of the application. I have seen tutorials on how to use baseURL to load within the application bundle/MainBundle which is straightforward but not with resources from the iPhone's Documents directories. The structure

UIWebView webpage caching for offline viewing

好久不见. 提交于 2019-12-17 08:59:08
问题 First of all, I'm pretty sure that I have checked every answer here and nothing does what I would like to do. In this question, for answer is given ASIHTTPRequest which is dead project. (How do I download an entire webpage (with images) on the iPhone?) In this question, user proposed RNCachingURLProtocol which is really great but I had a few problems after closing app completely (closing it in task-bar). After that I didn't get css or images, only html was loaded. (Cache a single webpage for

Is it possible for a UIWebView to save and autofill previously entered form values (e.g., username & password)?

二次信任 提交于 2019-12-17 08:09:55
问题 I'm building an iPhone app that is just a UIWebView of an existing mobile site that has a form-based login. When I login to the mobile site on iPhone Safari, I'm prompted to save my username/password, and it's then autofilled when I go back to the site later. I'd like to enable the same functionality in the UIWebView , but for the life of me, I can't figure out how to do it. Any ideas? Solution Following Michael's basic model (see accepted answer), I was able to get this done. Here's what I

how to intercept Button click inside UIWebview on IOS?

╄→尐↘猪︶ㄣ 提交于 2019-12-17 08:09:16
问题 I have a HTML form that has certain fields which i am opening inside a UIWebview. On click of a particular button i want to do a in app action. The approach i'm using now is on click of the button i redirect the page to a dummy URL. I sniff the URL using delegate method "shouldStartLoadWithRequest" and stop the redirection. I then do my custom event (capture image and upload) and then continue. This seems to be an ugly hack. Anyway i can directly hook into the button click event rather than a

Using custom font in a UIWebView

给你一囗甜甜゛ 提交于 2019-12-17 08:09:08
问题 I would like to display a custom font inside a UIWebView. I have already put the font in the plist under "Fonts provided by application". The code in use: UIWebView *webView = [[UIWebView alloc] initWithFrame:myRect]; NSURL *baseURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]; [webView loadHTMLString:html baseURL:baseURL]; [self addSubview:webView]; where html is an NSString that has the following contents: <html><head> <style type="text/css"> @font-face { font-family: gotham

How to clear UIWebView cache?

霸气de小男生 提交于 2019-12-17 06:39:23
问题 I need UIWebView to display some local .webarchive file. But images there have same names, so UIWebView shows only one image all the time. How can I clear the cache? Thanks in advance 回答1: // Flush all cached data [[NSURLCache sharedURLCache] removeAllCachedResponses]; 回答2: NSURLRequest* request = [NSURLRequest requestWithURL:fileURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60.0]; [webView loadRequest:request]; (now with typo fixed) 回答3: I've had this issue myself

iPhone UIWebView local resources using Javascript and handling onorientationChange

强颜欢笑 提交于 2019-12-17 06:24:15
问题 I'm trying to server HTML Javascript and CSS content from an iPhone application's local resources, and I'm having trouble handling onOrientationChange events and including external Javascript. I seem to be able to link in CSS properly but not javascript. I'm trying to use the following example of handling onOrientationChange (How to build an iPhone website) but I'm serving the webpage from my app's NSBundle mainBundle. I tried attaching a javascript function to body.onorientationchange and to

How the default keyboard comes up when user taps in UIWebView?

无人久伴 提交于 2019-12-17 06:16:10
问题 I am currently developing a custom iOS browser something like Mogok. I need to change the default keyboard when user taps on any textinput in the UIWebView. I wonder how the system shows keyboard when a user taps on any input text in UIWebView? How can I get the reference of the text field which becomes first responder in UIWebView ? I have already made 2 nights black :-) No result yet :-( Any help would be highly appreciated. Regards Ranjan 回答1: Well, if you can't beat them, join them. As