2

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

J. Doe
  • 563
  • 1
  • 9
  • 20
  • Have you added `UserNotifications.framework` in `Linked Framework and Libraries`? – Poles Nov 28 '16 at 13:09
  • To use Xcode 8, simply open your project, find the build settings and set `Use_Legacy_Swift_Version` to true. Do this for any libraries you have installed too. You may also have to codesign the libs. – Jacob King Nov 28 '16 at 13:09
  • @Poles I cannot find it in the list there – J. Doe Nov 28 '16 at 13:13
  • @JacobKing I already did that. But Alamofire still gives me syntax errors =/ – J. Doe Nov 28 '16 at 13:14

2 Answers2

0

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.

Rajat
  • 10,977
  • 3
  • 38
  • 55
0

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