Created
June 22, 2012 12:54
-
-
Save rraallvv/2972592 to your computer and use it in GitHub Desktop.
Storing integer into NSValue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int theInt = 123; | |
// storing value | |
NSValue* valObj; | |
valObj = [NSValue value:&myVal withObjCType:@encode(int*)]; | |
// retrieving value | |
[valObj getValue:&valPtr]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I came here because I needed to return an
NSValue
containing anNSUInteger
within OCMock (to stub a method that returns anNSUInteger
).OCMock wants me to specify
@encode(NSUInteger)
not@encode(NSUInteger *)
so perhaps that is the "correct" way to do it? I dunno.