I'm trying to start multiple auto renewable purchase of subscriptions in once for one user, I'm curious how it is handled by Apple
I append transactions like this:
func startTransactions(purchaseIDs: Array<String>) {
if (SKPaymentQueue.canMakePayments()) {
purchaseIDs.forEach { id in
let transactionRequest = SKMutablePayment()
transactionRequest.productIdentifier = id
SKPaymentQueue.default().add(transactionRequest)
}
}
}
and I have this method
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
for transaction in transactions {
}
}
What i want to know if multiple SKPaymentQueue.default().add(transactionRequest) in a row results in one transaction of does it results in multiple transactions (one per product)
Thanks in advance for your help
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
We have a webapp that has a page that allows users to link its Garmin Connect account with his/her account but when I open the Garmin page in the WkWebview I've this page that I cannot interact with the buttons but the only quick fix I've found is to open the URL in a SFSafariViewController , sadly this requires us to re-log the user before opening the URL (with a token) that’s why I'm not happy with this solution (and I want to avoid using other things than our wkwebview).
In my ViewController I have this method
func runOauth(){
self.loadingLabel.isHidden=true
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.oauth2!.afterAuthorizeOrFail = self.callBackOAuth
var url:URL?
do{
//the url for authorizing the user, kronos://oauth/callback" is called after the OAuth finish
url = try appDelegate.oauth2!.authorizeURL(withRedirect:"kronos://oauth/callback", scope: "auth",params: ["tg":"addon/kronos/main","idx":"login.OAuth","formId":"iOS"])
do{
let authorizer = appDelegate.oauth2!.authorizer as! OAuth2Authorizer
safariVC = try authorizer.authorizeSafariEmbedded(from: self,at: url!)
}catch let error {
DispatchQueue.main.async {
print("ERROR authorizing\(error)")
}
}
}catch let error {
DispatchQueue.main.async {
print("ERROR creating OAuth URL \(error)")
}
- }
}
This afterAuthorizeOrFail method is called in background
func callBackOAuth(authParameters:OAuth2JSON!, error: OAuth2Error!){
let appDelegate = UIApplication.shared.delegate as! AppDelegate
if (error == nil && appDelegate.oauth2!.accessToken != nil){
//OAuth succeed in
//we store the token and its experation date in keychain
self.keychain!.set(appDelegate.oauth2!.accessToken!,forKey:"Token")
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
let myString = formatter.string(from: appDelegate.oauth2!.accessTokenExpiry!)
self.keychain!.set(myString,forKey:"ExpiryDate")
appDelegate.reloadView()
}else if (error != nil){//OAUth failed
print("OAuth error \(String(describing: error))")
}else{//Another error
print("Cannot login")
self.showMessage(msg: "Login error", title: "Error")
self.runOauth()
}
}
And I want to wait the end of callBackOAuth to call handleRedirectURL here in AppDelegate
func application(_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
let components = URLComponents(url: url, resolvingAgainstBaseURL: false)
let site=components?.host
print("Application")
if site == "oauth"{//OAuth terminated
if components?.path == "/callback" {
let viewController = self.window?.rootViewController as! ViewController
print("oauth")
self.oauth2!.handleRedirectURL(url)
viewController.hideSafariView()
}
}else if site == "logoff"{//User logoff
print("logoff")
}
return true
}
Does someone has a solution?
In swift I'm calling successfully a callback URL which revoke a token after the user is logout, and right after I call this to enable re-logging
func runOauth(){
self.loadingLabel.isHidden=true
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.oauth2!.logger = OAuth2DebugLogger(.debug)
//code executed when OAuth have finished
appDelegate.oauth2!.afterAuthorizeOrFail = self.callBackOAuth
var url:URL?
do{
//the url for authorizing the user, kronos://oauth/callback" is called after the OAuth finish
url = try appDelegate.oauth2!.authorizeURL(withRedirect:"kronos://oauth/callback", scope: "auth",params: ["tg":"addon/kronos/main","idx":"login.OAuth","formId":"iOS"])
do{
let authorizer = appDelegate.oauth2!.authorizer as! OAuth2Authorizer
//launch OAuth in embeded view "SafariVC"
print("Safari embeded")
safariVC = try authorizer.authorizeSafariEmbedded(from: self,at: url!)
}catch let error {
DispatchQueue.main.async {
print("ERROR authorizing\(error)")
//self.runOauth()
}
}
}catch let error {
DispatchQueue.main.async {
print("ERROR creating OAuth URL \(error)")
//self.runOauth()
}
}
}
But it re-log the user automatically when loading logging page, I've tried this:
let appDelegate = UIApplication.shared.delegate as! AppDelegate
let authorizer = appDelegate.oauth2!.authorizer as! OAuth2Authorizer
authorizer.oauth2.forgetTokens()
Does someone have a solution?
Hello,
We have a page in PHP showing the price of our subscriptions displayed in a WKWebView and we want to display the localized prices
we successfully implemented
func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse)
And I'm curious to know if, with a URLRequest, we can call a callback method which stores in $_SESSION the prices when the user login. And more precisely the $_SESSION of the currently displayed WKWebView (this is that specific thing we want to achieve)
Hello there,
Our App has been rejected with this message :
Additionally, the following are still missing in your app’s binary:
– A functional link to the Terms of Use (EULA)
– A functional link to the privacy policy
And from your app's metadata:
– A functional link to the Terms of Use (EULA)
Can someone please help us to fix those errors steps by steps, I'm not sure to understand well how to do this in App Store Connect Help
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
In-App Purchase
App Store Connect
Hello there,
I've implemented signing with apple and successfully retrieve access_token but if the user either don't share his email or use an email already used on our website we want to kind of dissociate the user with our app / cancel sign with apple, so I'm curious if this is possible in php (with curl for example) and if it is, how?
Thanks in advance
Hello there,
I've another question about signing with apple more precisely how to create the jw token in php after sign with apple, here is what I do:
$header = json_encode(array(
'kid' => $keyId,
));
$decodedTokenData = json_decode(base64_decode(str_replace('_', '/', str_replace('-','+',explode('.', $_POST['id_token'])[1]))),true);
$payload = json_encode(array(
'iss' => $teamid,
'iat' => time(),
'exp' => time() + 86400*180,
'aud' => $decodedTokenData['aud'],
'sub' => $decodedTokenData['sub'],
));
$base64UrlHeader = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($header));
$base64UrlPayload = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($payload));
$signature = hash_hmac('sha256', $base64UrlHeader . "." . $base64UrlPayload, 'abC123!', true);
$base64UrlSignature = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($signature));
$jwt = $base64UrlHeader . "." . $base64UrlPayload . "." . $base64UrlSignature;
curl -X POST https://appleid.apple.com/auth/token -d '{"client_id":$CLIENTID,"client_secret":$jwt,"code": $_POST['code'],"grant_type":"authorization_code","redirect_uri":$URL}'
and I've got a
{"error":"invalid_client"}
i don't know what is wrong
Thanks in advance for your help