2

My perfectly working app used to have an Xcode Project Navigator as shown below.

Project Navigator Old

iOS 10 requirements meant I had to upgrade Xcode to 8.1, which meant upgrading the entire Mac OS to Sierra and also translating the whole app to Swift 2.3.

Needless to say, this caused errors, one of which was an issue with PubNub. However, apart from this new build error the app structure was the same and everything seemed ok after dealing with all the layout issues.

I was requested to run the following steps to try to solve the PubNub pod error despite me warning that previous attempts to deal with the pod file caused fatal errors that were ultimately unrecoverable.

  1. Install all iOS simulators after Xcode update
  2. Open Xcode preferences (Cmd+,) and navigate to ”Locations” tab where will be shown path to ”DerivedData” folder
  3. Click on small circle with arrow on the right side of shown ”DerivedData” path to open it in Finder
  4. Quit Xcode
  5. Remove ”DerivedData” folder
  6. Clean up CocoaPods (if integrated with it) caches by entering this in Terminal: rm -rf ~/Library/Caches/CocoaPods
  7. From project root (where Podfile is located) run this in Terminal: pod deintegrate MyApp.xcodeproj
  8. Remove from project root (where Podfile is located) Podfile.lock file
  9. From project root (where Podfile is located) run this in Terminal: pod update
  10. Launch Xcode (hit Shift + Cmd + K just in case)
  11. Try build project

After doing all this my Project Navigator now looks like this.

Project Navigator New

As you can see, I've lost a load of stuff including the pod file etc. As suspected, my app is now fatally wounded.

My bridging header is red, Restkit.h is red and all pod references gone.

My project root in Finder has the Pods folder and pod file etc, however if I try to drag folders into the project from Finder they do not show as they used to - e.g., folders are blue color not yellow.

I'm on Xcode 8.1 and Cocoapods 1.1.1.

How can I recover my app?

EDIT: If it helps, here is the link to my unsolved question in January which was the last time I dared touch the pod file at all until now. The consequences of this situation are the same as before - the difference is that in January I was ditching 2 weeks work, now I'm looking at ditching 10 months' work.

RestKit.h never found in Xcode project

Podfile:

pod 'RestKit', '~> 0.24.0'
pod 'SimpleKeychain'
pod 'AWSS3'
pod 'VideoCore'
pod 'SDWebImage', '~>3.7'
pod 'SVPullToRefresh'
pod 'PubNub', '~> 3.7.11'
pod 'MZFormSheetController'

Result of pod update in Terminal:

Update all pods Updating local specs repositories Performing a deep fetch of the master specs repo to improve future performance warning: inexact rename detection was skipped due to too many files. CocoaPods 1.2.0.beta.1 is available. To update use: sudo gem install cocoapods --pre [!] This is a test version we'd love you to try. For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.2.0.beta.1

Analyzing dependencies [!] The dependency RestKit (~> 0.24.0) is not used in any concrete target. The dependency SimpleKeychain is not used in any concrete target. The dependency AWSS3 is not used in any concrete target. The dependency VideoCore is not used in any concrete target. The dependency SDWebImage (~> 3.7) is not used in any concrete target. The dependency SVPullToRefresh is not used in any concrete target. The dependency PubNub (~> 3.7.11) is not used in any concrete target. The dependency MZFormSheetController is not used in any concrete target.

Craig Conover
  • 4,710
  • 34
  • 59
RobertyBob
  • 803
  • 1
  • 8
  • 20
  • Maybe instead of dragging your folders into your project try doing `File > Add Files...` – l'L'l Nov 10 '16 at 07:05
  • Thx I'L'l - this still adds them blue not yellow (not that I know what the difference is but I don't like anything that looks different to how the working version looked) – RobertyBob Nov 10 '16 at 07:09
  • Even if I add manually by right-clicking project and Add File To it's no good as it says folder Pods already there even though not showing in Project Navigator – RobertyBob Nov 10 '16 at 07:25
  • Are you trying this inside an Xcode Workspace or Xcode Project? Generally I've always managed everything from a workspace once pods are installed; It might help also if you posted your `podfile` — the issue might be something really simple, who knows... – l'L'l Nov 10 '16 at 07:26
  • This is within a workspace - have added pod file for you - I'm told this might be outdated but I don't know how I can edit it when it's not in the Project Navigator anymore or even if it's worth doing it when the project is currently messed up - thx – RobertyBob Nov 10 '16 at 07:38
  • What's the result of the last `pod update`? Do you have a folder called `Pods` with all the libraries you want? – Luca D'Alberti Nov 10 '16 at 07:41
  • @LucaD'Alberti - after running pod update i have the situation in the second screenshot. I have a Pods folder in the root folder in Finder but there is no longer a Pods folder within Project Navigator (but I cannot manually add a folder called Pods as it says it has one even tho seems it doesn't) – RobertyBob Nov 10 '16 at 07:43
  • @RobertyBob I meant the result of the operation in `Terminal`. Is there any warning or error reported by CocoaPods? – Luca D'Alberti Nov 10 '16 at 07:46
  • @LucaD'Alberti - sry, misunderstood - have added the terminal response for you – RobertyBob Nov 10 '16 at 07:51
  • @RobertyBob aren't you assigning any target to the pods? – Luca D'Alberti Nov 10 '16 at 07:52
  • Since the fiasco in January I haven't touched the pods or podfile at all but they have always worked perfectly - if the pod file needs changing I will need to know how to do that when it isn't in the Project Navigator – RobertyBob Nov 10 '16 at 07:55

1 Answers1

1

From the pod update logs seems like CocoaPods can't find any target where the libraries have to be applied.

Can you try something like this in your Podfile?

target 'YOUR_TARGET_NAME' do
    pod 'RestKit', '~> 0.24.0'
    pod 'SimpleKeychain'
    pod 'AWSS3'
    pod 'VideoCore'
    pod 'SDWebImage', '~>3.7'
    pod 'SVPullToRefresh'
    pod 'PubNub', '~> 3.7.11'
    pod 'MZFormSheetController'
end

Not sure if it will fix the error you have.

Luca D'Alberti
  • 4,749
  • 3
  • 25
  • 45
  • Can you let me know how I edit or overwrite the podfile when can't see it in Navigator and the file in the root folder cannot be opened for editing? thanks – RobertyBob Nov 10 '16 at 07:56
  • Can you try to open the `Podfile` via terminal? `vim /folder/Podfile` or `open /folder/Podfile -a TextEdit` should work – Luca D'Alberti Nov 10 '16 at 07:57
  • Many thanks - so after doing that I run through the same steps as before (as shown in original post)? – RobertyBob Nov 10 '16 at 08:01
  • You should at least be able to have a working copy. After that you can investigate on `PubNub` problem – Luca D'Alberti Nov 10 '16 at 08:01
  • Success! Many thanks indeed - no idea where/when the podfile got corrupted but this has got back the pods and structure - have weird new errors on the build but that will no doubt be an xcode8.1 issue rather than this issue – RobertyBob Nov 10 '16 at 08:20