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

Crashed when sending notification with buttons #401

Closed
pffan91 opened this issue Aug 20, 2018 · 4 comments
Closed

Crashed when sending notification with buttons #401

pffan91 opened this issue Aug 20, 2018 · 4 comments

Comments

@pffan91
Copy link

pffan91 commented Aug 20, 2018

Description:
I follow installation guides. Regular notifications worked as assumed but when I send notification with buttons - app crashed (if in focus) without informative logs or stack trace.. Also if app in background there is no buttons (just regular notification), if I open it - crash.

Environment

  1. iOS 11.4.1
  2. pod 'OneSignal', '>= 2.5.2', '< 3.0' (installed 2.8.6, latest)

Steps to Reproduce Issue:

  1. Follow https://documentation.onesignal.com/docs/ios-sdk-setup without point 5 and 6
  2. Then call POST to send notification with the next object in body:

POST /api/v1/notifications

{"app_id":"YOUR_APP _ID","contents":{"en":"TEST_TITLE"},"data":{"id":SOME_ARTICLE_ID,"type":"article"},"filters":[{"field":"tag","key":"user_id","value":"SOME_USER_ID","relation":"="}],"buttons":[{"id":"watch_later","title":"Watch later"}]}

Anything else:
iOS App deployment target is 9.0 (but also crashed if 10.0), extension deployment target is 10.0
Crash Log:

Application Specific Information:
abort() called

Filtered syslog:
None found

Last Exception Backtrace:
0 CoreFoundation 0x1829c6d8c __exceptionPreprocess + 228
1 libobjc.A.dylib 0x181b805ec objc_exception_throw + 55
2 CoreFoundation 0x18295f750 _CFThrowFormattedException + 111
3 CoreFoundation 0x1828980cc -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 351
4 CoreFoundation 0x182897f48 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 63
5 RainTV iOS App 0x10480b2b8 0x104114000 + 7303864
6 RainTV iOS App 0x104809c14 0x104114000 + 7298068
7 RainTV iOS App 0x104809950 0x104114000 + 7297360
8 RainTV iOS App 0x1048097c0 0x104114000 + 7296960
9 RainTV iOS App 0x1047f1514 0x104114000 + 7197972
10 RainTV iOS App 0x1047e25f4 0x104114000 + 7136756
11 RainTV iOS App 0x1047fc044 0x104114000 + 7241796
12 UIKit 0x18c5d7c0c -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] + 5059
13 UIKit 0x18d2367f0 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 203
14 UIKit 0x18c5a01ec -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 431
15 UIKit 0x18d01bac8 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 219
16 UIKit 0x18d169bf8 _performActionsWithDelayForTransitionContext + 111
17 UIKit 0x18c59fc0c -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 247
18 UIKit 0x18c59f5a8 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 367
19 UIKit 0x18c5dd334 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 467
20 FrontBoardServices 0x1851c8f24 __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.362 + 211
21 libdispatch.dylib 0x1822b8a60 _dispatch_client_callout + 15
22 libdispatch.dylib 0x1822c0170 _dispatch_block_invoke_direct$VARIANT$mp + 223
23 FrontBoardServices 0x1851fc878 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 35
24 FrontBoardServices 0x1851fc51c -[FBSSerialQueue _performNext] + 403
25 FrontBoardServices 0x1851fcab8 -[FBSSerialQueue _performNextFromRunLoopSource] + 55
26 CoreFoundation 0x18296f404 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 23
27 CoreFoundation 0x18296ec2c __CFRunLoopDoSources0 + 275
28 CoreFoundation 0x18296c79c __CFRunLoopRun + 1203
29 CoreFoundation 0x18288cda8 CFRunLoopRunSpecific + 551
30 GraphicsServices 0x184872020 GSEventRunModal + 99
31 UIKit 0x18c8ac758 UIApplicationMain + 235
32 RainTV iOS App 0x1041b6998 0x104114000 + 666008
33 libdyld.dylib 0x18231dfc0 start + 3

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018244d2e0 __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001825ee288 pthread_kill$VARIANT$mp + 376
2 libsystem_c.dylib 0x00000001823bbdb0 __abort + 152
3 libsystem_c.dylib 0x00000001823bbd18 __abort + 0
4 libc++abi.dylib 0x0000000181b572c8 __cxa_bad_cast + 0
5 libc++abi.dylib 0x0000000181b57470 default_unexpected_handler+ 5232 () + 0
6 libobjc.A.dylib 0x0000000181b808d4 _objc_terminate+ 35028 () + 124
7 RainTV iOS App 0x0000000104388380 0x104114000 + 2573184
8 libc++abi.dylib 0x0000000181b7137c std::__terminate(void (*)+ 111484 ()) + 16
9 libc++abi.dylib 0x0000000181b71400 std::terminate+ 111616 () + 84
10 libdispatch.dylib 0x00000001822b8a74 _dispatch_client_callout + 36
11 libdispatch.dylib 0x00000001822c0170 _dispatch_block_invoke_direct$VARIANT$mp + 224
12 FrontBoardServices 0x00000001851fc878 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 36
13 FrontBoardServices 0x00000001851fc51c -[FBSSerialQueue _performNext] + 404
14 FrontBoardServices 0x00000001851fcab8 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
15 CoreFoundation 0x000000018296f404 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 24
16 CoreFoundation 0x000000018296ec2c __CFRunLoopDoSources0 + 276
17 CoreFoundation 0x000000018296c79c __CFRunLoopRun + 1204
18 CoreFoundation 0x000000018288cda8 CFRunLoopRunSpecific + 552
19 GraphicsServices 0x0000000184872020 GSEventRunModal + 100
20 UIKit 0x000000018c8ac758 UIApplicationMain + 236
21 RainTV iOS App 0x00000001041b6998 0x104114000 + 666008
22 libdyld.dylib 0x000000018231dfc0 start + 4

@Nightsd01
Copy link
Contributor

@pffan91 I don't see any of our SDK methods in that stacktfrace, just Facebook methods?

Can you provide a list of your dependencies so we can attempt to reproduce?

@pffan91
Copy link
Author

pffan91 commented Aug 21, 2018

The problem was in parsing request:

POST /api/v1/notifications

{"app_id":"YOUR_APP _ID","contents":{"en":"TEST_TITLE"},"data":{"id":SOME_ARTICLE_ID,"type":"article"},"filters":[{"field":"tag","key":"user_id","value":"SOME_USER_ID","relation":"="}],"buttons":[{"id":"watch_later","title":"Watch later"}]}

When I post the same notification from OneSignal Dashboard - there is no crash. Also I tried with OneSignal Sample Swift iOS Application - the same crash.

So there is two options - you can close this ticket because I found workaround which worked for me. Or you can try to reproduce this issue and fix it in next updates. Anyway thank you for your response!

curl -X "POST" "https://onesignal.com/api/v1/notifications" \
     -H 'Cookie: __cfduid=HERE IS MY COOCKIES FROM PREVIOUS SESSION' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -u 'HERE IS MY ONESIGNAL APP ID:' \
     -d $'{
  "data": {
    "id": 435332,
    "type": "article"
  },
  "filters": [
    {
      "value": "2410891",
      "key": "user_id",
      "relation": "=",
      "field": "tag"
    }
  ],
  "buttons": [
    {
      "id": "watch_later",
      "title": "Watch later"
    }
  ],
  "app_id": "HERE IS MY ONESIGNAL APP ID",
  "contents": {
    "en": "DESC"
  }
}'

@Nightsd01
Copy link
Contributor

@pffan91 After doing some debugging, it looks like there is an error in your request. The buttons JSON should use the field text, not title.

However, mistakes like this should not cause a crash, I'll be updating our SDK to fix this crash, thanks for bringing it up!

@pffan91
Copy link
Author

pffan91 commented Aug 22, 2018

Great, thank you @Nightsd01 for quick response and fix!

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