ApplePay 'requiredShippingAddressFields' was deprecated in iOS 11.0 - ios

What is the latest way to set/activate email, phone, or postalAddress in IOS > 11?
I tried scrolling through the methods and attributes and came up with the following: paymentRequest.shippingType
Here is the old way:
paymentRequest.requiredShippingAddressFields = [.phone, .email, .postalAddress]
I would like to understand if there is a way to write the code that is easier than the old way and doesn't cause a warning.

It’s been replaced by requiredShippingContactFields.
https://developer.apple.com/documentation/passkit/pkpaymentrequest/2865927-requiredshippingcontactfields

requiredShippingAddressFields is deprecated, use requiredBillingContactFields instead.
For more info: documentation.

Related

MapBox Route Progress RouteStepProgress variables mostly return nil

I used to use the userDistanceToManeuverLocation variable from the RouteStepProgress Class but this seems to just return nil recently.
Just in case I was doing something wrong I tried following the MapBox iOS nav tutorial (https://docs.mapbox.com/help/tutorials/ios-navigation-sdk/) but this had the same result.
Going by the MapBox tutorial I would do the following to get the variable:
let navigationViewController = NavigationViewController(for: directionsRoute!)
let distance = navigationViewController.navigationService.routeProgress.currentLegProgress.currentStepProgress.userDistanceToManeuverLocation
I don't seem to see any error messages or other concerns. I would get this variable on every tick of the users location but now just returns nil. Thanks for any help
So after some testing I figured out the issue is to do with the newer versions of MapBox Navigation (SDK MapboxNavigation). Anything from version 0.29.0 onwards causes issues. For now I'm sticking with version 0.28.0 and will have to report this to MapBox
Edit:
It looks like the latest version (MapboxNavigation 0.38.0 at the time of writing this edit) appears to provide a solution. I now use distanceRemaining found in the RouteProgress class which does the same thing.

How to show/hide comments in XCode 8.2.1

While programming in XCode 8.2.1, I am simply trying to perform the following action:
... but when I try to do this (either by using the mouse/menu, or using the shortcut: "Control-Shift-Command-Left Arrow") , I get the unexpected result of the "Funk" alert sound... and no folding/unfolding takes place.
I have researched the question but all other posts are outdated.
Is this a known bug or am I just doing something wrong?
Thankyou!!!!

Swift - 'init()' was deprecated in iOS 9.0: Use -initWithConcurrencyType: instead

I have an error (yellow warning) on my model on line:
var managedObjectContext = NSManagedObjectContext()
'init()' was deprecated in iOS 9.0: Use -initWithConcurrencyType: instead
What is causing this? How can I fix this issue?
Change it to:
var managedObjectContext = NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType)
You can download Apple's document to see more details.
NSConfinementConcurrencyType
Specifies that the context will use the thread confinement pattern.
Available in iOS 3.0 and later.
Deprecated in iOS 9.0.
Or Command+Click "NSManagedObjectContext" direct to NSManagedObjectContext.h:
#available(iOS, introduced=3.0, deprecated=9.0, message="Use another NSManagedObjectContextConcurrencyType")
case ConfinementConcurrencyType
#available(iOS, introduced=3.0, deprecated=9.0, message="Use -initWithConcurrencyType: instead")
public convenience init()
So it seems NSManagedObjectContext() use "ConfinementConcurrencyType" to init.When Apple deprecated "ConfinementConcurrencyType" in iOS 9.0,for the sake of coherence,Apple did not change the behavior of init() method.
So you'd better use another NSManagedObjectContextConcurrencyTypes( PrivateQueueConcurrencyType, MainQueueConcurrencyType) with another init method:
init(concurrencyType: NSManagedObjectContextConcurrencyType)
Apple changed how core data works. Don't use init(), use initWithConcurrencyType instead as required/recommended.
The underlying reason is related to thread safety and asynchronous access to core data objects.
In general, when Apple tells you that something is deprecated, you will always get a message like
'init()' was deprecated in iOS 9.0: Use -initWithConcurrencyType: instead
And clearly, what you need to do is follow the very strong hint that you were given: Don't use init. Read up what initWithConcurrencyType: does, figure out what is the right way for you to call it, and replace your init call with a call to initWithConcurrencyType:
Take this as an answer to the general question, because really, you should be able to figure this out yourself.

suddenly UIUserNotificationActionResponseTypedTextKey is unavailable

I don't understand this. Suddenly, I couldn't use the in iOS 9.0 introduced UIUserNotificationActionResponseTypedTextKey identifier for accessing text input messages in notifications. Xcode 7.1 says: "UIUserNotificationActionResponseTypedTextKey is unavailable".
But I can see this value in UIUserNotificationeSettings.h.
In Watchos2.0 I have this value.
Any Ideas?
I'm seeing the same exact thing in the release version of Xcode 7.2. Instead of using the key UIUserNotificationActionResponseTypedTextKey, I've gotten it working using the string version "UIUserNotificationActionResponseTypedTextKey".
So for me this is doing the trick:
if let response = responseInfo["UIUserNotificationActionResponseTypedTextKey"] as? String {
// Your code here
}

Using new features while supporting older iOS versions

I am developing an app using SDK 8.1, Apple LLVM 6.0 and Xcode 6.1.1. The deployment target is 6.0. I'm using NSOperationQueue and I want to use QoS whenever it's available.
The code I'm using is:
if ([self.operationQueue respondsToSelector:#selector(setQualityOfService:)]
&& (&NSOperationQualityOfServiceUserInitiated)) {
[self.operationQueue performSelector:#selector(setQualityOfService:) withObject: NSOperationQualityOfServiceUserInitiated];
} else {
//Other stuff not related to the scope of this question
}
The error I get is:
Use of undeclared identifier 'NSOperationQualityOfServiceUserInitiated'
I added the if (&NSOperationQualityOfServiceUserInitiated) part to check if this constant exists. This code worked with older versions of Xcode/Obj-C Compiler.
I am able to use selectors with performSelectorWithIdentifier but what about constants that do not have a defined value in the docs? The value of this constant is set by NSQualityOfServiceUserInitiated but there is no definition for this value that can be hardcoded.
How do I fix that?
There are several things wrong with the code.
NSOperationQualityOfServiceUserInitiated is a native type (NSInteger) so you can't use it the way that you are in either line.
The qualityOfService is a property of type NSQualityOfService. Your attempt to pass an argument to the qualityOfService method (getter method) makes no sense. If you are trying to set the quality of service, you need to call the setter but you can't use performSelector.
You want:
if ([self.operationQueue respondsToSelector:#selector(qualityOfService)]) {
self.operationQueue.qualityOfService = NSOperationQualityOfServiceUserInitiated;
} else {
//Other stuff not related to the scope of this question
}
This code will compile fine as long as your Base SDK is iOS 8.0 or later. The Deployment Target doesn't matter.
If you also want to build this code with Xcode 5 or earlier (a Base SDK of iOS 7 or earlier) then you need to wrap the code with the proper compiler directives to check for the Base SDK.

Resources