1

I store some floats in my app delegate, then synthesise it in the .m of the app delegate.

Now when I come to use that float in one view controller I do this:

del = [[UIApplication sharedApplication] delegate];
CGFloat PUEresult = (*(del.FacilitiesLoad) / *(del.ItLoad));

(ItLoad and FacilititesLoad are both the floats stored in my delegate)

Now in the next controller I do the same thing:

CGFloat localPUE = (*(del.FacilitiesLoad) / *(del.ItLoad));

That always returns inf why is this and how do I stop it doing this?

I've not been working with obj-c for long so be nice please.

Removing pointers does this:

Invalid operands to binary expression ('CGFloat *' (aka 'float *') and 'CGFloat *')

dev6546
  • 1,412
  • 7
  • 21
  • 40
  • 2
    Why are all those asterisks there? –  Sep 05 '12 at 16:43
  • Please share the definition of FacilitiesLoad and ItLoad - but I have a feeling that the answer will include removing some asterisk (you are treating those two properties as pointers - but they are likely just float values) – driis Sep 05 '12 at 16:45

1 Answers1

4

CGFloat is a primitive type, no needs to use * symbol. Try to remove it in all places where you use CGFloat and check result again

Don't forget to cast youp app delegate to your type:

del = (MyAppDelegate*)[[UIApplication sharedApplication] delegate];
beryllium
  • 29,669
  • 15
  • 106
  • 125