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

fatal error: all goroutines are asleep - deadlock! #69

Open
sorawa opened this issue Feb 29, 2016 · 1 comment
Open

fatal error: all goroutines are asleep - deadlock! #69

sorawa opened this issue Feb 29, 2016 · 1 comment

Comments

@sorawa
Copy link

sorawa commented Feb 29, 2016

package main

import (
  "fmt"
  "github.com/timehop/apns"
)

func main() {
     c, _ := apns.NewClient("gateway.sandbox.push.apple.com:2195", "dev_ck.pem", "dev_pk.pem")

    p := apns.NewPayload()
    p.APS.Alert.Body = "I am a push notification!"
    p.APS.Badge.Set(5)
    p.APS.Sound = "turn_down_for_what.aiff"

    m := apns.NewNotification()
    m.Payload = p
    m.DeviceToken = "A_DEVICE_TOKEN"
    m.Priority = apns.PriorityImmediate

    resp := c.Send(m)
    fmt.Printf("%v\n",resp)
}





fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan send (nil chan)]:
main.main()
D:/go/bin/project/src/applePush/applyPush.go:21 +0x1b2
exit status 2
``

@nathany
Copy link
Contributor

nathany commented Mar 2, 2016

The first issue I see is that you should use NewClientWithFiles instead of NewClient. It's always good to check errors that functions return.

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