ios - Detect If between time periods -


I'm having trouble with the code given below. What's the problem with it? I have tried to define the NSUInteger as int , but it still does not work.

  NSCalendar * cal = [NSCalendar currentCalendar]; NSDateComponents * Component = [KAL component: NSHourCalendarUnitDate: now longer]; NSLog (@ "% LD", [hours of components]); NSUInteger * timeHour = [component hours]; If it is between 5 and 9 in the morning for the code, then it can be ascertained that    

. >

Anything that is timeHour & lt; 5 Automatically timeHour> 9 . You are desirous of these two situations, which can never be true at the same time, so you will always make a wrong return.

In addition, if is nothing in the block

if (timeout => 5 & amp; amp; Time holes & lt; = 9) {// stuff}

timeHour> = 5 gives the right for anything where is greater than

Time gives the right for anything where timeHour is 9 or less.

another amp; Amp; Both and b are correct.


Edit: Also ... NSUInteger * timeHour = [components hour];

There is a problem in this line that I have caught. You are defining timeHour as the NSUInteger POINTER as NSUInteger . Get rid of * and try again.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -