Pods project with App Extension started failing to build

3.4k views Asked by At

I was working on my app, haven't changed any setting or pod, and I tried to archive a build after about two weeks, and it failed. Then I tried to debug build (normal Cmd+R) and it failed with the error:

ld: library not found for -lPods-AFNetworking

I've tried pod install many times. I've tried removing everything related to pods (instead of Podfile itself) and making a pod install/pod update again. No avail.

Here is my Podfile:

platform :ios, '8.0'

link_with 'MY_APP_NAME_REDACTED'

pod 'Parse', '1.7.4'
pod 'ParseFacebookUtils', '1.7.4'
pod 'ParseCrashReporting', '1.7.4'
pod 'GPUImage'
pod 'AFNetworking'
pod 'IntentKit'

inhibit_all_warnings!

I haven't touched it, it was working perfectly until today morning. Now, after everything that I've tried, after a clean reinstall, I'm getting:

Lexical or preprocessor issue: 'Parse/Parse.h' file not found in my app extension (my app itself doesn't seem to have a problem).

I have no idea how a build system can effectively 'self-destruct' itself out of absolutely nothing. I haven't done any pod updates, pod installs, I haven't touched Podfile, I haven't changed any configuration settings in my project etc. I just wrote code, and when I tried to archive my project to send to beta testers, it broke.

If I change my podfile and add my share extension to link_with:

platform :ios, '8.0'

link_with 'MY_APP_NAME_REDACTED', 'Share Extension'

pod 'Parse', '1.7.4'
pod 'ParseFacebookUtils', '1.7.4'
pod 'ParseCrashReporting', '1.7.4'
pod 'GPUImage'
pod 'AFNetworking'
pod 'IntentKit'

inhibit_all_warnings!

Then I'm getting some warnings and an error.

Pods was rejected as an implicit dependency for 'libPods.a' because its architectures 'arm64' didn't contain all required architectures 'armv7 arm64'

ld: warning: directory not found for option '-L/Users/Can/Documents/Programming/iOS/MY_APP_NAME_REDACTED/build/Debug-iphoneos'

ld: warning: directory not found for option '-L/Users/Can/Documents/Programming/iOS/MY_APP_NAME_REDACTED/build/Release-iphoneos'

ld: library not found for -lPods-AFNetworking <--- THIS IS ERROR

How can I build my project again? I am on Xcode 6.3.2 and CocoaPods 0.37.2.

1

There are 1 answers

5
Can Poyrazoğlu On BEST ANSWER

I honesly had no idea what went wrong but after hours of investigation (and removing pods altogether, giving up, and then trying again), I've cleaned everything. I've reset configurations of my project too (which some I accidentally deleted when investigating). I've deleted xcworkspace file, Pods folder, and Podfile.lock file. There was also the settings Build active architecture only and it was bold-set (overriding the default) to yes, I've removed the override and it became no again. It was a clean start. Went back to my Podfile and restructured it a bit:

platform :ios, '8.0'

link_with 'MY_APP_NAME_REDACTED', 'Share Extension'

def shared_pods
    pod 'Parse', '1.7.4'
end

target 'uLouder' do
    shared_pods
    pod 'GPUImage'
    pod 'AFNetworking'
    pod 'IntentKit'
    pod 'ParseFacebookUtils', '1.7.4'
    pod 'ParseCrashReporting', '1.7.4'
end

target 'Share Extension' do
    shared_pods
end

Only Parse was needed for both my app and my share extension. Others were not needed for my app extension. Then I've built, and got some errors about some other non-pod frameworks in my project. I've deleted them, removed them from build phases etc. and then re-added them, and it built successfully (honestly I don't know what deleting-from-everything-then-adding-again fixed but it apparently fixed something).

Now my project compiles successfully with the podfile above. For reference, I'm using Parse and I have a sharing extension. Just be extra careful with this scenario as you apparently can't have 32-bit-only binaries/frameworks/libraries on an app extension.