-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cast from BTJSON! to unrelated type String always fail 4.0.0 #195
Comments
Basically now using responseJSON from Alamofire in swift return BTJSON! object when using subscript so I guess you changed the behavior of the JSON parsing library used by alamofire. or something else |
Braintree iOS does not change the behavior of any other JSON parsing library. I believe you may be in touch with Braintree Support and that this issue is now resolved. If the problem persists, it would be helpful if you could provide steps for reproducing the problem (or even better, create a demo project that exhibits the problem). Thanks! |
Yes its the same issue. well i dont have the time to replicate the issue as i just say « as! NSDictionary » to solve the problem. I think it might be linked to swift itself or Xcode. no big deal just useless warning appearing. Thank you for your answer. regards, nicolas
|
BTJSON conflicted with SwiftyJSON |
Hi, I have the same problem. I'am using swift 2.0 braintree and Alamofire. if responseJSON.result.isSuccess {
if let response = responseJSON.result.value as? [String: AnyObject] {
//This have and Alert "Cast from BTJSON to unrelated type 'String' always fails"
if let text = response["locale"]?["en_US"]?["s_text"] as? String {
terms = text
}
// This works
if let locale = response["locale"] as? [String: AnyObject] {
if let en_us = locale["en_US"] as? [String: AnyObject] {
if let text = en_us["s_text"] as? String {
terms = text
}
}
}
}
} |
After getting another report of this issue, we're taking a look at this again. |
We've made a preliminary discovery as to the issue -- seems that the Swift compiler is doing strange things due to |
Fixes issue #195, which is caused by the Swift compiler doing something weird with the objectForKeyedSubscript implementation in BTJSON.
To everyone who has been affected by this issue, please upgrade to 4.1.2. Thanks for your patience. |
I did suspected the subscript issue... swift is definitely still work in progress... |
okay I've updated to Braintree 4.0.0 but now when accessing NSDictionary in an NSArray coming from a json parsed with alamofire and accessed using subscript in swift they are considered as BTJSON... wtf
The text was updated successfully, but these errors were encountered: