Just to note, I'm doing something similar and have run into a throttling issue with GetInstanceId. It seems if you call it too many times in a short period of time, it'll start returning nil.
I'm not sure of the calls/sec the throttling kicks in, maybe 100? Or even if it is per second, but it's something to take into account.
|