iOS v12 Https requests errors - ios

I noticed that https requests made from my Ionic Angular app on iOS v12 are failing respectively never reach my backend.
I could confirm that my app is productive and the fact that this error only occurs on iOS >= v12
When I debug in Xcode 10 beta I get the following error
{“headers”:{“normalizedNames”:{},“lazyUpdate”:null,“headers”:{}},“status”:0,“statusText”:“Unknown Error”,“url”:null,“ok”:false,“name”:“HttpErrorResponse”,“message”:“Http failure response for (unknown url): 0 Unknown Error”,“error”:{“isTrusted”:true}}
My Node / Express.js backend set the following headers
var allowedOrigins = ["https://example.com", "http://ionic.local", "http://localhost:8080"];
var origin = req.headers.origin;
if(allowedOrigins.indexOf(origin) > -1){
res.setHeader('Access-Control-Allow-Origin', origin);
} else {
res.setHeader("Access-Control-Allow-Origin", "https://example.com");
}
res.header("Access-Control-Allow-Credentials", "true")
res.header("Access-Control-Allow-Headers", "Origin, Authorization, Content-Type, Content-Range, Content-Disposition, Content-Description, X-Requested-With, X-ACCESS_TOKEN");
res.header("Access-Control-Allow-Methods", "GET,PUT,POST");
Anyone is facing the same problem?
What did you change in your code to fix the problem for iOS v12?
P.S.:
I have opened an issue by Apple
Also here the linked subject on the Ionic forum: https://forum.ionicframework.com/t/ios-12-beta-preflight-requests-fail
And just in case opened an issue on the WkWebView plugin: https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/112
UPDATE
I'm not sure but it looks like that I only face issue while querying POST requests respectively that I don't face it while doing GET requests...could you confirm that too?
UPDATE 2
In the following discussion/issue, https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/112, we are also betting on a bug in the iOS version itself. Let see if it will be corrected with the next beta version
UPDATE 3
Xcode 10 beta 2 respectively iOS 12 beta 2 released Tuesday 19th June 2018 solved my problem

The problem was an internal problem of iOS 12 beta 1
Xcode 10 beta 2 respectively iOS 12 beta 2 released Tuesday 19th June 2018 solved my problem

I'm feeling very confident that this is just a beta 1 bug with no confirmed work around. I never found an opportunity to get this verified in person while at WWDC, but it seems to be very confirmed by multiple sources including this bug on open radar. I'm going to file an additional bug with Apple directly and will update my answer with any responses.
Update:
I've tested multiple devices on iOS 12 beta 2 and the issue seems to be resolved. No update on the bug filed with Apple, but I'm going to assume that it was addressed in the latest update.
Update 2:
Apple has finally closed my bug as fixed.

Test is issue, On iOS 12, below two ways will not run into this issue
request with HTTP
post request with form-data, not with json. if you post with JSON, will trigger option request, but webkit not post this request, so cros domain failed

Related

Requesting an In App Purchase in iOS 13 fails

I use SwiftyStoreKit to request In App Purchases and get only this error with iOS 13:
Error: Optional(Error Domain=ASDErrorDomain Code=507 "Error decoding object" UserInfo={NSLocalizedDescription=Error decoding object, NSLocalizedFailureReason=Attempted to decode store response})
I cannot request information about the products, nor make purchases with a sand box account. However, it works fine in iOS 12.1 on my device. It does not work with the iPhone 11 simulator or an actual device with iOS 13.
I have found a lot, that the Xcode 11 GM seed 1 beta simulator had this problem, but have not found a solution yet. I also tested it with the new released Xcode 11 GM seed 2 version, but there was no fix for me.
Does anyone have a solution on how I can request and purchase In App Purchases again with iOS 13 installed?
Restarting Xcode and simulator did the trick: now my in-app purchases load properly in iOS 13 simulator.
EDIT: This happens in release Xcode 11 too. And happens once in a while, but restarting Xcode and simulators still helps.
EDIT 2: In Xcode 12 beta this bug is also present. But the solution is to create new StoreKit Configuration file (in File -> New menu)
Then add all your products there. Use the same product id's as in AppStore Connect.
Then add this file to Run Scheme configuration.
I had the same issue, iOS13 Simulators produced the same error, iOS12 Simulators were working well.
I then tried out on the iPhone with iOS13 installed, there the calls were working flawlessly too.
Hoping that it'll be fixed soon in Xcode Simulators, I guess until then we are stuck with the error.
Edit:
Now it seems to work also in iOS 13 Simulator Devices.
Note: I've updated the answer, read the Edit part.
To share my experience, it seems that this problem does not exist any more in Xcode 11.1 GM Seed. There's no need to restart Simulators or Xcode to make in-app purchases work anymore.
I had submitted an app for review and it was rejected because of that particular error. As it turns out, it was rejected for a stupid reason as it wasn't my app's bug, however I spent hours trying to get around it.
So, just update to Xcode 11.1 GM Seed and run again. Everything will be okay.
EDIT
The issue still exists in Xcode 11.1 and apparently I was just lucky that it didn't happen to me again. However, I had a second rejection for the exact same reason. What eventually worked and made my app get approved was this:
I had to update my IAP record on App Store by editing and saving it again.
So, I recommend you to try the same; change something temporarily in your IAPs, save and then revert your changes (and save again) so records on the App Store to be refreshed.
FYI, after the second rejection Apple invalidated my IAP and therefore showed me the way. It looks like to be a known issue to them at the end.
For details read this discussion I wrote on Reddit.
For those that has this issue in iOS 14.0, you still need to create the storekit configuration file as per #silvansky answer. Rather than adding it to the target, we can actully start an SKTestSession before making any product request in order to avoid the error.
if #available(iOS 14.0, *) {
do {
let session = try SKTestSession(configurationFileNamed: "Your_StoreKit_Configuration_File_Name")
session.disableDialogs = true
} catch {
// catch error here
}
// Start your product request here
let productIdentifiers = Set(["product_identifier_1", "product_identifier_2"])
let productsRequest = SKProductsRequest(productIdentifiers: productIdentifiers)
productsRequest.delegate = self
// Run the request
productsRequest.start()
}
You can refer to Apple's documentation for SKTestSession for more info: https://developer.apple.com/documentation/storekittest/sktestsession

iOS 13 - FileManager url(forPublishingUbiquitousItemAt:expiration:) not working anymore

I've developed an iOS app that uses the url(forPublishingUbiquitousItemAt:expiration:) method of Apple's FileManager class. Starting with the first Beta of iOS 13 this function stopped working and now it throws an error, stating "This code has been removed. You should switch off of this SPI". But I can't find anything related to this function neither in the release notes of iOS nor in the documentation for this function, and it even states there that it would be supported on Mac Catalyst 13.0+.
This also has nothing to do with Xcode 10 and 11, as it occurs when the app is built using either one of those versions.
Does anyone of you know more about that? It would be great to get new information on that.
Thanks,
Fabian.
This is fixed in iOS 13 beta 6. Updated today and this error magically disappeared!
Had my mind blown when I saw this error message.

iOS 11 Beta - NSURLErrorDomain - code: 18446744073709550617

When running my app on iOS 11 beta 5 built with Xcode 9 I see this error from several of our network calls.
"NSURLError * domain: #“NSURLErrorDomain” - code:
18446744073709550617"
I've never come across this error before and we haven't made any change to the app currently. For networking, we are using AFNetworking v2.5
So it turns out it was ssl related. Eventually what I did was add an exception for the domain in info.plist and was able to get a reasonable error that said there was an ssl issue. Investigating that showed our cert was weakly signed. We replaced it which resolved the issue.

AddressBook not working in iOS9

Recently I have downloaded Xcode beta4 for giving support to iOS 9 in myApp.Now the address book is not working its show blank screen when I select a contact, with following logs.
plugin com.apple.MobileAddressBook.ContactsViewService interrupted
plugin com.apple.MobileAddressBook.ContactsViewService invalidated
I have implemented all major delegate of ABPeoplePicker and put break points its not going in any of them.
Thanks in advance.
UPDATE
This issue has been solved by Apple since Xcode 7 GM , I have confirmed that it works.
ABPeoplePickerNavigationController no longer works on iOS9,
Apple created new library/framework for Contacts in iOS9 ( https://developer.apple.com/library/prerelease/ios/documentation/Contacts/Reference/Contacts_Framework/index.html )
even if application is compiled/built with older Xcode (6) it still behaves like that, in Beta 2 it crashed , in beta 3 it shows black screen,
Apples sample project ( https://developer.apple.com/library/prerelease/ios/samplecode/PeoplePicker/Introduction/Intro.html ) also has the same issue/behavior.
I have opened an issue at bugreport.apple.com ( id - 22001958 ) , saying that it should at least behave like older iOS versions

The network connection was lost error only on iOS7 with AFNetworking

I am using AFNetworking 1.2 library in my app. When I have iOS6 as a base SDK everything works fine, but if I change base SDK to iOS7, then receiving an error in some requests(not all) stating that - "The network connection was lost".
I am not able to find out the cause of the issue, also there is no pattern for this issue as all requests are not failing.
Is there something change in the iOS7 SDK which is causing this issue?
After analyzing issue for 2-3 days, found the root cause of the issue. In response header getting some field which sdk not able to handle.
As others have said, for iOS7, you'll want to upgrade to a newer version of AFNetworking (2.x)

Resources