json - Swift: iOS Paypal response parsing into NSDictionary/NSArray -
i'm using paypal sdk xcode ios
i managed work successfully. now, have following response server:
code:
self.resulttext = completedpayment.confirmation println(self.resulttext)
result:
[response: { "create_time" = "2015-07-13t17:52:31z"; id = "pay-nonetworkpayidexample123"; intent = sale; state = approved; }, client: { environment = mock; "paypal_sdk_version" = "2.11.1"; platform = ios; "product_name" = "paypal ios sdk"; }, response_type: payment]
my question that, want parse , access data results nsdictionary and/or nsarray
i solved in way...
let paymentresultdic = completedpayment.confirmation nsdictionary let dicresponse: anyobject? = paymentresultdic.objectforkey("response") println(dicresponse!.objectforkey("create_time")) println(dicresponse!.objectforkey("id")) println(dicresponse!.objectforkey("intent")) println(dicresponse!.objectforkey("state")) let dicclient: anyobject? = paymentresultdic.objectforkey("client") println(dicclient!.objectforkey("environment")) println(dicclient!.objectforkey("paypal_sdk_version")) println(dicclient!.objectforkey("platform")) println(dicclient!.objectforkey("product_name")) println(paymentresultdic.objectforkey("response_type"))
if has better solution, lets share it...
thanks
Comments
Post a Comment