Xcode 4: Auto-complete & Jump to Definition broken in my Xcode 3 Project

前端 未结 15 963
时光说笑
时光说笑 2021-01-30 09:11

My project was created in Xcode 3, I\'m opening it in Xcode 4 and notice the following:

  • \'Jump to Definition\' no longer works with my own symbols
相关标签:
15条回答
  • 2021-01-30 09:23

    http://three20.info/article/2011-03-10-Xcode4-Support worked for me. Specifically erasing the Build directory of three20. Strangely it worked even when the said build was made in xcode4. CodeSense started working the moment I erased the three20 build dir, I didn't even have to recompile or reload the project.

    0 讨论(0)
  • 2021-01-30 09:23

    Added this as a comment in a few places as well, so maybe Google juice will help get programmers up and running again... but anyway, I found if you just use the touch command on the YourAppName-Prefix.pch file it will get syntax highlighting/coloring and code completion/jumping back on without having to delete all your derived data or restart Xcode. I made this an alias in my .bashrc file.

    alias pch_touch='touch /path/to/your/apps/Prefix.pch'

    . ~/.bashrc

    Within about 1-2 sec of touching the pch file, syntax coloring comes back on, which is a sign code completion/jumping will be now working too. Kind of sad such an otherwise awesome powerful tool is humbled by some metadata / statefulness bugs, but there ya go. At least it gets you back up and running and stops wasting your time.

    0 讨论(0)
  • 2021-01-30 09:29

    From this comment here I was able to debug a similar problem with my project, it seemed to be a bad -w flag that the clang preprocessor wasn't recognizing properly. Basically, running

    defaults write com.apple.dt.Xcode IDEIndexingClangInvocationLogLevel 3

    in Terminal increases the verbosity of the indexer, and should help you track down issues. Run Console.app and search for IDEIndexingClang.

    0 讨论(0)
  • 2021-01-30 09:31

    EDIT: It seems that if you have any custom header search paths to support multiple targets with shared code XCode 4 indexing will break and then assistant and codesense along with it. I have raised this as #ID 9182099 with Apple. There is also an issue that if you have any conflicting settings between project global and target specific build settings the index will fail to complete correctly. Make sure that your build settings are consistent.

    I have just had this problem in a very large, multi target commercial project. As an additional pain all of the xib files would not show the controller in assistant view and none of the subclass/superclass/siblings/categories assistant views would work either.

    After much searching and experimentation with deleting the indexes etc I was forced to create a new empty project and re-import everything. I know you have said that your project is too big for this but I dont think there is any other option available. In the end it has taken me most of a day to migrate my project completely. I suppose you could hold on hopefully for a resolution in a future point release but I chose to bite the bullet now to benefit from the productivity increases from the new features.

    To achieve this I created a new "empty" project and then manually recreated the targets I needed. I then deleted the source and .plist files for the new targets leaving me again with an empty project with the three targets I needed.

    I then just selected "add files.." to the project one folder at a time linking against target as required. I stopped and built each target as it was imported to deal with any compiler errors that the latest clang gave me.

    If you have a complex group hierarchy that is not mapped to a file system folder structure then you will either need to recreate the groups after import or go through the painful process of moving all your files into subfolders and re-pointing the references in XCode.

    You will also need to carefully check any custom build settings in the targets as well as relink any libraries you include. Also make sure you remove any bulk imported .plist files from the target linking.

    Sorry if this is not the answer you had hoped for.

    0 讨论(0)
  • 2021-01-30 09:32

    In my XCode 4 setup, it is 100% reproducible that setting the User Header Search Path will break codesense, especially "Jump to Definition", after a restart. I have create a new project, added my helper library as a subproject. If I include the headers with the User Header Search Path (recursive), I can compile, but autocomplete/navigation is broken.

    Deleting the header search path, closing the project, and reopening, fixes it again.

    0 讨论(0)
  • 2021-01-30 09:32

    I had this exact same issue. I have a project with a bunch of ViewControllers that extend a class I'm calling BaseViewController. I added the following code to BaseViewController.h and syntax coloring and code autocomplete broke! Even with repeated deletions of derived data the problem was still there. I can't believe it!!

    @implementation UIView (FindFirstResponder)
    - (UIView *)findFirstResponder
    {
        if (self.isFirstResponder) {
            return self;
        }
    
        for (UIView *subView in self.subviews) {
            UIView *firstResponder = [subView findFirstResponder];
    
            if (firstResponder != nil) {
                return firstResponder;
            }
        }
    
        return nil;
    }
    @end
    

    Commenting out this code solved my issues! I have XCode Version 4.4.1 (4F1003)

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