6

I am adding firebase to my ios project via cocoapods. However after performing

`pod install`

I receive Undefined symbols for architecture arm64: error :

Full list of errors :

`Undefined symbols for architecture arm64:
  "___ubsan_handle_add_overflow", referenced from:
  _ReadRawVarInt32 in 
FirebaseMessaging(FIRMessagingCodedInputStream.o)
  -[FIRMessagingConnection willProcessProto:] in FirebaseMessaging(FIRMessagingConnection.o)
  -[FIRMessagingConnection willSendProto:] in FirebaseMessaging(FIRMessagingConnection.o)
  -[FIRMessagingDelayedMessageQueue queueMessage:] in FirebaseMessaging(FIRMessagingDelayedMessageQueue.o)
  -[FIRMessagingDataMessageManager handleExpirationForDataMessage:] in FirebaseMessaging(FIRMessagingDataMessageManager.o)
  +[FIRMessagingReceiver nextMessageID] in FirebaseMessaging(FIRMessagingReceiver.o)
  -[FIRMessagingRmqManager loadInitialOutgoingPersistentId] in FirebaseMessaging(FIRMessagingRmqManager.o)
  ...
  "___ubsan_handle_divrem_overflow", referenced from:
  _FIRMessagingGetFreeDiskSpaceInMB in 
FirebaseMessaging(FIRMessagingUtilities.o)
  "___ubsan_handle_float_cast_overflow", referenced from:
  -[FIRMessaging setupSyncMessageManager] in 
FirebaseMessaging(FIRMessaging.o)
  -[FIRMessagingDelayedMessageQueue calculateTimeoutInMillisWithDelayInSeconds:] in 
FirebaseMessaging(FIRMessagingDelayedMessageQueue.o)
  -[FIRMessagingClient retryConnectionImmediately:] in 
FirebaseMessaging(FIRMessagingClient.o)
  _FIRMessagingCurrentTimestampInSeconds in 
FirebaseMessaging(FIRMessagingUtilities.o)
  _FIRMessagingCurrentTimestampInMilliseconds in 
FirebaseMessaging(FIRMessagingUtilities.o)
  _FIRMessagingGetFreeDiskSpaceInMB in 
FirebaseMessaging(FIRMessagingUtilities.o)
  "___ubsan_handle_load_invalid_value", referenced from:
  -[FIRApp setDataCollectionDefaultEnabled:] in 
FirebaseCore(FIRApp.o)
  -[FIRApp isAppIDValid] in FirebaseCore(FIRApp.o)
  -[FIRApp alreadyOutputDataCollectionFlag] in 
FirebaseCore(FIRApp.o)
  -[FIRApp setAlreadyOutputDataCollectionFlag:] in 
FirebaseCore(FIRApp.o)
  -[FIRApp isDefaultApp] in FirebaseCore(FIRApp.o)
  +[FIRDependency dependencyWithProtocol:isRequired:] in 
FirebaseCore(FIRDependency.o)
  -[FIRDependency initWithProtocol:isRequired:] in 
FirebaseCore(FIRDependency.o)
  ...
  "___ubsan_handle_negate_overflow", referenced from:
  -[FIRMessagingConnection logMessage:messageType:isOut:] in 
FirebaseMessaging(FIRMessagingConnection.o)
  "___ubsan_handle_nonnull_arg", referenced from:
  +[FIRApp registerAsConfigurable:] in FirebaseCore(FIRApp.o)
  +[FIRApp readDataCollectionSwitchFromPlist] in 
FirebaseCore(FIRApp.o)
  +[FIRConfiguration sharedInstance] in 
FirebaseCore(FIRConfiguration.o)
  +[FIRAnalyticsConfiguration sharedInstance] in 
FirebaseCore(FIRAnalyticsConfiguration.o)
  +[FIRComponentContainer registerAsComponentRegistrant:] in 
FirebaseCore(FIRComponentContainer.o)
  _FIRLoggerInitializeASL in FirebaseCore(FIRLogger.o)
  +[FIRMessaging messaging] in FirebaseMessaging(FIRMessaging.o)
  ...
  "___ubsan_handle_pointer_overflow", referenced from:
  _ReadRawByte in FirebaseMessaging(FIRMessagingCodedInputStream.o)
  -[FIRMessagingSecureSocket performRead] in 
FirebaseMessaging(FIRMessagingSecureSocket.o)
  "___ubsan_handle_shift_out_of_bounds", referenced from:
  _ReadRawVarInt32 in 
FirebaseMessaging(FIRMessagingCodedInputStream.o)
  _LogicalRightShift32 in 
FirebaseMessaging(FIRMessagingSecureSocket.o)
  -[FIRMessagingClient nextRetryInterval] in 
FirebaseMessaging(FIRMessagingClient.o)
  "___ubsan_handle_sub_overflow", referenced from:
  +[FIRMessagingPendingTopicsList pruneTopicBatches:] in 
FirebaseMessaging(FIRMessagingPendingTopicsList.o)
  -[FIRMessagingConnection willProcessProto:] in 
FirebaseMessaging(FIRMessagingConnection.o)
  -[FIRMessagingDelayedMessageQueue scheduleTimeoutInMillis:] in 
FirebaseMessaging(FIRMessagingDelayedMessageQueue.o)
  -[FIRMessagingDataMessageManager sendDelayedMessages:] in 
FirebaseMessaging(FIRMessagingDataMessageManager.o)
  "___ubsan_handle_type_mismatch_v1", referenced from:
  -[FIRApp initInstanceWithName:options:] in FirebaseCore(FIRApp.o)
  -[FIRApp configureCore] in FirebaseCore(FIRApp.o)
  -[FIRApp options] in FirebaseCore(FIRApp.o)
  +[FIRApp registerAsConfigurable:] in FirebaseCore(FIRApp.o)
  -[FIRApp isAppIDValid] in FirebaseCore(FIRApp.o)
  -[FIRApp expectedBundleID] in FirebaseCore(FIRApp.o)
  +[FIRApp readDataCollectionSwitchFromPlist] in 
FirebaseCore(FIRApp.o)
  ...

ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)`

I have tried cleaning the project, clearing cache and removing pods and reinstalling.

platform :ios, '11.0'

use_frameworks!

Inhibit compiler warning for all pods (except where inhibit_warnings is set as false).

inhibit_all_warnings!

target 'Generic Viewer' do

pod 'VatomicSDK', :path => '../ios-vatoms-sdk', :inhibit_warnings => false # Locally reference our SDK (i.e. not pulled from Cocoapods)
pod 'Crashlytics'
pod 'Fabric'
pod 'FBSDKLoginKit'
pod 'Firebase/Core',            '~> 5.0'
pod 'AFNetworking',             '~> 2.0'    # CraftAR framework
pod 'libPhoneNumber-iOS'
pod 'Stripe',                   '~> 13.0'
pod 'NSAttributedString-DDHTML'             # HTML string parsing
pod 'PromiseKit',               '~> 4.0'
pod 'PureLayout'

pod 'UIAlertController+Show'
pod 'ReachabilitySwift'
pod 'DateToolsSwift'
pod 'SwiftQRCode'
pod 'GPUImage'                              # Camera motion detection
pod 'Cheers'                                # Confetti

# Required for the 3D face in VatomicSDK
# NOTE: Once the author has fixed the versioning issue in their repo, these should be removed.
# See: https://stackoverflow.com/questions/22447062/how-do-i-create-a-cocoapods-podspec-that-has-a-dependency-that-exists-outside-of/22475228#22475228
pod 'GLTF',     :git => "https://github.com/warrenm/GLTFKit.git", :commit => "e1939408bcd6990f477541915d5652d20e0f9edd"
pod 'GLTFSCN',  :git => "https://github.com/warrenm/GLTFKit.git", :commit => "e1939408bcd6990f477541915d5652d20e0f9edd"

pod 'Permission/Notifications'
pod 'Permission/Bluetooth'
pod 'Permission/Contacts'
pod 'Permission/Location'
pod 'Permission/Camera'

# Unit tests
target 'GV Unit Tests' do
end

# Developer Signed distribution target
# target 'Generic Viewer (Developer Signed)' do
# end

# Run code after project has been set up
post_install do |installer|

    # Some pods have not yet been updated to Swift 4.
    # As a temporary workaround, set their build version to Swift 3.2.
    myTargets = ['SwiftQRCode', 'Permission']
    installer.pods_project.targets.each do |target|
        if myTargets.include? target.name
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '3.2'
            end
        end
    end

end

end

Malcolmn Roberts
  • 354
  • 3
  • 11
  • Put the following pods in this exact order: `pod 'Firebase'` then `pod 'Firebase/Messaging'` ` – om-ha Jan 22 '19 at 14:14
  • 1
    @om-ha trying that now – Malcolmn Roberts Jan 22 '19 at 14:40
  • 1
    @om-ha no change, same errors – Malcolmn Roberts Jan 22 '19 at 15:00
  • Try [clearing derived data](https://stackoverflow.com/a/42301870/10830091) or [clearing pod cache](https://stackoverflow.com/a/53534917/10830091) and finally it could be a linker error [1](https://stackoverflow.com/a/53534917/10830091) or [2](https://stackoverflow.com/a/26903572/10830091) – om-ha Jan 22 '19 at 15:20
  • Also I'd try `pod 'Firebase'` instead of `pod 'Firebase/Core'`. Finally make sure you have included any required frameworks as specified in Firebase docs. As this is a linker error probably. – om-ha Jan 22 '19 at 15:21
  • Can you please include your complete podfile? I just built a project using CocoaPods and it worked fine. Did you remember to completely quit out of XCode before running the Install within the CocoaPods app? – Jay Jan 22 '19 at 20:56
  • Clearing clearing derived data and clearing pod cache didnt work. Firebase only requires those 2 pods. Yes I had xcode closed completely when doing the pod install. @Jay – Malcolmn Roberts Jan 23 '19 at 07:26
  • You may need to install Firebase first which requires two pieces: *pod 'Firebase/Core'* and then *pod 'Firebase/Database'*. Also ensure you've created the Firebase project and and downloaded & installed the GoogleService-Info.plist. Can you update your podfile to match that and try again? – Jay Jan 23 '19 at 12:04
  • @Jay I added the plist and removed all pods and installed just core and database. Still same issues – Malcolmn Roberts Jan 23 '19 at 12:44
  • @Jay If i still Firebase/Core version 4 then its fine but as soon as it 5 and up then I get these issues – Malcolmn Roberts Jan 23 '19 at 13:05
  • What's your OS and XCode version? – Jay Jan 23 '19 at 17:32
  • @Jay OS : 10.14.2 & Xcode : 10.1 – Malcolmn Roberts Jan 24 '19 at 07:57
  • As per above, can you include your complete Podfile in your question? Please remember to copy and paste it as text, no images. – Jay Jan 25 '19 at 17:01
  • @Jay updated question to included full pod file – Malcolmn Roberts Jan 28 '19 at 07:45

1 Answers1

2

I managed to solve this issue:

1) Edit Scheme

2) Ensure Undefined Behaviour Sanitiser is turned off ( If it is greyed out, you will have to edit it manually by right clicking on the project file/ Show Package Contents/xcsharedata/xcschemes )

3) Remove pods - pod deintegrate && pod cache clean --all

4) Install pods - pod install

Malcolmn Roberts
  • 354
  • 3
  • 11