Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode: "Find In Project" doesn't find some text

In Xcode 5.1.1 'Find In Project' seems to be behaving erratically. Sometimes it doesn't find targets. I double checked in the Find Navigator: scope of search is "In Project" and the search modifier "Ignoring Case" is selected. Some target text is found successfully, and other target text is not found - even when it occurs within THE SAME SOURCE FILEs.

For example I can Find In Project "theHousehold" (a property name), with multiple source files and occurrences located. But if I search for "NSAssert", Find In Project returns 'No Results Found for "NSAssert"' - even though a local file Find of the same text is successful.

Here's a clue or perhaps a red herring - sometimes when searching with the Standard Editor's Find, the count of occurrences goes to zero - even for text that it successfully finds. Does Xcode build a full text search index, and can I trigger a rebuild of it?

I am pretty sure this has worked in the past. I have already tried "Clean Build Folder" and restarted Xcode. I don't see any prefs or settings that I might have munged - I'm stumped.

like image 328
jbbenni Avatar asked Feb 13 '23 21:02

jbbenni


1 Answers

One extra setting to check: in the Find Navigator there is a hierarchical control (just above the search target box) for "Find/Replace", then additional for "Text/References/Definitions/Regular Expression" then "Containing/Matching/Starting with/Ending With". I had inadvertently switched from "Text" to "References". Only certain constructs were recognized, others weren't. Surprise, xCode was behaving correctly, just not as I expected.

Lastly, the way to force a text index rebuild is from the Organizer Window. Select the project, then press the Delete button for the "Derived Data". This forces a rebuild.

(For recent versions of Xcode, link to this question: How to delete derived data in Xcode 8?)

All is working now!

like image 144
jbbenni Avatar answered Mar 16 '23 05:03

jbbenni