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
}
Related
After upgrading from XCode 10.0 to 11
I am getting the error 'name' is unavailable: not available on iOS
This is during Build for Swift 4.2 on XCode 11.0 and 11.1 , I can still build using XCode 10
This is happening in the code of one of the Objective C external libraries we have been using through Cocopods.
return [(NSNumber *)[table[state] objectForKey:[rule name]] unsignedIntegerValue];
I can work around the issue by renaming the variable name to ruleName , but I would rather not do this.
Why is Xcode objecting to a variable name of name? Is this an Xcode but or is it something I can fix in the build settings
Edit
The specific pod is NUI 0.5.5
In module NUIPShiftReduceGotoTable.m
- (NSUInteger)gotoForState:(NSUInteger)state rule:(NUIPRule *)rule
{
return [(NSNumber *)[table[state] objectForKey:[rule name]] unsignedIntegerValue];
}
Apple made a change that can break previously compiling code in Xcode 11.0/11.1. Previously the compiler would be fine with passing the 'name' message to an object that it didn't know the type of. This can happen for many reasons in the weakly typed Objective-C world.
Currently in Xcode 11.1 you can do.
id x = nil;
[x name];
And this will compile, no problem. But:
NSObject *x = nil
[x name];
won't compile due to the compiler identifying the most likely selector being the API_UNAVAILABLE one in NSLayoutAnchor.h (maybe).
If the compiler had more information it can map the correct selector. This might be as simple as including the header for whatever has name property in the .m file that is failing.
My guess is something like in NUIPShiftReduceGotoTable.m you add a line
#import"NUIPRule.h"
What compatibility issues, if any, are there with using isEmpty on a string in Swift?
let str = "Hello, planet"
if !str.isEmpty {
print(str)
}
I'm developing with the latest Xcode+Swift versions, but I thought I once read (perhaps incorrectly) that .isEmpty will not work with older versions of iOS, and so str == "" should be used instead.
Thanks!
References (whose overlap confuses me some):
(String) "whether a string has no characters" ... From Protocol: Collection
(String) "whether the collection is empty"
(Range) "whether the collection is empty" ... SDK: Xcode 10+
The availability of isEmpty to check if a String is empty came into Swift, when String became a collection type with the release of Swift 4. So the isEmpty check on a String is quite similar to the isEmpty check on an Array, Dictionary or a Set.
And, features like these are not limited to the iOS or Xcode versions. These kind of changes are specific to the language version (Swift); so you can safely assume that it would work on all devices or OS which can run your application.
In the recent / latest version of Swift, you can just use the isEmpty, and it's the same with comparing == "".
but I thought I once read (perhaps incorrectly) that .isEmpty will not
work with older versions of iOS
The iOS/MacOS version is NOT related to the Swift version you are using (and you should use always the latest), and instead, some of the new provided APIs in Swift do support a minimum version of the iOS/MacOS. So don't be confused.
I have created an ARKit project using a beta version of Xcode 9, which I was able to run on my real device without issues.
Yesterday, I upgraded to Xcode 9 GM, and without touching anything, Xcode shows multiple errors, saying it does not know ARSessionConfiguration i.e.:
Use of undeclared type 'ARSessionConfiguration'
and:
Use of undeclared type 'ARWorldTrackingSessionConfiguration'
...for this code:
let session = ARSession()
var sessionConfig: ARSessionConfiguration = ARWorldTrackingSessionConfiguration()
I have imported ARKit and am using the ARSCNViewDelegate in my ViewController.
When opening the project from the beta version of Xcode, it does not show the errors and I can again run the app on my phone.
Any idea how I can fix this?
ARWorldTrackingSessionConfiguration has been deprecated and renamed to ARWorldTrackingConfiguration: See here
Also, ARSessionConfiguration has been deprecated and renamed to ARConfiguration, which is now an abstract base class.
Use AROrientationTrackingConfiguration when you don't want world tracking, instead of using a generic ARConfiguration. Thus:
let configuration = AROrientationTrackingConfiguration()
You can also check if world tracking is supported on a device:
if ARWorldTrackingConfiguration.isSupported {
configuration = ARWorldTrackingConfiguration()
}
else {
configuration = AROrientationTrackingConfiguration()
}
In Xcode 9 GM, looks like ARWorldTrackingSessionConfiguration has been renamed to ARWorldTrackingConfiguration:
https://developer.apple.com/documentation/arkit/arworldtrackingconfiguration
Reference to this change:
https://github.com/markdaws/arkit-by-example/issues/7
ARSessionConfiguration has been renamed to ARConfiguration:
https://developer.apple.com/documentation/arkit/arconfiguration
I have developed iOS application using Swift 2.3. and I have put the application to the app store in review process, apparently they have rejected it due to crash in iOS 10 .
Then in order to fix it I have downloaded the Xcode 8 and tried to build the app without converting code in to swift 3 using legacy setting
But I couldn't build the app. There was few compile errors in pods that I have used. (Alamofire framework)
error :- and there will more
private func trustIsValid(trust: SecTrust) -> Bool {
var isValid = false
var result = SecTrustResultType(kSecTrustResultInvalid)
let status = SecTrustEvaluate(trust, &result)
if status == errSecSuccess {
let unspecified = SecTrustResultType(kSecTrustResultUnspecified)
let proceed = SecTrustResultType(kSecTrustResultProceed)
isValid = result == unspecified || result == proceed
}
return isValid
}
So I did a small digging apparently Alamofire has released a new version for Xcode 8 so i have put that version, apparently I can't integrate that version in to my source code since it's in Swift 2.3.
Can someone help me to get over with this issue, problem was I can't release the app to App store since there is a crash in iOS 10 and I can't check it since I don't have iOS 10.
I'm using a dictionary to evaluate an expression, when the expression has variables and the dictionary is actually used by NSExpression, something happens and I get EXC_BAD_ACCESS when trying to update the dictionary, this only happens when debugging in an iPhone6, not in the simulator and not in an iPhone 4S.
let strExpression = "a+b+20"
let exp = NSExpression(format:strExpression)
self.dictionary = ["a":10.0, "b":15.0, "c":25.0]
let value:AnyObject = exp.expressionValueWithObject(self.dictionary, context: nil)
let doubleValue = value as Double
self.dictionary.updateValue(doubleValue, forKey: "c")
Something really weird is that if i add this line just after creating the dictionary, then it woks fine:
let newDic = self.dictionary
I,m using iOS 8.1. Thanks in advance!
With #bensarz comment, I thought it might be helpful for others searching for answers if I put the response into an actual answer instead of a comment.
Per #LeeWhitney's response on a similar post:
Looks like a compiler bug.
Have you tried switching between Release and Debug then rebuilding? If debug works but not release it can be an indication of a compiler/optimizer bug.
Does it happen in the simulator also?
Your code works for me on iOS 8.1 with XCode 6.1.
Solution:
The issue seems to be solved by changing the 'Optimization Level' under the 'Swift Compiler - Code Generation' to 'None'. The issue seems to be with the 'Fastest' Compiler optimization level.
Also, a work around that I've found original before the compiler change:
If you use a let statement prior to assigning values in the dictionary, it seems to alleviate the issue. More information found at link below:
EXC_BAD_ACCESS on iOS 8.1 with Dictionary