Firebase-ios-sdk: FUIPhoneAuth crashes when entering invalid phone number

Created on 22 Sep 2017  路  11Comments  路  Source: firebase/firebase-ios-sdk

  • Xcode version: 9.0

    • Firebase SDK version: 4.2

    • Library versions:

- Firebase/Auth (4.2.0):
    - Firebase/Core
    - FirebaseAuth (= 4.2.0)
  - Firebase/Core (4.2.0):
    - FirebaseAnalytics (= 4.0.3)
    - FirebaseCore (= 4.0.7)
  - FirebaseAnalytics (4.0.3):
    - FirebaseCore (~> 4.0)
    - FirebaseInstanceID (~> 2.0)
    - GoogleToolboxForMac/NSData+zlib (~> 2.1)
    - nanopb (~> 0.3)
  - FirebaseAuth (4.2.0):
    - FirebaseAnalytics (~> 4.0)
    - GoogleToolboxForMac/NSDictionary+URLArguments (~> 2.1)
    - GTMSessionFetcher/Core (~> 1.1)
  - FirebaseCore (4.0.7):
    - GoogleToolboxForMac/NSData+zlib (~> 2.1)
    - nanopb (~> 0.3)
  - FirebaseInstanceID (2.0.3)
  - FirebaseUI/Auth (4.3.0):
    - Firebase/Auth (~> 4.2)
  - FirebaseUI/Phone (4.3.0):
    - FirebaseUI/Auth
  • Firebase Product: FUIPhoneAuth and FIRPhoneAuth

    Steps to reproduce:

When entering an invalid phone number, like a 9 digit phone number for the US, the error callback is called out of the main thread

Relevant Code:

let auth = FUIAuth(uiWith: Auth.auth())!
let provider = FUIPhoneAuth(authUI: auth)
auth.providers = [provider]
auth.delegate = self
provider.signIn(withPresenting: self)

enter 123456789 as phone number, with US selected as country

This triggers a callback with an error that is in a background thread and tries to change the UI and crashes:

screen shot 2017-09-21 at 5 19 55 pm

and the log is:

[Assert] Cannot be called with asCopy = NO on non-main thread.
*** Assertion failure in void _UIPerformResizeOfTextViewForTextContainer(NSLayoutManager *, UIView<NSTextContainerView> *, NSTextContainer *, NSUInteger)(), /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIFoundation/UIFoundation-543/UIFoundation/TextSystem/NSLayoutManager_Private.m:1619
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only run on the main thread!'
auth bug

All 11 comments

This has already been fixed in https://github.com/firebase/firebase-ios-sdk/pull/298/files but the fix didn't make into the release.

Great, thanks. Is there an easy way to copy those changes in my pods? They seem to only include frameworks.

Hi there. I am facing the same issue. Xcode 9, iOS 11

  • Firebase, 4.2.0

    • FirebaseAnalytics, 4.0.3

    • FirebaseAuth, 4.2.0

    • FirebaseCore, 4.0.7

    • FirebaseInstanceID, 2.0.3

    • FirebaseStorage, 2.0.2

    • FirebaseUI, 4.3.0

      How can I get it to work

The fix is planned for our next release. I'll update this issue when the release is available.

Hi @paulb777, great to hear! Do you have a sense of the timeline to expect? Also has a test been added to the PR done by @XiangtianDai ? I had to ship with this crash since the deadline to migrate from Digit is end of September :(

@gsabran Since you're using FUIPhoneAuth, the workaround https://github.com/firebase/FirebaseUI-iOS/pull/339 has already been merged by @yramanchuk , who can ping the thread when this is released as part of FirebaseUI.

@gsabran FirebaseUI 4.3.1 that conatins the fix has just been released and on cocoapods too.

Re-closing here. I conflated the FirebaseAuthUI with a FirebaseAuth issue.

I think it is a FirebaseAuth issue, just that FirebaseAuthUI had implemented a workaround before our fix is shipped as their release schedule is more flexible.

OK, I'll open again and update when the next Auth release goes out.

Fix released today in Firebase 4.3.0 and FirebaseAuth 4.2.1

Was this page helpful?
0 / 5 - 0 ratings