Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Occurrence circles #674

Closed
majidsaleem105 opened this issue Oct 26, 2022 · 29 comments
Closed

Occurrence circles #674

majidsaleem105 opened this issue Oct 26, 2022 · 29 comments

Comments

@majidsaleem105
Copy link

Hi @gavirawson-apple,

We are facing a very strange issue regarding occurrence circles (scheduling events). Sometimes the occurrence circles do not display in the app and it's not happening to all users and all devices. Some of our users are experiencing this issue and it started happening a few days ago.

We've tested on the following real devices and we haven't experienced this issue:

  • iPhone XS (iOS 16.1)
  • iPhone 11 Pro Max (iOS 16.1)
  • iPhone 12 (iOS 15.7)
  • iPhone 12 Pro Max (iOS 16.0.3)
  • iPhone 13 Pro Max (iOS 15.7)

But the people who are experiencing this issue are using:

  • iPhone 12 Pro Max (iOS 16.1)
  • iPhone 13 (iOS 16.1)

Please see the attached screenshot:
circles-issue

Do you've any clue why it is happening to some of the users?

Kind Regards,

  • Majid S.
@gavirawson-apple
Copy link
Collaborator

Very strange! Are you able to reproduce the issue and print out the event that's displayed in the view? I wonder if there are no events found for those particular tasks.

If the events are retrieved properly, can you share as much information as possible to help me reproduce the issue? That way I can track down what's happening.

It also seems like these might be custom views, sharing the view synchronizer implementation will be helpful here.

@majidsaleem105
Copy link
Author

Thanks, @gavirawson-apple for your kind response.

We were able to identify the issue but are not able to identify the reason yet. It happens when there is only one scheduled event for the day of activity. But it appears the circles if we change it from 1 to 2 or 3 occurrences.

Unfortunately, I don't have access to the device that is showing this issue. I cannot print an output of the event. Can you please advise an alternate way to debug the issue on that device when I don't have access to it?

I used the following statement to schedule a single occurrence event.
let dailySchedule = OCKSchedule.dailyAtTime(hour: 8, minutes: 0, start: thisMorning, end: nil, text: nil)

I also tried the following statement for scheduling a single occurrence event but it also didn't work:
let dailySchedule = OCKScheduleElement(start: thisMorning, end: nil, interval: DateComponents(day: 2))

This doesn't work for some people but works for others. The people are living in different TimeZones, do you think it's because of the different TimeZones?

I'll create a private gist to share my custom views and synchronizer implementation with you.

Thank You!

  • Majid S.

@gavirawson-apple
Copy link
Collaborator

It's hard to say whether this is a time zone or a visual issue. There are complexities that occur when a user moves across time zones - a scheduled task is typically fixed to the time zone in which it was scheduled. The exception is an all-day task. But if your users are not moving across time zones, I suspect time zones is lower on the list of potential culprits, but definitely still a possibility. It sounds like the problem is only occurring when there is one event in the card, which leads me to suspect this might be a visual issue.

If you're able to share that gist with me, I can use the scheduling logic you've shared above along with the custom view synchronizer logic and try to reproduce the issue on my end. With a reproducible case and some breakpoints, we can better lock down the underlying issue.

@majidsaleem105
Copy link
Author

Hi @gavirawson-apple,

The user isn't moving between the time zones. I and the user lives in different time zones so, when I log into the app using his credentials, it loads all the content correctly at my end. I used different devices and it worked just fine for me on all different devices. But when the user tries on his side, he faces this strange issue on his side.

You can see the gist files here: https://gist.github.com/majidsaleem105/f2ce4d348eac3e79748a780a03bdc12a.
I added the Custom View, Synchronizer Implementation Class, and DailyPageViewController function.

Please let me know if you need any additional information from me.

Thank You!

  • Majid S.

@majidsaleem105
Copy link
Author

Hi @gavirawson-apple,

I've shared the gist files. Did you get a chance to look at them?
Any suggestions?

Kind Regards,

  • Majid S.

@majidsaleem105
Copy link
Author

Hi @gavirawson-apple,

Any suggestions? We're stuck because of this strange issue.

Thanks,

  • Majid S.

@gavirawson-apple
Copy link
Collaborator

Apologies for the delay! Looking through the code for the view synchronizer, there might be some business logic could be causing issues. Mainly the logic that fetches events, or the logic that dispatches to the main queue. We typically put lightweight logic in that updateView method that maps data to the view, since the method can get called often.

Let's test that hunch - can you try using the plain OCKGridTaskViewSynchronizer and check to see if the issue is still present? That will help us break this down into a smaller working example.

@majidsaleem105
Copy link
Author

Hi @gavirawson-apple,

I followed your instructions and removed all my custom logic from the OCKGridTaskViewSynchronizer but the issue is still appeared on the user's device.

Here is my OCKGridTaskViewSynchronizer class: https://gist.github.com/majidsaleem105/8e28e7afa6588c3cdec933d321a59660

It is omitting Single Event activities from the Home screen.

As I don't have access to the devices, is there a way that I can write/fetch error logs for debugging purpses from the Device?

Thank You.

Best Regards,

  • Majid S.

@majidsaleem105
Copy link
Author

Hi @gavirawson-apple,
any suggestions.

Best Regards,

  • Majid S.

@gavirawson-apple
Copy link
Collaborator

Ah okay, sounds like my hunch was wrong.

I'm having trouble reproducing this issue with the gist here, because I'm missing a lot of the contextual code needed to get this compiling and running on my end. Are you able to demonstrate this issue in a smaller reproducable example?

Can you also share the CareKit scheduling code for the task that's disappearing? Is it ever updated or deleted throughout the app lifecycle?

@gavirawson-apple
Copy link
Collaborator

I might also try implementing the method dailyPageViewController(dailyPageViewController:prepare:for:) with the code we have in our sample app. It looks like there's a lot of custom grouping and sorting in the custom implementation here. If that fixes the issue, we know what code we need to fix. If it doesn't, we can keep searching for the underlying issue elsewhere.

@majidsaleem105
Copy link
Author

Hi @gavirawson-apple,

Here is the gist for CareKit scheduling. We group activities for users' ease to find them quickly. Initially, I used sample app to start building our app.

The app was working fine a few weeks ago for everyone. But we experienced this issue after taking iOS 16 updates and build generated on XCode 14.0. It is not happening to all users on all devices but for a few users.

I also saw warning while upload the app to the TF/Store. An issue is already open for this issue.

As I don't have access to the devices, is there a way that I can write/fetch error logs for debugging purpses from the Device?

Thank you so much for your help.

Best Regards,
Majid S.

@gavirawson-apple
Copy link
Collaborator

Thanks for the gist! Looks like there are a few tasks scheduled in here, but only a subset of them have multiple events on a single day. Is my reading correct - the task in question is scheduled either on line 126 or 139? Any idea which one it is exactly?

But we experienced this issue after taking iOS 16 updates and build generated on XCode 14.0.

Thank you for that info! I'll make sure to use that configuration in my attempts to reproduce the issue.

I also saw warning while upload the app to the TF/Store.

Is that issue a blocker for you uploading to the App Store? Or is it just a warning? My understanding is that it is just a warning, and the underlying issue is not in CareKit.

As I don't have access to the devices, is there a way that I can write/fetch error logs for debugging purpses from the Device?

It will depend on a few factors, including how the app is deployed. This link should contain all of the info you need!

@majidsaleem105
Copy link
Author

majidsaleem105 commented Dec 1, 2022

Hi @gavirawson-apple,

Thanks for looking at the gist file. The lines 126 or 139 were not for the single task. I've updated the gist file, the else block from line 113 - 120 is for the single event.

Is that issue a blocker for you uploading to the App Store? Or is it just a warning? My understanding is that it is just a warning, and the underlying issue is not in CareKit.

Yes, It is just a warning. It doesn't block us to publish the app to the store.

I tried to create a very basic version to identify this issue. I took the stable versions of the CareKit and ResearchKit frameworks. But when I try to build the app, it gives error build: Undefined symbol: _OBJC_CLASS_$_ORKTaskViewController under the Carekit.

Any idea, why I'm getting this error?

Best Regards,
Majid S.

@majidsaleem105
Copy link
Author

Hi @gavirawson-apple,

I got some more information for you. It might help you to identify the issue. I'm using the following code line to schedule the Single Event.

OCKSchedule.dailyAtTime(hour: 8, minutes: 0, start: Date(), end: nil, text: "Push Up")

I got the scheduled activity information from the device that doesn't display the circle. Please see the attached screenshot:
schedule-element-info

Do you see any problem with this information?

Thanks,
Best Regards,

  • Majid S.

@gavirawson-apple
Copy link
Collaborator

Thanks for the additional info. Unfortunately, I'm still not able to reproduce the issue you're seeing. I feel like I'm still missing the key piece here. Were you able to reproduce the issue in a small example project to send me?

In the attempt I've put together, I first seed the store with what I think is the same task information you have above:

func seed() async throws {

    // Trying to match the start date you have in the example above
    let startDate = Calendar.current.date(
        bySettingHour: 5,
        minute: 0,
        second: 0,
        of: Date()
    )!

    let schedule = OCKSchedule.dailyAtTime(
        hour: 8,
        minutes: 0,
        start: startDate,
        end: nil,
        text: "Push Up"
    )

    let task = OCKTask(
        id: "pushups",
        title: "Pushups",
        carePlanUUID: nil,
        schedule: schedule
    )

    _ = try await storage.addTask(task)
}

I then display the task using this custom view controller:

class CareViewController: OCKDailyPageViewController {

    override func dailyPageViewController(
        _ dailyPageViewController: OCKDailyPageViewController,
        prepare listViewController: OCKListViewController,
        for date: Date
    ) {

        let taskViewController = OCKGridTaskViewController(
            taskID: "pushups",
            eventQuery: OCKEventQuery(for: date),
            storeManager: storeManager
        )

        listViewController.appendViewController(taskViewController, animated: false)
    }
}

When I run the app, I see the correct occurrence circle:

What am I missing here?

@majidsaleem105
Copy link
Author

Hi @gavirawson-apple,

I'm also doing the same. I schedule the event, save into the store first and then I fetch it from the store to display it. But it doesn't work on some of the devices.

I created the simple app version from the Sample app, but the issue appeared on that device with it.
Please see the attached video:

sample.app.mp4

The following activities are scheduled for the Single Event:

  • Kegel Exercises
  • Track your nausea (from the Optional section)

As I explained earlier that it doesn't happen to every device but on some devices. You can see in the attached video that the Sample app also doesn't work on that device.

Do you think it's an issue on the device side?
If so, how we can get it fixed on these devices?

Thank You.
Best Regards,

  • Majid S.

@gavirawson-apple
Copy link
Collaborator

Unfortunately I'm not able to reproduce the issue even when I test this out on an iPhone 13 running iOS 16.1. I'm sure there's some piece I'm missing that you have in your own app. If you can, please try reproducing the issue in a new project that you can send to me. That way I'll have the full context here, and we can lock down what's causing the issue.

@gavirawson-apple
Copy link
Collaborator

Out of curiosity, if you change the grid to an OCKChecklistTaskViewController do all of the checklist items show up properly?

@majidsaleem105
Copy link
Author

Hi @gavirawson-apple

I've created a new sample project for you. You can clone it from https://github.com/majidsaleem105/sample-health-app.git.
The video I attached with my previous message was created from the same project. As I mentioned in my earlier message, the following activities are scheduled for the Single Event:

  • Kegel Exercises
  • Track your nausea (from the Optional section)

Here is the phone info if it helps:
phone-infor

Please let me know if you need any information from my side. We've completed our upgrade from the 1.2 version to the CareKit 2.0 version, but unfortunately, we are unable to release it because of this Single Event issue.

Thanks,

  • Majid S.

@majidsaleem105
Copy link
Author

Hi @gavirawson-apple,

As per your suggestion, I replaced OCKGridTaskViewController with OCKChecklistTaskViewController and it worked fine on the device.

Can you please advise, what could be the possible reason for not displaying the Single Event with OCKGridTaskViewController?

Thanks,

  • Majid S.

@gavirawson-apple
Copy link
Collaborator

Thanks for sharing that project. Unfortunately after running the project, I'm still not seeing the circles disappear. Without being able to reproduce the issue, it'll be really tough to say for certain what the cause is.

However, after I cloned the project it didn't immediately compile - so it's possible the fixes I had to apply could have affected the problem. I had to manually embed the frameworks, and copy the source code into a new Xcode project (there were some strange build errors after embedding the frameworks, perhaps remnants from some previous setup).

Given the OCKChecklistTaskViewController works as expected, I bet this issue is in the OCKGridTaskViewController view code and not the task scheduling logic. But again, without being able to reproduce the issue I'm not sure how much I can help fix it. If it's a possibility for you, I'd recommend sticking to the checklist task card. That card should be functionally the same as the grid task card.

@majidsaleem105
Copy link
Author

Thanks, @gavirawson-apple for the advice.

We decided to use the OCKChecklistTaskViewController . Can you please advise on if we want to execute different functions by Tapping on the Title and Completion buttons?

How we can do this if it's possible?

@gavirawson-apple
Copy link
Collaborator

Which title are you referring to? The one in the checklist item?

@majidsaleem105
Copy link
Author

Yes, I'm referring to the checklist item label.
We want to implement 2 different features by tapping on the Checklist Item label and the completion button.

@gavirawson-apple
Copy link
Collaborator

There isn't first class support for that sort of action as it may not be immediately clear to the user that tapping in those two different areas will produce different results. But, if you'd still like to support that feature you can modify the framework directly. See the OCKChecklistTaskView and the method makeItem(withTitle:). The current implementation creates a single button, but you can explore creating two buttons instead.

Alternatively, you can create a custom task view that might better fit your specific needs and desired UX.

@gavirawson-apple
Copy link
Collaborator

@majidsaleem105 does that help address your question? Is this issue ready to be closed out?

@majidsaleem105
Copy link
Author

Thanks, @gavirawson-apple for your kind help.

We are using OCKChecklistTaskViewController now, and it's working fine so far.
We can close it, and I'll post if I have new questions.

@gavirawson-apple
Copy link
Collaborator

Sounds great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants