Tag: null

RestKit:如何处理空的response.body?

我用POST请求了一些东西,服务器只发送一个内容长度为0的状态码200。 我该如何处理? 我不允许在没有映射的情况下添加RKResponseDescriptor,也不能添加RKResponseDescriptor。

在iTunes中可以使用封面时,MPMediaItemArtwork为空

UIImage “图片”始终是空的(“空”),虽然封面显示在音乐应用程序由苹果。 在iOS 7中,它工作正常,但与iOS 8我没有掩护。 我的代码有什么问题,或iOS 8中发生了什么变化? -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { AlbumCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AlbumCell"]; MPMediaItemCollection *song = self.songsList[indexPath.row]; cell.albumName.text = [[song representativeItem] valueForProperty: MPMediaItemPropertyAlbumTitle]; cell.albumArtist.text = [[song representativeItem] valueForProperty:MPMediaItemPropertyAlbumArtist]; CGSize artworkImageViewSize = CGSizeMake(100, 100); MPMediaItemArtwork *artwork = [song valueForProperty:MPMediaItemPropertyArtwork]; UIImage *image = [artwork imageWithSize:artworkImageViewSize]; NSLog(@"——————-"); NSLog(@"%@",[[song representativeItem] valueForProperty: MPMediaItemPropertyAlbumTitle]); NSLog(@"%@",image); if […]

indexPathForSelectedRow返回nil

我有一个UIVableViewController与我试图得到当前选定的行的segue: -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ if([[segue identifier] isEqualToString:@"EditFilterElementSegue"]){ // Get the element that was clicked and pass it to the view controller for display NSIndexPath *selectedIndexPath = [self.tableView indexPathForSelectedRow]; Element *element = [fetchedResultsController objectAtIndexPath:selectedIndexPath]; FilterElementTableViewController *vc = segue.destinationViewController; vc.filter = filter; vc.element = element; } } 问题是indexPathForSelectedRow返回nil。 文档说,如果索引path无效,返回nil。 如果我添加: [self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:YES scrollPosition:0]; selectedIndexPath […]

在NSUserDefaults中存储值(来自JSON序列化)会导致不需要的exception

我有一个应用程序,我使用基于JSON的API。 作为JSON的一部分,常常将值设置为“null”。 这可能是常见的: {"data":["one","two","three"],"name":null,otherstuff:10} 最近我试图在NSUserDefaults中存储一个从JSON对象转换来的misc NSDictionary层次结构。 不幸的是,如果有空数据,在IOS中将其转换为[NSNull null],则会导致exception。 显然,不能保存在首选项。 我想知道有没有人曾经解决这个问题? 我试图添加一些逻辑来首先从JSON中删除所有的空值,但成功有限,但是在存储数据之前修改数据似乎不合适。 有没有更好的方法来处理这个问题?

在应用程序购买后,应用程序在启动时崩溃。 产品识别=无?

我有几个用户报告说,尝试在应用程序内购买应用程序现在崩溃在启动。 我已经要求他们删除并重新安装那些没有工作的应用程序,并试图要求他们进入飞机模式,以阻止任何没有工作的networking通信。 我无法在我的设备上复制错误,我的应用程序购买在沙箱和生产模式下都能很好地完成。 我的想法是,不知何故,他们的交易收到了一个零产品标识导致启动崩溃,但我不知道什么事情观察员方法在应用程序启动时被调用,我可以解决他们的问题。 有没有办法“清除”交易队列,或者在启动时testing零产品标识符,并允许这些用户至less再次运行应用程序? 我使用下面的代码做了数百次的应用程序购买,这只是最近开始发生。 应用程序启动时调用哪个助手方法? 在AppDelegate.m中 [[SKPaymentQueue defaultQueue] addTransactionObserver:[MovieClockIAPHelper sharedHelper]]; 在应用帮手代码中: – (id)initWithProductIdentifiers:(NSSet *)productIdentifiers { if ((self = [super init])) { // Store product identifiers _productIdentifiers = [productIdentifiers retain]; // Check for previously purchased products NSMutableSet * purchasedProducts = [NSMutableSet set]; for (NSString * productIdentifier in _productIdentifiers) { BOOL productPurchased = [[NSUserDefaults standardUserDefaults] […]