In apple developer document about Event Handling Guide for iOS we can find a statement “Core Motion establishes the reference frame when your app starts device-motion updates”.
Experiments about quaternion:
The experiment results does not fit with the statement in the document. I'm really confused about it.
You use the reference frame CMAttitudeReferenceFrameXArbitraryZVertical when you are interested in deviation from the initial position. In a reference frame of CMAttitudeReferenceFrameXArbitraryZVertical, the first attitude reported establishes the initial frame of reference. This means that its value is essentially arbitrary. You should ignore its value, but at the same time it is up to you to save this initial attitude and subsequently always to call multiplyByInverseOfAttitude:
on any new attitudes, passing the saved attitude as parameter. This gives you information relative to the initial position.