Swift Compiler Error (Xcode): Cannot find type 'PhoneNumberKit' in scope
Cannot compile
Swift Compiler Error (Xcode): Cannot find type 'PhoneNumberKit' in scope /Users/xxxxx/.pub-cache/hosted/pub.dev/libphonenumber_plugin-0.3.3/ios/Classes/SwiftLibphonenumberPlugin.swift:6:24
Swift Compiler Error (Xcode): Extra argument 'phoneNumberKit' in call /Users/xxxxx/.pub-cache/hosted/pub.dev/libphonenumber_plugin-0.3.3/ios/Classes/SwiftLibphonenumberPlugin.swift:127:82
Uncategorized (Xcode): Command SwiftCompile failed with a nonzero exit code
Encountered error while building for device.
Same here, any updates?
You can lock the PhoneNumberKit version to 3.8.0 in your Podfile because the PhoneNumberKit package just released new version 4.0. It has a breaking change by renaming PhoneNumberKit to PhoneNumberUtility https://github.com/marmelroy/PhoneNumberKit/pull/798
target 'Runner' do
use_frameworks!
use_modular_headers!
# This is just a temporary solution to fix the iOS build issue. We need to remove this line after the author fixes this [issue](https://github.com/natintosh/plugin_libphonenumber/issues/35)
pod 'PhoneNumberKit', '3.8.0'
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
Same issue here. I'm using flutterflow to develop my app. I cant fix the issue locally and deploy from an specific branch but this must be resolved else I should consider using another lib.
How can we help?
@natintosh Can you update PhoneNumberKit version please?
Same issue here, Cannot find type 'PhoneNumberKit' in scope
@natintosh I would really appreciate it if you could fix and update the package.
i am applying fix and will create Pull request
Following...
Hey , After debugging Package , i realised this error is coming from Another package plugin_libphonenumber and this package then uses another package called PhoneNumberKit.
During debugging of plugin_libphonenumber , i found that version 3.8.0 and 4.0.0 is causing this Cannot find type 'PhoneNumberKit' in scope. Although i could not find the exact reason of this but i was able to make a build on version 3.7.8
This was the context and i hope this will be helpful for author or people working on this plugin .
--- Now to solve this problem for your flutter app replace code in pubspec.yaml to this Replace this
intl_phone_number_input: your pub version of package
with
intl_phone_number_input:
git:
url: https://github.com/Shahidbangash/intl_phone_number_input.git
ref: develop
then you need to do flutter clean
also delete pubspec.lock file and pod.lock to get rid of old version.
do flutter pub get
and then cd ios
pod install
Now this should work
@natintosh Could you please help? I can buy you a coffee :)
Subscribing to this thread as we are also experiencing the exact same issue.
You can lock the
PhoneNumberKitversion to 3.8.0 in yourPodfilebecause the PhoneNumberKit package just released new version 4.0. It has a breaking change by renamingPhoneNumberKittoPhoneNumberUtilitymarmelroy/PhoneNumberKit#798target 'Runner' do use_frameworks! use_modular_headers! # This is just a temporary solution to fix the iOS build issue. We need to remove this line after the author fixes this [issue](https://github.com/natintosh/plugin_libphonenumber/issues/35) pod 'PhoneNumberKit', '3.8.0' flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end
Perfect solutions. It worked for me. If anyone needs help you can mail me I will fix the issue for you. Thank you [email protected]
The tactical solution is fine but we might need a permanent solution, I am not familiar with the lib whatsoever else I would do it myself.
But if someone can guide me on how to do it I will do it
I hadn't seen this issue, so the solution I used to get round this error was to add the package flutter_libphonenumber. It works, but it's not a clean, definitive solution
Hi,
The issue is actually fixed at the current develop branch targeting v0.7.5 but it is not yet deployed.
At Perci Health we simply forked the repo and published to intl_phone_number_input_perci under the MIT license.
It is possible to use as a temporary workaround.
- Install
intl_phone_number_input_perci: ^0.7.5. - Import packages
import 'package:flutter/material.dart'; import 'package:intl_phone_number_input_perci/intl_phone_number_input_perci.dart';
The rest of the code should be compatible with intl_phone_number_input.
In Flutterflow add intl_phone_number_input_perci: ^0.7.5 to the pubspec dependancies in any custom function.
Hi, The issue is actually fixed at the current
developbranch targetingv0.7.5but it is not yet deployed.At Perci Health we simply forked the repo and published to intl_phone_number_input_perci under the MIT license.
It is possible to use as a temporary workaround.
- Install
intl_phone_number_input_perci: ^0.7.5.- Import packages
import 'package:flutter/material.dart'; import 'package:intl_phone_number_input_perci/intl_phone_number_input_perci.dart';The rest of the code should be compatible with
intl_phone_number_input.In Flutterflow add
intl_phone_number_input_perci: ^0.7.5to the pubspec dependancies in any custom function.
worked for me, thanks a lot.
@natintosh Waiting for your updates.
@natintosh Please provide contributor access for the pub lib and I will deploy the changes myself. Thank youuuu
To fix this issue, follow these steps to integrate the updated SwiftLibphonenumberPlugin.swift and automate the process using intl_phone_number_input.sh: Files.zip
- Update SwiftLibphonenumberPlugin.swift
- Replace the existing SwiftLibphonenumberPlugin.swift with the updated file.
- Place the updated SwiftLibphonenumberPlugin.swift in your project root directory.
- Add intl_phone_number_input.sh
- Create a script file named intl_phone_number_input.sh (or use the one provided).
- Place intl_phone_number_input.sh in your project root directory.
- Modify Your Podfile
- Open your Podfile.
- Locate the post_install section.
- Add the following line to execute the script during the post-installation phase: post_install do |installer| // Your existing post_install configurations // Execute the intl_phone_number_input.sh script system('bash ../intl_phone_number_input.sh') if File.exist?('../intl_phone_number_input.sh') end
The script ensures any necessary updates or configurations are applied automatically during pod install.
Following!