I really do not encode the iPhone, so I will trust you in the frame "real world coordinates."
In this case, you want the point-to-point between the vectors of the z axis. This will give you the cosine of the angle you are looking for, pretty close. Since the angle between the planes really makes sense as a value between 0° and 90° , in fact you have all the necessary information in this cosine.
And there is no latex formatting, otherwise I’ll tell you a little more, but read this page , interestingly, I’ll just include the final result here, the rotation matrix for your three turns: 
Now the horizontal axis z-axis vector is (0,0,1) (although it's like a vertical vector) and rotated with this matrix, you just get its third column.
So, we want to have a point product between this third column and our vector (0,0,1) , so you get cos(β)cos(γ) , which cos(pitch)*cos(roll)
In conclusion, the angle between your plans is arccos(cos(pitch)*cos(roll)) . This value will tell you how inclined your iPhone is, and not in which direction, of course. But you can fix it from the values of the vector (the rightmost column of the matrix), which we talked about.
source share