iosswiftxcodensusernotificationusernotifications

No such module "UserNotifications" in Swift 2.3


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


Solution

  • 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.