Xcode shows many errors but program compiles and runs fine (in both simulator and device)

后端 未结 16 1358
陌清茗
陌清茗 2020-12-23 13:46

After installing the CocoaLumberjack\' log compressor class I\'ve been getting this annoying behavior: Xcode complains that there are many undeclared identifiers and gives m

相关标签:
16条回答
  • 2020-12-23 13:59

    I got the similar type of issue.

    Alternate option to fix this is Open organizer and delete the derived data of your project or delete all the projects in organizer projects tab. It works fine..

    0 讨论(0)
  • 2020-12-23 14:03

    Open up a terminal and create a nice little function accessible via the command line...

    nano ~/.bashrc

    add (making the necessary substitutions between the pointy braces)

    cycle() {
      git stash save "BACKUP"
      git checkout <<SOME OTHER BRANCH>>
      git branch -D $1
      xcodebuild -allowProvisioningUpdates -workspace <<YOUR WORKSPACE>>.xcworkspace -scheme <<YOUR SCHEME>> -configuration Release clean
      git checkout $1
    }
    

    ^X and save it by following the prompts, then enter source ~/.bashrc to make it visible to the current terminal session.

    Make sure your branch is pushed to origin, cause we're going to delete it :)

    Call the function using cycle <<MY BRANCH>> (once it's run you might want to call git stash pop to restore any working copy changes)

    Hope it works for you! Xcode, get on your game!

    0 讨论(0)
  • 2020-12-23 14:06

    Running on Xcode Version 10.1 (10B61), I set the build setting "Increase Sharing of Precompiled Headers" to NO. I was working in an .xcworkspace with many projects sharing the same frameworks, and no Objective-C bridging header (meaning I've added no obj-c code myself). I'm not sure when Xcode did away with .pch files by default, but I didn't have any of those in my project.

    0 讨论(0)
  • 2020-12-23 14:08

    I have removed some extra spaces and extra lines from .pch file and it xcode stopped complaining

    0 讨论(0)
  • 2020-12-23 14:08

    This happened to me as well, but cleaning didn't fix it. What did was quitting and reopening XCode. Afterwards, all the phantom errors were gone. For those wondering, the tabs you have open when you close will still be open when you reopen.

    0 讨论(0)
  • 2020-12-23 14:09

    I just had the same thing in Xcode 5.1.

    I fixed it by making sure there were no blank lines between #import's

    0 讨论(0)
提交回复
热议问题