Smart cities can handle numerous IoT devices with enhanced services that offer intelligent and effective answers to different elements of urban life. Smart cities use the Internet of Things (IoT). Even as the amount of Internet of Things (IoT) devices, smart city services, and quality of service (QoS) limits increase quickly, servers must allocate finite resources among all Internet-based services to deliver efficient implementation. A smart city's IoT system uses a lot of energy and experiences network latency since a cloud exists. Depending on a cloud computing architecture, edge computing relocates processing, memory, and a shared network near the data provider. The cloud computing model is the same as the IoT model. Optimal energy use while upholding time constraints is a crucial issue in edge computing when carrying out activities produced by IoT devices. This research examines a multi-joint optimization method for distributing edge computing resources in IoT-based smart cities. For IoT-based smart cities, we suggest a Four-layer network design. After that, other air offloading algorithms are added depending on the weight and capacity of the UAV's motor, its altitude just above the surface, and the area it may create. A proposed edge resource allocation strategy based on an actionable method is put forth to provide efficient computing resources for delay-sensitive jobs.