草庐IT

empty2null

全部标签

Android Studio Firebase数据库返回null对象参考

大家好,我需要你,我对firebase实时数据库有问题,我将数据成功放到firebase上,但是当我尝试从firebase中检索它时,我遇到了一个问题,我如何将数据放在privatevoiduser_info(Stringuser_id,Stringuser_display_name){mDatabase=FirebaseDatabase.getInstance().getReference().child("Users").child(user_id);HashMapuserMap=newHashMap();userMap.put("Name",user_display_name);user

ios - NSJSONSerialization 有时会在异步请求中返回 null

我一直在开发应用程序,它对JSON类型的数据发出异步请求。最近,我在我的代码中发现了一个奇怪的错误,我不知道为什么会这样。确定代码!-(void)connectionDidFinishLoading:(NSURLConnection*)connection{NSError*error=nil;result=[NSJSONSerializationJSONObjectWithData:retrievedDataoptions:kNilOptionserror:&error];NSLog(@"Result%@",result);NSLog(@"Retrieveddata%@",retrie

ios - GCDAsyncUDPSocket源地址返回null

谷歌代码问题镜像:https://groups.google.com/forum/#!topic/cocoaasyncsocket/grhjZSMLr3U这是我读取响应的代码:-(void)init{udpSocket=[[GCDAsyncUdpSocketalloc]initWithDelegate:selfdelegateQueue:dispatch_get_main_queue()];NSError*error=nil;if(![udpSocketbindToPort:UDP_PORTerror:&error]){//notconnectingtohostreturn;}if(!

ios - 切换到 Xcode 7 后将 null 传递给需要 non_null 参数的被调用方

我是Obj-C的新手,但我正在尝试在Xcode7上构建一些以前在Xcode6中运行的代码。具体来说,我遇到了这个问题:[_webViewloadData:[_textdataUsingEncoding:NSUTF8StringEncoding]MIMEType:@"application/xml"textEncodingName:@"utf-8"baseURL:nil];我一直收到一条错误消息:Passinganulltoacalleethatrequiresanon_nullargumentafterswitchtoxcode7.我知道这是因为baseURL,但我不知道我可以通过的替

ios - 为什么要将常量的地址与 NULL 进行比较?

#define_UIKeyboardFrameEndUserInfoKey(&UIKeyboardFrameEndUserInfoKey!=NULL?UIKeyboardFrameEndUserInfoKey:@"UIKeyboardBoundsUserInfoKey")UIKeyboardFrameEndUserInfoKey!=NULL和&UIKeyboardFrameEndUserInfoKey!=NULL有区别吗?我试过:if(&UIKeyboardFrameEndUserInfoKey!=NULL){...}并收到警告Comparisonofaddressof'UIKeybo

objective-c - NSUserDefaults 正确存储 NSDate,然后在第二次检索后返回 null

我正在尝试使用NSUserDefaults存储和检索startTime和endTimeNSDate。存储它们似乎不是问题:self.convertedStringToDate=convertDateNSLog(@"Thisshouldread16:00:%@",self.convertedStringToDate);NSUserDefaults*userDefaults=[NSUserDefaultsstandardUserDefaults];[userDefaultssetObject:convertDateforKey:@"startDate"];[userDefaultssync

iphone - NSDictionary 添加 NULL 键值

所以我创建了一个NSDictionary来提供要使用的方法数据,但是键数组中的一些键值并不总是用值填充..假设我有18个键(我有)..我可能在一个调用中只使用5个,而在另一个调用中使用6个,甚至在我的代码中的某些点上使用全部18个。我想知道的是如何将NULL值添加到这些键中,以便稍后当我查看键值对时,我可以看到哪些键是我需要担心的,哪些是我可以忘记的?所以问题是,如果我想向键添加任何内容/空值,我该怎么做而不会导致错误或认为它是数组nil的末尾..这是我目前拥有的,但是当我尝试阅读NSDicionary时,它给我一个错误的exe错误NSDictionary*sendSeriesDict

objective-c - 插入对象 : atIndex: - index 3 beyond bounds for empty array

我根据字典键创建一个数组:factsBuiltArray=[NSMutableArrayarrayWithCapacity:6];if([statusDictcount]==10){for(NSString*keyin[statusDictallKeys]){if([keyisEqualToString:@"currenciesAndConversions"]){[factsBuiltArrayinsertObject:keyatIndex:0];}elseif([keyisEqualToString:@"languageAndTranslations"]){[factsBuiltAr

iphone - -[__NSArrayM objectAtIndex :]: index 4294967295 beyond bounds for empty array with arc4random

编辑:我将arc4random()替换为arc4random_uniform()进行修复我正在使用试飞来监控坠机事故。一直在修复错误,但是我遇到了这个错误,我不确定为什么索引这么大。-[__NSArrayMobjectAtIndex:]:index4294967295beyondboundsforemptyarray很可能这就是bug所在for(NSUIntegeri=0;i导致此处崩溃//FrogNameCaptionNSString*tempCaption=[defaultFrogImageCaptionobjectAtIndex:[defaultFrogImageCaptionc

iphone - UISlider minimumValueImageRectForBounds : and super maximumValueImageRectForBounds returns empty rectangle

我将UISlider子类化以使拇指变小,并且我想覆盖minimumValueImageRectForBounds和maximumValueImageRectForBounds以使其宽度减少2px。所以我的代码是-(CGRect)minimumValueImageRectForBounds:(CGRect)bounds{CGRectstdRect=[superminimumValueImageRectForBounds:bounds];returnCGRectMake(stdRect.origin.x+2,stdRect.origin.y,stdRect.size.width-2,std