Failed to open Apple Pay sheet on iPhone 6 - ios

I want to make an example project that open an Apple Pay sheet when user clicks on the 'Pay with Apple Pay' button on my app.
I test my app on an iPhone 6 with iOs version 8.1 (which contains Apple Pay) and Xcode 6.1 GM. Both of them have not been officially released yet.
I followed the tutorial on this page. And this is my code for handling the on-click event of 'Pay with Apple Pay' button:
PKPaymentRequest *request = [PKPaymentRequest new];
// Must be configured in Apple Developer Member Center
// Doesn't seem like the functionality is there yet
request.merchantIdentifier = #"my.valid.merchant.identifier";
request.countryCode = #"US";
request.currencyCode = #"USD";
// Let's go!
// if (![PKPaymentAuthorizationViewController canMakePayments]) return;
PKPaymentAuthorizationViewController *authVC = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:request];
authVC.delegate = self;
[self presentViewController:authVC animated:YES completion:nil];
Clicking on the 'Pay with Apple Pay' button, I got this error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target
When checking the PKPaymentAuthorizationViewController canMakePayments], it returns false.
I'm not sure about the reason of my error is of the iPhone's setting or my code.
Does someone have the experience with Apple Pay? Please help me. Thank you so much.

I test my app on an iPhone 6 with iOs version 8.1 (which contains Apple Pay)
No, the most recent beta (iOS 8.1 Beta 2) does not contain Apple Pay. There's obviously some stuff in there under the hood as they're working on it, but it's not intended to work for developers yet.
This is why [PKPaymentAuthorizationViewController canMakePayments] returns NO and authVC is nil. Apple Pay is also not available in Settings, nor is it mentioned in the release notes.

Related

Black screen when using ARGeoTrackingConfiguration on iOS 15.4?

I am trying to run this sample project from Apple that uses ARGeoTrackingConfiguration: https://developer.apple.com/documentation/arkit/content_anchors/tracking_geographic_locations_in_ar
This sample app is supposed to show an AR camera feed in the top part of the screen, and a map view in the lower part. However, I am not seeing the camera feed, it's just black.
I suspect this is something that changed in iOS 15.4, since my colleague was able to run the app successfully on a phone with iOS 15.3.1.
Some other details:
I am seeing this issue on an iPhone 12 Pro Max and an iPhone 13 mini.
Both these devices can support geotracking and are connected to the internet.
I am in a location that has geotracking support, according to these docs: https://developer.apple.com/documentation/arkit/argeotrackingconfiguration
I updated to iOS 15.4.1 but the issue is still occurring.
I tried updating to the iOS 15.5 beta 1 and the issue is still occurring.
Has anyone else noticed this issue? Am I doing something wrong? Is there a workaround?
I filed a radar ticket as well, just in case.
EDIT: I filed a TSI request for this issue, and I got back a response saying that there is no workaround for the issue. However, it looks like the bug has been fixed in iOS 15.5 beta 2.
// Class originalClass = NSClassFromString(#"NSXPCDecoder");
// Class swizzledClass = NSClassFromString(#"SwizzledDecoder");
// SEL originalSelector = #selector(_validateAllowedClass:forKey:allowingInvocations:);
// SEL swizzledSelector = #selector(__validateAllowedClass:forKey:allowingInvocations:);
#interface SwizzledDecoder : NSObject
- (void)__validateAllowedClass:(Class)arg1 forKey:(id)arg2 allowingInvocations:(bool)arg3;
#end
#implementation SwizzledDecoder
- (void)__validateAllowedClass:(Class)arg1 forKey:(id)arg2 allowingInvocations:(bool)arg3 {
if ([arg2 isEqualToString: #"collaborationData"]) {
return;
}
return [self __validateAllowedClass: arg1 forKey: arg2 allowingInvocations: arg3];
}
#end
https://developer.apple.com/forums/thread/703735?answerId=711909022#711909022
I could think of a few options to "fix" this using Private (Apple) APIs. This approach is not super terrible and at least would unblock you from testing on a 15.4.x device (I confirmed this works on Xcode 13.3.1 and iOS 15.4.1).
As far as whether or not Apple would approve #YOLO #FIDLAR code like this in an App Store review? I can't help you there.
The real fix (we can hope for) is the next version of Xcode ships with an SDK that builds and compiles with a retroactive fix for 15.4.x.
This issue has been fixed in iOS 15.5

Hand Off between iOS and Mac device is not working

I am implementing both iOS and Mac applications. I implemented Hand Off feature in both applications. When I test implementation it works well when:
start on iOS app and continue on iOS app
start on iOS app and continue on Mac app
But it doesn't work when I start on Mac app and want to continue on iOS app. Logically, the problem is when I create userActivity and becomeCurrent on Mac app. But the code for iOS and Mac is the same, so I don't know where the problem is.
// Create userActivity
_userActivity = [[NSUserActivity alloc] initWithActivityType:#"com.myapp.image"];
_userActivity.title = #"Image";
_userActivity.supportsContinuationStreams = YES;
_userActivity.delegate = self;
_userActivity.userInfo = #{
#"Key" : #"information from the other device",
#"URL" : #"http://www.apple.com"
};
[_userActivity becomeCurrent];
Thanks!
I submitted a bug report with ID: 41374510 with title: Handoff doesn't work from MacOS to iOS.
I tested it with the same code in reverse from iOS to MacOS and that worked great so I am assuming that it is a Apple's bug.

App crashes if PaywithCard is selected in PayPalPaymentViewController [Paypal iOS SDK]

I have integrated paypal's payment gate way in my app and I have added all the neccessary sdks and libraries. When I enable acceptCreditCards option in paypal configuration, app crashes as soon as user tries to tap on PaywithCard option.
Crash Log:
'Application tried to present a nil modal view controller on target <PayPalPaymentViewController: 0x7fce3029f200
Environment: sandbox
languageOrLocale: en-US
>
I even tried enabling PaywithCard in paypal's sample app and observed the same behaviour.I'm using Xcode 8, swift 3 and
I have added card.io SDK and cleaned the app before running.Now app works as expected.

your app loads indefinitely upon launch

I have an app which works fine on below devices.
iPhone 4s (iOS 7.1)
iPhone 5 (iOS 9.1)
iPhone 6 (iOS 9.1)
However app is rejecting saying below rejection.
We discovered one or more bugs in your app when reviewed on iPad and iPhone running iOS 9.1 on both Wi-Fi and cellular networks.
App did not load its contents, did not load beyond the flash screen.
However when I run this from my side, its working fine but it has problem at Apple end only. I don't know how can app run at my end and its giving problem at Apple end only? I tried to upload with iOS 8.4, but still Apple reply still we can't go beyond splash screen.
Did anyone face such issue OR does anyone point me where I can be wrong?
I have uploaded 6 builds and all are rejected saying same reason.
Note: Same app was working fine earlier (before iOS 9.1 release), but when I try to upload now, it is giving this error.
The biggest challenge for me is, I don't know what is the problem, but I need to FIX this problem
Edit 1
I have first screen as language screen where I have animation of images.
animationImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 1080, 1920)];
animationImageView.hidden = NO;
animationImageView.animationImages = mArray;
animationImageView.animationDuration = 1.5;
animationImageView.animationRepeatCount = 1;
[self.view addSubview:animationImageView];
[animationImageView startAnimating];
After testing on testflight, I found a problem.
If I open the app after clicking app icon, it was working fine.
The problem comes when I click Open button from testflight
When I click Open button, launchOptions in AppDelegate was not nil, so the code in push was going wrong and internally it was crashing but still app was hanged at splash screen (not sure why though)
Below is what I have when I print launchOptions in AppDelegate didFinishLaunchingWithOptions
launchOptions==={
UIApplicationLaunchOptionsSourceApplicationKey = "com.apple.TestFlight";
}
So I changed my code to below and all is working perfectly.
NSLog(#"launchOptions===%#", launchOptions);
if (launchOptions!=nil) {
NSMutableDictionary *userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
NSLog(#"userInfo===%#", userInfo);
NSLog(#"userInfo===%d", userInfo.count);
if (userInfo.count>=1) {
// here is my code on what to do if i click on push
}
}
Do let me know if someone is not clear
It was crashing saying below
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithString:]: nil argument'
So I feel problem was at line below.
NSString *badge =[[NSString alloc] initWithFormat:#"%#", [apsInfo objectForKey:#"badge"]];
But after putting above condition, all was working fine.
Did you test using "Run" from Xcode, or using Test Flight? Test Flight gets you the app in the same environment as Apple gets it, while running directly from Xcode may yield different results (different push notification environment, possibly different compilation options...).
Also, do you have access to the logs of the server that the app queries? If so, have you checked them to see what happens when Apple try to use the app? Is the query correctly formed? Was there an error (status code different from 200, or in the error log)?
What kind of request does your app perform? Is it a regular http(s) request? Or are you using an unusual protocol which may be blocked somehow?
I suppose the server queried is fully reachable from the Internet (i.e. you did not put a server that is only accessible on your local network)?
You should add error handling in your code, to test the result of requests and display information about it, so that if there's an error when they test it, at least they can report what the error is.

FBSDKGameRequestDialog error with landscape app

in my project i call this function: (Facebook SDK for iOS version v4.1.0)
FBSDKGameRequestContent *gameRequestContent = [[FBSDKGameRequestContent alloc] init];
gameRequestContent.message = #"Choi thu nhe, hay lam day";
gameRequestContent.title = #"Monkey Junior";
gameRequestContent.to = friends;
dialog = [FBSDKGameRequestDialog showWithContent:gameRequestContent delegate:(id)self];
Image:
Our app is in landscape and the Facebook friend invite dialog is in portrait and the buttons Send and Cancel are located outside the screen.
Please help me.
This is a known issue with the FB SDK for iOS being tracked here.
This issue is seen in iOS 7.x so if it is blocking you then you can maybe at least test your functionality (if feasible) in iOS 8.x till the fix is released.

Resources