UserNotifications.framework
or start the archive package.Error message:
Dyld Error Message:
Dyld Message: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserNotifications
Solution: go to Targets
> Build Phases
> Link Binary With Libraries
and set UserNotifications.framework
to Optional
or use an earlier version for packaging.
If an application is installed in the Xcode development environment, and development environment messages are pushed through Tencent Push Notification Service, the following error messages are reported:
Missing Provisioning Profile - iOS Apps must contain a provisioning profile named embedded.mobileprovision.
The provisioning profile is missing. iOS apps must contain a provisioning profile named `embedded.mobileprovision`.
Error cause: the application package does not contain the embedded.mobileprovision
configuration file, making the token environment unknown.
Solution:
bundle id
configured in the Xcode project matches the configured Provision Profile
file and whether the Provision Profile
file corresponding to the application has been configured with the message push capability.aps-environment
field in the embedded.mobileprovision
file is correct.building for iOS Simulator, but linking in object file built for iOS
is reported when the Xcode 12 simulator integrates with the notification extension plugin during the build?You need to find the extension plugin target, click Build Settings > Excluded Architectures, and add the ARM64 instruction set, as shown in the following figure:
Convert the .p12 file of the push certificate into a .pem file and troubleshoot as follows:
apns-dev-cert
is the name of the sample push certificate, which should be replaced with the name of your certificate).openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12
openssl x509 -in apns-dev-cert.pem -inform pem -noout -text
The content
field cannot be empty if the RESTful API is called for push; otherwise, the notification will not pop up on devices on iOS 10 or below.
A .p8 certificate has security risks. Although its validity is longer than that of a .p12 certificate, it has a wider push permission and scope. If leaked, it may cause more severe consequences. Tencent Push Notification Service recommends you use .p12 certificates to manage the push services of your applications separately. If you insist on using .p8 certificates, follow the steps below for application:
Message push involves various associated modules, and exception in any steps can lead to message delivery failure. If message delivery failures occur, you are recommended to use the Toolbox for troubleshooting. Below are the most common issues:
Client troubleshooting
If the device is not connected to the Internet, it cannot receive the message, even if the client has correctly obtained the token, registered it with the Tencent Push Notification Service backend, and the Tencent Push Notification Service server has successfully delivered the message. The message might be received if the device reconnects to the Internet within a short time, as APNs will retain the message for some time and deliver it again.
Check the SDK integration. After the SDK is integrated, please make sure that it can get the device token used to receive messages. For more information, please see iOS SDK Integration Guide.
Server troubleshooting
Push certificate troubleshooting
When the Tencent Push Notification Service server requests APNs to deliver the message, it needs to use two required parameters: the message push certificate and the device token. When pushing the message, please make sure that the message push certificate is valid. For more information on how to configure the message push certificate, please see Acquisition of Push Certificate.
no valid 'aps-environment' entitlement string found for application
is reported in terminal?Check whether the bundle ID configured in the Xcode project matches the configured provisioning profile, and whether the provisioning profile corresponding to the app has been configured with the message push capability.
First, on the device development side, put the audio file in the bundle
directory.
sound
parameter to the name of the audio file (the full path of the audio file is not required).Yes. If notifications are delivered when devices are offline (the persistent connection is interrupted due to a shutdown, airplane mode, or network exception):
Set content-available
to 1
and do not use alert
, badge
, or sound
.
DeviceToken
is not returned occasionally for registration or APNs' request for token fails in the development environment of iOS?This problem is caused by instability of APNs. You can fix it in the following ways:
When creating a push, you can use the API to specify the notification bar message type, leave the title empty, and only set badge_type
. For more information, please see Push API.
Sample:
{
"platform": "ios",
"audience_type": "token",
"environment":"dev",
"token_list": [
"05a8ea6924590dd3a94480fa1c9fc8448b4e"],
"message_type":"notify",
"message":{
"ios":{
"aps": {
"badge_type":-2
}
}
}
}
Crash: you can't call -sendResponse: twice nor after encoding it
?If your application integrates Tencent Push Notification Service SDK for iOS (1.2.7.2–1.2.5.4), uses the Recall feature of Tencent Push Notification Service, and implements the following system callback:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
Then you may encounter this error. You can use the override feature to process sent messages.
Error Domain=NSCocoaErrorDomain Code=1001. APNs' request for a token failed
is reported during Xcode debugging?Problem description:
The following error is reported during Xcode debugging: "Error Domain=NSCocoaErrorDomain Code=1001. APNs' request for a token failed during Xcode debugging. -> Please resolve the problem as follows: use 4G network and restart the phone. If the problem persists after the phone is restarted for multiple times, you are recommended to use another phone for testing." However, the problem persists after I fixed the problem as instructed.
Troubleshooting process:
Troubleshooting process:
Message delivered via the APNs channel:
Message delivered via the Tencent Push Notification Service channel:
Possible case 1: The Tencent Push Notification Service backend delivered the message via the Tencent Push Notification Service channel when the link between the Tencent Push Notification Service SDK and the backend was actually disconnected. As a result, the message failed to reach the device.
Possible case 2: No arrival data was reported but the message actually reached the device (the actual push effect is not affected).
Was this page helpful?