草庐IT

about_nil

全部标签

ios - NSInvalidArgumentException - 'Can' t 对 PFObject 上的键或值使用 nil。使用 NSNull 作为值

在我看来确实加载了我正在尝试设置从用户到安装的指针。这是我的用户类的一部分的图片。然后我有这段代码来检查我是否设置了指针PFInstallation*currentInstalation=[PFInstallationcurrentInstallation];NSString*installationObjectId=currentInstalation.objectId;if(![currentUser[@"installationString"]isEqual:installationObjectId]){NSLog(@"hasnotbeenset");//************

ios - SWRevealViewController 插入对象 :atIndex object cannot be nil

我是Storyboard的新开发者。我尝试制作一个带有滑出式菜单的应用程序。为此,我使用库:SWRevealViewController和教程:http://www.appcoda.com/ios-programming-sidebar-navigation-menu/.我按照教程进行操作,但是我加载了应用程序,出现了这个错误:Terminatingappduetouncaughtexception'NSInvalidArgumentException',reason:'***-[__NSArrayMinsertObject:atIndex:]:objectcannotbenil'我的

ios - NSArrayWithObject :nil asserts, 但 NSArrayWithObjects :nil doesn't. 错误或功能?

在调试UICollectionView-reloadItemsAtIndexPaths的问题时,我追踪到一个断言,我(通常)需要将单个元素数组传递给此方法(我只有一个单元格要重新加载)。因此,很明显,我使用了以下等价物来生成必要的数组:NSIndexPath*foo=...NSArray*bar=[NSArrayarrayWithObject:foo];[mycollectionviewreloadItemsAtIndexPaths:bar];但是,在特殊情况下,当mycollectionview仍然为空时,索引路径foo为nil(即没有要重新加载的单元格),它出现arrayWithO

ios - [单元格 viewWithTag :] is always returned as nil 中的标签

我为这件基本的事情苦苦挣扎了一天多,这让我发疯!有趣的是,我在其他屏幕上也有非常相似的东西,而且效果很好!我已经这样做了一千次,但从未经历过如此奇怪的事情。也许这种行为仅在iOS8中存在?在我非常简单的Prototype单元格上,我有两个带有标签102和103的标签。但是当我想为它们设置文本时,它们总是nil。我已经仔细检查过标识符是否正确,并且该标签与Storyboard中的标签相同。-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{NSS

ios - NSKeyedArchiver: key 返回 nil - Swift

我在这里遇到了一些问题。我正在尝试使用NSKeyedArchiver存储一些信息,但是当我运行该应用程序时,我得到:fatalerror:在展开可选值时意外发现nil。Appledocssays:"Ifyouinvokeoneofthedecode...methodsofthisclassusingakeythatdoesnotexistinthearchive,anon-positivevalueisreturned.Thisvaluevariesbydecodedtype.Forexample,ifakeydoesnotexistinanarchive,decodeBoolForK

ios - IPCAUClient : bundle display name is nil

当我在iOS9应用程序中运行以下命令时:AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)然后在命令行上显示以下消息:ERROR:126:IPCAUClient:bundledisplaynameisnil有什么建议吗? 最佳答案 刚发现,我的Appsinfo.plist文件中的CFBundleDisplayName条目丢失了。添加这个修复了错误。 关于ios-IPCAUClient:bu

ios - 核心数据 - NSManagedObject 返回 nil

我在Appdelegate类中编写了两个单独的函数fetchRecords和displayRecords。fetchRecords函数将从实体中获取所有记录并且它工作正常。displayRecords函数接受来自fetchRecords函数的返回值并打印所有记录逐个。我有一个ViewController调用这两个函数来完成所需的任务。我的问题是displayRecords中的result.count显示获取的记录中可用的记录总数。当一条一条地打印记录时,该值为nil。overridefuncviewDidLoad(){super.viewDidLoad()letfetchedRecor

ios - UIImage 在 UITests 中返回 nil

在我的UITests中,我想将元素的图像与来自.xcassets的图像进行比较:letreferenceImage=UIImage(named:"referenceImage")guardreferenceImage!=nilelse{print("didn'tfindreferenceImageimageinassets")XCTAssert(false)return}letcellImage=myCell.images.elementBoundByIndex(0)letimagesEqual=(referenceImage!.isEqual(cellImage))XCTAssert

ios - 线程 1 : Fatal error: Unexpectedly found nil while unwrapping an Optional value while applying effects to image

我正在尝试对ImageView应用滑动、淡入淡出和增长效果。以下是我的代码@IBActionfuncfadeIn(_sender:Any){imageView.alpha=0UIView.animate(withDuration:1,animations:{self.imageView.alpha=1})}@IBActionfuncslideIn(_sender:Any){imageView.center=CGPoint(x:imageView.center.x-500,y:imageView.center.y)UIView.animate(withDuration:2){self.i

ios - CALayer.draw(in :) and CALayer. needsDisplay(forKey :) not called when expected, presentation layer unexpectedly nil

我正在尝试实现一个具有隐式动画属性的图层,但我看到了一些非常奇怪的行为。这是一个简单的层,它演示了我的意思:classCustomLayer:CALayer{overrideinit(){super.init()implcitlyAnimatedProperty=0.0000needsDisplayOnBoundsChange=true}overrideinit(layer:Any){super.init(layer:layer)implcitlyAnimatedProperty=(layeras!CustomLayer).implcitlyAnimatedProperty}requi