skip to Main Content

I have an application in ionic 3 (legacy) when building it I get the error in the Firebase Messaging library in this part of the file "GtalkExtensions.pbobjc"

if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {
      [worker release];
    }

Conflicting types for ‘OSAtomicCompareAndSwapPtrBarrier’

Declaration of ‘OSAtomicCompareAndSwapPtrBarrier’ must be imported from module ‘Darwin.libkern.OSAtomic’ before it is required

Implicit declaration of function ‘OSAtomicCompareAndSwapPtrBarrier’ is invalid in C99

How to solve this problem I already removed cocoapods completely and tested several versions and it didn’t help.

Mac Mini M1
Mac OS Ventura
XCode 14.2

4

Answers


  1. I have find smth like
    https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/OSAtomicCompareAndSwapPtrBarrier.3.html

    it is very bad idea, but actually it works

    You can import at in files with this error and continue work

    #include <libkern/OSAtomic.h>
    
    Login or Signup to reply.
  2. I have upgraded everything firebase related to the latest version and the error is gone.
    Example:

    "@react-native-firebase/analytics": "^17.5.0",
    "@react-native-firebase/app": "^17.5.0",
    "@react-native-firebase/crashlytics": "^17.5.0",
    "@react-native-firebase/dynamic-links": "^7.5.1",
    "@react-native-firebase/firestore": "^17.5.0",
    "@react-native-firebase/messaging": "^17.5.0",
    "@react-native-firebase/remote-config": "^17.5.0",
    Login or Signup to reply.
  3. it’s might be incompatible with Protobuf.
    maybe you can try to specific another version in Podfile.lock like

    - Protobuf (3.21.12)
    
    Login or Signup to reply.
  4. The problem is related to new Protobuf (3.23.X) library. If you want to fix your current version of Firebase without upgrading to the latest one you can pin a previous working version of ‘Protobuf’ in your Podfile:

    ...
    target 'YourTarget' do
      project 'YourProject'
      ...
      pod 'Protobuf', '= 3.22.1' # Pinned version for Firebase Messaging
    end
    

    Then remove Podfile.lock and run pod install.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search