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

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

python - Pygame screen.blit not working -

c# - Web API response xml language -