How do you specify the heart character in NSSString? I am implementing a network protocol and want to send this as the heartbeat.
This is the Unicode info from character viewer:
Unicode: U+1F493 (U+D83D U+DC93), UTF-8: F0 9F 92 93
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The simplest way would be to type it directly into a string constant in Xcode:
If you need to convert it to bytes in a specific encoding, use
NSData, like this:With an instance of
NSDatain hand, you can access itsbytesandlengthto copy into the heartbeat message.