I’m working on an in-app email function, and right now I have the line [mailer setSubject:@"Someone has sent you a haiku."];. How do I set it so that “Someone” is replaced by the name of the iPhone’s owner, and the subject is “John Doe has sent you a haiku”?
I’m working on an in-app email function, and right now I have the line
Share
As discussed in this post you can’t get the user’s name since it is a privacy issue. You can ask the user for his or her name in a first time application setup and then store this information. Of course you’d want to provide a way for the user to change it later via a settings view or similar.
You can, however, find the name of the iPhone you are running on and these are typically named like “John’s iPhone”. So you might find it acceptable to send messages like “John’s iPhone has sent you a haiku.”. If this works for you, you can get the iPhone’s name and insert it into your string as follows: