No such module "UserNotifications" in Swift 2.3 - ios

I'm using Swift 2.3 on Xcode 7.3.1 and when in AppDelegate I'm trying to import
import UserNotifications
it gives me the error that "No such module UserNotifications". What is the problem and how can I fix that?
I've tried to run it on Xcode 8 with defined SWIFT_VERSION = 2.3, but I get a lot of errors in Alamofire framework, but I set inside of Alamofire swift version, too. So I decided to continue working on Xcode 7.
So, is it because of Xcode versions or I can fix that on Xcode 7, too? My target iOS is 10. I copied inside of supported platforms 10.2 folder, so I can run on iOS 10 device from Xcode 7

You can't simply mix swift2.3 and swift3 in a single project within single target and this is also not a recommended approach.
The error which you are getting is due to UserNotifications framework. This framework has been added in xcode8 so you can't use this framework in xcode7.3.1 .
Also if you are planning to use swift2.3 in Xcode 8 then you have to use Legacy Swift Version if you made it yes then you will be able to run your project which is in swift2.3, but you will be not able to use syntax of swift3.

TO open swift 2.3 project in xcode 8, you have to on legacy form build setting for target and alamofire both.

Related

How to set the swift compiler version?

I am new at developing with Swift so I guess I am missing something...
I have an iOS app built in Swift 3, which is no longer supported in xCode. So I guess I need to migrate to a newer version of swift. Xcode (10.1) suggests Swift 4.2.
But ... There is a dependency which uses Swift 3. I tried recompiling this library (using Xcode 12.1 because I get some built errors in Xcode 10.1). In that project the Swift version is set on Swift 4.2. I compiled the and added the package to the original app.
Now I get an error: Module compiled with Swift 5.3 cannot be imported by the Swift 4.2 compiler.
How can is get the package compiled with Swift 4.2?
Thanks

Old framework version incompatible with iOS 13, new framework incompatible with iOS 12

I have developed a swift iOS app that uses frameworks Moya and Alamofire.
In preparation for iOS 13, I've downloaded Xcode 11 with Swift 5.1 and when I loaded my projects, Moya framework reported error “Module compiled with Swift 5.0 cannot be imported by the Swift 5.1 compile”.
I’ve tried to troubleshoot using this solution Module compiled with Swift 4.0 cannot be imported in Swift 4.0.1 however, that didn't help so I installed pre-release versions of the frameworks.
However, the app can't be run on iOS 12 now because the pre-release version of Moya (maybe its Alamofire which Moya is dependent on) uses Apple's Combine framework.
Is there any other solution to this or will I have to satisfy myself with this app running only on iOS 13?
Use "clean" + "remove derived data"; select proper "command line tools" in the preferences. Rebuild again

How to Update Swift Version Dynamic Coca Touch Framework

I Created a dynamic framework on Swift 3.2 & Xcode 9.0 and use it in my projects worked fine,
today, I update to Xcode 9.2 & Swift 4.0 so compiled framework on Swift 4.0 and export myFramework.framework so added by embedded Binaries it in project.
This is a strange problem when add new framework with Swift 4.0 not resolve any Framework Classes and get error:
Use of unresolved identifier 'MyClassName'
I tired more solution but no solved my problem.
Note: All of Classes Framework have open access.
Where my Framework Problem?
Is there an easy way to update framework swift version?
The Issue was that I build framework via Generic iOS Device If it should compiled on iOS Simulators like iPhone SE or iPhone 8.
I build framework on one of iOS Simulator Device and import in project.

Unsupported Swift Version

I am following this tutorial and am trying to get the starter project to run. When I open the project, I see these warnings:
Unsupported Swift Version
The target “SocketChat” contains source code developed with Swift 2.x. Xcode 9 does not support building or migrating Swift 2.x targets.
Use Xcode 8.x to migrate the code to Swift 3.
On running this program stops executions and I get this error
Dependency Analysis Error Group
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.
I am using Xcode 9 beta. How can I resolve this issue and get the project running?
Your project possibly has swift 2.0, swift 2.1 or swift 2.2 version so Xcode 9 or later does not support that versions. and neither it can convert the swift 2.x's syntax to swift 4
Remember that xcode 9 or later has swift 4 version by default.
Open this project in Xcode 8 8.1, 8.2, or 8.3 your project will run successfully.

Building frameworks for iOS 8 and above in XCode 8

I have recently updated to Xcode 8. Previously I was using Xcode 7 with Swift 2.2.
I have a framework that I built in with deployment target iOS 9.3. Now that I have moved to Xcode 8 I cannot use this framework.
Is there a way I can build a framework that will work for iOS sdks 8 and above?
I want to set the minimum deployment target of my app to iOS 8+.
Also
Alamofire for Swift 3 has been updated and I have updated my pod file.
Will I be able to run the app in iOS versions above 8?
Any help will be appreciated.
Yes it is possible to build frameworks for iOS 8 with Xcode 8. But if you try to support iOS 8 you could also use Swift 3, put If you use other frameworks like Alamofire, you have to be careful, because the latest version of Alamofire (4.x) requires a minimum iOS target version of iOS 9. So you have to use Alamofire (3.x). With Alamofire 3.5 you have to use Swift 2.3
So first you have to decide what's more important for you:
iOS 8 support: So you have to switch to Swift 2.3 and Alamofire 3.x
Swift 3 support: So you have to drop iOS 8 support, because Alamofire 4.x requires iOS 9
As you know that Xcode 8 supports only Swift 2.2 and Swift 3. Your framework is built on top of Swift 2.2. So there is no way that you can run or build the project in Xcode 8, you will get an error like "The project has an older version of Swift, Please build it with newer version of Xcode".
You can use Xcode 8 and you can set minimum deployment target to iOS 8. But you can't use any of the new Swift 3 features in there, I mean you can use it but it will not execute in iOS 8. For that you have to write code with class or API availability checking for each snippet you write.
If you use new version of Alamofire there is no chance that you can use it in iOS 8.0. You need an older version of it. Because Alamofire new version is Swift 3 and have minimum deployment target of iOS 10 I think.
So it is better to convert your project into Swift 3 or to Swift 2.3. That is the best way to solve this situation. Otherwise you will see more lot of problems eventually.

Resources