我正在开发一个应用程序,其中服务器将在base64中将图像作为推送通知格式发送给我,因为从ios侧我必须使用base 64的解码显示此图像?我可以进行解码,除了我将如何将PNS显示为图像 是否可以接受PNS作为图像(在base64中)?
我使用的代码如下,
#pragma mark -
#pragma mark - Push Notifications Methods
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
NSString *tokenStr = [deviceToken description];
// Separete Your device token with <,< and blanksapace
NSString *pushToken = [[[tokenStr
stringByReplacingOccurrencesOfString:@"<" withString:@""]
stringByReplacingOccurrencesOfString:@">" withString:@""]
stringByReplacingOccurrencesOfString:@" " withString:@""];
// Save the token to server
NSString *urlStr = [NSString stringWithFormat:@"http://www.vijaywebsolutions.com/Development_FTP/webservice/webservices.php?deviceToken=%@",pushToken]; // Passing token to URL
NSURL *url = [NSURL URLWithString:urlStr];
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:req delegate:self]; // Support to perform URLrequest
if( theConnection )// checking connection successfull or not
{
webData = [NSMutableData data];
NSLog(@"device token is %@", pushToken);
}
}
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
if (application.applicationState == UIApplicationStateActive)
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Did receive a Remote Notification" message:[NSString stringWithFormat:@"You Have a Notification :\n%@",userInfo[@"aps"][@"alert"]]delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
}
答案 0 :(得分:0)
你不能。通知用户将显示标题和消息文本,然后,如果用户触发通知打开应用程序,您的应用程序将传递完整的通知数据,您可以显示图像。