The ubiquitous Internet of Things (IoT) system is a key component of future 6G networks to realize a fully connected world. Extensive efforts have been made to provide on-demand traffic scheduling in IoT networks through machine learning algorithms. However, the current learning approaches are hindered by the heterogeneous information in ubiquitous IoT systems since the data are collected from different domains (e.g., space, air, ground, and ocean). To uncover the complete picture of ubiquitous IoT, this article presents a novel federated imitation learning framework for traffic prediction without compromising privacy. This framework contains a knowledge-sharing module to imitate the status of cross-domain models. After that, we design a distributed resource allocation algorithm, where the IoT devices cooperatively make association decisions using matching theory. Simulation results reveal that our proposed approach outperforms state-of-the-art federated transfer learning and achieves desirable traffic scheduling performance in a cross-domain environment.