I have localization in my project, when i add the apple pay button it displays IN_APP_PAYMENT_BUTTON_SETUP
instead of "Setup Pay".
Strangely same code displays proper Apple pay button when added to a different sample project.
if ([PKPaymentAuthorizationViewController canMakePayments]) {
if ([PKPaymentAuthorizationViewController canMakePaymentsUsingNetworks:@[PKPaymentNetworkVisa, PKPaymentNetworkMasterCard, PKPaymentNetworkAmex]]) {
//Standard code
}
else{
UIButton *btnApplePay = [PKPaymentButton buttonWithType:PKPaymentButtonTypeSetUp style:PKPaymentButtonStyleWhiteOutline];
[btnApplePay setFrame:CGRectMake(10, 10, 294, 50)];
[self.view addSubview:btnApplePay];
}
}
Also if the width of the PKPaymentButton is of size smaller than 128 px then the PKPaymentButton displays " Pay" text.
FINALLY, I found the reason behind this whole issue.
As I have mentioned in my comments, I was able to find the root cause of this issue, which was Localization.
I tried to replicate the same code and environment in a demo app but was not able to reproduce the same behavior. Finally i was able to pin point the exact cause viz BundleLocalization
which I have used in my app, as I need to change languages inside the app on the fly.
As I dug deep inside the BundleLocalization
class, I was able to figure out that there is a category use called NSBundle+Localization
which has a method called:
-(NSString*) customLocaLizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)tableName
Apparently, this messes up the localizationBundle
. So, I have to find a workaround for this, in order to continue using localization in my app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With