IGListKitCrashes when used in an iMessages Extension

Created on 16 Oct 2016  ·  24Comments  ·  Source: Instagram/IGListKit

New issue checklist

Running iMessage Apps which have IGListKit included via CocoaPods results in the app crashing on launch with the error like the following: dyld: Library not loaded: @rpath/IGListKit.framework/IGListKit
Referenced from: /Users/demo/Library/Developer/CoreSimulator/Devices/5C343568-A532-405F-8B65-52A049827328/data/Containers/Bundle/Application/AA18B7D3-48C4-4958-A14C-C056A309D6D8/IGListStickerDemo.app/PlugIns/MessagesExtension.appex/MessagesExtension
Reason: image not found

Check out https://github.com/ishabazz/IGListKitMessagesExtensionDemo for a sample project that exhibits this error.

bug

All 24 comments

I've definitely seen this error before, but that was using a non-Swift library in a Swift app using Buck for dep management. Might be something similar though.

Not clear if this is:

  1. a bug in IGListKit
  2. a bug in CocoaPods
  3. an issue with project setup

Off the bat I get an Xcode warning in the sample project:

ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/rnystrom/Library/Developer/Xcode/DerivedData/IGListStickerDemo-cherwvpgwwdqmjhkvyhkxnqnciyx/Build/Products/Debug-iphonesimulator/IGListKit/IGListKit.framework/IGListKit

Seeing the same error message as @ishabazz

dyld: Library not loaded: @rpath/IGListKit.framework/IGListKit
Referenced from: /Users/rnystrom/Library/Developer/CoreSimulator/Devices/68FD0653-60FD-438C-BF3E-C6753A5F683E/data/Containers/Bundle/Application/4EB30904-90A4-4E77-A205-B59794CA7312/IGListStickerDemo.app/PlugIns/MessagesExtension.appex/MessagesExtension
Reason: image not found

After $ pod install I see some weird CocoaPods warnings:

[!] The `IGListStickerDemo [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-IGListStickerDemo/Pods-IGListStickerDemo.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `IGListStickerDemo [Release]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-IGListStickerDemo/Pods-IGListStickerDemo.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

edit: I manually added IGListKit.framework to the message extension target, it failed to build. I deleted the framework and reran $ pod install then ran the app again (it was still installed) and everything worked. I saw the "Hello world" in the message app.

Ok. To recap, you removed it from the Podfile, ran pod install and manually installed the framework?

@ishabazz I actually didn't remove it from the Podfile at first, just added to Linked Libraries and Frameworks. Then I built, got compiler errors, removed the framework from Linked Libraries and Frameworks, then did $ pod install again. This definitely isn't the answer but might be a clue to what's going on.

Fixing the warning in #79

@ishabazz ok now I can't get it to happen at all anymore. I ran

$ pod deintegrate
$ rm -rf ~/Library/Developer/Xcode/DerivedData
$ pod install

It installs and runs on multiple simulators and device.

I believe my Podfile is unchanged from what you originally sent:

target 'IGListStickerDemo' do
  use_frameworks!
  pod 'IGListKit'
end

target 'MessagesExtension' do
  use_frameworks!
  pod 'IGListKit'
end

hmm...tried that but mine still crashes. Your Podifle is the same as mine

@ishabazz a couple other configs I tried that seemed to work:

  • Remove IGListKit from the main target since its empty
  • Remove use_frameworks!

Progress! I can get the demo project to run without crashing. I get a compiler error when trying "import IGListKit" though.

@ishabazz any update on this? Not really sure what to do here ¯_(ツ)_/¯

Still a problem. Compiles fine until you try to import IGListKit, then doesn't compile and gives a "No such module 'IGListKit' found" Did it work for you?

Compiles fine until you try to import IGListKit, then doesn't compile and gives a "No such module 'IGListKit' found"

Hm... 🤔 Sounds like this is probably a project setup issue... ?

Created a very basic example over on my fork (here) of an iMessage extension.

I've downloaded your demo repository and it seems that it doesn't have the 'Embed Pods Frameworks' run script which is usually generated by CocoaPods - this would most likely explain the error (and when you add it, seems to work)

EDIT: I've created a pull request to your repository which is working for me (clean your workspace if you pull it down) link

@rnystrom Relating to my previous comment, how would you feel about adding extension examples into this repo? Happy to make modifications/make them more useful!

my fork contains an example for both a Today Extension and an iMessage Extension.

Thanks @Sherlouk!

@Sherlouk yes yes yes yes yes! That would be amazing! Should we clean up and add your fork to the example or should we make something new?

By the way. When trying to submit the build to TestFlight I ran into this issue http://stackoverflow.com/questions/40005130/error-itms-90685-cfbundleidentifier-collision-there-is-more-than-one-bundle

Still working on a resolution

@ishabazz -- This should be fixed with CocoaPods 1.1

http://blog.cocoapods.org/CocoaPods-1.1.0/

@rnystrom @ishabazz Flagging to be closed?

There's now an example in the pack, and the issue at hand was seemingly resolved.

👍

will re-open if needed

I'm still getting this warning intermittently. I'm using pods 1.6.1. Why is this happening and how do I fix it.

Was this page helpful?
0 / 5 - 0 ratings