This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Trying to migrate an Objective C project to Cocoapods for an iOSDFULibrary with Xcode 9 results in an unopenable project

Hi,

When I take a vanilla Objective C Xcode project and try to convert it to Cocoapods for an iOSDFULibrary with Xcode 9 results in an unopenable project. You get an error "Unsupported Swift Version". Please see the attached screenshot.

I’ve tried both: github.com/.../IOS-Pods-DFU-Library github.com/.../IOS-nRF-Toolbox Both result with the same error in the attached screenshot.

This issue seems to be a newer incarnation of: devzone.nordicsemi.com/.../ image001.png

  • Hi @red! Sorry to hear about your issue , seems like it’s a simple fix due to Xcode assuming your swift version, just select the pods project and go to build settings and search for ‘SWIFT_VERSION’ then select 4.0 instead of your current setting. This might be a bug in Xcode or cocoa pods, we will take a look into that next Monday and update you. But doing that will allow you to build with no problems, let us know after doing that if your problems are resolved!

    If not we will gladly take you through it personally step by step to make sure your project works properly as soon as possible

  • I can't seem to find anything named "SWIFT_VERSION"... even if I grep for it. red$ grep -r "SWIFT_VERSION" . red$ What file specifically should this flag be located in?

  • Oh, sorry, you meant the Pods.xcodeproj in the Pods sub-folder. Anyhow, now I end up with 47 errors and 3 warnings.

  • Here are the issues now that we switched the pod file into thinking it was Swift v4: Swift Compiler Error Group /Pods/Zip/Zip/QuickZip.swift:40:63: Function types cannot have argument labels; use '' before 'progress' /Pods/Zip/Zip/QuickZip.swift:83:83: Function types cannot have argument labels; use '' before 'progress' /Pods/Zip/Zip/Zip.swift:65:121: Function types cannot have argument labels; use '' before 'progress' /Pods/Zip/Zip/Zip.swift:71:43: Expected ',' joining parts of a multi-clause condition /Pods/Zip/Zip/Zip.swift:210:99: Function types cannot have argument labels; use '' before 'progress' /Pods/Zip/Zip/QuickZip.swift:25:34: Missing argument label 'path:' in call /Pods/Zip/Zip/QuickZip.swift:41:27: 'NSFileManager' has been renamed to 'FileManager' /Pods/Foundation.NSFileManager:2:18: 'NSFileManager' was obsoleted in Swift 3 /Pods/Zip/Zip/Zip.swift:13:23: 'ErrorType' has been renamed to 'Error' /Pods/Swift.ErrorType:2:18: 'ErrorType' has been explicitly marked unavailable here /Pods/Zip/Zip/QuickZip.swift:43:28: Thrown expression type 'ZipError' does not conform to 'Error' /Pods/Zip/Zip/QuickZip.swift:45:29: Value of type 'String' has no member 'stringByReplacingOccurrencesOfString' /Pods/Zip/Zip/QuickZip.swift:67:33: Missing argument label 'paths:' in call /Pods/Zip/Zip/QuickZip.swift:84:27: 'NSFileManager' has been renamed to 'FileManager' /Pods/Foundation.NSFileManager:2:18: 'NSFileManager' was obsoleted in Swift 3 /Pods/Zip/Zip/Zip.swift:13:13: Type 'ZipError' does not conform to protocol 'RawRepresentable' /Pods/Zip/Zip/Zip.swift:13:13: Do you want to add protocol stubs? /Pods/Zip/Zip/Zip.swift:68:27: 'NSFileManager' has been renamed to 'FileManager' /Pods/Foundation.NSFileManager:2:18: 'NSFileManager' was obsoleted in Swift 3 /Pods/Zip/Zip/Zip.swift:72:28: Thrown expression type 'ZipError' does not conform to 'Error' /Pods/Zip/Zip/Zip.swift:75:28: Thrown expression type 'ZipError' does not conform to 'Error' /Pods/Zip/Zip/Zip.swift:82:67: Argument 'repeatedValue' must precede argument 'count' /Pods/Zip/Zip/Zip.swift:92:31: 'NSProgress' has been renamed to 'Progress' /Pods/Foundation.NSProgress:3:18: 'NSProgress' was obsoleted in Swift 3 /Pods/Zip/Zip/Zip.swift:103:28: Thrown expression type 'ZipError' does not conform to 'Error' /Pods/Zip/Zip/Zip.swift:106:42: 'cStringUsingEncoding' has been renamed to 'cString(usingEncoding:)' /Pods/Foundation.StringProtocol:15:17: 'cStringUsingEncoding' has been explicitly marked unavailable here /Pods/Zip/Zip/Zip.swift:106:63: 'NSASCIIStringEncoding' has been renamed to 'String.Encoding.ascii' /Pods/Foundation.NSASCIIStringEncoding:2:12: 'NSASCIIStringEncoding' has been explicitly marked unavailable here /Pods/Zip/Zip/Zip.swift:113:32: Thrown expression type 'ZipError' does not conform to 'Error' /Pods/Zip/Zip/Zip.swift:116:41: Expected member name or constructor call after type name /Pods/Zip/Zip/Zip.swift:116:41: Add arguments after the type to construct a value of the type /Pods/Zip/Zip/Zip.swift:116:41: Use '.self' to reference the type object /Pods/Zip/Zip/Zip.swift:116:34: 'sizeof' is unavailable: use MemoryLayout.size instead. /Pods/Zip/Zip/Zip.swift:120:32: Thrown expression type 'ZipError' does not conform to 'Error' /Pods/Zip/Zip/Zip.swift:124:56: 'alloc' has been renamed to 'allocate(capacity:)' /Pods/Swift.UnsafeMutablePointer:19:24: 'alloc' has been explicitly marked unavailable here /Pods/Zip/Zip/Zip.swift:126:32: Thrown expression type 'ZipError' does not conform to 'Error' /Pods/Zip/Zip/Zip.swift:130:36: Argument labels '(CString:, encoding:)' do not match any available overloads /Pods/Zip/Zip/Zip.swift:130:36: Overloads for 'String' exist with these partially matching parameter lists: (decoding: C, as: Encoding.Type), (decodingCString: UnsafePointer<Encoding.CodeUnit>, as: Encoding.Type), (_builtinUTF16StringLiteral: RawPointer, utf16CodeUnitCount: Word), (repeating: Unicode.Scalar, count: Int), (repeating: String, count: Int), (T, radix: Int, uppercase: Bool), (count: Int, repeatedValue: Character), (count: Int, repeatedValue: Unicode.Scalar), (repeating: Character, count: Int), (bytes: S, encoding: String.Encoding), (utf16CodeUnits: UnsafePointer, count: Int), (contentsOfFile: String, encoding: String.Encoding), (contentsOfFile: String, usedEncoding: inout String.Encoding), (contentsOf: URL, encoding: String.Encoding), (contentsOf: URL, usedEncoding: inout String.Encoding), (cString: UnsafePointer, encoding: String.Encoding), (data: Data, encoding: String.Encoding), (format: String, CVarArg...), (format: String, arguments: [CVarArg]), (format: String, locale: Locale?, CVarArg...) /Pods/Zip/Zip/Zip.swift:131:32: Thrown expression type 'ZipError' does not conform to 'Error' /Pods/Zip/Zip/Zip.swift:135:55: 'cStringUsingEncoding' has been renamed to 'cString(usingEncoding:)' /Pods/Foundation.StringProtocol:15:17: 'cStringUsingEncoding' has been explicitly marked unavailable here /Pods/Zip/Zip/Zip.swift:135:76: 'NSUTF8StringEncoding' has been renamed to 'String.Encoding.utf8' /Pods/Foundation.NSUTF8StringEncoding:2:12: 'NSUTF8StringEncoding' has been explicitly marked unavailable here /Pods/Zip/Zip/Zip.swift:143:32: Thrown expression type 'ZipError' does not conform to 'Error' /Pods/Zip/Zip/Zip.swift:146:40: 'NSFileCreationDate' has been renamed to 'FileAttributeKey.creationDate' /Pods/Foundation.NSFileCreationDate:2:12: 'NSFileCreationDate' was obsoleted in Swift 3 /Pods/Zip/Zip/Zip.swift:146:74: 'NSFileModificationDate' has been renamed to 'FileAttributeKey.modificationDate' /Pods/Foundation.NSFileModificationDate:2:12: 'NSFileModificationDate' was obsoleted in Swift 3 /Pods/Zip/Zip/Zip.swift:174:32: Thrown expression type 'ZipError' does not conform to 'Error' /Pods/Zip/Zip/Zip.swift:180:32: Extraneous argument label 'progress:' in call /Pods/Zip/Zip/Zip.swift:189:28: Extraneous argument label 'progress:' in call /Pods/Zip/Zip/Zip.swift:213:27: 'NSFileManager' has been renamed to 'FileManager' /Pods/Foundation.NSFileManager:2:18: 'NSFileManager' was obsoleted in Swift 3 /Pods/Zip/Zip/Zip.swift:217:28: Thrown expression type 'ZipError' does not conform to 'Error' /Pods/Zip/Zip/Zip.swift:221:61: Missing argument label 'paths:' in call /Pods/Zip/Zip/Zip.swift:242:31: 'NSProgress' has been renamed to 'Progress' /Pods/Foundation.NSProgress:3:18: 'NSProgress' was obsoleted in Swift 3 /Pods/Zip/Zip/Zip.swift:308:28: Extraneous argument label 'progress:' in call /Pods/Zip/Zip/Zip.swift:325:38: Missing argument label 'fileExtension:' in call /Pods/Zip/Zip/ZipUtilities.swift:14:23: 'NSFileManager' has been renamed to 'FileManager' /Pods/Foundation.NSFileManager:2:18: 'NSFileManager' was obsoleted in Swift 3 /Pods/Zip/Zip/ZipUtilities.swift:50:17: Cannot convert value of type 'ObjCBool' to expected argument type 'Bool' /Pods/Zip/Zip/ZipUtilities.swift:55:65: Missing argument label 'directory:' in call /Pods/Zip/Zip/ZipUtilities.swift:80:21: Cannot convert value of type 'ObjCBool' to expected argument type 'Bool' Swift Compiler Warning Group /Pods/Zip/Zip/Zip.swift:125:25: Comparing non-optional value of type 'UnsafeMutablePointer' (aka 'UnsafeMutablePointer') to nil always returns false /Pods/Zip/Zip/Zip.swift:162:31: Comparing non-optional value of type 'UnsafeMutablePointer' (aka 'UnsafeMutablePointer<__sFILE>') to nil always returns true

Related