Life-cycle of iOS app and rules example