I have tackled similar problems that have been posted in this forum, however my issue remains unresolved. I am attempting to utilize stringByEvaluatingJavaScriptFromString in swift, but it is not functioning as expected. Any assistance would be greatly appreciated! Code:
import UIKit
import Foundation
import iAd
class zmanimViewController: UIViewController, ADBannerViewDelegate, UIWebViewDelegate {
//variables*******************************************
var adBannerView = ADBannerView(adType: ADAdType.Banner)
@IBOutlet weak var webView: UIWebView!
//functions*******************************************
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.canDisplayBannerAds = true
webView.delegate = self
var url = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("testHTML", ofType: "html")!)
loadLocalHtmlFile(webView, url!)
}
func webViewDidFinishLoad(webView: UIWebView) {
var jsZoom25 = "alert(\"ran1\"); document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust=450%; alert(\"ran2\");"
webView.stringByEvaluatingJavaScriptFromString(jsZoom25)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Thank you for any help provided! Additional info: When my javascript is reduced to only "alert('ran');", the alert pops up. However, the required alerts within the specific javascript are not displaying.