0

i am having problem with swift do try catch

my xCode doesn't recognize try or catch gives me error like this.did some googling and watched some tutorials.they do the same as i did but i get this error.using xCode 6.3
need help

https://i.sstatic.net/8GiPe.png and https://i.sstatic.net/k5bZ6.png

4
  • Please include the code you're attempting, and the exact error it is generating. Commented Dec 29, 2015 at 14:51
  • 1
    Try/catch was introduced with Swift 2/Xcode 7. It won't compile in your (stone-old :) Xcode 6.3
    – Martin R
    Commented Dec 29, 2015 at 14:53
  • please don't link to images when asking questions, make everyone life easier by posting the code instead. Please read How to Ask Commented Dec 29, 2015 at 15:21
  • gist.github.com/anishparajuli555/e3f7e851ef91042ae7aa look at this gist ...
    – LC 웃
    Commented Dec 29, 2015 at 17:01

1 Answer 1

3

The error-handling model using throw/try/catch is one of the major new features that came with Swift 2 and Xcode 7. You cannot compile that code with Xcode 6.3 (Swift 1.2).

The current Xcode version (at the time of writing this) is Xcode 7.2, so for any Swift development it is recommended that you upgrade. (If necessary for other reasons, you can install older Xcode versions in parallel.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.