swift2.3

Migrating from Swift 2.3 to Swift 3 with dependencies

痴心易碎 提交于 2019-12-24 03:59:13
问题 I am working on migrating my project from Swift 2.3 to Swift 3 but am having issues with 3rd party frameworks that I use via Cocoapods. Many of them have already upgraded to Swift 3, yet some of them haven't. When I build my project, I get the error: Module compiled with Swift 2.3 cannot be imported in Swift 3.0: [...] I have read answers such as this one and this one, however they do not solve my problem. I cannot set SWIFT_VERSION to 2.3 if my project actually is using Swift 3, neither can

Module compiled with Swift 2.3 cannot be imported in Swift 3.0

偶尔善良 提交于 2019-12-19 14:19:11
问题 i add Facebook SDK (Swift) to my project. And now i update Xcode 8 and Swift 3. I have error in build time Module compiled with Swift 2.3 cannot be imported in Swift 3.0 It is very strange that is not supported. Has anyone had similar problems? 回答1: Remember to set Use Legacy Swift Language Version to YES for your project target You are building your project in 2.3 and not in 3.0 回答2: Have in mind that if you want to use Swift 3 as your main project's language you have to use pods that are

LazyFilterBidirectionalCollection<Results<datatype>>' to expected argument type '[datatype]'

让人想犯罪 __ 提交于 2019-12-13 03:46:34
问题 After I convert my project from swift 2.3 to swift 3 , I got this error in Realm Filter I can't get filter result in array : func filterUsers(_ searchText: String, completion: (([Lawyer]) -> Void)) { let bgRealm = try! Realm() // Filter the whole list of users let results = bgRealm.objects(Lawyer.self).filter { (cc) -> Bool in cc.name.contains2(searchText) || cc.name.contains2(searchText) || cc.phoneNumber2.contains2(searchText) } print(results) completion(results) } 回答1: filter , map , etc.

Conversion from Swit2.3 to Swift3 cause “Terminating with uncaught exception of type NSException”

痞子三分冷 提交于 2019-12-12 01:24:22
问题 Here is the code I want to convert from Swift2.3 to Swift3: AWSCloudLogic.defaultCloudLogic().invokeFunction(functionName, withParameters: parameters, completionBlock: {(result: AnyObject?, error: NSError?) -> Void in if let result = result { dispatch_async(dispatch_get_main_queue(), { print("CloudLogicViewController: Result: \(result)") //self.activityIndicator.stopAnimating() //self.resultTextView.text = prettyPrintJson(result) }) } var errorMessage: String if let error = error { if let

iOS Swift 2.3: correct syntax for application restorationHandler?

喜夏-厌秋 提交于 2019-12-11 23:44:35
问题 I am trying to setup Firebase Dynamic Links in my iOS project using Swift 2.3. When I add this function in the AppDelegate (as reported at the bottom of this page), I get the error: Unknown attribute 'escaping' func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool { guard let dynamicLinks = FIRDynamicLinks.dynamicLinks() else { return false } let handled = dynamicLinks.handleUniversalLink(userActivity

How to show an alert from another class in Swift?

烂漫一生 提交于 2019-12-09 04:08:44
问题 I have a main class, AddFriendsController , that runs the following line of code: ErrorReporting.showMessage("Error", msg: "Could not add student to storage.") I then have this ErrorReporting.swift file: import Foundation class ErrorReporting { func showMessage(title: String, msg: String) { let alert = UIAlertController(title: title, message: msg, preferredStyle: UIAlertControllerStyle.Alert) alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil)) self

using KVO to observe WKWebView's URL property not work in iOS 10

若如初见. 提交于 2019-12-07 15:26:32
问题 I use WKWebView to load my webpage. When user click a button in webpage, my webpage will open a custom schema URL (e.g. asfle://download?media_id=1). And I use KVO to observe WKWebView's URL property to get the URL. It works well in iOS 9, but it doesn't work in iOS 10. I can't get the url. I use Xcode 8, swift 2.3. override func viewDidLoad() { super.viewDidLoad() webView.addObserver(self, forKeyPath: "URL", options: .New, context: nil) } override func observeValueForKeyPath(keyPath: String?

UIAlertcontroller set attributed messages

这一生的挚爱 提交于 2019-12-04 02:54:15
问题 How we can set Attributed text in UIAlertcontroller as message. My try code As bellow, but it will crash the app. // create Attributed text let myAttribute = [NSForegroundColorAttributeName: UIColor(red:122.0/255, green:125.0/255, blue:131.0/255, alpha:1.0),NSFontAttributeName: Constant.flinntRegularFont(15)] let myAttribute2 = [NSForegroundColorAttributeName: UIColor.blackColor(),NSFontAttributeName: Constant.flinntMediumFont(15)] let myString = NSMutableAttributedString(string: "You have

Cannot debug Swift module/framework embedded in Objective-C app

旧街凉风 提交于 2019-12-03 04:46:44
问题 Alternative titles (to aid searching) Cannot debug Swift 2.3 framework linked to an Objective-C app in Xcode 8 error in auto-import: failed to get module 'XYZ' from AST context Xcode 8 Xcode 8 cannot debug Swift framework warning: Swift error in module <XYZ> Workaround for; Xcode Debugger cannot debug apps written in Objective-C only but that link against frameworks written in Swift only. (28312362) I have an app written in Objective-C that links against some modules (frameworks) written in

Cannot debug Swift module/framework embedded in Objective-C app

☆樱花仙子☆ 提交于 2019-12-02 18:00:13
Alternative titles (to aid searching) Cannot debug Swift 2.3 framework linked to an Objective-C app in Xcode 8 error in auto-import: failed to get module 'XYZ' from AST context Xcode 8 Xcode 8 cannot debug Swift framework warning: Swift error in module <XYZ> Workaround for; Xcode Debugger cannot debug apps written in Objective-C only but that link against frameworks written in Swift only. (28312362) I have an app written in Objective-C that links against some modules (frameworks) written in Swift 2.x. Question Everything (debugging etc.) works fine in xcode7 , however when moving to xcode8 and