apple-push-notifications https://www.e-learn.cn/tag/apple-push-notifications zh-hans Apple Push Notification service must incorporate the new root certificate (AAACertificateServices) - APNS certificate update [duplicate] https://www.e-learn.cn/topic/4120059 <span>Apple Push Notification service must incorporate the new root certificate (AAACertificateServices) - APNS certificate update [duplicate]</span> <span><span lang="" about="/user/223" typeof="schema:Person" property="schema:name" datatype="">拥有回忆</span></span> <span>2021-02-20 08:34:18</span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><h3>问题</h3><br /><div> <aside class="s-notice s-notice__info js-post-notice mb16" role="status"><div class="grid fd-column fw-nowrap"> <div class="grid fw-nowrap"> <div class="grid--cell wmn0 fl1 lh-lg"> <div class="grid--cell fl1 lh-lg"> <b>This question already has an answer here</b>: </div> </div> </div> <div class="grid--cell mb0 mt4"> Apple Push Notification service server certificate update <span class="question-originals-answer-count"> (1 answer) </span> </div> <div class="grid--cell mb0 mt8">Closed <span title="2021-02-16 06:35:32Z" class="relativetime">3 days ago</span>.</div> </div> </aside></div> <p>I got this mail from Apple.</p> <p>"On March 29, 2021, token and certificate-based HTTP/2 connections to the Apple Push Notification service must incorporate the new root certificate (AAACertificateServices 5/12/2020) which replaces the old GeoTrust Global CA root certificate. To ensure a seamless transition and to avoid push notification delivery failures, verify that both the old and new root certificates for the HTTP/2 interface are included in the Trust Store of each of your notification servers before March 29.</p> <p>Note that Apple Push Notification service SSL provider certificates issued to you by Apple do not need be to updated at this time."</p> <p>I configured Firebase as provider server and using APNS authentication Key.</p> <p>Steps followed:<br /> 1.I downloaded AAA certificate<br /> 2.Opened in Keychain<br /> 3.Tried to export it as p12, not able to do it since it doesn't have private key. 4.Therefore can't export this certificate to Firebase server.</p> <p>I'm not sure what to do from my end. No documentation for this on apple site or any other site.</p> <p>To be more specific should I do anything from my end or this should be taken care of by provider server like Firebase?</p> <p>I'm wondering how come these instructions are not clearly mentioned by Apple?</p> <br /><h3>回答1:</h3><br /><p>Since you're using Firebase, there's nothing to be done on your side. Firebase will handle the job for you, since they are the ones who communicate with Apple. The same applies for any Push service. You should only be concerned if you personally send Push requests to Apple servers.</p> <p>A more complete explanation about this can be found here.</p> <br /><br /><p>来源:<code>https://stackoverflow.com/questions/66169296/apple-push-notification-service-must-incorporate-the-new-root-certificate-aaace</code></p></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">标签</div> <div class="field--items"> <div class="field--item"><a href="/tag/ios" hreflang="zh-hans">ios</a></div> <div class="field--item"><a href="/tag/apple-push-notifications" hreflang="zh-hans">apple-push-notifications</a></div> </div> </div> Sat, 20 Feb 2021 00:34:18 +0000 拥有回忆 4120059 at https://www.e-learn.cn Apple Push Notification service must incorporate the new root certificate (AAACertificateServices) - APNS certificate update [duplicate] https://www.e-learn.cn/topic/4120057 <span>Apple Push Notification service must incorporate the new root certificate (AAACertificateServices) - APNS certificate update [duplicate]</span> <span><span lang="" about="/user/49" typeof="schema:Person" property="schema:name" datatype="">帅比萌擦擦*</span></span> <span>2021-02-20 08:34:02</span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><h3>问题</h3><br /><div> <aside class="s-notice s-notice__info js-post-notice mb16" role="status"><div class="grid fd-column fw-nowrap"> <div class="grid fw-nowrap"> <div class="grid--cell wmn0 fl1 lh-lg"> <div class="grid--cell fl1 lh-lg"> <b>This question already has an answer here</b>: </div> </div> </div> <div class="grid--cell mb0 mt4"> Apple Push Notification service server certificate update <span class="question-originals-answer-count"> (1 answer) </span> </div> <div class="grid--cell mb0 mt8">Closed <span title="2021-02-16 06:35:32Z" class="relativetime">3 days ago</span>.</div> </div> </aside></div> <p>I got this mail from Apple.</p> <p>"On March 29, 2021, token and certificate-based HTTP/2 connections to the Apple Push Notification service must incorporate the new root certificate (AAACertificateServices 5/12/2020) which replaces the old GeoTrust Global CA root certificate. To ensure a seamless transition and to avoid push notification delivery failures, verify that both the old and new root certificates for the HTTP/2 interface are included in the Trust Store of each of your notification servers before March 29.</p> <p>Note that Apple Push Notification service SSL provider certificates issued to you by Apple do not need be to updated at this time."</p> <p>I configured Firebase as provider server and using APNS authentication Key.</p> <p>Steps followed:<br /> 1.I downloaded AAA certificate<br /> 2.Opened in Keychain<br /> 3.Tried to export it as p12, not able to do it since it doesn't have private key. 4.Therefore can't export this certificate to Firebase server.</p> <p>I'm not sure what to do from my end. No documentation for this on apple site or any other site.</p> <p>To be more specific should I do anything from my end or this should be taken care of by provider server like Firebase?</p> <p>I'm wondering how come these instructions are not clearly mentioned by Apple?</p> <br /><h3>回答1:</h3><br /><p>Since you're using Firebase, there's nothing to be done on your side. Firebase will handle the job for you, since they are the ones who communicate with Apple. The same applies for any Push service. You should only be concerned if you personally send Push requests to Apple servers.</p> <p>A more complete explanation about this can be found here.</p> <br /><br /><p>来源:<code>https://stackoverflow.com/questions/66169296/apple-push-notification-service-must-incorporate-the-new-root-certificate-aaace</code></p></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">标签</div> <div class="field--items"> <div class="field--item"><a href="/tag/ios" hreflang="zh-hans">ios</a></div> <div class="field--item"><a href="/tag/apple-push-notifications" hreflang="zh-hans">apple-push-notifications</a></div> </div> </div> Sat, 20 Feb 2021 00:34:02 +0000 帅比萌擦擦* 4120057 at https://www.e-learn.cn Missing Push Notification Entitlement: While Resigining ipa https://www.e-learn.cn/topic/4117749 <span>Missing Push Notification Entitlement: While Resigining ipa</span> <span><span lang="" about="/user/203" typeof="schema:Person" property="schema:name" datatype="">眉间皱痕</span></span> <span>2021-02-19 07:57:45</span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><h3>问题</h3><br /><p>Team, </p> <p>We are releasing new update to our project, In the last version we dont have Push Notifications now are implementing all the process. </p> <p>We work for a client where we used to send ipa file with our distribution profile (Push notifications are working for the ipa we are sending). </p> <p>Once we send the working ipa, they will resign the ipa with there Distribution Profiles and Upload to appstore. </p> <p>We have checked all the scenarios like, App Id enabled with Push Notification,SSl generated for Distribution (Is it mandatory for developing for developer also?). </p> <p>The Resigning is successfull and we are able to upload the app to App Store. </p> <p>But still we are getting the Below mail from Apple. Please Suggest what is the Solution for it</p> <blockquote> <p>Missing Push Notification Entitlement - Your app includes an API for Apple's Push Notification service, but the aps-environment entitlement is missing from the app's signature. To resolve this, make sure your App ID is enabled for push notification in the Provisioning Portal. Then, sign your app with a distribution provisioning profile that includes the aps-environment entitlement. This will create the correct signature, and you can resubmit your app. See "Provisioning and Development" in the Local and Push Notification Programming Guide for more information. If your app does not use the Apple Push Notification service, no action is required. You may remove the API from future submissions to stop this warning. If you use a third-party framework, you may need to contact the developer for information on removing the API.</p> </blockquote> <br /><h3>回答1:</h3><br /><ul><li><p>You have to check if you have enabled push notifications in member center for the provisioning profile that you are using </p></li> <li><p>You have to check if you have enabled push notifications in xcode capabilities</p></li> </ul><p>i.e </p> <p>just check <em>Entitlements.plist</em> for the following key values</p> <pre><code> &lt;key&gt;aps-environment&lt;/key&gt; &lt;string&gt;production&lt;/string&gt; </code></pre> <br /><br /><p>来源:<code>https://stackoverflow.com/questions/39091591/missing-push-notification-entitlement-while-resigining-ipa</code></p></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">标签</div> <div class="field--items"> <div class="field--item"><a href="/tag/ios" hreflang="zh-hans">ios</a></div> <div class="field--item"><a href="/tag/app-store" hreflang="zh-hans">app-store</a></div> <div class="field--item"><a href="/tag/apple-push-notifications" hreflang="zh-hans">apple-push-notifications</a></div> <div class="field--item"><a href="/tag/provisioning-profile" hreflang="zh-hans">provisioning-profile</a></div> <div class="field--item"><a href="/tag/appstore-approval" hreflang="zh-hans">appstore-approval</a></div> </div> </div> Thu, 18 Feb 2021 23:57:45 +0000 眉间皱痕 4117749 at https://www.e-learn.cn How to reset the Badge app icon number? https://www.e-learn.cn/topic/4117340 <span>How to reset the Badge app icon number?</span> <span><span lang="" about="/user/226" typeof="schema:Person" property="schema:name" datatype="">泄露秘密</span></span> <span>2021-02-19 06:57:05</span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><h3>问题</h3><br /><p>I integrated the Push Notification to the CloudKit so that every change in the iCloud will pop up a notification on my iPhone and the badge app icon number will add one correspondingly. However, when I used the code:</p> <p><code>application.applicationIconBadgeNumber = 0</code></p> <p>to reset that number in the <code>applicationDidBecomeActive(_ application: UIApplication)</code>, I noticed that the badge app icon number truly disappeared but if another new notification came again, the number won't start from one again as supposed but just add one to the original total number before the reset. Therefore the number is getting bigger and bigger. I wonder how to solve this problem?</p> <br /><h3>回答1:</h3><br /><p>The problem is your <strong>apns payload</strong>, it contains badge count <strong>more than 1</strong>, you need to reset the payload as well.</p> <p>When you set <code>application.applicationIconBadgeNumber = 0</code> it just resets the badge count locally, not in the server.</p> <p>Solution would be reset the badge count for the user in the server too.</p> <p><strong>Update: Apns Payload</strong></p> <pre><code>{ "aps" : { "alert" : { "title" : "Push", "body" : "Hello User" }, "badge" : 5 } } </code></pre> <p>The app shows the badge count same as in the apns payload above, you need to reset the badge value in the payload above from server. </p> <p>Hope it helps.</p> <p>Cheers.</p> <br /><br /><br /><h3>回答2:</h3><br /><p>I find that I should not only set the application side like:</p> <pre><code>UIApplication.sharedApplication().applicationIconBadgeNumber = 0 </code></pre> <p>but I should also set the iCloud side in CKContainer. Therefore, the complete code is like below:</p> <pre><code>let operation = CKModifyBadgeOperation(badgeValue: 0) operation.modifyBadgeCompletionBlock = {(error) in if let error = error{ print("\(error)") return } application.applicationIconBadgeNumber = 0 } CKContainer.default().add(operation) </code></pre> <br /><br /><p>来源:<code>https://stackoverflow.com/questions/42720259/how-to-reset-the-badge-app-icon-number</code></p></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">标签</div> <div class="field--items"> <div class="field--item"><a href="/tag/ios" hreflang="zh-hans">ios</a></div> <div class="field--item"><a href="/tag/swift3" hreflang="zh-hans">swift3</a></div> <div class="field--item"><a href="/tag/apple-push-notifications" hreflang="zh-hans">apple-push-notifications</a></div> <div class="field--item"><a href="/tag/cloudkit" hreflang="zh-hans">cloudkit</a></div> </div> </div> Thu, 18 Feb 2021 22:57:05 +0000 泄露秘密 4117340 at https://www.e-learn.cn Unable to set header field “apns-push-type” in Apple Push Notification in javapns https://www.e-learn.cn/topic/4109724 <span>Unable to set header field “apns-push-type” in Apple Push Notification in javapns</span> <span><span lang="" about="/user/106" typeof="schema:Person" property="schema:name" datatype="">会有一股神秘感。</span></span> <span>2021-02-17 06:57:07</span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><h3>问题</h3><br /><p>I am unable to find any option (method, class, etc.) to set http header information using <strong>apns library.</strong></p> <p>This question is alrady present here: Unable to set header field "apns-push-type" in Apple Push Notification in javapns</p> <p>But not answered so asking again. <strong>Sorry to post duplicate question.</strong></p> <p>来源:<code>https://stackoverflow.com/questions/61278008/unable-to-set-header-field-apns-push-type-in-apple-push-notification-in-javapn</code></p></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">标签</div> <div class="field--items"> <div class="field--item"><a href="/tag/ios" hreflang="zh-hans">ios</a></div> <div class="field--item"><a href="/tag/apple-push-notifications" hreflang="zh-hans">apple-push-notifications</a></div> <div class="field--item"><a href="/tag/javapns" hreflang="zh-hans">javapns</a></div> <div class="field--item"><a href="/tag/javaapns" hreflang="zh-hans">javaapns</a></div> </div> </div> Tue, 16 Feb 2021 22:57:07 +0000 会有一股神秘感。 4109724 at https://www.e-learn.cn Firebase cloud messaging sendToDevice works properly but sendMulticast fails for the same list of tokens https://www.e-learn.cn/topic/4109077 <span>Firebase cloud messaging sendToDevice works properly but sendMulticast fails for the same list of tokens</span> <span><span lang="" about="/user/106" typeof="schema:Person" property="schema:name" datatype="">会有一股神秘感。</span></span> <span>2021-02-17 05:30:16</span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><h3>问题</h3><br /><p>For certain types of messages, I want to target users by FIRTokens vs topic, which are stored in my real-time database. I load these tokens with <code>async/await</code> and then decide if I want to send notifications to a topic vs a smaller list of users. The data loading code works as expected. But what's odd is that if I use <code>.sendMulticast(payload)</code>, the notifications fail for all tokens in the list. On the other hand if I use <code>.sendToDevice(adminFIRTokens, payload)</code> the notification goes successfully to all my users. Right now my list has 2 tokens and with <code>sendMulticast</code> I have 2 failures and with <code>sendToDevice</code> I have 2 successes. Am I missing the point of what <code>sendMulticast</code> is supposed to do? According to the docs: Send messages to multiple devices:</p> <blockquote> <p>The REST API and the Admin FCM APIs allow you to multicast a message to a list of device registration tokens. You can specify up to 500 device registration tokens per invocation.</p> </blockquote> <p>So both should logically work. Then why does one fail and the other work? In fact with <code>sendToDevice</code> I get a <code>multicastId</code> in the response!</p> <p>Here are some console outputs:</p> <ol><li>sendToDevice:</li> </ol><pre><code>Sent filtered message notification successfully: { results: [ { messageId: '0:1...45' }, { messageId: '16...55' } ], canonicalRegistrationTokenCount: 0, failureCount: 0, successCount: 2, multicastId: 3008...7000 } </code></pre> <ol start="2"><li>sendMulticast:</li> </ol><pre><code>List of tokens that caused failures: dJP03n-RC_Y:...MvPkTbuV,fDo1S8jPbCM:...2YETyXef </code></pre> <p>Cloud function to send the notification:</p> <pre><code>functions.database .ref("/discussionMessages/{autoId}/") .onCreate(async (snapshot, context) =&gt; { // console.log("Snapshot: ", snapshot); try { const groupsRef = admin.database().ref("people/groups"); const adminUsersRef = groupsRef.child("admin"); const filteredUsersRef = groupsRef.child("filtered"); const filteredUsersSnapshot = await filteredUsersRef.once("value"); const adminUsersSnapshot = await adminUsersRef.once("value"); var adminUsersFIRTokens = {}; var filteredUsersFIRTokens = {}; if (filteredUsersSnapshot.exists()) { filteredUsersFIRTokens = filteredUsersSnapshot.val(); } if (adminUsersSnapshot.exists()) { adminUsersFIRTokens = adminUsersSnapshot.val(); } const topicName = "SpeechDrillDiscussions"; const message = snapshot.val(); const senderName = message.userName; const senderCountry = message.userCountryEmoji; const title = senderName + " " + senderCountry; const messageText = message.message; const messageTimestamp = message.messageTimestamp.toString(); const messageID = message.hasOwnProperty("messageID") ? message.messageID : undefined; const senderEmailId = message.userEmailAddress; const senderUserName = getUserNameFromEmail(senderEmailId); const isSenderFiltered = filteredUsersFIRTokens.hasOwnProperty( senderUserName ); var payload = { notification: { title: title, body: messageText, sound: "default", }, data: { messageID: messageID, messageTimestamp: messageTimestamp, }, }; if (isSenderFiltered) { adminFIRTokens = Object.values(adminUsersFIRTokens); // payload.tokens = adminFIRTokens; //Needed for sendMulticast return ( admin .messaging() .sendToDevice(adminFIRTokens, payload) // .sendMulticast(payload) .then(function (response) { if (response.failureCount === 0) { console.log( "Sent filtered message notification successfully:", response ); } else { console.log( "Sending filtered message notification failed for some tokens:", response ); } // if (response.failureCount &gt; 0) { // const failedTokens = []; // response.responses.forEach((resp, idx) =&gt; { // if (!resp.success) { // failedTokens.push(adminFIRTokens[idx]); // } // }); // console.log( // "List of tokens that caused failures: " + failedTokens // ); // } return true; }) ); } else { payload.topic = topicName; return admin .messaging() .send(payload) .then(function (response) { console.log("Notification sent successfully:", response); return true; }); } } catch (error) { console.log("Notification sent failed:", error); return false; } }); </code></pre> <br /><h3>回答1:</h3><br /><p>I think it's an issue of using a different payload structure.</p> <p>This is the old one (without iOS specific info):</p> <pre><code>var payload = { notification: { title: title, body: messageText, sound: "default", }, data: { messageID: messageID, messageTimestamp: messageTimestamp, }, }; </code></pre> <p>Whereas this is the new version (apns has iOS specific info)</p> <pre><code>var payload = { notification: { title: title, body: messageText, }, data: { messageID: messageID, messageTimestamp: messageTimestamp, }, apns: { payload: { aps: { sound: "default", }, }, }, }; </code></pre> <p>With the new structure, both <code>send</code> and <code>sendMulticast</code> are working properly. Which would fail to send or give errors like apns key is not supported in payload.</p> <p>The new function:</p> <pre><code>functions.database .ref("/discussionMessages/{autoId}/") .onCreate(async (snapshot, context) =&gt; { // console.log("Snapshot: ", snapshot); try { const groupsRef = admin.database().ref("people/groups"); const adminUsersRef = groupsRef.child("admin"); const filteredUsersRef = groupsRef.child("filtered"); const filteredUsersSnapshot = await filteredUsersRef.once("value"); const adminUsersSnapshot = await adminUsersRef.once("value"); var adminUsersFIRTokens = {}; var filteredUsersFIRTokens = {}; if (filteredUsersSnapshot.exists()) { filteredUsersFIRTokens = filteredUsersSnapshot.val(); } if (adminUsersSnapshot.exists()) { adminUsersFIRTokens = adminUsersSnapshot.val(); } // console.log( // "Admin and Filtered Users: ", // adminUsersFIRTokens, // " ", // filteredUsersFIRTokens // ); const topicName = "SpeechDrillDiscussions"; const message = snapshot.val(); // console.log("Received new message: ", message); const senderName = message.userName; const senderCountry = message.userCountryEmoji; const title = senderName + " " + senderCountry; const messageText = message.message; const messageTimestamp = message.messageTimestamp.toString(); const messageID = message.hasOwnProperty("messageID") ? message.messageID : undefined; const senderEmailId = message.userEmailAddress; const senderUserName = getUserNameFromEmail(senderEmailId); const isSenderFiltered = filteredUsersFIRTokens.hasOwnProperty( senderUserName ); console.log( "Will attempt to send notification for message with message id: ", messageID ); var payload = { notification: { title: title, body: messageText, }, data: { messageID: messageID, messageTimestamp: messageTimestamp, }, apns: { payload: { aps: { sound: "default", }, }, }, }; console.log("Is sender filtered? ", isSenderFiltered); if (isSenderFiltered) { adminFIRTokens = Object.values(adminUsersFIRTokens); console.log("Sending filtered notification with sendMulticast()"); payload.tokens = adminFIRTokens; //Needed for sendMulticast return admin .messaging() .sendMulticast(payload) .then((response) =&gt; { console.log( "Sent filtered message (using sendMulticast) notification: ", JSON.stringify(response) ); if (response.failureCount &gt; 0) { const failedTokens = []; response.responses.forEach((resp, idx) =&gt; { if (!resp.success) { failedTokens.push(adminFIRTokens[idx]); } }); console.log( "List of tokens that caused failures: " + failedTokens ); } return true; }); } else { console.log("Sending topic message with send()"); payload.topic = topicName; return admin .messaging() .send(payload) .then((response) =&gt; { console.log( "Sent topic message (using send) notification: ", JSON.stringify(response) ); return true; }); } } catch (error) { console.log("Notification sent failed:", error); return false; } }); </code></pre> <br /><br /><p>来源:<code>https://stackoverflow.com/questions/66075132/firebase-cloud-messaging-sendtodevice-works-properly-but-sendmulticast-fails-for</code></p></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">标签</div> <div class="field--items"> <div class="field--item"><a href="/tag/javascript" hreflang="zh-hans">javascript</a></div> <div class="field--item"><a href="/tag/firebase" hreflang="zh-hans">firebase</a></div> <div class="field--item"><a href="/tag/firebase-cloud-messaging" hreflang="zh-hans">firebase-cloud-messaging</a></div> <div class="field--item"><a href="/tag/apple-push-notifications" hreflang="zh-hans">apple-push-notifications</a></div> </div> </div> Tue, 16 Feb 2021 21:30:16 +0000 会有一股神秘感。 4109077 at https://www.e-learn.cn The provided registration token is not registered https://www.e-learn.cn/topic/4107680 <span>The provided registration token is not registered</span> <span><span lang="" about="/user/47" typeof="schema:Person" property="schema:name" datatype="">谁说胖子不能爱</span></span> <span>2021-02-16 20:39:19</span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><h3>问题</h3><br /><p>I'm trying to send push notification for iOS via Google cloud functions but it returns error that <code>The provided registration token is not registered</code>. But I've checked it by debugging my app and the FCM registration token is correct. After that I've tried to send push notification via Firebase console to single device by providing FCM token but it failed due to <code>Unregistered registration token</code>. How this happens because there is no issue with device FCM token?</p> <br /><h3>回答1:</h3><br /><p>I think it should be some careless mistake, you should make sure the things below:</p> <ol><li><p>The token is same with <code>-[FIRMessagingDelegate messaging:(FIRMessaging *)messaging didReceiveRegistrationToken:(NSString *)fcmToken]</code></p></li> <li><p>The <code>GoogleService-Info.plist</code> is downloaded from the same account with your Firebase push console.</p></li> <li><p>Updated to the latest Firebase SDK.</p></li> </ol><p>From the Google Firebase document are some description of your error <code>The provided registration token is not registered</code>.</p> <blockquote> <p>The provided registration token is not registered. A previously valid registration token can be unregistered for a variety of reasons, including:</p> <ul><li>The client app unregistered itself from FCM.</li> <li>The client app was automatically unregistered. This can happen if the user uninstalls the application or, on iOS, if the APNS Feedback Service reported the APNS token as invalid.</li> <li>The registration token expired. For example, Google might decide to refresh registration tokens or the APNS token may have expired for iOS devices.</li> <li>The client app was updated, but the new version is not configured to receive messages. For all these cases, remove this registration token and stop using it to send messages.</li> </ul></blockquote> <br /><br /><p>来源:<code>https://stackoverflow.com/questions/53009207/the-provided-registration-token-is-not-registered</code></p></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">标签</div> <div class="field--items"> <div class="field--item"><a href="/tag/ios" hreflang="zh-hans">ios</a></div> <div class="field--item"><a href="/tag/objective-c" hreflang="zh-hans">objective-c</a></div> <div class="field--item"><a href="/tag/firebase" hreflang="zh-hans">firebase</a></div> <div class="field--item"><a href="/tag/apple-push-notifications" hreflang="zh-hans">apple-push-notifications</a></div> <div class="field--item"><a href="/tag/firebase-cloud-messaging" hreflang="zh-hans">firebase-cloud-messaging</a></div> </div> </div> Tue, 16 Feb 2021 12:39:19 +0000 谁说胖子不能爱 4107680 at https://www.e-learn.cn xcodebuild Unsigned IPA - Missing Push Notification Entitlement (Work when signing directly the App in XCode) https://www.e-learn.cn/topic/4100729 <span>xcodebuild Unsigned IPA - Missing Push Notification Entitlement (Work when signing directly the App in XCode)</span> <span><span lang="" about="/user/153" typeof="schema:Person" property="schema:name" datatype="">风流意气都作罢</span></span> <span>2021-02-11 16:55:54</span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><h3>问题</h3><br /><p><strong>Context :</strong> <strong>XCODE 12.0.1</strong></p> <p>I'm using Push Notifications in Ionic. The configuration is OK. I added the Push Notification Capability in <code> Signing and Capabilities</code> . I build my app and I do <code>npx cap open ios</code>, and I do <code>Product &gt; Archive</code> and then it asks me to sign the app, I sign it, and OK. When I test Notifications, everything works well.</p> <p><strong>Problem :</strong> I need to generate <code>unsigned IPA with xcodebuild</code> for my client. He wants to sign it himself. But when I generate the <code>xcarchive</code> (unsigned IPA), then he tells me that after signing it, Notifications don't work, and he received this message when he tried to upload it on App Store :</p> <p><em>Missing Push Notification Entitlement - Your app appears to register with the Apple Push Notification service, but the app signature's entitlements do not include the 'aps-environment' entitlement. If your app uses the Apple Push Notification service, make sure your App ID is enabled for Push Notification in the Provisioning Portal, and resubmit after signing your app with a Distribution provisioning profile that includes the 'aps-environment' entitlement. Xcode does not automatically copy the aps-environment entitlement from provisioning profiles at build time. This behavior is intentional. To use this entitlement, either enable Push Notifications in the project editor's Capabilities pane, or manually add the entitlement to your entitlements file. For more information, see https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/HandlingRemoteNotifications.html#//apple_ref/doc/uid/TP40008194-CH6-SW1.</em></p> <p><strong>How I generate the xcarchive :</strong> <code>xcodebuild -workspace ios/App/App.xcworkspace -allowProvisioningUpdates -scheme App -sdk iphoneos -configuration Release -destination generic/platform=iOS -archivePath output/ios/App.xcarchive archive CODE_SIGNING_REQUIRED="NO" CODE_SIGNING_ALLOWED="NO" </code></p> <p>Signing manually or automatically don't solve the problem.</p> <p>Do you know why I get these errors when using xcodebuild (App Store Error, Push Notification Error) ?</p> <p>It looks a little bit like this problem : Missing Push Notification Entitlement: While Resigining ipa</p> <p>Do you know if i'm using xcodebuild the wrong way?</p> <p><strong>EDIT 1 :</strong> If I use this software https://github.com/maciekish/iReSign , to resign my xcarchive, it works... But clients won't agree to use some mystical softwares. I tried to compare my "normally XCODE signed" .ipa with the .ipa signed by this software. The only thing that differs is that there is an <code>entitlements.plist</code> file in the folder in the second case. And this file looks like this :</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;application-identifier&lt;/key&gt; &lt;string&gt;**TEAMID*.*APP-ID*&lt;/string&gt; &lt;key&gt;aps-environment&lt;/key&gt; &lt;string&gt;production&lt;/string&gt; &lt;key&gt;com.apple.developer.applesignin&lt;/key&gt; &lt;array&gt; &lt;string&gt;Default&lt;/string&gt; &lt;/array&gt; &lt;key&gt;com.apple.developer.team-identifier&lt;/key&gt; &lt;string&gt;**TEAM ID**&lt;/string&gt; &lt;key&gt;get-task-allow&lt;/key&gt; &lt;false/&gt; &lt;key&gt;keychain-access-groups&lt;/key&gt; &lt;array&gt; &lt;string&gt;TeamID.*&lt;/string&gt; &lt;string&gt;com.apple.token&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/plist&gt; </code></pre> <p>But I can find this in the "normally signed" ipa on the <code>embedded.mobileprovision</code> file, there is the <code>entitlements</code> section containing these lines... I can't understand why this tool made it work</p> <br /><h3>回答1:</h3><br /><p>I finally solved my problem. The command line I used for generating the xcarchive was wrong. I just had luck by testing this line without the "SIGNING" parameters :</p> <p><code>xcodebuild -workspace ios/App/App.xcworkspace -allowProvisioningUpdates -scheme App -sdk iphoneos -configuration Release -destination generic/platform=iOS -archivePath output/ios/App.xcarchive archive </code></p> <p>I found these parameters in some Medium page, and I don't know why I was using them.</p> <br /><br /><p>来源:<code>https://stackoverflow.com/questions/65687353/xcodebuild-unsigned-ipa-missing-push-notification-entitlement-work-when-signi</code></p></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">标签</div> <div class="field--items"> <div class="field--item"><a href="/tag/ios" hreflang="zh-hans">ios</a></div> <div class="field--item"><a href="/tag/xcode" hreflang="zh-hans">xcode</a></div> <div class="field--item"><a href="/tag/ionic-framework" hreflang="zh-hans">ionic-framework</a></div> <div class="field--item"><a href="/tag/firebase-cloud-messaging" hreflang="zh-hans">firebase-cloud-messaging</a></div> <div class="field--item"><a href="/tag/apple-push-notifications" hreflang="zh-hans">apple-push-notifications</a></div> </div> </div> Thu, 11 Feb 2021 08:55:54 +0000 风流意气都作罢 4100729 at https://www.e-learn.cn xcodebuild Unsigned IPA - Missing Push Notification Entitlement (Work when signing directly the App in XCode) https://www.e-learn.cn/topic/4100696 <span>xcodebuild Unsigned IPA - Missing Push Notification Entitlement (Work when signing directly the App in XCode)</span> <span><span lang="" about="/user/79" typeof="schema:Person" property="schema:name" datatype="">你离开我真会死。</span></span> <span>2021-02-11 16:54:58</span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><h3>问题</h3><br /><p><strong>Context :</strong> <strong>XCODE 12.0.1</strong></p> <p>I'm using Push Notifications in Ionic. The configuration is OK. I added the Push Notification Capability in <code> Signing and Capabilities</code> . I build my app and I do <code>npx cap open ios</code>, and I do <code>Product &gt; Archive</code> and then it asks me to sign the app, I sign it, and OK. When I test Notifications, everything works well.</p> <p><strong>Problem :</strong> I need to generate <code>unsigned IPA with xcodebuild</code> for my client. He wants to sign it himself. But when I generate the <code>xcarchive</code> (unsigned IPA), then he tells me that after signing it, Notifications don't work, and he received this message when he tried to upload it on App Store :</p> <p><em>Missing Push Notification Entitlement - Your app appears to register with the Apple Push Notification service, but the app signature's entitlements do not include the 'aps-environment' entitlement. If your app uses the Apple Push Notification service, make sure your App ID is enabled for Push Notification in the Provisioning Portal, and resubmit after signing your app with a Distribution provisioning profile that includes the 'aps-environment' entitlement. Xcode does not automatically copy the aps-environment entitlement from provisioning profiles at build time. This behavior is intentional. To use this entitlement, either enable Push Notifications in the project editor's Capabilities pane, or manually add the entitlement to your entitlements file. For more information, see https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/HandlingRemoteNotifications.html#//apple_ref/doc/uid/TP40008194-CH6-SW1.</em></p> <p><strong>How I generate the xcarchive :</strong> <code>xcodebuild -workspace ios/App/App.xcworkspace -allowProvisioningUpdates -scheme App -sdk iphoneos -configuration Release -destination generic/platform=iOS -archivePath output/ios/App.xcarchive archive CODE_SIGNING_REQUIRED="NO" CODE_SIGNING_ALLOWED="NO" </code></p> <p>Signing manually or automatically don't solve the problem.</p> <p>Do you know why I get these errors when using xcodebuild (App Store Error, Push Notification Error) ?</p> <p>It looks a little bit like this problem : Missing Push Notification Entitlement: While Resigining ipa</p> <p>Do you know if i'm using xcodebuild the wrong way?</p> <p><strong>EDIT 1 :</strong> If I use this software https://github.com/maciekish/iReSign , to resign my xcarchive, it works... But clients won't agree to use some mystical softwares. I tried to compare my "normally XCODE signed" .ipa with the .ipa signed by this software. The only thing that differs is that there is an <code>entitlements.plist</code> file in the folder in the second case. And this file looks like this :</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;application-identifier&lt;/key&gt; &lt;string&gt;**TEAMID*.*APP-ID*&lt;/string&gt; &lt;key&gt;aps-environment&lt;/key&gt; &lt;string&gt;production&lt;/string&gt; &lt;key&gt;com.apple.developer.applesignin&lt;/key&gt; &lt;array&gt; &lt;string&gt;Default&lt;/string&gt; &lt;/array&gt; &lt;key&gt;com.apple.developer.team-identifier&lt;/key&gt; &lt;string&gt;**TEAM ID**&lt;/string&gt; &lt;key&gt;get-task-allow&lt;/key&gt; &lt;false/&gt; &lt;key&gt;keychain-access-groups&lt;/key&gt; &lt;array&gt; &lt;string&gt;TeamID.*&lt;/string&gt; &lt;string&gt;com.apple.token&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/plist&gt; </code></pre> <p>But I can find this in the "normally signed" ipa on the <code>embedded.mobileprovision</code> file, there is the <code>entitlements</code> section containing these lines... I can't understand why this tool made it work</p> <br /><h3>回答1:</h3><br /><p>I finally solved my problem. The command line I used for generating the xcarchive was wrong. I just had luck by testing this line without the "SIGNING" parameters :</p> <p><code>xcodebuild -workspace ios/App/App.xcworkspace -allowProvisioningUpdates -scheme App -sdk iphoneos -configuration Release -destination generic/platform=iOS -archivePath output/ios/App.xcarchive archive </code></p> <p>I found these parameters in some Medium page, and I don't know why I was using them.</p> <br /><br /><p>来源:<code>https://stackoverflow.com/questions/65687353/xcodebuild-unsigned-ipa-missing-push-notification-entitlement-work-when-signi</code></p></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">标签</div> <div class="field--items"> <div class="field--item"><a href="/tag/ios" hreflang="zh-hans">ios</a></div> <div class="field--item"><a href="/tag/xcode" hreflang="zh-hans">xcode</a></div> <div class="field--item"><a href="/tag/ionic-framework" hreflang="zh-hans">ionic-framework</a></div> <div class="field--item"><a href="/tag/firebase-cloud-messaging" hreflang="zh-hans">firebase-cloud-messaging</a></div> <div class="field--item"><a href="/tag/apple-push-notifications" hreflang="zh-hans">apple-push-notifications</a></div> </div> </div> Thu, 11 Feb 2021 08:54:58 +0000 你离开我真会死。 4100696 at https://www.e-learn.cn APNS connection failure https://www.e-learn.cn/topic/4085704 <span>APNS connection failure</span> <span><span lang="" about="/user/199" typeof="schema:Person" property="schema:name" datatype="">北城以北</span></span> <span>2021-02-10 06:16:05</span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><h3>问题</h3><br /><p>Facing problem with APNS push services at client end. Server side is ok and it sends push to APNS properly as particular devices get stuck at some moment. Here are the server logs. </p> <p>VOIP Push: Push notification waiting by APNs gateway.</p> <p>VOIP Push: Push notification accepted by APNs gateway.</p> <p><strong>Here are the console logs of effected device</strong></p> <pre> default 09:16:30.203262 +0400 apsd Connection 1507: enabling TLS default 09:16:30.203409 +0400 apsd Connection 1507: starting, TC(0x0) default 09:16:30.203504 +0400 apsd [C1507 DBE7C1B4-DC94-4B2A-BD21-63661595E267 Hostname#45fde594:443 tcp, url hash: f51ce5f3, tls] start default 09:16:30.204664 +0400 apsd nw_connection_report_state_with_handler_on_nw_queue [C1507] reporting state preparing default 09:16:30.205294 +0400 mDNSResponder [R80990] DNSServiceCreateConnection START PID[99](apsd) default 09:16:30.205592 +0400 mDNSResponder [R80991] DNSServiceGetAddrInfo(C000D000, 0, 0, ) START PID[99](apsd) default 09:16:30.206815 +0400 apsd Task . setting up Connection 1507 default 09:16:30.208190 +0400 apsd nw_connection_report_state_with_handler_on_nw_queue [C1507] reporting state failed error DNS Error: NoSuchRecord error 09:16:30.208282 +0400 apsd Connection 1507: received failure notification error 09:16:30.208361 +0400 apsd Connection 1507: failed to connect 12:8, reason -1 error 09:16:30.208448 +0400 apsd Connection 1507: encountered error(12:8) default 09:16:30.208522 +0400 apsd Connection 1507: is being canceled default 09:16:30.208600 +0400 mDNSResponder [R80990] DNSServiceCreateConnection STOP PID[99](apsd) default 09:16:30.208678 +0400 mDNSResponder [R80991] DNSServiceGetAddrInfo() STOP PID[99](apsd) default 09:16:30.208848 +0400 apsd Connection 1507: summary for unused connection {protocol="(null)", domain_lookup_duration_ms=0, connect_duration_ms=0, secure_connection_duration_ms=0, idle_duration_ms=0} default 09:16:30.208932 +0400 apsd [C1507 DBE7C1B4-DC94-4B2A-BD21-63661595E267 Hostname#45fde594:443 tcp, url hash: f51ce5f3, tls] cancel default 09:16:30.209009 +0400 apsd [C1507 Hostname#45fde594:443 tcp, url hash: f51ce5f3, tls] cancelled default 09:16:30.209091 +0400 apsd 0.000s [C1507 29735B49-F0FB-40A5-A092-F15E19D8B4B0 Hostname#45fde594:443 resolver path=satisfied (Path is satisfied), interface: en0, ipv4, dns] path:start default 09:16:30.209174 +0400 apsd 0.000s [C1507 29735B49-F0FB-40A5-A092-F15E19D8B4B0 Hostname#45fde594:443 resolver path=satisfied (Path is satisfied), interface: en0, ipv4, dns] path:satisfied default 09:16:30.209260 +0400 apsd 0.001s [C1507 29735B49-F0FB-40A5-A092-F15E19D8B4B0 Hostname#45fde594:443 resolver path=satisfied (Path is satisfied), interface: en0, ipv4, dns] resolver:start_dns default 09:16:30.209341 +0400 apsd 0.003s [C1507 29735B49-F0FB-40A5-A092-F15E19D8B4B0 Hostname#45fde594:443 resolver path=satisfied (Path is satisfied), interface: en0, ipv4, dns] path:trigger default 09:16:30.209427 +0400 apsd 0.004s [C1507 29735B49-F0FB-40A5-A092-F15E19D8B4B0 Hostname#45fde594:443 resolver path=satisfied (Path is satisfied), interface: en0, ipv4, dns] resolver:receive_dns DNS Error: NoSuchRecord default 09:16:30.209509 +0400 apsd 0.005s [C1507] path:cancel default 09:16:30.209821 +0400 apsd nw_connection_report_state_with_handler_on_nw_queue [C1507] reporting state cancelled error DNS Error: NoSuchRecord default 09:16:30.209998 +0400 apsd Task . can retry(N) with reason(2) for error [12:8] default 09:16:30.211029 +0400 apsd _CFNetworkIsConnectedToInternet returning 1, flagsValid: 1, flags: 0x2 error 09:16:30.211367 +0400 apsd Task . HTTP load failed, 0/0 bytes (error code: -1003 [12:8]) default 09:16:30.211510 +0400 apsd Task . summary for task failure {transaction_duration_ms=9, response_status=0, cache_hit=0} default 09:16:30.211758 +0400 apsd removing all entries config 0x100f3bfc0 default 09:16:30.212028 +0400 apsd removing all entries config 0x100f3bfc0 default 09:16:30.212151 +0400 apsd Calling configuration completion blocks, expiration date Thu Dec 12 09:31:30 2019 error: Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={NSUnderlyingError=0x102121bc0 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 UserInfo={_kCFStreamErrorCodeKey=8, _kCFStreamErrorDomainKey=12}}, NSErrorFailingURLStringKey=, NSErrorFailingURLKey=, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSLocalizedDescription=A server with the specified hostname could not be found.} default 09:16:30.212393 +0400 apsd APSTCPStream got config -- opened? YES default 09:16:30.212593 +0400 apsd Failed to load config bag: Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={NSUnderlyingError=0x102121bc0 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 UserInfo={_kCFStreamErrorCodeKey=8, _kCFStreamErrorDomainKey=12}}, NSErrorFailingURLStringKey=, NSErrorFailingURLKey=, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSLocalizedDescription=A server with the specified hostname could not be found.} default 09:16:30.212700 +0400 apsd Using DNS TXT record lookup to determine load balance count for development default 09:16:30.212786 +0400 apsd performing DNS lookup for default 09:16:30.213329 +0400 mDNSResponder [R80992] DNSServiceQueryRecord(0, 0, , TXT) START PID[99](apsd) default 09:16:30.214890 +0400 apsd Closing with environment [development] default 09:16:30.215049 +0400 mDNSResponder [R80992] DNSServiceQueryRecord(0, 0, , TXT) STOP PID[99](apsd) default 09:16:30.215730 +0400 apsd : Stream error occurred for onInterface NonCellular: Error Domain=APSErrorDomain Code=1 UserInfo={NSLocalizedDescription=} default 09:16:30.215855 +0400 apsd : Calling into AWD for ConnectionDisconnected (withError) default 09:16:30.217664 +0400 apsd : AWD for ConnectionDisconnected (withError) finished default 09:16:30.217741 +0400 apsd _disconnectStream for interface: NonCellular default 09:16:30.217821 +0400 apsd asked to change isSuspended=NO to NO default 09:16:30.217896 +0400 apsd Closing with environment [development] default 09:16:30.217972 +0400 apsd : enableNonCellularConnections changed to NO default 09:16:30.218458 +0400 apsd Connection closed development NonCellular default 09:16:30.218633 +0400 apsd canUseProxy? NO deviceConfiguration NO isNearby NO default 09:16:30.218706 +0400 apsd received courierConnectionStatusDidChange from . default 09:16:30.218877 +0400 apsd canUseProxy? NO deviceConfiguration NO isNearby NO default 09:16:30.219036 +0400 apsd canUseProxy? NO deviceConfiguration NO isNearby NO default 09:16:30.219115 +0400 apsd updating network guidance isConnected? YES default 09:16:30.219271 +0400 apsd canUseProxy? NO deviceConfiguration NO isNearby NO default 09:16:30.219404 +0400 apsd canUseProxy? NO deviceConfiguration NO isNearby NO default 09:16:30.219532 +0400 apsd : Disconnected in response to connection failure on interface NonCellular. (Consecutive failures: 24) isConnected NO onInterface None shouldUseDualChannel YES. Connected on 0 interfaces. default 09:16:30.219596 +0400 apsd Created metric container: 0x130002 succeeded? YES default 09:16:30.220000 +0400 apsd Connection method alternative changed to 1 default 09:16:30.220094 +0400 apsd Advising client to enter reconnect mode in response to a connection failure since currently in reconnect mode default 09:16:30.220166 +0400 apsd Resuming push keep alive timer in normal mode with action PCActionShrinkPushKeepAliveInterval default 09:16:30.220230 +0400 apsd Last timer interruption was early: []. Expected fire time was []. default 09:16:30.220300 +0400 apsd WiFi growth algorithm-IPv4: received action PCActionShrinkPushKeepAliveInterval while in stage Backoff default 09:16:30.220366 +0400 apsd {keep alive interval = 600, state = Backoff, next recalibration date = (null)}: adjustGrowthAlgorithmMode. {lastMode: Defaults, currentMode: Defaults} default 09:16:30.220431 +0400 apsd created default 09:16:30.220506 +0400 apsd Started simple timer with fire date [2019-12-12 09:27:05 +0400] default 09:16:30.220713 +0400 apsd created preventSleepTimer and fireTimer on queue default 09:16:30.221159 +0400 apsd Enabling power monitoring for - 6 timers default 09:16:30.221275 +0400 apsd Existing wake at (null) re-scheduling to 2019-12-12 09:26:50 +0400 with leeway of 0 default 09:16:30.221551 +0400 apsd Request to schedule wake 1 date 2019-12-12 09:26:50 +0400 leeway 0 service identifier com.apple.apsd(sandbox.push.apple.com)-NonCellular unique identifier default 09:16:30.221693 +0400 apsd calculating _earlyFireDate. powerStateDetectionSupported = NO = (detectionSupported(YES) &amp;&amp; (wwanIsUp(NO) || ! internetReachable(YES))) default 09:16:30.221779 +0400 apsd Last system wake date (2019-12-12 09:11:10 +0400) was longer than half of the timer duration, so setting minimum fire date to fire date. default 09:16:30.221867 +0400 apsd Device is plugged in, overriding earlyFireProportion to be 1.0 default 09:16:30.222061 +0400 apsd Calculated minimum fire date [2019-12-12 09:27:05 +0400] (100%) with fire date [2019-12-12 09:27:05 +0400], start date [2019-12-12 09:16:30 +0400], minimum early fire proportion 0, power state detection supported: no, in high power state: no, early fire constant interval 0.000000 default 09:16:30.222194 +0400 apsd PCConnectionManager was stopped by client default 09:16:30.222261 +0400 apsd Invalidating timer default 09:16:30.222322 +0400 apsd Invalidating simple timer default 09:16:30.222699 +0400 apsd Scheduling a wake for date leeway 0 wake identifier default 09:16:30.224084 +0400 apsd Wake schedule for ''() completed for [] (took 0.002 seconds; result code 0) default 09:16:30.225070 +0400 apsd Canceling system wake for simpletimer [2019-12-12 09:26:50 +0400] default 09:16:30.225159 +0400 apsd Request to schedule wake 0 date 2019-12-12 09:26:50 +0400 leeway 0 service identifier com.apple.apsd(sandbox.push.apple.com)-NonCellular unique identifier default 09:16:30.225385 +0400 apsd APSCourier adjusting connection. Connected on 0 interfaces. Current link quality: default 09:16:30.225498 +0400 apsd Disabling power monitoring for - 5 timers default 09:16:30.225646 +0400 apsd canUseProxy? NO deviceConfiguration NO isNearby NO default 09:16:30.225720 +0400 apsd calling _connectStream with interface preference NonCellular default 09:16:30.225800 +0400 apsd attempting to _connectStream. currently onInterface None consecutiveFailures 24 preference NonCellular shouldUseDualChannel YES. Connected on 0 interfaces. default 09:16:30.225869 +0400 apsd _getClientIdentity: already had identity: default 09:16:30.225929 +0400 apsd _connectStream - Stopping the connectionManager on our attemptInterface NonCellular default 09:16:30.225990 +0400 apsd PCConnectionManager was stopped by client default 09:16:30.226047 +0400 apsd : isWWANUsable NO isWiFiUsable YES onInterface NonCellular default 09:16:30.226112 +0400 apsd : enableNonCellularConnections changed to YES default 09:16:30.226165 +0400 apsd Opening stream on interface NonCellular default 09:16:30.226214 +0400 apsd Cancelling scheduled wake for wake identifier default 09:16:30.226560 +0400 apsd Opening with environment [development] default 09:16:30.226659 +0400 apsd loadConfigurationForEnvironment: development interface: NonCellular default 09:16:30.227135 +0400 apsd Task . resuming, QOS(0x15) Voucher (null) default 09:16:30.227218 +0400 apsd Wake cancel for ''() completed for [] (took 0.002 seconds; result code 0) default 09:16:30.227330 +0400 apsd Opening stream onInterface: NonCellular, development default 09:16:30.227496 +0400 apsd : Connecting courier stream using configuration bag at and port TCP 443 default 09:16:30.227752 +0400 apsd Closing with environment [development] default 09:16:30.227837 +0400 apsd Task . {strength 0, tls 4, ct 0, sub 0, sig 1, ciphers 0, bundle 1, builtin 0} default 09:16:30.228815 +0400 apsd Connection 1508: enabling TLS default 09:16:30.228964 +0400 apsd Connection 1508: starting, TC(0x0) default 09:16:30.229353 +0400 apsd [C1508 F67A490F-3214-41AE-AC96-0CD52FC88397 Hostname#45fde594:443 tcp, url hash: f51ce5f3, tls] start default 09:16:30.230101 +0400 symptomsd NBSM: received symptom that apsd is failing on WiFi in state: idle default 09:16:30.231119 +0400 apsd nw_connection_report_state_with_handler_on_nw_queue [C1508] reporting state preparing default 09:16:30.231365 +0400 mDNSResponder [R80993] DNSServiceCreateConnection START PID[99](apsd) default 09:16:30.231620 +0400 mDNSResponder [R80994] DNSServiceGetAddrInfo(C000D000, 0, 0, ) START PID[99](apsd) default 09:16:30.232216 +0400 apsd Task . setting up Connection 1508 default 09:16:30.233279 +0400 mDNSResponder [R80993] DNSServiceCreateConnection STOP PID[99](apsd) default 09:16:30.233462 +0400 mDNSResponder [R80994] DNSServiceGetAddrInfo() STOP PID[99](apsd) default 09:16:30.233983 +0400 apsd nw_connection_report_state_with_handler_on_nw_queue [C1508] reporting state failed error DNS Error: NoSuchRecord error 09:16:30.234066 +0400 apsd Connection 1508: received failure notification error 09:16:30.234124 +0400 apsd Connection 1508: failed to connect 12:8, reason -1 error 09:16:30.234179 +0400 apsd Connection 1508: encountered error(12:8) default 09:16:30.234443 +0400 apsd Connection 1508: is being canceled default 09:16:30.234525 +0400 apsd Connection 1508: summary for unused connection {protocol="(null)", domain_lookup_duration_ms=0, connect_duration_ms=0, secure_connection_duration_ms=0, idle_duration_ms=0} default 09:16:30.234584 +0400 apsd [C1508 F67A490F-3214-41AE-AC96-0CD52FC88397 Hostname#45fde594:443 tcp, url hash: f51ce5f3, tls] cancel default 09:16:30.234681 +0400 apsd [C1508 Hostname#45fde594:443 tcp, url hash: f51ce5f3, tls] cancelled </pre> <br /><h3>回答1:</h3><br /><p>Encountered a similar situation where no push was arriving, and dns errors were logged when querying sandox.push.apple.com</p> <p>A fix was to change the phones to use an alternative DNS like Google (8.8.8.8) or Cloudflare (1.1.1.1) in the wifi settings.</p> <br /><br /><p>来源:<code>https://stackoverflow.com/questions/59298620/apns-connection-failure</code></p></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">标签</div> <div class="field--items"> <div class="field--item"><a href="/tag/ios" hreflang="zh-hans">ios</a></div> <div class="field--item"><a href="/tag/swift" hreflang="zh-hans">swift</a></div> <div class="field--item"><a href="/tag/push-notification" hreflang="zh-hans">push-notification</a></div> <div class="field--item"><a href="/tag/apple-push-notifications" hreflang="zh-hans">apple-push-notifications</a></div> </div> </div> Tue, 09 Feb 2021 22:16:05 +0000 北城以北 4085704 at https://www.e-learn.cn