I am actually compiling for macOS 10.12, as stated. I import the Reachability.swift package, that is compatible down to 10.9. No minimum version is indicated within the Package.swift file. However, I get this error while compiling :
Compiling for macOS 10.12, but module 'Reachability' has a minimum
deployment target of macOS 10.13
It happens since I updated to XCode 14, with version 13, there was no problem.
If I specify the minimum version in the Package.swift of Reachability platforms:[.macOS(.v10_10)],, I clean all the caches, I get the same problem.
I could probably upgrade deployment target to 10.13 (same computer compatibility) or simply include the Reachability.swift file in my code, but I would rather that it works...
[EDIT] Note : other packages, like AppCenter, do not have the same problem… which is weird.
[EDIT 2] With the release of XCode 14.1, the problem remains the same.
Do you have any suggestion ?
I can reproduce your problem: Using AppCenter is OK, but the reachability throws an error.
Here is what I found and maybe this is the root cause:
Make Reachability a local SPM, and modify its swift-tool-version settings and platform settings to align with AppCenter.
Then if you click into the .v10_12 MacOSVersion, you will find os versions lower than 10.13 has all been marked as unsupported
If you head to the built files, test it with otool, you will find the built product's minimum supported version matches with the above description:
So even if you specify the minimum support version to 10.12, the build tools will still target 10.13.
If you check LC_MIN_VERSION_MACOSX on AppCenter. It is also targeting 10.13 instead of 10.12 in its package.swift file.
But why Xcode accepts AppCenter and raise an error for Reachability?
Check the build log below. You will find it in the emitting module stage, the build system is using swift-frontend to embed those 3rd party dependencies. So I guess since the AppCenter is written in objective C.
The checking minimum os version behavior of swift-frontend is different between OC Dependency "AppCenter" and Swift Dependency "Reachability."
Related
So I got an demo ios project from different company but I can't launch it
Basically i get two errors:
Sometimes I also go an unsupported swift architecure error
I work on M2 processor and use XCode 14.2
Project does not have pods, all packages are managed via spm (that's what I was told)
For now i tried:
opening xcode via rosetta (nothing changed)
changing version of xcode to 14.0 (nothing changed)
using other swift version via toolchain (Swift 5.7), screen below ( get different erorrs but i dont think its a good way)
UPDATE
I downloaded version 14.0 of xcode and toolchain 5.7.2
When i use that version of xcode i get an error about missing classes from that sdk in scope and also some weird error from SentrySamplingProvider ( screens below)
I am using Swift Package Manager that doesn't having a xcodeproject file associated with it and I get an error when building through he terminal. When I call the swift build command I get an error that the MacOS build failed. The package I'm building doesn't support MacOS (It uses UIKit), but only iOS. I can't figure out a way to call the command to only specify that the build is targeted for iOS. I've Google searched around with no luck. Does anybody know the correct syntax if it exists to build an SPM package for iOS from the terminal?
The version of Swift I'm using is: "Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)"
I have specified the platform in the Package.swift file
let package = Package(
name: "Package",
platforms: [.iOS(.v10), ],
products: [
...
I have created a sample project on github https://github.com/mike011/Swift-Package-Manager-Example. When I run swift build it fails with
/git/Swift-Package-Manager-Example/Sources/Swift-Package-Manager-Example/iOSSpecificFile.swift:9:8: error: no such module 'UIKit'
import UIKit
^
/git/Swift-Package-Manager-Example/Sources/Swift-Package-Manager-Example/iOSSpecificFile.swift:9:8: error: no such module 'UIKit'
import UIKit
^
I "solved" this by wrapping all my files in #if !os(macOS) #endif blocks. So the package builds on a Mac, but it doesn't have any content.
SwiftPM doesn't currently have a way to disallow building for a specific platform but if you want you can take advantage of the minimum build version to cause compile time errors on platforms you don't support.
For example if you don't want to allow building on macOS you can use the platform version: .macOS("99.0") in your platforms section of your manifest and you will be given the compilation warnings and errors similar to this when building in Xcode:
The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 99.0, but the range of supported deployment target versions is 10.8 to 10.16.99
Invalid Darwin version number: macos99.0
Invalid version number in 'target x86_64-apple-macos99.0'
Some time after upgrading to Xcode 9, I discovered that I was no longer able to build a Kitura-based project with the Swift 3.1.1 snapshot (which I have installed via swiftenv).
When I ran swift build, some time into the build I would get:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes:8:28: error: unknown key 'SwiftImportAsNonGeneric'
SwiftImportAsNonGeneric: true
^
<unknown>:0: error: could not build Objective-C module 'Foundation'
It seems that there is a dependency between Swift and Xcode, and Xcode 9 is no longer fully compatible with Swift 3.1.1 (or earlier) snapshots. I believe it may be because my project uses Foundation, and Foundation on Mac is provided as part of Xcode, whereas on Linux it is part of the Swift snapshot (via swift-corelibs-foundation).
I did find a solution to this problem: If I keep a copy of Xcode 8.3.3 around (eg. in /Applications/Xcode8.3.3.app) then I can use sudo xcode-select -s /Applications/Xcode<version>.app/Contents/Developer to select the appropriate one prior to building with SPM, and I can then build both Swift 3.1.1 and 4.0 projects on the same system.
However, this feels a bit clunky. Each time I build a project with the 'other' Swift version, I have to make sure I run xcode-select, or the build will fail. Is having multiple versions of Xcode the right solution in this case, or am I missing a trick with Xcode 9?
note that if, like me, you upgraded Xcode via the App Store, previous versions of Xcode are still available from https://developer.apple.com/download/more/
As per the instructions given on Bluemix site; I installed the Swift SDK
pod use_frameworks!
pod 'BMSSecurity'
and it shows this on my terminal:
Then, when I built the project, I got 36 build errors.
First of which is "no such module as BMSCore" when I can see that framework imported in the pod and 35 errors related to BMSAnalytics, which is again framework imported.
These build errors are due to the incompatibility between two of the BMSSecurity dependencies (BMSCore and BMSAnalyticsAPI) and the version of Xcode you are using (7.2.1). The latest versions of these 2 frameworks only support Xcode 7.3 and higher, as explained in the BMSCore Github README. If you want to continue using Xcode 7.2, you can use BMSCore 1.0.3 instead.
So, there are 2 possible solutions here:
Upgrade Xcode to version 7.3
Add the following line to your Podfile: pod 'BMSCore', '~> 1.0.3'
Option 1 is recommended since only Xcode 7.3+ will be supported in future releases of BMSSecurity.
Are you opening FoodTracker.xcworkspace ?? please open .xcworkspace after pod install..
I recently added a static library (mobclix) to my iPhone project which required me to set the Base SDK to 3.0. This library is claimed to be compatible with 2.2 and so far it looks like it's true. I set the project's Deployment Target to 2.2. No problems there.
Now, I am also using libxml2 in this same project. Apparently, the libxml2.2.dylib in OS 3.0 is newer than in OS 2.X (version 10 and 9 respectively). However, my code that uses libxml2, was already compatible with the libxml2 version included with OS 2.X. Since I needed to set the Base SDK to 3.0, the "compatibility version" / minimum version requirement / dependency is automatically set to the newer version of libxml2. When I try to run the app in OS 2, I get this runtime error (obviously):
Dyld Error Message:
Library not loaded: /usr/lib/libxml2.2.dylib
Referenced from: /Users/Martijn/Library/Application Support/iPhone Simulator/User/Applications/4D5456DE-F297-4DF4-ACA6-DA8BBBBBA914/Luisterpaal.app/Luisterpaal
Reason: Incompatible library version: Luisterpaal requires version 10.0.0 or later, but libxml2.2.dylib provides version 9.0.0
Is it possible to override the version requirement somewhere?
Or other ideas to solve this issue?
The compatibility version is set according to the version embedded in the dylib of the current SDK during build. I have not found a way to change or override this.
However, in the target in Xcode under the "Link with binary with libraries" branch there is an option to link a dylib "weakly". This skips version checking at the time of loading the dylib (runtime). It's your responsibility then to only make calls to existing functions. Making calls to non-existent functions will crash the application.
Apparently there was a change with SDK 3.0 that broke compatibility with libxml. Apple have posted about it here:
http://developer.apple.com/iphone/library/qa/qa2009/qa1659.html