incompatible integer to pointer conversion unsigned long

Hello


I have a code to create my own function but it gives me a warning:


- Incompatible integer to pointer conversion assigning to 'SMUserKey *' (aka 'unsigned long *') from 'int'

- Incompatible integer to pointer conversion sending 'SMUserKey' (aka 'unsigned long') to parameter of type 'SMUserKey *' (aka 'unsigned long *')

When I run the app, it works fine, but I dont want the warnings.


This is my .h code:


typedef NSUInteger SMUserKey;



NS_ENUM(SMUserKey) {

SMUsername = 1,

SMFirstName = 2,

SMLastName = 3,

SMFullName = 4,

SMEmail = 5,

};


This is my .m code:


-(void)awakeFromNib {

NSString *result = [SMUsergetValueForKey:SMUsername];

NSLog(@"THE RESULT: %@", result);

}


+ (NSString *)getValueForKey:(SMUserKey*)myUserKey {

NSString *myUserKeyValue = nil;

if ((myUserKey = 1)) {

myUserKeyValue = @"Username";

}

return myUserKeyValue;

}



This is the image showing the warnings:


User uploaded file

iMac, OS X Yosemite (10.10)

Posted on Jun 15, 2016 8:24 AM

Reply
1 reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

incompatible integer to pointer conversion unsigned long

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.