I am working on iOS application.In one scenario I am sending phone number and some text message to server like this
- (void)postData:(NSString *)message :(NSString *)mobileno
{
NSLog(@"postData is called");
@try
{
NSString *urlString = [NSString stringWithFormat:@"http://anlgelist.commonshell.net/api/account"];
NSURL *url = [[NSURL alloc] initWithString:urlString];
NSMutableURLRequest *urlRequest1=[NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
NSMutableDictionary *postDictionary=[[NSMutableDictionary alloc]init];
[postDictionary setValue:message forKey:@"Message"];
[postDictionary setValue:mobileno forKey:@"MobileNumber"];
SBJsonWriter *jsonWriter = [SBJsonWriter new];
NSError *error = nil;
NSLog(@"~~~~~~~~ postDictionary is %@",postDictionary);
NSString * jsonDataString =[jsonWriter stringWithObject:postDictionary];
if ( ! jsonDataString )
{
NSLog(@"Error: %@", error);
}
NSData *requestData = [NSData dataWithBytes:[jsonDataString UTF8String] length:[jsonDataString length]];
[urlRequest1 setHTTPMethod:@"PUT"];
[urlRequest1 setValue:@"application/json" forHTTPHeaderField:@"content-type"];
[urlRequest1 setHTTPBody: requestData];
connection1 = [NSURLConnection connectionWithRequest:urlRequest1 delegate:self];
}
@catch (NSException *exception)
{
////NSLog(@"exception is %@",exception);
@throw exception;
}
}
I am continuously calling this web service to send the details.But sometimes I am getting the following error and app getting crashed.
<Error>: -[__NSCFDictionary _expandedCFCharacterSet]: unrecognized selector sent to instance 0x14fdf350
I had not faced this kind of error previously.I googled but not found the solution.
Crash Report is