We are creating an application using Xcode 6 beta 5 + Swift on the iOS 8 SDK. We would also like to install iOS 7. Is this possible? When we set the project deployment target to 7.0, we get compile-time errors as follows:
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_WKPreferences", referenced from: __TMaCSo13WKPreferences in WebViewController.o "_OBJC_CLASS_$_WKWebView", referenced from: __TMaCSo9WKWebView in WebViewController.o "_OBJC_CLASS_$_WKWebViewConfiguration", referenced from: __TMaCSo22WKWebViewConfiguration in WebViewController.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
I believe that since we use WKWebKit , which is only supported by iOS 8+. We are fine using UIWebKit for iOS 7, but WKWebKit for iOS 8. How do we define this?
The definition of our class is as follows:
import WebKit class WebViewController: UIViewController, WKNavigationDelegate { ... }
and it is called:
let mainStoryboard = UIStoryboard(name: "Main", bundle: nil) let destinationVC = mainStoryboard.instantiateViewControllerWithIdentifier("WebViewController") as WebViewController presentViewController(destinationVC, animated: true, completion: nil)
I was thinking about using this snippet to call presentViewController , but this does not solve the compile-time problem. ( NSFoundationVersionNumber also does not solve compilation problems)
if ((UIDevice.currentDevice().systemVersion as NSString).floatValue >= 8.0) { } else { }
UPDATE: kkoltzau has the correct answer. I am adding additional information to others.
First go to Project , click General , scroll down to Linked Frameworks and Libraries and add WebKit.framework as optional. (I also did this for UIKit.framework ) See screenshot:

As for my WebViewController class. It still imports UIKit and WebKit . but viewDidLoad() sets up a view based on the kkoltzau example. Then, when I need to load / reload a web page, it checks for the existence of wkWebView .
ios xcode ios7 ios8 swift
Dean Aug 16 '14 at 2:42 a.m. 2014-08-16 14:42
source share