Я работаю над приложением iOS, аналогичным getPocket. У меня есть новостное приложение для последующего чтения.Приложение зависает с данными ядра
Я собираю весь список новостей в первый звонок и сохраняется в coredata. а также я начал загружать весь контент новостей и пытаться сохранить в coredata.
согласно требованию мы не нуждаемся в волосиве.
Я использую этот codee
NSDictionary *params [email protected]{
@"access_token" :str_AccessToken,
@"bookmark_file" :str_BookmarkFile,
@"alternate_id" :str_ALTID
};
//============================AFNETWORKING HEADER=========================================
//
//==========================AFNETWORKING HEADER==================================
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];
httpClient.parameterEncoding = AFFormURLParameterEncoding;
[httpClient registerHTTPOperationClass:[AFJSONRequestOperation class]];
[httpClient setDefaultHeader:@"Accept" value:@"application/json"];
//===============================SIMPLE REQUEST=====================
NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST"
path:kGetArticleDetail
parameters:params];
//====================================================RESPONSE
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setUploadProgressBlock:^(NSUInteger bytesWritten,long long totalBytesWritten, long long totalBytesExpectedToWrite) {
}];
// Get the data
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSError *error = nil;
NSDictionary *JSON = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:&error];
[delegate.activityIndicator stopAnimating];
self.view.userInteractionEnabled=YES;
[self ResponseDetail:JSON];
}
//==================================================ERROR
failure:^(AFHTTPRequestOperation operation, NSError error) {
[delegate.activityIndicator stopAnimating];
if([operation.response statusCode] == 406){
//[SVProgressHUD showErrorWithStatus:@"Not Login"];
return;
}
if([operation.response statusCode] == 403){
NSLog(@"Upload Failed");
return;
}
if ([[operation error] code] == -1009) {
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"mywebsite"
message:@"Please check your internet connection"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[av show];
}
else if ([[operation error] code] == -1001) {
[self aFGetReaderDetail:str_BookmarkFile string:str_ALTID];
}
}];
[operation start];
и основной код данных
delegate=(AppDelegate *)[[UIApplication sharedApplication] delegate];
NSManagedObjectContext *context=[delegate managedObjectContext];
NSEntityDescription *entityDesc=[NSEntityDescription entityForName:@"Save_Reader" inManagedObjectContext:context];
// NSPersistentStoreCoordinator *persistentStoreCoordinator = [context persistentStoreCoordinator];
// context = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
//
Мое приложение зависает ..
Любая идея?
Благодаря
Сэр, я новичок в ios. Не могли бы вы предоставить мне пример –
Спасибо большое .. –