checkout / frames-ios

Frames iOS: making native card payments simple

Home Page:https://www.checkout.com/docs/integrate/sdks/ios-sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PhoneNumberTextField definition conflict

barniques opened this issue · comments

Recently we have found a bug, which is blocking our integration of your iOS sdk

In our project we use third-party dependencies with Objc code. Because of this, Cocoapods generates Objc headers for swift files automatically.
After installing yours sdk, our project does not compile with this error:
'PhoneNumberTextField' has different definitions in different modules; first difference is definition in module 'PhoneNumberKit.Swift' found return type is 'void'

The investigation shows that PhoneNumberTextField is declared in your sdk and PhoneNumberKit, which installed through cocoapods. Similar problems in other pods:
onevcat/Kingfisher#1530
Adyen/adyen-ios#257
xmartlabs/Eureka#2109
and apple developer forum
https://developer.apple.com/forums/thread/658012?page=3

Possible solutions:

  • Do not generate headers for ObjC. SWIFT_INSTALL_OBJC_HEADER = NO
  • Set an explicit prefix for ObjC which will resolve namespacing
  • Add PhoneNumberKit as Cocoapods dependency in Frames.podspec

Because we still use objc third-party dependencies, we can’t solve this problem through SWIFT_INSTALL_OBJC_HEADER, neither the third option may take a while to fix

So we suggest to fix this problem through explicit prefix for ObjC like this

@objc(CKO)
open class PhoneNumberTextField: UITextField, UITextFieldDelegate {

We can’t reproduce this problem in sample project, because our project is not simple enough.
But we can be in touch and test this issue through custom branch via cocoapods

Hi @barniques,

We are currently working on a solution to this, which will be fixed in our next release. We expect to follow your third suggestion (adding PhoneNumberKit as a dependency).

@barniques , we have fixed this now as part of our latest release 3.4.0. We have added PhoneNumberKit as Cocoapods dependency in Frames.podspec. Please feel to re-poen the issue if you still have questions.