Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when compiling for iOS asking for type PhoneNumberKit #457

Open
andrebaldo opened this issue Dec 7, 2024 · 3 comments
Open

Error when compiling for iOS asking for type PhoneNumberKit #457

andrebaldo opened this issue Dec 7, 2024 · 3 comments

Comments

@andrebaldo
Copy link

Describe the bug
After configuring the app on a Macbook Apple Silicon I got this error when trying to build it:
flutter build ios --simulator
...
Swift Compiler Error (Xcode): Cannot find type 'PhoneNumberKit' in scope
/Users/andrebaldo/.pub-cache/hosted/pub.dev/libphonenumber_plugin-0.3.3/ios/Classes/SwiftLibphonenumberPlugin.swift:6:24
Uncategorized (Xcode): Command SwiftCompile failed with a nonzero exit code

Package version
intl_phone_number_input: ^0.7.4

Flutter version
Flutter 3.24.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision dec2ee5c1f (3 weeks ago) • 2024-11-13 11:13:06 -0800
Engine • revision a18df97ca5
Tools • Dart 3.5.4 • DevTools 2.37.3

To fix it you can just update the code on this file:
/.pub-cache/hosted/pub.dev/libphonenumber_plugin-0.3.3/ios/Classes/SwiftLibphonenumberPlugin.swift
line 7
from this: let phoneNumberKit: PhoneNumber = PhoneNumber()
to this: let phoneNumberKit: PhoneNumberUtility = PhoneNumberUtility()

and line 128
from this: let partialFormatter: PartialFormatter = PartialFormatter(phoneNumberKit: phoneNumberKit, defaultRegion: isoCode.uppercased())

to this: let partialFormatter: PartialFormatter = PartialFormatter(utility: phoneNumberKit, defaultRegion: isoCode.uppercased())

To Reproduce
Steps to reproduce the behavior:

  1. Code Snippet
  2. Use case
  3. Interaction with the widget
  4. See error
    5 ...

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

** Targeted platforms (please complete the following information):**

  • OS [e.g. Android, iOS, ...]
  • Web [✔ or ❌]

Additional context
Add any other context about the problem here.

@mlab817
Copy link

mlab817 commented Dec 12, 2024

Since the package was published 12 months ago and never updated, it seems that the ios version for PhoneNumberKit is already outdated. I overrode the flutter_libphonenumber_ios to the latest version "^1.4.0".

flutter_libphonenumber_ios: "^1.4.0"

I ran flutter pub get, removed Podfile.lock and run pod install --repo-update. I only encountered this error after updating to XCode 16.2 and ios 18.2.

@happyriri
Copy link

@mlab817 Oh I don't find flutter_libphonenumber_ios in my Flutter project.
Where is it ?

@coolnalu
Copy link

coolnalu commented Dec 16, 2024

Seems related to this issue natintosh/plugin_libphonenumber#35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants