//发送rich型的notification内部会重试 func (self *ApnsClient) SendEnhancedNotification(identifier, expiriedTime uint32, deviceToken string, pl entry.PayLoad) error { id := entry.WrapNotifyIdentifier(identifier) message := entry.NewMessage(entry.CMD_ENHANCE_NOTIFY, self.maxttl, entry.MESSAGE_TYPE_ENHANCED) payload := entry.WrapPayLoad(&pl) if nil == payload { return errors.New("SendEnhancedNotification|PAYLOAD|ENCODE|FAIL") } message.AddItem(id, entry.WrapExpirationDate(expiriedTime), entry.WrapDeviceToken(deviceToken), payload) return self.sendMessage(message) }
//发送rich型的notification内部会重试 func (self *ApnsClient) SendEnhancedNotification(identifier, expiriedTime uint32, deviceToken string, pl entry.PayLoad) error { id := entry.WrapNotifyIdentifier(identifier) message := entry.NewMessage(entry.CMD_ENHANCE_NOTIFY, self.maxttl, entry.MESSAGE_TYPE_ENHANCED) payload, err := entry.WrapPayLoad(&pl) if nil == payload || nil != err { return errors.New(fmt.Sprintf("SendEnhancedNotification|PAYLOAD|ENCODE|FAIL|%s", err)) } token, err := entry.WrapDeviceToken(deviceToken) if nil != err { return err } expiry := uint32(time.Now().Add(time.Duration(int64(expiriedTime) * int64(time.Second))).Unix()) message.AddItem(id, entry.WrapExpirationDate(expiry), token, payload) return self.sendMessage(message) }