Summary of common errors and warnings in development (18)
Xib/storyboard Support
Swift projects encounter two different issues when using Xib/storyboard
Xib do not load view content
When creating Uiviewcontroller, the Xib file is selected by default, and when Xib is consistent with the class file name, it can be instantiated with the following code:
Let controller = Ilviewcontroller ()
Operation, the interface is not a thing, xib is not loaded. Workaround, precede the class with @objc (class name), for example:
Import UIKIT@OBJC (Ilviewcontroller) class Ilviewcontroller:uiviewcontroller {}
Tips:
Uiviewcontroller that are created in storyboard, do not require @objc (class name) and can be kept compatible
Storyboard The class file could not be found
The Swift language introduces the module concept and, when converted by keyword @objc (class name), causes the following two types of errors because Storboard does not update the module property in a timely manner:
The Swift class or Objective-c class marked with @objc (class name) may have an error:
2015-06-02 11:27:42.626 ilswift[2431:379047] Unknown class _ttc7ilswift33ilnotfindswifttagbyobjccontroller in Interface Builder file.
Workaround, press, select Blank in module, direct enter
Swift class with no @objc (class name) tag
-----------£ º29.788 ilswift[2719: 417490 class in Interface Builder file.
Workaround, press, select the correct module
3. The cause of the above error: After setting the storyboard, directly in the class file, add or remove the @objc (class name) keyword, causing the module property in storyboard is not automatically updated, so a more general solution is that Let storyboard automatically update the module as follows:
Error simulation Demo download
In order to be able to get a clearer understanding of the solution process, the above error has been simulated, want to try to solve the above problems of students can directly download the demo
iOS Development-Error summary & common errors and warnings in development summary (18)