iOS Development--Error summary & common errors and warnings in development summary (18)

Source: Internet
Author: User

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

    • Storyboard: class file not found

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.