Description:
so i followed the setup tutorial but doesn't work as expected.
the problem is when I send a remote push notification, it does not trigger Notification Service Extension methods.
Steps:
placed breakpoint in didReceive method
run the project target on a device
send a notification
attached extension process
send a remote notification again
notification shows ( but not modified as expected, I replace the title string )
extension process crashed (?) with error " Thread 1: signal SigKill"
just like this SO question
https://stackoverflow.com/questions/49511005/cant-attach-debugger-to-unnotificationserviceextension
I also tried to run the extension target
when received the remote notification, Xcode shows an warning window says
"could not attach to pid: ensure is not already running and has permission to debug it"
I think it's because the Xcode setting but not sure which one.
please help :(
Environment
Steps to Reproduce Issue:
Steps:
placed breakpoint in didReceive method
run the project target on a device
send a notification
attached extension process
send a remote notification again
notification shows ( but not modified as expected, I replace the title string )
extension process crashed (?) with error " Thread 1: signal SigKill"
Anything else:
(crash stacktraces, as well as any other information here)
*I did enable mutable-content to be 1 *
when i look into system log it says
"OneSignalNotificationServiceExtensionDev] Extension will be killed due to sluggish startup
"
@chenkuanhuaian Unfortunately it can be quite difficult to attach the Xcode debugger to an iOS notification service extension, it is more of an art than a science. It can take many attempts. I wish Apple would do a bit of work on this, but it is what it is.
Can you post a link to your NotificationService.m?
Also, what kind of attachment are you sending? Keep in mind that if you are sending a large attachment, this can happen because it takes too long to download and the system will terminate the extension.
Hi,
i didn't do much in the NotificationService.swift
add a [modified] string to notification title is all I do (and of course oneSignal required methods)
also, I was sending only title, subtitle and body + mutable-content = 1 in my payload
i honestly don't think these will the problem.
one thing bothered me, which is, when I run the project target and receive a notification,
the extension should waken up and shown in "Attached to Process" list
but instead, it goes into the notification related delegate method in appDelegate,
does it means my extension is not working properly ?
thank you
and this is what i get from my device console

@chenkuanhuaian Can you please post your full NotificationService.swift? I would suspect that something in there is hanging, either in your actual code or our SDK.
Also, how did you add onesignal as a dependency to the extension service, cocoapods?
https://gist.github.com/chenkuanhuaian/62989e404f6e00f04085c78921bca3b9
line 17 is the only line I added to the NotificationService.swift as I mentioned.
I need to make modification the notification title work first so I would proceed to add attachments.
and yes, I am using cocoapods
thanks for helping, been working on this for over 3 days :(
@chenkuanhuaian It鈥檚 the weekend but I know how frustrating that is! So I鈥檒l keep looking into it with you.
What is your deployment target for the Extension service?
Could you share your Podfile?
Also, if you comment out the OneSignal related code from NotificationService.swift, does it modify the title or still not launch? This will help narrow down what鈥檚 causing the issue.
Also, just to make sure, are you building with Xcode or some other IDE (like Xamarin with VS)? What version of Xcode, and what versions of iOS have you tested with? You aren鈥檛 using the iOS 12 beta right?
Unfortunately notifications in iOS don鈥檛 work on simulator so you鈥檇 have to be testing with real devices
I appreciate that ! thanks for replying on weekend.
deployment target for the Extension service and my project is both iOS 10,
I read some SO questions saying that it has to be iOS 10 so i did so, but still...
here's my podifle gist
https://gist.github.com/chenkuanhuaian/6e704e69b4b85cf962269ac82aa2e660
When I comment out the OneSignal Related Code, the extension is still not launched.
I do get notifications and notification related delegate method in appDelegate are called.
(I think if I have mutable-content = 1, it should goes into the extension rather than appDelegate,
but my extension is kill by OS so... )
Yeah I should tell my environment in the first place,
I am building with Xcode 9.4.1 on iOS 11.4.1 device (iPhone 8 plus) if that matters.
Again, thanks for helping me out,
I've been follow the setup tutorial and other extension tutorial several times,
asked my senior developer fellows but apparently no one has encounter this before. :(
@chenkuanhuaian @Nightsd01 I am also facing the exact same issue.
Good to know I鈥檓 not the only one.
I don鈥檛 know why people have no problem dealing with application extension....
Makes me feel I鈥檓 an idiot lol
@chenkuanhuaian I think I see what the issue is. App extensions are memory limited. The system won鈥檛 grant them much memory.
Looking at your pod file, it looks like the extension service is a member of myProject and it gets all pods installed into it from the pods group? If all of those dependencies are getting linked, it could consume quite a lot of memory just to launch the extension service, and the system would kill it (which explains the SIGKILL)
I would suggest making the OneSignalNotificationServiceExtension target a top level target and make sure it ONLY gets OneSignal installed.
If that doesn鈥檛 fix it let me know
Good Point!
But by extension service is a member of myPorject, what do you mean exactly?
As far as I know, application extension is independent from other targets ?
since I do
target 'OSNotificationExtension' do
pod 'OneSignal', '>= 2.6.2', '< 3.0'
end
In my podfile, I thought OneSignal is the only pod I installed to OSNotificationExtension target right ?
does this help ??
target 'myPorject_iOS' do
pods
target 'myPorject_iOS_Dev' do
pods
end
target 'myPorject_iOSTests' do
inherit! :search_paths
testPods
end
target 'myPorject_iOSUITests' do
inherit! :search_paths
testPods
end
end
target 'OSNotificationExtension' do
pod 'OneSignal', '>= 2.6.2', '< 3.0'
end
thanks for replying :)
OMG, that Worked !!!!!!!!!!!!!!!!!!!!!!!
OMG, You just saved my life.
I didn't even noticed that i place my extension target in the wrong scope.
You are the Sweetest human being on this planet.
You Rock 馃
thank you, thank you and thank you!!!!!!!!!!! <3 <3 <3
now I could finally sleep tight :D
Glad to hear it! Little misconfigurations with Cocoapods like this can be time consuming to debug. Feel free to ask if you have any other problems
Most helpful comment
OMG, that Worked !!!!!!!!!!!!!!!!!!!!!!!
OMG, You just saved my life.
I didn't even noticed that i place my extension target in the wrong scope.
You are the Sweetest human being on this planet.
You Rock 馃
thank you, thank you and thank you!!!!!!!!!!! <3 <3 <3
now I could finally sleep tight :D