swift - Using Returned JSON Status in an if statement (Checking IAP Auto Renew Receipt ) -


im want check current subscription status of auto renew in app purchase. im getting receipt data via json, im after advice on how use/query returned data

if let parsejson = json {                         println("recipt \(parsejson)")                      } 

returns

recipt {     environment = sandbox;     status = 21004; } 

whilst know wouldn't compile, want to along lines of if statement like:

if parsejson contains status = 21004 {                             //do                          } 

you might consider like

if parsejson["status"] as? int == 21004 {     // } 

this works because as? int automatically convert nsnumber swift integer, , because there version of == accepts optional arguments.

public func ==<t : equatable>(lhs: t?, rhs: t?) -> bool 

Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -