Open sorawa opened 8 years ago
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 ``
The first issue I see is that you should use NewClientWithFiles instead of NewClient. It's always good to check errors that functions return.
NewClientWithFiles
NewClient
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 ``