0

I recently added Firebase In-App Messaging to my project via cocoapods. After following the setup process in the documentation, I'm getting the error below. If it helps, I also have recently installed Admob but this error didn't show up until I installed in-app messaging. The thing that baffles me is: there is hardly any code to set this up, so where could I be getting a nil URL error?

At first, I wasn't sure it was Firebase I.A.M. causing the problem, but after deleting and reinstalling it, the issue went away then reappeared. So, I'll describe how I installed Firebase IAM. I used this link for reference:

https://firebase.google.com/docs/in-app-messaging/get-started?authuser=0

  1. Added it to my Podfile, with cocoapods 1.4.0

  2. Added the "-FIRDebugEnabled" to my schemes

  3. Got my instance ID, and added it to my campaign in the console

  4. Double checked my schemes

Error:

    Terminating app due to uncaught exception
    'NSInvalidArgumentException', reason: ' -[NSBundle initWithURL:]: nil URL argument'
    First throw call stack:
    (0x234b8cec4 0x233d5da40 0x234a93594 0x23554f6a8 0x23554f62c 
    0x10027a1b8 0x10248cdc8 0x10248ee28 0x10027a0f8 0x10027a2c0
    0x10027b518 0x100267038 0x100260888 0x100266e44 0x100267328   
    0x100264bd0 0x10248b824 0x10248cdc8 0x10248fc90 0x10249e1dc
    0x10249ebc8 0x2347a917c 0x2347abcec)
    libc++abi.dylib: terminating with uncaught exception of type NSException

In the console, my instance ID appears, then some more information, then the error, So I have no clue as to what could be causing it to happen. Here is some of the output in my console:

     [Firebase/InAppMessaging][I-IAM700004] 1 messages were fetched successfully.
    [Firebase/InAppMessaging][I-IAM270005] No impression records update due to no change after applying the server message list
    [Firebase/InAppMessaging][I-IAM160010] There are analytics event trigger based messages, enable listening
    [Firebase/InAppMessaging][I-IAM160001] There are 0 test messages and 1 regular messages and 3 Firebase analytics events to watch after resetting the message cache
    [Firebase/InAppMessaging][I-IAM240002] Fetch is done. Start message rendering flow.

For reference, I've looked through all these links and more when you google the error:

Any ideas?

Nazim Kerimbekov
  • 4,712
  • 8
  • 34
  • 58
J Derbs
  • 153
  • 14
  • did you find any solution? – nikdange_me May 28 '19 at 09:25
  • Sadly no I just didn't include it in my app. If you find a solution comment. I feel like I was close to figuring it out, so if you look at the links you might figure it out but idk there wasn't really a good answer anywhere – J Derbs May 29 '19 at 00:46
  • You could raise/support here, hope they help solve issue https://github.com/firebase/firebase-ios-sdk/issues/3090 – nikdange_me May 29 '19 at 03:37

2 Answers2

0

Reason this is failing is because the InAppMessagingDislayResources.bundle file is missing. You need the Copy Pods Resources Build Phase script to copy and create that file. The following will restore that build phase script.


-In Xcode run clean
-Delete the Pods directory
-Delete the Podfile.lock file
-In the project directory run 'pod install'
-Restart Xcode

user5269602
  • 126
  • 6
0

I started debugging app by placing breakpoint where the path for the resource was nil. when you hit a breakpoint, the value was nil & showed proj_name was compiled with optimization - stepping may behave oddly.. message.

This prevented us from watching real variable values because the in pod project setting optimization was different from main & target setting, so change to None.

Pods > Project Setting > Build Setting > Code Generation

image

Now I was able to see value/path for the main app bundle, but InAppMessagingDisplayResources.bundle was still missing from proj_name.app which gave a hint that there is a mistake while copying file. Found out that in Copy pod resource section flag for Run script only when installing was checked. Unchecked it, the app didn't crash for missing bundle.

Target Setting > Build Phases > Copy Pod Resources

image

nikdange_me
  • 2,949
  • 2
  • 16
  • 24