Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGListKitCrashes when used in an iMessages Extension #77

Closed
ishabazz opened this issue Oct 16, 2016 · 24 comments
Closed

IGListKitCrashes when used in an iMessages Extension #77

ishabazz opened this issue Oct 16, 2016 · 24 comments
Assignees
Labels
Milestone

Comments

@ishabazz
Copy link

New issue checklist

General information

  • Library version(s):1.0.0
  • XCode:8.0
  • iOS version(s):10.0.x
  • Devices/Simulators affected:iPhone 7Plus
  • Reproducible in the demo project? (Yes/No):Yes

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.

@ishabazz ishabazz changed the title IGListKitCrashes when used in an iMessages Extension IGListKitCrashes when used in an iMessages Extension [bug] Oct 16, 2016
@rnystrom rnystrom added the bug label Oct 16, 2016
@rnystrom rnystrom changed the title IGListKitCrashes when used in an iMessages Extension [bug] IGListKitCrashes when used in an iMessages Extension Oct 16, 2016
@rnystrom
Copy link
Contributor

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.

@jessesquires
Copy link
Contributor

jessesquires commented Oct 16, 2016

Not clear if this is:

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

@rnystrom
Copy link
Contributor

rnystrom commented Oct 16, 2016

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

@rnystrom
Copy link
Contributor

rnystrom commented Oct 16, 2016

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.

@ishabazz
Copy link
Author

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

@rnystrom
Copy link
Contributor

@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.

@ishabazz
Copy link
Author

@rnystrom
Copy link
Contributor

Fixing the warning in #79

@rnystrom
Copy link
Contributor

rnystrom commented Oct 17, 2016

@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

@ishabazz
Copy link
Author

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

@rnystrom
Copy link
Contributor

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

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

@ishabazz
Copy link
Author

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

@rnystrom
Copy link
Contributor

rnystrom commented Oct 20, 2016

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

@ishabazz
Copy link
Author

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?

@jessesquires
Copy link
Contributor

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... ?

@Sherlouk
Copy link
Contributor

Sherlouk commented Oct 22, 2016

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

@Sherlouk
Copy link
Contributor

@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.

@ishabazz
Copy link
Author

Thanks @Sherlouk!

@rnystrom
Copy link
Contributor

@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?

@ishabazz
Copy link
Author

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

@jessesquires
Copy link
Contributor

@ishabazz -- This should be fixed with CocoaPods 1.1

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

facebook-github-bot pushed a commit that referenced this issue Nov 1, 2016
Summary:
Offering this open to a bit of a discussion based on the comments at #77.
- Created two new schemes (IGListKitTodayExample, IGListKitMessageExample) in which respectively correspond to their app extension.
- Updated the Podfile to ensure they have IGListKit as a dependency
- Added a super simple example reusing the `LabelSectionController` from the main app

Done more as a 'yes it can be done' as opposed to 'look at what can be done' hence the basic functionality but I can see ways to improve if necessary!
- [x] All tests pass. Demo project builds and runs.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)
Closes #112

Differential Revision: D4066698

Pulled By: rnystrom

fbshipit-source-id: 64c5cc6f34cc9107f4f6e52ebc57596101eb695c
@Sherlouk
Copy link
Contributor

Sherlouk commented Nov 1, 2016

@rnystrom @ishabazz Flagging to be closed?

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

@jessesquires jessesquires added this to the 2.0.0 milestone Nov 1, 2016
@jessesquires
Copy link
Contributor

👍

will re-open if needed

@philosopherdog
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants