The XCode error generated:
"Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x1c7a60 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}" error.
I have generated App ID with APNS enabled (the Development one).
And have created a new provisioning profile with this App ID, and installed it in XCode for use.
I think the problem is the "iOS Team Provisioning Profile: *" profile. Its AppID is the one which I generated several months ago, with no APNS enabled, and I don't use it anymore.
But the problem is, I can't edit/delete it! Everytime I "deleted" it by clicking delete in the apple portal, it would appear again.
The reason why I think the problem comes from this is because I opened this provisioning profile to see the text, I can't find the aps-environment, while I can find this tag in the provisioning profile that is newly created with the new APNS-enabled App ID.
I have also included the new provisioning profile in my iPhone in which my app is installed. But I feared that it's because of that old provisioning profile(i.e. iOS Team Provisioning Profile: *) always appear in the device, too.
Or it may be because of other reasons. Hope someone can give me ideas to tackle the problem.