70

I have a development pod that I connect to the my app locally using :path => '~/Projects/Swift/pod'. When I make changes inside the application code in that development pod, this changes are not included after build. It's like I'm build cached code, not my code changes.

For include code changes into build I have to run the command "Clean Build Folder", but after that build takes a very long time, for 10 minutes, which is not very productive.

Literally, I comment on a line of code and wait 10 minutes to see the changes.

What is the problem?

I was trying to run "pod install/pod update" after any changes, but it has no effect.

JAL
  • 41,701
  • 23
  • 172
  • 300
Gikas
  • 961
  • 1
  • 8
  • 20
  • This works as expected for me, with multiple apps and pods. Are you sure you're changing files that are actually referenced by your podspec's `sources`? – Gereon May 27 '18 at 14:35
  • @Gereon Yes, I am sure that I am changing files that are actually referenced by my pod spec's source – Gikas May 30 '18 at 08:14
  • Can you reproduce this in a newly created project? I also found this old cocoapods issue: https://github.com/CocoaPods/CocoaPods/issues/5341 - are you maybe on an old cocoapads version (1.5.x is current) – Gereon May 30 '18 at 09:06
  • 3
    Having this problem using XCode 10 Beta 2. Things used to work fine with XCode 9 – Guy Daher Jun 25 '18 at 12:19
  • @Gikas did you find a solution to this? I have the same problem. – nikolovski Sep 24 '18 at 10:16
  • @GuyDaher works in Xcode 9 because this is the bug of the new build system. – Nike Kov May 02 '19 at 14:27
  • 1
    This issue still persists in Xcode 10.2.1 – onmyway133 May 13 '19 at 10:17

8 Answers8

71

I'm using to below.

Product -> Schemes -> EditScheme -> Build -> Add a development Pods ("+" sign)
Aleksei Akireikin
  • 1,999
  • 17
  • 22
won
  • 754
  • 6
  • 13
50

I had the same issue with Xcode 10.0 (10A255). Changing back to the legacy build system (in File -> Project/Workspace Settings) worked for me to resolve the issue for now, until this is fixed by either Cocoapds or Xcode.

Ahti
  • 1,420
  • 1
  • 11
  • 20
  • 2
    Yes, this works. After that you can switch back to new build system. – sabiland Oct 07 '18 at 08:08
  • 11
    This is by far one of the most annoying bugs I’ve found with Xcode 10. Many wasted hours! – Shayno Dec 02 '18 at 06:33
  • FWIW while setting the path _locally_, setting the 'build system' to legacy worked great. Even `pod install` was not necessary. `pod install` is not needed if you have **file changes**, it's only needed if you have **new files** – mfaani Aug 28 '19 at 15:25
8

While Changing back to the legacy build system works, the build time might increase in some large projects. An alternate solution is to add this run script find "${SRCROOT}/Pods" -type f -name *frameworks.sh -exec bash -c "touch \"{}\"" \; to touch all framework scripts under your project's Build Phases->Embed Pods Framework. This should pickup your new changes until this bug is fixed.

Alibaba
  • 352
  • 4
  • 14
  • This seems to be the most reliable since Apple new build system is bad at finding changes and Catalyst for example won't work with legacy :( – Rock_Artist Apr 10 '20 at 08:41
  • This workaround somewhat worked for me. But the script is overwritten on pod install run – Luten Jun 01 '20 at 13:23
5

As a workaround I've been manually "cleaning" out my development pods.

  1. In the Pods project open Products select the development pod framework(s)
  2. In the inspector on the right I select the arrow which opens Finder
  3. Delete the framework(s)
  4. Build/Run

Hope that helps, and that Apple fixes this soon...

P.S. Will definitely be writing a simple script to do this.

Update 9/25/18

Also seems like sometimes I must delete the Intermediate build(s) as well.

Update 9/23/19

Looks like it was fixed in CocoaPods 1.8.0 (Wow, it been a whole year...)

nickgzzjr
  • 409
  • 6
  • 9
  • Your solution works greatly. I just don't understand what you mean by "must delete the Intermediate build". Can you please elaborate? – mfaani Aug 28 '19 at 14:24
4

I have not yet a practical automatic solution for this. But manually you can do CMD + shift + k or product -> clean build folder.

But then the entire project needs to be build again. If you have a lot of pods/frameworks or source code this can take some time to recompile.

Like other people mention it seems to be a bug related to the new build system. So you can switch back to the old system.

Both not really good solutions. But that is the price we pay for working with apple ;).

Saren Inden
  • 3,450
  • 4
  • 32
  • 45
  • @NikKov totally agree but do you have a better solution? I already mention that both solutions are not really good solutions. – Saren Inden Aug 29 '19 at 10:07
0

I tried accepted answer and it didnt work, then I added install! 'cocoapods', :disable_input_output_paths => true to podfile and it is working now.

use_frameworks!

install! 'cocoapods', :disable_input_output_paths => true

target 'TargetName' do
  # ...
end
Renetik
  • 5,887
  • 1
  • 47
  • 66
0

There's a cleaner fix provided here on this Github issue provided by Andrés Cecilia Luque and it also worked for me on Xcode 11.5 too. Very convenient.

cdescours
  • 6,004
  • 3
  • 24
  • 30
-2

I'm working with development pods for a while, it works fine at most of the time. Changes don't take effect like you only happens a few times.

Delete the Pods folder and reinstall might fix the problem.


Update:

I have to declare that my answer is not for the situation after Xcode 10. For Xcode 10, CocoaPods may not support the new build system at this time. They had fixed it https://github.com/CocoaPods/CocoaPods/issues/8073

In my case (before Xcode 10), most of the time it works well, except few.

BB9z
  • 2,432
  • 1
  • 30
  • 36
  • 4
    This is completely wrong answer. The problem is with new Xcode 10 that caches all other targets and does not detect code changes in local pods, not ones in `Pods` folder. Xcode 9 does not have this issue. – Legoless Sep 03 '18 at 12:35
  • 2
    @Legoless Maybe you have to perform a forced clean with Xcode 10 at this time https://github.com/CocoaPods/CocoaPods/issues/8073 – BB9z Sep 18 '18 at 00:17
  • Yes, that is definitely a solution, but having a large project, this takes 10-15 minutes on my high-end MBP. Which you can imagine how big of a waste of time that is, if you are just iterating on small tweaks. – Legoless Sep 18 '18 at 09:19
  • @Legoless is correct. I've reported this bug to Apple back in June and it is still flagged as open. Only clean builds work for me (Command+Shift+K then Command+B). – Bruno Philipe Sep 24 '18 at 15:07