1

我正在开发一个应用程序,在该应用程序中,服务器将以 base64 格式的图像作为推送通知格式从 ios 端发送给我图像是否可以接受 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];
}
}
4

1 回答 1

0

你不能。给用户的通知将显示标题和消息文本,然后,如果用户触发通知打开应用程序,您的应用程序将收到完整的通知数据,您可以显示图像。

于 2013-11-01T08:23:21.490 回答