SquarePointOfSaleSDK-iOS icon indicating copy to clipboard operation
SquarePointOfSaleSDK-iOS copied to clipboard

Unable to receive whether `UIApplication.openURL(_:options:completionHandler:)` was successful

Open naoigcat opened this issue 2 years ago • 0 comments

SCCAPIConnection.performRequest(_:error:) returns YES even if UIApplication.openURL(_:options:completionHandler:) fails (i.e. Square Point of Sale fails to launch).

The launch failure occurred once, but the condition of occurrence could not be specified.

Code

https://github.com/square/SquarePointOfSaleSDK-iOS/blob/291656d64d633a2876b61fa3f1b5c3935ebe2e3a/Sources/SCCAPIConnection.m#L83-92

+ (BOOL)_performRequestWithURL:(nonnull NSURL *)URL error:(out NSError *__nullable *__nullable)error;
{
    if (![self _canPerformRequestWithURL:URL error:error application:[UIApplication sharedApplication]]) {
        return NO;
    }

    [[UIApplication sharedApplication] openURL:URL options:@{} completionHandler:nil];

    return YES;
}

naoigcat avatar Jul 04 '22 03:07 naoigcat