Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Simple iPhone App with Swift Running Apps On a Device Running on Device

Paul Chelaru
Paul Chelaru
4,109 Points

21 errors

When I plug in my device and I run the program I get 21 errors from the category "Swift Compiler Error", but when I use the simulator everything is good and the program runs without problems.

2 Answers

Nathan F.
Nathan F.
30,773 Points

Hi Paul,

I've never experienced this issue, so I'm firing in the dark here. I did some digging and this seems to be a rather rare problem. In one case, someone had success by reinstalling Xcode--there was an issue with a framework file being blank, but it wasn't obvious because the simulator relies on a different source. Another, it was an issue with certain classes not being marked with @objc in a library they were using.

If your project is on Github, you can send me a link to it and I'd be happy to clone it down and see if I'm able to build to device successfully or not. That'd help us rule out some issues. The alternative would be to try and update / reinstall Xcode and see if that does anything for you.

Paul Chelaru
Paul Chelaru
4,109 Points

I just updated the Xcode and after that, I could run it with no problems. Thank you!

Nathan F.
Nathan F.
30,773 Points

What sort of errors appear when you run on device? Are they errors or warnings? Some of those warnings might be from not including app icons or other things that would be necessary for a complete, store ready app.

Paul Chelaru
Paul Chelaru
4,109 Points

Attempting to use the forward class 'UIViewController' as superclass of 'UIActivityViewController' / Attempting to use the forward class 'UIViewController' as superclass of 'UIAlertController' / Attempting to use the forward class 'UIViewController' as superclass of 'UICollectionViewController' / Attempting to use the forward class 'UIViewController' as superclass of 'UIDocumentPickerViewController' / Attempting to use the forward class 'UIViewController' as superclass of 'UIDocumentMenuViewController' / Attempting to use the forward class 'UIViewController' as superclass of 'UIDocumentPickerExtensionViewController' / Attempting to use the forward class 'UIViewController' as superclass of 'UICloudSharingController' / Attempting to use the forward class 'UIViewController' as superclass of 'UINavigationController' / Cannot define category for undefined class 'UIViewController' / Cannot define category for undefined class 'UIViewController' / Attempting to use the forward class 'UIViewController' as superclass of 'UIInputViewController' / Unknown type name 'UIModalPresentationStyle' / Cannot define category for undefined class 'UIViewController' / Expected a type