Regarding the problem of not receiving the iOS Subscription notification

Ask a question here. It may wind up in the FAQ on the plugin homepage.
crSudo
Posts: 10
Joined: Thu Jul 08, 2021 10:52 am

Regarding the problem of not receiving the iOS Subscription notification

Post by crSudo »

※I am Japanese. I am translating using Google Translate. Please let us know if you have any misunderstandings.

We are verifying Subscription using Example9_Subscriptions.
I'm checking the notification using one device and [Cloudkit dashboard], but I haven't received the notification.

■ Operation procedure
①. Install and run the app on your iPhone.
②. Select Subscriptions.
③. Exit the app.
④. Go to the CloudKit Dashboard.
⑤. Record: Change the value of SaveNo of SubscriptionRecordType and save.

I expected the log of [remote notification handler called] or [Recieved notification:] to be output, but it was not output.

■ Program modification contents
◇ Forum content correction ① [viewtopic.php?f=4&t=25&p=83&hilit=notification#p83]
I made the following settings with reference to the site.
-Import Unity Package [Mobile Notifications] 1.4.2
-Added notificationInfo.ShouldSendContentAvailable = true;

◇ Forum content correction ② [viewtopic.php?f=3&t=29]
I modified /HovelHouseiCloud/CloudKit/Editor/BuildProcess.cs by referring to the site.

◇ Sample source correction
Example9_Subscriptions.cs
I wanted to change the data in [Cloudkit Dashboard], so I added a parameter.

CKRecord clsCKRecord = new CKRecord (recordType);
clsCKRecord.SetInt (0, "SaveNo");
database.SaveRecord (clsCKRecord, (record, error2) => {

■ [Mobile Notifications] Settings
・Request Authorization on App Launch: OFF
* Turned off for Apple Arcade support.
・Enable Push Notification: ON
・ Register for Push Notification on App Launch: OFF
・Remote Notification Foreground Presentation Options: ALL
・Enable Release Environment for APNS: OFF
・Include CoreLocation Framwork: OFF

■Development environment
◇Unity 2020.3.17f1 (64-bit)
・[Mobile Notifications] 1.4.2

◇XCode 13.0

◇HovelHouseiCloud 1.1.9

Best Regards

admin
Site Admin
Posts: 49
Joined: Thu Mar 19, 2020 8:52 pm

Re: Regarding the problem of not receiving the iOS Subscription notification

Post by admin »

Thank you for the report.

Notifications support was added using a technique known as 'Method Swizzling' where we override the default implementation of an application method. Method swizzling can result in unpredictable behavior if multiple plugins or sources attempt to override the same methods.

The unity notifications package may be interfering with the correct operation of the plugin. We will re-test the behavior of the subscription support and its interaction with the unity notifications plugin and reply back when we have more information about it.

crSudo
Posts: 10
Joined: Thu Jul 08, 2021 10:52 am

Re: Regarding the problem of not receiving the iOS Subscription notification

Post by crSudo »

Thank you for your reply.

We are looking forward to hearing from you.

Best Regards

crSudo
Posts: 10
Joined: Thu Jul 08, 2021 10:52 am

Re: Regarding the problem of not receiving the iOS Subscription notification

Post by crSudo »

Has there been any progress since then?

Best Regards

admin
Site Admin
Posts: 49
Joined: Thu Mar 19, 2020 8:52 pm

Re: Regarding the problem of not receiving the iOS Subscription notification

Post by admin »

Very sorry for the wait but we've been very busy with other apple compliance work. Still looking at the issue. I know that the subscriptions are working for some users so it is likely a configuration or environment issue. Hoping to have something for you by next week. One question for you, have you followed the steps posted here: http://hovelhouse.com/tutorial_subscriptions.html ?

admin
Site Admin
Posts: 49
Joined: Thu Mar 19, 2020 8:52 pm

Re: Regarding the problem of not receiving the iOS Subscription notification

Post by admin »

Hi CrStudio,

I re-tested subscriptions and notifications with your configuration but I was unable to reproduce the issue.
* XCode 13.0
* HovelHouseCloudKit 1.1.9
* Unity 2020.3.17f1

I have verified that there is no conflict between this unity version and the plugin with regard to notifications.

Could you verify the following for me:
* You have created, downloaded, and installed an apple push notification services (APS) certificate from the apple developer portal
* You have enabled the push notification service in your apps provisioning profile
* The push notification capability and the background mode 'remote notifications' are added to your Xcode project
* You have enabled the notification permission for the application in iOS settings

The next time you test can you provide me with the log of your application so that I can verify you receive a push notification token.

For your reference, you may find the following guide from apple helpful: https://developer.apple.com/library/arc ... index.html
It outlines a few scenarios in which you should not expect to receive CloudKit notifications.

Thank you,
-HovelHouse

crSudo
Posts: 10
Joined: Thu Jul 08, 2021 10:52 am

Re: Regarding the problem of not receiving the iOS Subscription notification

Post by crSudo »

Apologies for the delay.

■About [http://hovelhouse.com/tutorial_subscriptions.html]
◇[identifiers]-[Push Notifications'].
It is set as follows.

Development SSL Certificate
Name: Apple Development iOS Push Services: com.ofcr.cloudkitexsample
Type: APNs Development iOS
Expires: 2022/10/19

◇unity project. plugin's build settings 'Enable CloudKit Notifications'
It is checked.

■About the log
We will send you the log.zip file.

◇log_cloudkit_UnityEditor.txt
The following is the log of running Example9_Subscriptions.cs.

◇log_cloudkit_Recieved.txt
This is the log of the iOS device when you drop the app, change the Fields in the CloudKit Dashboard, and execute Save.
If you search for [com.ofcr.cloudkitexsample], you may find something.

Best Regards
Attachments
log20211202.zip
(19.29 KiB) Downloaded 140 times

crSudo
Posts: 10
Joined: Thu Jul 08, 2021 10:52 am

Re: Regarding the problem of not receiving the iOS Subscription notification

Post by crSudo »

About the test method

I'm testing as follows, is there any mistake in recognition?

1. Connect your iPhone to your Mac.
2. launch the project output from Unity in XCode.
3. Play and launch the application.
4. Press [Subscriptions] in the menu and run Example9_Subscriptions.cs.
5. Launch the Task Manager and delete the app.
6. Launch the Mac Tools [Console].
7. From the CloudDashboard, change the [SaveNo].
8. Check the console and see if the logs such as [remote notification handler called] or [Recieved notification:] are output.

Note: In Example9_Subscriptions.cs, the following process has been added.

OnSubscriptionsFetched()
{
 Debug.Log("No subscriptions detected - making a new one");

 CKRecord clsCKRecord = new CKRecord( recordType );
 clsCKRecord.SetInt( 0, "SaveNo");
 database.SaveRecord( clsCKRecord, (record, error2) => {
}

Best Regards

admin
Site Admin
Posts: 49
Joined: Thu Mar 19, 2020 8:52 pm

Re: Regarding the problem of not receiving the iOS Subscription notification

Post by admin »

Thank you for your very detailed steps. I believe there may be an issue.

The apple technical document "Debugging issues with CloudKit subscriptions here https://developer.apple.com/library/arc ... index.html" indicates that you should not expect to receive notifications while the app is force quit. As I understand it, quitting the application is step 5 for you.
CloudKit notifications won’t be delivered to your app if the notifications' shouldSendContentAvailable property is true and meanwhile your app is force quit. On iOS, users can force quit an app by double-tapping the home button and swiping it away from the multitasking UI.
At your convenience, can you re-run your test method and skip test 5? You should receive a notification for record change from the application now.

Example_9 demonstrates how to use silent notifications. I should be more explicit about that. These notifications are delivered in the background to a running app and do not generate notification messages in the user's notification center.

Are you attempting to implement regular notifications that can 'badge' the app icon, show in the notification center, or play sounds or messages?

crSudo
Posts: 10
Joined: Thu Jul 08, 2021 10:52 am

Re: Regarding the problem of not receiving the iOS Subscription notification

Post by crSudo »

Thank you for your reply.

■About skipping [test 5].
I skipped [test 5] to check the operation, but I still could not check the log written in [ICloudNotifications.SetRemoteNotificationHandler()].

I added [NotificationInfo.ShouldBadge = true] to [CreateSubscription()] in [Example9_Subscriptions.cs], and I was able to confirm that the batch was added to the icon.

Also, when I added the log output code to didReceiveRemoteNotification() in the Xcode project [/ios/Classes/UnityAppController.mm] output by UnityBuild, it was displayed correctly.

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
NSLog(@"----Test didReceiveRemoteNotification.fetchCompletionHandler");

The notifications seem to be reaching the app correctly, but it seems that ICloudNotifications.SetRemoteNotificationHandler() in [Example9_Subscriptions.cs] is not being executed.


■Are you attempting to implement regular notifications that can 'badge' the app icon, show in the notification center, or play sounds or messages?
No, we just want to add a process to update the local save after receiving a silent notification per Apple Arcade guidelines.

Best Regards

Post Reply