0

iOS mobile App crashing after clicking the Push Notification and showing the following error. The crash is being observed for Clevertap Push Notification when the app closed. The crash is not happening when the mobile app is in background or foreground. The Application is build using Mobilefirst V7.1 and all the Mobilefirst libraries and methods are being used for handling push notification on iOS Application.

We have tried to pull out the logs from the device and got the logs before app crashes.

2018-04-30 15:07:39.466141+0530 AppDev[1386:622734] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper start] in WLAFHTTPRequestOperationManagerWrapper.m:356 :: Starting the request with URL https://wls.**.co.in:80/Dev/apps/services/api/AppDev/iphone/query

2018-04-30 15:07:40.337279+0530 AppDev[1386:619825] [FATAL] [WORKLIGHT] Uncaught Exception: *** -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]

2018-04-30 15:07:40.355216+0530 AppDev[1386:619825] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]'

*** First throw call stack:
(0x182653d38 0x181b68528 0x1825ecc44 0x18251cdbc 0x100574328 0x100573dcc 0x18302c4c4 0x1825fc99c 0x1825fc6c0 0x1825fbec0 0x1825f9aa8 0x18251a2d8 0x1843abf84 0x18bac7880 0x100477f4c 0x18203e56c)
libc++abi.dylib: terminating with uncaught exception of type NSException

I am not able to identify the issue whether there is an issue on Mobilefirst Libraries or Clevertap libraries. But logs clearly indicates issue is on the Mobilefirst.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • To be clear, are you sending clevertap notifications? And you are using MFP push to receive these notifications? – Vivin K May 04 '18 at 09:51
  • Hi @VivinK, Nice to have you on this issue. Yes we are using Clevertap to send the push notification and MFP push to receive these notifications. – user2436743 May 04 '18 at 13:44
  • Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer May 04 '18 at 17:25
  • The most likely cause is a difference in the format - what Clevertap sends vs what MFP server would have send. But then you would have seen this error everytime - that surprises me. Can you send a notification from MFP server and confirm that this one does not crash the application when opened by tapping the notification. – Vivin K May 04 '18 at 17:54
  • @VivinK Yes We have tried to send the MFP push and nothing happens. But the crash is happening with the Clevertap Push Notification only. I just want to know which Mobilefirst Method I need to override just to handle push message in iOS App – user2436743 May 05 '18 at 10:56
  • @halfer, I think production issues need to be resolved soon and urgently. As the matter we are dealing with is related to Application Crash in a certain scenario which is not only hampering customer experience but business is being hampered at the same time. Hope you got the point of urgency. – user2436743 May 05 '18 at 10:59
  • I understand that, @user2436743. However, the point I try to impress on new users here is that a person's urgency is not other people's urgency, especially when those others are volunteers. Indeed, any expression of urgency is essentially a request for special treatment, which is not appropriate when other people have a desire to have their questions answered also. This view is strongly reflected amongst the user-base giving opinions in the link I have supplied - please do read it. Thank you! – halfer May 05 '18 at 15:47
  • @user2436743, do you have both CleverTap and MFP Push SDK in your client application? – Vivin K May 07 '18 at 07:46
  • @VivinK Yes We have both(Clevertap + MFP Push) SDK installed in the App. – user2436743 May 08 '18 at 06:59

2 Answers2

0

Somehow We are able to manage the crash issue just changing the config file for iOS application. We have commented out the default push message handling in config file and now application is not crashing while clicking on the Push message. But We are not able to read the push message and not able to show the details of Push Message in Alert message when app is opened.

0

This issue happens because both MFP SDK cannot parse the format of the Push notification dispatched from CleverTap. When the application starts both MFP Push and CleverTap plugins compete for the message and in all likelihood, MFP Push plugin gets there first and tries to read the message.

Since you already have CleverTap SDK also present in the application, you can turn off MFP Push plugin to ensure only CleverTap SDK reads all notifications.

To do this ,navigate to:

<Workspace>/<HybridProjectName>/apps/<HybridApplication>/iphone/native 

folder.

Here open the config.xml and locate these lines:

<feature name="Push">
        <param name="ios-package" value="Push" />
        <param name="onload" value="true" />
</feature>

Change to:

<param name="onload" value="false" />

This prevents MFP Push plugin from loading.

Note: this change will get overridden if you re-build the iPhone/iPad environment.

Vivin K
  • 2,681
  • 1
  • 11
  • 14