Custom implemented views duration are not valid

I implemented a custom views in IOS with these code :

[Countly.sharedInstance addExceptionForAutoViewTracking:@"Cart"];
[Countly.sharedInstance recordView:_strfmt(@"Cart")];

but often the duration of views is equal to zero or sums of the duration of some views for one of them and other views have zero duration.

Hi @ssezavar - glad you are here and have a question. I have asked my colleague to respond to this. We'll keep you posted.

Hi,

It is not clear what the problem is here.
Can you explain more?

addExceptionForAutoViewTracking is for excluding views from Auto View Tracking, and not related to what you are trying to achieve at all.

I recommend you to read view tracking docs one more time:
https://resources.count.ly/docs/countly-sdk-for-ios-and-os-x#section-view-tracking

And what does _strfmt do? Any chances that it returns nil?

Hi,
I've read the docs again, unfortunately the instructions have not helped me achieve my goal yet.
What I'm trying to achieve here is to simply add custom names when I record my views. therefore, I've had to record the view manually, but while doing that I would have 2 records of one view with different names on my server and in order to solve that I called the addExceptionForAutoViewTracking right before I record my views.
_strfmt is a function that creates string with format and is tested so that can not be the problem.
My problem is that sometimes, auto view tracking does not track some of the views and therefore it creates problems with durations of the previous views.
am I doing something wrong here or should I implement something that I'm not already?

Let me clarify:

You are trying to use both manual and automatic view tracking at the same time, right?
As a result, you are getting 2 records of the same view with different names.
One from automatic view tracking, and one from manual recording you do yourself.
So, you are adding that view as an exception to prevent auto view tracking.

Are my assumptions correct up to this point?

If correct, let me explain more:

  1. You start Countly SDK with auto view tracking feature
  2. You add exceptions
  3. You kick start your apps view hierarchy
  4. Countly SDK starts tracking views
  5. If Countly SDK encounters an exception view, it ignores and tracking goes on for previous view
  6. You manually record the view
    and so on...

If your work flow is like this, it should work.

By the way, you can just set the view controller's title property to change name of the view automatically tracked.