推送通知警告?
我正在我的应用程序中处理推送通知。但我收到这个警告: 不兼容的 Objective-C 类型分配“struct NSString *”,期望“struct NSData *”,
其收到警告的代码是:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// Here you send the deviceToken to your server..
deviceToken = [[[[deviceToken description]
stringByReplacingOccurrencesOfString: @"<" withString: @""]
stringByReplacingOccurrencesOfString: @">" withString: @""]
stringByReplacingOccurrencesOfString: @" " withString: @""];
NSLog(@"Device Token: %@",deviceToken);
}
任何人都可以告诉我为什么收到该警告。
谢谢
I am working with push notifications in my app. but I am getting this warning:
Incompatible Objective-C types assigning 'struct NSString *', expected 'struct NSData *'
the code where its getting warning is:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// Here you send the deviceToken to your server..
deviceToken = [[[[deviceToken description]
stringByReplacingOccurrencesOfString: @"<" withString: @""]
stringByReplacingOccurrencesOfString: @">" withString: @""]
stringByReplacingOccurrencesOfString: @" " withString: @""];
NSLog(@"Device Token: %@",deviceToken);
}
Can anybody tell me why did I got that warning.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不创建一个名为 deviceTokenStr 的单独 NSString 因为 deviceToken 本身是一个 NSData 对象并且它导致了错误
Why don't you create a separate NSString called deviceTokenStr as deviceToken itself is an NSData object and it is causing the error