function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tomo OkadaTomo Okada 

UNKNOWN_EXCEPTION occurs in the Push Notification of Chatter REST API

I am a development in the "SalesforceMobileSDK for iOS".
While using Chatter REST API for exchanging the data, we're attempting for Push notification using Push Notification resources.
However we can't send any Push Notification but recieve UNKNOWN_EXCEPTION even though we set upthe  POST Palameter referring to API Guide. 

Code you are using is following.
 
NSMutableArray *sendUserIds = [[NSMutableArray alloc] init];
[sendUserIds addObject:@"UserID1"];
[sendUserIds addObject:@"UserID2"];
[sendUserIds addObject:@"UserID3"];
    
NSString *payload = @"{'aps':{'alert':'test', 'badge':0, 'sound':'default'}}";
NSDictionary *sendDic = [[NSDictionary alloc] initWithObjectsAndKeys:@"PushTest", @"appName", @"PushTest", @"namespace", sendUserIds, @"userIds", payload, @"payload", nil];

// URL and Request Object creation
NSString *url = [NSString stringWithFormat:@"/%@/connect/notifications/push",@"v32.0"];
SFRestRequest *req =[SFRestRequest requestWithMethod:SFRestMethodPOST path:url queryParams:sendDic];
    
//POST Execution
[[SFRestAPI sharedInstance] sendRESTRequest:req failBlock:^(NSError *e) {
    NSLog(@"/connect/notifications/push error:: %@",e);
} completeBlock:^(id jsonResponse) {
    NSLog(@"MessegeOk");
}];

Error trace after the above code execution will be below.
 
--------
Response
--------
[{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 633409168-7007 (1770975217)","errorCode":"UNKNOWN_EXCEPTION"}]
, [The operation couldn’t be completed. (NSURLErrorDomain error 500.)]
2015-02-17 10:06:51:927 [592:807] ERROR|SFNetworkOperation|callDelegateDidFailWithError An unexpected error occurred. Please include this ErrorId if you contact support: 633409168-7007 (1770975217)
2015-02-17 10:06:51.927 [592:148638] -[MKNetworkOperation operationFailedWithError:] [Line 1792] State: 0
2015-02-17 10:06:51.932 [592:148875] /connect/notifications/push error:: Error Domain=NSURLErrorDomain Code=500 "An unexpected error occurred. Please include this ErrorId if you contact support: 633409168-7007 (1770975217)" UserInfo=0x1d2a3d30 {NSLocalizedFailureReason=UNKNOWN_EXCEPTION, SFOriginalApiError=<CFArray 0x1d290f40 [0x39ef4460]>{type = immutable, count = 1, values = (
	0 : <CFBasicHash 0x1d298640 [0x39ef4460]>{type = immutable dict, count = 2,
entries =>
	0 : <CFString 0x1d2b95c0 [0x39ef4460]>{contents = "message"} = <CFString 0x1d29b8e0 [0x39ef4460]>{contents = "An unexpected error occurred. Please include this ErrorId if you contact support: 633409168-7007 (1770975217)"}
	2 : <CFString 0x1d2b0860 [0x39ef4460]>{contents = "errorCode"} = <CFString 0x1d2b63c0 [0x39ef4460]>{contents = "UNKNOWN_EXCEPTION"}
}

)}, NSLocalizedDescription=An unexpected error occurred. Please include this ErrorId if you contact support: 633409168-7007 (1770975217)}
Gaurav KheterpalGaurav Kheterpal
I took a quick look and your code mostly seems okay. I would recommend that you do a couple of things

A) Post this on Mobile SDK Community page and I'll nudge the Mobile SDK team about this issue.
B) Raise a support case with the error ID shown above.

If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others and improve the overall quality of Discussion Forums.

Gaurav Kheterpal
Certified Force.com Developer| Salesforce Mobile Evangelist| Developer Forums Moderator| Dreamforce Speaker
Gaurav KheterpalGaurav Kheterpal

For A), this is the URL to Mobile SDK Google+ Community page - https://plus.google.com/u/1/communities/114225252149514546445

Thanks!

Gaurav

Sasha_SFDCSasha_SFDC
@Tomo Okada  

I believe this problem should be resolved now. Are you able to send push notifications successfully?