Cocoapods: dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserNotifications Referenced from: /private/var/mobile/Containers/Bundle/Application/CCA44320-A37C-494F-8ACC-74C1E1D8425B/MyProjectCocoaPods.app/Frameworks/MyExtension.framework/MyExtension Reason: image not found

Created on 27 Oct 2016  Â·  21Comments  Â·  Source: CocoaPods/CocoaPods

What did you do?

Run pod install
Build and run the app on device with iOS 9

What did you expect to happen?

Run the app correctly.

What happened instead?

dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserNotifications
Referenced from: /private/var/mobile/Containers/Bundle/Application/CCA44320-A37C-494F-8ACC-74C1E1D8425B/MyProjectCocoaPods.app/Frameworks/MyExtension.framework/MyExtension
Reason: image not found

CocoaPods Environment

Stack

   CocoaPods : 1.1.1
        Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
    RubyGems : 2.0.14.1
        Host : Mac OS X 10.12 (16A323)
       Xcode : 8.0 (8A218a)
         Git : git version 2.8.4 (Apple Git-73)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
Repositories : bitbucket-cocoapodsspecs - https://XXXXXXXXXXXXX/cocoapodsspecs.git @ 0de74547534c803655da9496f043ccf3a3bf5f2a
               master - https://github.com/CocoaPods/Specs.git @ c900ec88572a406e1257d60b53ec6d0e5a3b8b1b

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.1.1
cocoapods-try         : 1.1.0

Podfile

# My specs source repo
source 'https://XXXXXXXXXXXXX/cocoapodsspecs.git'

# CocoaPods master specs repo
# source 'https://github.com/CocoaPods/Specs.git'

use_frameworks!

target 'MyProjectCocoaPods' do
    platform :ios, '8.0'
    pod 'My-iOS-SDK', '~> 6.0'
end

target 'MyProjectCocoaPodsExtension' do
    platform :ios, '8.0'
    pod 'My-iOS-SDK-Extension', '~> 1.0'
end

Project that demonstrates the issue

Project is commercial :/.

My Framework Podspec

Pod::Spec.new do |s|
  s.name         = "My-iOS-SDK-Extension"
  s.module_name  = "MyExtension"
  s.version      = "1.0.0"
  s.summary      = "..."

  s.homepage     = "https://github.com/"
  s.license =    { :type => 'proprietary', :text => <<-LICENSE
                      Copyright 2016, Me ;)
                   LICENSE
                 }  
  s.author       = { "Yass" => "[email protected]" }
  s.source = { :http => "http://XXXXXXXXXXXXX/MyExtension.zip" }

  s.ios.deployment_target = "8.0"

  s.vendored_frameworks  = 'MyExtension.framework'
end

My Framework: otool -arch arm64 -l

Load command 12
cmd LC_LOAD_DYLIB
cmdsize 104
name /System/Library/Frameworks/UserNotifications.framework/UserNotifications (offset 24)
time stamp 2 Thu Jan 1 01:00:02 1970
current version 1.0.0
compatibility version 1.0.0
Load command 13
cmd LC_LOAD_DYLIB
cmdsize 80
name /System/Library/Frameworks/UIKit.framework/UIKit (offset 24)
time stamp 2 Thu Jan 1 01:00:02 1970
current version 3599.6.0
compatibility version 1.0.0
Load command 14
cmd LC_LOAD_DYLIB
cmdsize 88
name /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics (offset 24)
time stamp 2 Thu Jan 1 01:00:02 1970
current version 1070.0.0
compatibility version 64.0.0
Load command 15
cmd LC_LOAD_WEAK_DYLIB
cmdsize 88
name /System/Library/Frameworks/Foundation.framework/Foundation (offset 24)
time stamp 2 Thu Jan 1 01:00:02 1970
current version 1349.0.0
compatibility version 300.0.0
Load command 16
cmd LC_LOAD_DYLIB
cmdsize 56
name /usr/lib/libobjc.A.dylib (offset 24)
time stamp 2 Thu Jan 1 01:00:02 1970
current version 228.0.0
compatibility version 1.0.0
Load command 17
cmd LC_LOAD_DYLIB
cmdsize 56
name /usr/lib/libSystem.B.dylib (offset 24)
time stamp 2 Thu Jan 1 01:00:02 1970
current version 1238.0.0
compatibility version 1.0.0
Load command 18
cmd LC_LOAD_DYLIB
cmdsize 96
name /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (offset 24)
time stamp 2 Thu Jan 1 01:00:02 1970
current version 1348.0.0
compatibility version 150.0.0

Note

When i remove the use_frameworks! the app run correctly. But i must add the stip-framework.sh manually.

awaiting input

Most helpful comment

For user case if anyone tries to see this type of issue in future.

Please make the particular framework optional in "General -> Linked Framework and libraries" in project setting. It has nothing to do with cocoapods.

All 21 comments

Can you tell me the value of your "Runpath Search Paths" setting for both of your targets?

MyProjectCocoaPods: $(inherited) @executable_path/Frameworks
capture d ecran 2016-10-28 a 10 32 58

MyProjectCocoaPodsExtension: $(inherited) @executable_path/Frameworks @executable_path/../../Frameworks
capture d ecran 2016-10-28 a 10 33 43

Oh actually, I think this means you're missing some system framework:

dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserNotifications

You might try re-installing Xcode? I've never encountered this before.

UserNotifications.framework is not really missing. When i add the My-iOS-SDK-Extension dependency manually or with CocoaPods but by disabling use_frameworks! everything works well.

But when i enable the use_frameworks! option, the error occurs with devices with iOS 8/9.

@benasher44 do you need more inputs ?

@yacir i'm pretty stuck here. Can you share a project that reproduces the issue?

@benasher44 Here is an example :)
MyProjectCocoaPods.zip

Thanks in advance

@benasher44 any news on this?

Thanks

The attached sample app runs fine for me. I'm back to feeling like this is an issue with your Xcode environment :(

Unfortunately, I'm not the only person who has this problem. It's the case for all of our customers.
Did you try to run on a device with iOS 9? Because it works fine with iOS 10 devices, but not those with prior versions. :(

@benasher44 any news?

@yacir sorry I missed your previous comment. I'll try with iOS 9 and get back to you

@benasher44 ok no problem i will wait for your answer :)

@yacir I tried it, and I reproduced your issue. That said, this isn't a CocoaPods issue. CocoaPods aside, your target will only launch on iOS 10, and I'm not sure why. I created a fresh target with an app that has a deployment target of iOS 8.0 and a notification service extension with a deployment target of iOS 10 and it worked fine. There seems to be something wrong with your build settings, but I can't pinpoint exactly which one it is. I suggest you re-create your targets to get fresh build settings set to Xcode defaults. Sorry about that!

Going to close this, since there's nothing we can do on the CocoaPods-side of things to help you here. Thanks for filing!

@benasher44 i tried your solution and I reproduced your issue. Could you please upload your project and specify your env configuration (XCode and Pod version) ?

@yacir I'm not sure what issue you mean, since in my project there was no issue. Here's the sample project I made: SampleNotificationExtensionApp.zip

Just to add, I'm facing this issue which is not using CocoaPods too.

For user case if anyone tries to see this type of issue in future.

Please make the particular framework optional in "General -> Linked Framework and libraries" in project setting. It has nothing to do with cocoapods.

I had a similar issue where I would get this error (app would crash) for iOS 9/10 users only.

I solved it by adding (both) UserNotifications and UserNotificationsUI frameworks to General → Linked Framework and libraries, I had to make them both optional.

For others that come here by googling: the UserNotificationsUI framework is not compatible with Mac Catalyst. It just generated a build failure without telling why.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hmistry picture hmistry  Â·  3Comments

k06a picture k06a  Â·  3Comments

dawnnnnn picture dawnnnnn  Â·  3Comments

gerchicov-bp picture gerchicov-bp  Â·  3Comments

iosdev-republicofapps picture iosdev-republicofapps  Â·  3Comments