53

I have a react native app and just noticed that a few lines were added for Recovered References in my project.pbxproj file in Xcode.

I don't remember adding or deleting any references and the recovered references show libraries that I normally use. I'm hesitant to check in the local changes to git without knowing what these changes were. Should I just discard these changes?

Can someone explain why these lines might be added if I didn't add or remove these packages myself? Does this mean some references were deleted to later be recovered? The only thing I can think of is that I ran react-native link, would that have made these changes?

This line was added

E3C5B1001F6966D2006296E1 /* Recovered References */,

This entire section is new:

E3C5B1001F6966D2006296E1 /* Recovered References */ = {
            isa = PBXGroup;
            children = (
                E602D61E379048BF92DC0C6D /* libRNDeviceInfo.a */,
                DEE39860F1B042208F193884 /* libRNVectorIcons.a */,
                C193FEFE9F3B45388016E921 /* libRNShare.a */,
                58B3A26CAB2543FB941C3D8D /* libRNFIRMessaging.a */,
                0BFBA42D662C492EBC1957A0 /* libreact-native-branch.a */,
                4BC248DD95524DE091A41CEC /* libCodePush.a */,
                6DB0E4FE64B34B68A29B262E /* libRNImagePicker.a */,
                E1502CC537D94CF4A5711814 /* libRNAddCalendarEvent.a */,
                065361D30B3F47D4A5101A1D /* libRNAccountKit.a */,
            );
            name = "Recovered References";
            sourceTree = "<group>";
        };
Cœur
  • 37,241
  • 25
  • 195
  • 267
MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460
  • Do not remove the line such as "887789815624279929B80802 /* Frameworks */," in your xy.xcodeproj/project.pbxproj file. Otherwise, Xcode will create 'Recovered References' section for you. I tried several times and make sure it's the cause. – DawnSong Aug 20 '20 at 16:43

5 Answers5

34

From: Release Notes for Xcode 9 Beta 2:

When a project is opened, Xcode will detect if any build files in targets in the project represent file references which are not present in that project’s group tree. Any such references will be added to a file group named “Recovered References” , which will be created if necessary. These references should be manually reorganized in the project as appropriate. (22924751)

Cœur
  • 37,241
  • 25
  • 195
  • 267
RobertK
  • 356
  • 2
  • 4
  • 22
    How would I go about doing what's written in the last sentence, i.e. `These references should be manually reorganized in the project as appropriate.`? – Andru Oct 09 '17 at 15:49
  • 8
    Can someone explain how to do this? – chetstone Nov 14 '17 at 00:05
  • 1
    @MonkeyBonkey Could you plz tell us how you solved this ? – Balasubramanian Jun 14 '18 at 03:30
  • 1
    You have to really double check which target the framework belongs to, remove (reference) the file from the `recovered references` group and and then go to the respective target BuildPhases > Linked Binaries and add the framework/file there via the + button. This was necessary for me since drag and drop did not set the correct target membership for me. It just discarded any target membership and I ran into compiler errors. – blackjacx Jul 02 '18 at 16:41
  • @jscs `The sentence just means "drag them to where they belong"`, what if I forgot the previous location of these files? – Sazzad Hissain Khan Dec 19 '19 at 07:07
  • @SazzadHissainKhan likely to be the "Frameworks" group. – Cœur Feb 07 '20 at 09:17
13

In my project I found out there's a "Recovered Reference" folder added to the project. It held references to files I recently deleted manually, and it existed only in the project (not on disk). Probably It happened as a result of deleting those files manually from disk before removing them from the Compile Sources. Even though I fixed it later, those files were stuck there.

Solution was to delete the whole folder (Right click on it -> Delete)

enter image description here

brkeyal
  • 1,317
  • 1
  • 16
  • 22
1

In addition to what RobertK provided, in my project I noticed that these Recovered References were also appearing in the target's project Build Phases as duplicates, seemingly located at strange file addresses.

className.swift ...in some/odd/nonProject/folder/structure

Basically anything other than what most other files show, like:

...in ProjectName/KnownFolder/ExpectedLocation

I found that I could safely remove (using the - button) any Recovered Reference that you find under Build Phases ...in odd locations. Delete the red recovered file references from the Project Navigator, and then quit & reload your project, finishing with a clean & rebuild for good measure.

I wish I could shed some light on how or what causes these odd files to be created, but here with multiple developers on a project it can be difficult to catch the inception event in order to track it down.

0

As gheni4 mentioned, Xcode 9 adds several *.a files under a Recovered References for some reason. By removing the folder and all targets except the iOS one (iOS-Test, tvOS, tvOS-Test) they are no longer automatically created and I can finally build without errors.

NilsVikt
  • 11
  • 2
  • I tried this and it really screwed things up. I removed my iOS Test target and the Recovered References folder and now my link fails with ` Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_Orientation", referenced from: objc-class-ref in AppDelegate.o "_OBJC_CLASS_$_CodePush", referenced from: objc-class-ref in AppDelegate.o` and I have no clue how to fix it. – chetstone Nov 14 '17 at 00:03
  • 1
    I managed to recover by reverting the pbxproj file from git. xcode added the Recovered References folder again, but it doesn't seem to really hurt anything. The build works fine and I'll just put up with the ugliness of it. – chetstone Nov 14 '17 at 00:25
-1

Fixed it by renaming the file, manually removing everything in the project file related to Recovered References quitting Xcode, and running synx - a useful ruby utility. When I opened it again I could build and everything was fine.

Aaron Brager
  • 65,323
  • 19
  • 161
  • 287
Joe Susnick
  • 6,544
  • 5
  • 44
  • 50