Displaying an Error when clicking a pay with apple button - ios

I am implementing apply pay with stripe. When I clicked a button it doesn't show the proceed to pay page and it shows an error like
"Failed to present in-app payment interface: Error Domain=PKPassKitErrorDomain Code=-1"
Cannot Present Remote Interface of type: PDRemoteInterfaceTypeInAppPayment
and Connection to remote alert view service failed.
How to solve that error.what's that meaning of the error PassbookUiService error

Related

How does one properly test within the sandbox for apple in-app purchases?

I have a brand new app, has not been published yet. I added an in-app purchase to the code, went through the process of adding the product to the app in "app store connect", and added a sandbox user there as well.
To test, I plug in my phone to the mac, and from xcode (13.3.1) I run the app on my phone. The app runs, and I see the product show up in the app. When I hit the button to "buy", I immediately get a dialog to enter credentials. I enter the sandbox credentials, then get another alert saying "Apple ID verification, open settings to continue signing in with.."
I do that, then it pops up a 2-factor dialog saying a code has been sent, but the dialog just goes away after the code is sent via sms to that same device. There's no place to enter that code, as if it knew "oh, the code is being sent to the device that wants it". After a couple of seconds, I end up in Settings->App store, and I don't see anything useful there.
I then go back to the app, and w/o doing anything in the app I immediately get messages in the debug console:
Payment Queue Error: Optional(Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x28160ee80 {Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x2816dc150 {Error Domain=AMSErrorDomain Code=100 "Authentication Failed" UserInfo={NSMultipleUnderlyingErrorsKey=(
"Error Domain=AMSErrorDomain Code=2 \"An unknown error occurred. Please try again.\" UserInfo={NSLocalizedDescription=An unknown error occurred. Please try again.}",
"Error Domain=AMSServerErrorDomain Code=-5000 \"(null)\" UserInfo={failureType=-5000, m-allowed=false, pings=(\n), cancel-purchase-batch=true, customerMessage=The Apple\U00a0ID you entered couldn\U2019t be found or your password was incorrect. Please try again.}"
), NSLocalizedDescription=Authentication Failed, NSLocalizedFailureReason=The authentication failed.}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}}})
I know the account credentials are correct (tried several times and verified them). It's almost as if I'm not really hitting the "sandbox" user db, more like production. But everything I read says I should be in development mode when I run things like this (based on What is a "development-signed version" of an iOS app? How do I run a development-signed version of my app?)
Is there some more precise way of determining whether or not I'm in development mode? Maybe some setting got tweaked or something.
Sorry, my bad. I had created the test account in the "regular user" section, not the "sandbox user" section up at "App store connect" (that's why I was getting the auth errors).
Things work fine with a real sandbox tester account.

Can't skip queue items on Chromecast

I integrated google-cast-sdk to my app, and when I enqueue some videos, I can't skip next/previous using the controls in the expanded controller.
When I tap the button, nothing happens in the UI or in the Chromecast. The log outputs:
-[GCKMediaControlChannel didReceiveTextMessage:] Received unexpected error: Invalid Request.
-[GCKUIMediaController request:didFailWithError:] request [incremental number] failed with error Error Domain=com.google.cast.GCKError Code=4 "Invalid request" UserInfo={NSLocalizedDescription=Invalid request}
To make sure this is not related to my app, I created a blank project/app and only included this Pod: https://github.com/guilhermearaujo/google-cast-bug
Update
I tried in both CAF receiver and Style Media receiver. The faulty behaviour is the same in both cases. This is what the Chromecast logs to the debugger:
[cast.receiver.MediaManager] Unexpected message type: NEXT
[cast.receiver.MediaManager] Sending error: INVALID_REQUEST INVALID_COMMAND

Strange HealthKit Access issue

I'm working on retrieving steps data within HealthKit. The query all works as expected (I'm only retrieving step data) however I'm having a strange issue with the Health Access modal that appears (see screenshot below - this is NOT my app, just an example screenshot taken from the web)
The issue is when the user soft closes the app (i.e. pressing the home to get to springboard) and then goes back into the app. The modal doesn't want to disappear when clicking allow or disallow.
Looking at the log it appears I have this strange error:
Error Domain=com.apple.healthkit Code=5 "(null)"
Any thoughts? If further info is required please let me know.
P.S. Just an addition to this, I notice that when clicking "Don't Allow" (where the "Cancel" is within the screenshot), I get an alert dialogue stating:
"You can turn on health data categories later in the Health app."
Upon clicking "OK" the Health Access screen still does not dismiss.
P.S.S. Not sure if this affect this but when the Health Access screen appears, it does so with the following message in the Log:
Unbalanced calls to begin/end appearance transitions for <UIViewController: 0x1343f4040>.

ApplePay iOS Error on PKInAppPaymentService connection - com.apple.passd.in-app-payment - Connection to remote alert view service failed

While trying to integrate Apple Pay into my test app, I couldn't get the payment sheet to show up, even though I followed all instructions in Apple's Getting Started with Apple Pay document.
When making the payment request:
PKPaymentAuthorizationViewController *auth = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:paymentRequest];
I get two weird errors, with no results on web searches:
Error on PKInAppPaymentService connection: Error Domain=NSCocoaErrorDomain Code=4097 "The operation couldn’t be completed. (Cocoa error 4097.)" (connection to service named com.apple.passd.in-app-payment) UserInfo=0x174273780 {NSDebugDescription=connection to service named com.apple.passd.in-app-payment}
Connection to remote alert view service failed
After following the four steps in Apple's getting started doc, the solution is hidden step number 5:
Enable Apple Pay in your project settings, on the Capabilities tab. This is arguably part of step 4 in Apple's doc, but the step that really tripped me up was checking on the merchant id as shown in the screenshot below:
Edit: Also see answer from #ChristopherJones if you still have trouble.
(Make sure the merchantId you use with a payment request is exactly the same as the one in your Apple Pay capabilities section. Remove the alphanumeric stuff in the beginning if you included it.)
After that, just build and run again.
I had this same issue and the problem was you have to make sure your PKPaymentRequest's merchantIdentifier matches exactly without the random number. Also, you need to make sure that the same identifier is check marked in the Capabilities tab.
PKPaymentRequest *request = [PKPaymentRequest new];
request.merchantIdentifier = #"merchant.com.example";
Also can happen if you subclass from PKPaymentRequest and feed your subclass to PKPaymentAuthorizationViewController
Try adding it for "All"
I had "Connection to remote alert view service failed" error too. For me it turned out that I added Apple Pay in Cababilities Tab, but only for Debug. Once I added it for "All" it started working

Cancelled Touch ID returns unknown error, not cancelled

Long time reader, first time writer. Thanks for a great community.
The app I am working on has In-App Purchase implemented and is working well, however I've run into a strange error case that I don't see an obvious solution to.
The scenario is seen on iPhone 5S with Touch ID enabled for purchases. When the user selects an item to purchase, the Touch ID dialog pops up. If user cancels this specific dialog, the SKPayment delegate receives a SKPaymentTransactionStateFailed event with SKErrorUnknown code - not SKErrorPaymentCancelled as one would expect and what is received when I cancel the password input dialog. As the code cannot categorize this as the user canceling the purchase, the user will see a generic error alert view.
I don't see this being a sandbox issue as purchases themselves works well both testing in sandbox and live.
Thoughts on how to detect that unknown error as a cancellation, anyone?

Resources