ios - Distinguish between distribution and development for apple push notificiations -


when start app, registers push notifications , depending on provisioning profile generate different push token.

since both adhoc , appstore provisioning profiles connect same server, have somehow distinguish kind of token is, server can connect right apple server. (sandbox/production)

how can achieve that?

i believe best way achieve make development/production distinction when send token server, , have server annotate type of token in database.

surely have sort of api call server passing in token. in call, pass in type of token well. ex:

{ "token" : "abcd....", "type" : "development" } 

to make distinction @ build time, can use preprocessor directives detect whether it's debug build, release build, or app store build.

checking if debug enabled easy, make distinction whether it's adhoc or app store, consider creating user defined variable. this, clone release scheme , create 1 called app store. in build settings, go user defined variables , create 1 called app_store, app store scheme. when release store, make sure build using scheme instead of release when archive.

then, checking type pass api easy doing this:

nsstring *type = nil; #ifdef debug     type = @"debug"; #elseif app_store     type = @"app_store"; #else     type = @"release"; #endif 

Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -