Xcframework 7.0.0 integration on iOS crashes on device

Hi all,

I’m trying to integrate the New Relic framework. We are not using CocoaPods, so I’ve followed the Manual Installation guide here: https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-ios/installation/ios-manual-installation

I’m not sure which download to use - the release notes are a bit confusing.
So I’ve tried both the iOS Agent 7.0.0 released on 11 Sep & the XCFramework Agent 7.0.0 released on 9 Sep. They appear to be the same, but not sure?

With iOS Agent 7.0.0 (link) - it works fine in the Simulator (the app launches and sends events to New Relic), but crashes on launch when running on device, with this error:

dyld: Library not loaded: @rpath/NewRelic.framework/NewRelic
Referenced from: /var/containers/Bundle/Application/aaaA/aaaaa.a/aaaa/Spil
Reason: image not found

I tried with both the xcframework or only the ios-armv7_arm64 framework alone.
Not sure what I am doing wrong, but I think the installation steps need updating. Any hint from someone would be profusely appreciated.

I’ve tried dragging the entire NewRelic.xcframework or a specific platform’s framework only. Same result.

Thanks in advance,
Mihai

So I’ve tried using the previous agent version: iOS Agent 6.14.0 and it all works as expected! I can even see the events in the New Relic dashboard.

So clearly I am doing something wrong with the new 7.0.0 xcframework - I tried searching the forums here. Are there any updated manual installation steps I could follow?

Thanks again!

We are currently updating our installation docs to reflect the changes with agent 7.0.0.
The bridging header import changed with the new version from:

#import "NewRelicAgent/NewRelic.h"

to

#import <NewRelic/NewRelic.h>

1 Like

Thanks, I’ve tried that already, but there must be something else besides that, which I’m missing.

Have you set link frameworks automatically: YES?

What version of Xcode are you using?

If it’s still giving you trouble, can you please share the error you are seeing?

Hi here,

I have the same issue than OP: my app crashes on opening with the 7.0.0 Agent but runs fine with the 6.14.0 one.
The error message seems identical too:

dyld: Library not loaded: @rpath/NewRelic.framework/NewRelic

Referenced from: /private/var/containers/Bundle/Application/XXX/APP.app/NAME

Reason: image not found

dyld: launch, loading dependent libraries

DYLD_LIBRARY_PATH=/usr/lib/system/introspection

DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib

Note that both frameworks work fine on Simulator.

About my environment:

  • I am using Xcode 12.0 / Swift 5
  • I changed #import "NewRelicAgent/NewRelic.h" by #import <NewRelic/NewRelic.h> in my Bridging-Header.h
  • I added the newrelic_postbuild.sh script to my target’s Build Phases
  • link frameworks automatically is set to YES

I am using Xcode 11.7 & yes, I did set that.

Are you using cocoapods? Did you remove NewRelicAgent.framework from your project before updating?

The error looks like it could be something in build settings, but it may also be beneficial to remove the agent entirely and try adding 7.0.0.

What error are you seeing specifically? The same as OP?

Hi and thank you @dmurray, some clarifications:

  • I do not use CocoaPods.
  • I removed the old NewRelicAgent.
  • Setting ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to Yes (stack post suggestion) did not work.
  • NewRelic.xcframework is in the Embedded Content of my general tab (stack post suggestion) BUT set as “Do Not Embed”.

The good news now: I switched the value from “Do Not Embed” to “Embed & Sign” (in the Embedded Content of my general tab) and it fixed the issue! :slight_smile: Can you please confirm me (us?) that it is the intended settings?

I will certainly look into this and run it by our engineers.

Glad you got it working :slight_smile:

Hey, we experience the same issue but with Cocoapods. When I run the app on device, it will crash with the message:

dyld: Library not loaded: @rpath/NewRelic.framework/NewRelic
  Referenced from: /private/var/containers/Bundle/Application/D3D83FF6-7CD7-433C-8BF9-E8E12AF38982/CMGuestApp.app/CMGuestApp
  Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=@executable_path/Frameworks/libclang_rt.asan_ios_dynamic.dylib:/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib

I can’t change the embedded content like cyril.le-pottier did since the framework is handled by Cocoapods.

The required iOS version from our app is iOS 12 and we’ve also updated the bridging header accordingly and it runs fine on simulator. This issue is happening only on 7.1.0, it is working fine on 7.0.0

What version of Xcode are you running?

Hey thx for your reply, the Xcode version is 12.0

It sounds like you may just need to update Xcode since 7.1.0 was built in Xcode 12.0.1. (Mentioned in release notes)

Let me know if that works!

1 Like

Thx, upgrading to Xcode 12.0.1 resolved the issue

Glad to hear that you resolved your issue by updating Xcode, @j.bakker. If you run into any other issues, please let us know so we can assist further.