Invalid Profile

I'm developing with XCode and i've a problem with profile validation (provisioning profile) for push notifications. The profile still in invalid status. I'm using APN (firebase for push notification). The push notification work correclty on Android and partial working on Debug Mode on iOS but only in debug mode with usb cable. Why the status of profile remain in invalid status? I see the status in active mode for few minutes, after app build it turn off in inactive status. How to fix it to send push notification?