mixpanel/mixpanel-iphone — pull request #80 by idpaterson (2013-10-03 17:14:12+00:00)
Title: Fixes a crash due to mutating event or people data while archiving [regression]

The `-archive` method can be used by an app to trigger an archive. However, the archive procedure is not dispatched to the serial queue, leaving any operations on the queue to mutate `eventsQueue` and `peopleQueue` while they are being archived. This causes the app to crash, a regression of #39 that was fixed last year before refactoring of the serialization. The crash appears to be quite rare at least in our circumstances, but we have seen it pop up on several occasions in our App Store releases.

One solution was to add an internal method for archiving from the serial queue and use that instead of `-archive`. This leaves `-archive` to be used solely by the app, so we can safely dispatch the event to the serial queue. Please advise whether you would prefer this to be dispatched synchronously with `dispatch_sync`.

Please cherry-pick this change into the people-identify branch if accepted.