Objective-C stub for message `fetchWithExpirationDuration:completionHandler:' type `v@:d@?' not precompiled

I’ve just updated to Mojave and I’m trying to get my app run on the latest version of Rubymotion (6.0). I’m getting the following error:

Objective-C stub for message `fetchWithExpirationDuration:completionHandler:' type `v@:d@?' not precompiled. Make sure you properly link with the framework or library that defines this message.

Which relates to the following Firebase code:

FIRRemoteConfig.remoteConfig.fetchWithExpirationDuration(10, completionHandler: proc { |fetch_status, error| S::Base.remote_configs.activateFetched })

I’m also getting the same type of error on the following OneSignal code:

OneSignal.alloc.initWithLaunchOptions(options, appId: Environment[:one_signal_id], handleNotification: proc { |message, data, is_active|}, autoRegister: false)

This worked fine when I was running on High Sierra and Rubymotion 5.10.

It seems like someone else had a similar issue with a native library (App crashing after 5.16 upgrade). I don’t see how I can apply the same solution though.

Any guess on what’s going on here?

Make sure to run rake clean:all after an upgrade so that any cached files from a previous build are removed.

If this doesn’t work, ping me on Slack and we’ll work through the issue.

I’ve made a demo repo of the issue. You can download it here:

The issue if happening for multiple functions that that have the following pattern: “someMethod:someHandler:”.

The demo above is trying to utilize Firebase’s remote config API (https://firebase.google.com/docs/reference/ios/firebaseremoteconfig/api/reference/Classes/FIRRemoteConfig)… specifically this method: https://firebase.google.com/docs/reference/ios/firebaseremoteconfig/api/reference/Classes/FIRRemoteConfig#-fetchwithexpirationdurationcompletionhandler.

Did you get a chance to look at this issue? Is it a bug in Rubymotion?

@holgersindbaek Did you try the solution that Amir mentioned? (you didn’t say)

I copied this from a changelog announcement a while back. Might help you track down your issue.

[Troubleshooting] iOS 12.0 has moved libraries around. If you ever run into runtime exceptions such as:

uninitialized constant [...] (NameError)


Objective-C stub for message [...] type `[...]' not precompiled.

Do the following:

brew install ag
cd /Library/RubyMotion/data/ios/
ag -i NameOfConstant -l

Note: brew is an application installation app that can downloaded from http://brew.sh
ag is an application that will quickly search for a piece of text in a directory.

You will be given a list of .bridgesupport files. Given this list, add the basename of the
file to your frameworks list.

Here is an example:

Let’s say you get the following exception:

uninitialized constant BubbleWrap::Device::Camera::KUTTypeMovie (NameError)

Do the following:

brew install ag # This only needs to be run once.
cd /Library/RubyMotion/data/ios/12.0
ag -i KUTTypeMovie -l

ag will output something like the following:

┌── [ /Library/RubyMotion/data/ios/12.0  ]
+-> ag -i KUTTypeMovie -l

Given this result, the following line can be added to the Rakefile:

Motion::Project::App.setup do |app|
  app.frameworks << "CoreServices"

Here is another example of an error you may encounter:

Objective-C stub for message `setBorderColor:' type `v@:^{CGColor=}'
not precompiled. Make sure you properly link with the framework or library
that defines this message.

Do the following:

brew install ag
cd /Library/RubyMotion/data/ios/12.0
ag -i setBorderColor -l

Which outputs:

┌── [ /Library/RubyMotion/data/ios/12.0  ]
+-> ag -i setBorderColor -l

Given this list, include the library that makes the most contextual sense for your application.

Motion::Project::App.setup do |app|
  app.frameworks << "QuartzCore"

@andrewhavens I’ve just given it a try, but it’s not working.

The error is a Firebase method I’m calling, so it would make sense that it can’t be found within /Library/RubyMotion/data/ios/12.0.

How would you solve the issue when the bug comes from calling a Cocoapod method?

@holgersindbaek I’m not sure. I’ve had this happen to me before when using a CocoaPod. I upgraded to a new version of the CocoaPod and the method that I thought was there no longer existed in that version. I found that out by looking at the header files (*.h) in my vendor/Pods/[name of cocoapod] directory. Maybe you could double check to see that the method is defined as you expect.

@andrewhavens I’ve just checked in the header files and the method is definitely there. It doesn’t seem like it’s getting imported though. Could you download the demo project (https://wetransfer.com/downloads/2ba335afb7c1486098411af7038a24a720190408104925/9264db) and take a look at it?

We’ve determined that the issue is the FirebaseRemoteConfig is a framework and does not put its header files in to the list of available public headers. We’re adjusting RubyMotion to look not only in Headers/Public but look for [name].framework directories as well when searching for available headers.

1 Like