Errors, finishing off Bulls Eye

I downloaded the new version of the iOS Apprentice this morning and yesterday I updated to Xcode 10 / Mojave.

I had started the Bulls Eye app previously and one of the last steps seems to be giving errors. Has this something to do with the version change?
(The project files supplied with it seem to be working fine, even copied the lot on the view controller.swift but didn’t make a difference)

thanks in advance

Rene

Did you try cleaning your project? It is possible that if you were working with Xcode 9 earlier, that you have artifacts remaining from a previous compilation.

If that doesn’t work, and you have not rebooted since installing Xcode 10, do check to see if a reboot helps as well.

1 Like

Fahim, thank you for your reply, have just rebooted and there is not difference, also tried copying the provided coded again from the same file to my fie (view controller.swift) and it still comes up with the same errors.

as I said previously though the project that I opened (which was provided) doesn’t seem to have the same errors, it’s working perfectly fine.

Just wondering where it’s coming from, I bet you if I would do it all over again it would be alright, but not really feeling up for that as I want to get onto the next chapter :wink:

I have followed the instructions from the book to the letter.

Rene

I just realized what is probably happening :slight_smile: You started this project in Xcode 9, correct? If so, your swift version for the project is set to Swift 4.1 whereas the code in iOS Apprentice 7th edition is for Swift 4.2 - and it’s the difference in Swift versions (and the changes from one version to another) that’s probably causing this …

If you check the Issue Navigator (5th tab on the left sidebar) you should see an option to update your project to Swift 4.2. Click on it and then follow the on screen prompts. That should update your project to Swift 4.2 and you should be able to proceed fine after that.

1 Like

That was correct Fahim! and updating this to Swift 4.2 has worked, just have to make sure that if you do that the code that generates the error (or any error for that matter) has been commented out as it does try to build the project.

thanks for the help! :slight_smile:

Rene

Sure thing :slight_smile: I’m glad that you were able to sort things out.

Hi Fahim,

I am having a somehow similar issue, I started following the steps of developing the bullseyes project, the first step after initial creation is run the programme in the simulator, however, the build process failed! and the following error message is displayed on the left had panel:

“Command ComplileSwift failed with
nonzero exit code”

When you say “similar issue”, do you mean that you started developing the project in Xcode 9 and then switched to Xcode 10? Or did you start out in Xcode 10 itself for creating the project?

If you created the project in Xcode 10, then try the following:

  1. Clean the project via the Product - Clean Build Folder Xcode menu option.
  2. Restart Xcode.
  3. Restart your machine.

Of course, you have to try step #2 only if step #1 fails, and step #3 only if step #2 fails.

If nothing works, then upload a screenshot of the full error from the Report Navigator tab since that might give a clue as to what is going on.

Also, if you have just created the project and have not added any code, then if you went through all three of the steps above and it still doesn’t work, then creating a new project to see if that compiles might also be something to try …

Hi Fahim,

Thanks for the help, unfortunately, the outcome is the same after trying steps 1,2 and 3! I even recreated the app within a new folder, however, the build failed because of the same reason!

On the side note which may or may not have any bearing under the Toolchain menu I have noted there are three options: i) - Xcode 10.0, ii) - Swift 4.1 Snapshot, iii) - 4.1.2 Release, please see attached screenshots35 12 .

Thanks

Henry

As you might notice from the error, it says that “Swift 4.2” is not found. And I am not sure how you have additional toolchains unless you installed them yourself since I don’t see that with a default installation of Xcode. Did you install additional Swift versions?

Either way, your toolchains menu shows that you have Swift set to 4.1 and of course,that is not going to work for project which need Swift 4.2 :slight_smile: So you might try switching the toolchains to Xcode 10 and see if that works since the Xcode 10 toolchain comes with Swift 4.2.

Hi Fahim,

Many thanks for your help, after switching the toolchains to Xcode 10, the problem was solved!

This topic was automatically closed after 166 days. New replies are no longer allowed.