2013-04-23 19 views
1

阿拉伯數據顯示?????從asp.net mvc到使用網絡庫處理響應對象的ios應用程序的字符。阿拉伯數據顯示?????從asp.net mvc到使用網絡庫的ios應用程序的字符

#import "AppGateway.h" 

//the web location of the service 
#define kAPIHost @"domain" 
#define kAPIPath @"Home/GetNews/" 

@implementation AppGateway 

/*Singleton*/ 
+(AppGateway*)sharedInstance 
{ 
    static AppGateway *sharedInstance = nil; 
    static dispatch_once_t oncePredicate; 
    dispatch_once(&oncePredicate, ^{ 
     sharedInstance = [[self alloc] initWithBaseURL:[NSURL URLWithString:kAPIHost]]; 
    }); 
    return sharedInstance; 
} 
-(AppGateway*)init{ 
    self = [super init]; 
    if(self!=nil) { 
     [self registerHTTPOperationClass:[AFJSONRequestOperation class]]; 
     [self setDefaultHeader:@"Accept" value:@"application/json"]; 
    } 
    return self; 
} 

-(void)commandWithParams:(NSMutableDictionary *)params onCompletion:(JSONResponseBlock)completionBlock{ 
    NSMutableURLRequest *apiRequest = [self multipartFormRequestWithMethod:@"POST" 
                     path:kAPIPath 
                   parameters:params 
               constructingBodyWithBlock:^(id <AFMultipartFormData>formData){ 
    }]; 
    AFJSONRequestOperation *operation = [[AFJSONRequestOperation alloc] initWithRequest:apiRequest]; 
    [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject){ 
     NSLog(@"AFNTSUCCESS"); 
     //This is where response object carry arabic data corrupted to '??????????' 
     completionBlock(responseObject); 
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) { 
     NSLog(@"AFNTFAILURE"); 
     completionBlock([NSDictionary dictionaryWithObject:[error localizedDescription] forKey:@"error"]); 
    }]; 
    [operation start]; 
} 

@end 

這是我用來連接到mvc動作的類。 謝謝

+0

則可能是web服務響應編碼問題,如果它不存在,那麼你必須對數據進行編碼,並顯示它,如果你從服務,您可以用阿拉伯語與[這個有用的類(HTTPS顯示它正確的數據://github.com/Accorpa/Arabic-Converter-From-and-To-Arabic-Presentation-Forms-B) – 2013-04-23 06:52:52

+0

感謝你的幫助,它的工作,因爲我下面提到的,它是在服務器數據庫上的問題。 – HEH 2013-04-23 07:45:11

+0

你能告訴我究竟是什麼問題,因爲我面臨着這個問題 – 2013-05-16 13:10:10

回答

0

是它的工作是不是從afnetworking或MVC的問題是與在服務器中。遺憾的是

+1

這並沒有提供問題的答案。要批評或要求作者澄清,在他們的帖子下留下評論 - 你可以隨時評論你自己的帖子,一旦你有足夠的[聲譽](http://stackoverflow.com/faq#reputation),你將能夠[評論任何帖子](http://stackoverflow.com/privileges/comment)。 – 2013-04-23 07:24:02

+0

這是剛纔說的問題似乎是從某處完全不相干的問題的話題,問題,同時節省數據庫中的數據阿拉伯語,並已與AFnetworking – HEH 2013-04-23 07:42:29

+0

確定沒有什麼是服務器的問題? – 2013-06-26 11:15:24