Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Setup Pay" text appearing as IN_APP_PAYMENT_BUTTON_SETUP Pay

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.

like image 902
Aditya Avatar asked Oct 18 '22 09:10

Aditya


1 Answers

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+Localizationwhich 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.

like image 120
Aditya Avatar answered Oct 20 '22 23:10

Aditya