Apple push notifications and Emoji characters - ios

I recently found this very interesting article on APNS and Emoji characters: EASY APNS - Just for fun
It contains a list with all supported Emojis. However, I couldn't get them to display in my push notifications. All I get is the code, not the image. For example, if I add \ue415 (a smiley) to my message, I never see the image, just the code.
Any idea what I'm doing wrong?

NSString *emoji = [NSString stringWithFormat:#"%C", 0xe415];

check out this site http://code.iamcal.com/php/emoji/
he does the emoji in php.
i use this command to achieve a emoji on the iphone.
emoji_unified_to_softbank("\xee\x80\xac");
Q

If you happen to be using Rubymotion for iOS dev the you can use the softbank code converted like this:
softbank code: U+E04A
Rubymotion string sent as push: "This is a sun with rays emoji \ue04a"

Related

malformed number error in push notification ios

I am making an ios application and using push notifications. When I copy and paste the following notificatiom everything works fine.
{"aps":{"alert":"Temperature reached to 37.3.Board: raspberrypi.Time: 2015-07-09T14:02:02.0000000","badge":1,"sound":"default"},"AdditionalInfo":"","SensorType":"Temperature"}
When I use the following notification it says payload has been pushed, but I never receive the notification.
{"aps":{"alert":"Humidity reached to 69.0.Board: onshore_raspberrypi.Time: 2015-07-09T10:31:00.0000000","badge":1,"sound":"default"},"AdditionalInfo":"","SensorType”:”Humidity”}
And at the bottom right corner I get the following message: "malformed 187". The link to the screen shot is below.
Screen shot of push notification
What does malformed mean? And how I can fix it?
Your second string is an invalid JSON string. Use a site like this to validate.
You had curly quotation marks instead of straight quotation marks in some places. I removed and replaced them with the correct ones. The following JSON should work!
{"aps":{"alert":"Temperature reached to 37.3.Board: raspberrypi.Time: 2015-07-09T14:02:02.0000000","badge":1,"sound":"default"},"AdditionalInfo":"","SensorType":"Humidity"}

How to get data(string,url,image,etc) from UIPasteboard while App is in Background State

i was digging on "How to get data from UIPasteboard while App is in background state" but could not find something useful.i followed this Link
and this but not helpful. any suggestions will be appreciated.
Daan Raman had a tutorial here. It have everything you want.
There are total 4 type of UIPasteboardNotifications
UIPasteboardChangedNotification;
UIPasteboardChangedTypesAddedKey;
UIPasteboardChangedTypesRemovedKey;
UIPasteboardRemovedNotification;
UIPasteboardChangedNotification generate notification when the pasteboard item changed. UIPasteboardChangedTypesRemovedKey and UIPasteboardRemovedNotification are the changes which are mode in pasteboard dictionary. UIPasteboardRemovedNotification when an app remove the pasteboard object.

iOS - Pinterest Sharing Description Text not working if I send "&" in description text

I had implemented pinterest sharing code in my app as well. Its working fine. But problem arrives at one scenario see follow
Correct working:
[pinterest createPinWithImageURL:[NSURL URLWithString:imageUrl]
sourceURL:[NSURL URLWithString:[NSString stringWithFormat:#"%#",shareUrl]]
description:#"My Description"];
Then it will share Pinterest Description same My Description as per my expectation.
But when I send Description Test like :
[pinterest createPinWithImageURL:[NSURL URLWithString:imageUrl]
sourceURL:[NSURL URLWithString:[NSString stringWithFormat:#"%#",shareUrl]]
description:#"My Details & Description"];
Then it will share Pinterest Description like My Details.
My expected text here is My Details & Description this is trunks my string after & symbol.
What actually wrong happening with me please look at here.
AFAIK, Pinterest's Pin It SDK isn't open source, so it's difficult to find out what's really going on.
I would guess, however, that this method is creating a GET request under-the-hood that's incorrectly URL encoding the description parameter (perhaps they're using stringByAddingPercentEscapesUsingEncoding or some other naive method).
I'd recommend contacting the Pinterest SDK developers/maintainers to look into this.
As a quick fix, you might try URL encoding the & yourself. For example, you might try replacing & with %26, e.g.
NSString *description = // ...whatever it should be set to...
description = [description stringByReplacingOccurrencesOfString:#"&" withString:#"%26"];
However, this might actually lead to other problems as the Pinterest SDK is likely doing some sort of URL encoding and would likely encode the % symbol.
Another naive approach may simply be to replace & with the word and, such as
NSString *description = // ...whatever it should be set to...
description = [description stringByReplacingOccurrencesOfString:#"&" withString:#"and"];
Again, it's hacky, but it's a workaround for a bug that's likely in the underlying SDK.

my apostrophe turns into ’

i'm trying to send the iOS device name along with the deviceToken to my server in didRegisterForRemoteNotificationsWithDeviceToken.. my device has an apostrophe in it and the request string shows as ....&name=John+Doe’s+iPhone ...
I've tried replacing "'" with "" and "’" with "" .. but neither fix it.. i assume i need to convert the encoding?
NSString *string = [[UIDevice currentDevice] name];
output-> John Doe’s iPhone
EDIT
output is from
NSLog(string);
You should never use NSLog with a user-provided string like that. NSLog expects a format string for its first argument. If it's something containing a format specifier, it will probably crash your application, and may expose a security hole if provided by an untrusted source.
Your encoding issue appears to be a bug in LLDB. Switching to GDB fixes the problem.
Wait, you're doing NSLog(string)? You need NSLog(#"%#", string)

Unable to get UIAutomation iOS UILabel value

I am trying to get the value "HELLO" of the UILabel shown in the iPad simulator.
I have enabled accessibility and have set the label as "Label Access".
But when I call target.logElementTree(), both the name and value are set to "LabelAccess" and as far as the apple docs say, the value field should contain the string that is set (in this case "Hello").
Does anybody know a fix for this?
PS: I am using the latest iOS SDK and Xcode.
Apple Stack Exchange
I think you encountered a UIAutomation bug that exists since forever.
Easiest way to get around this bug is to set the accessibilityValue to your text in code.
Something like this.
NSString *valueString = [NSString stringWithFormat:#"%d", value];
self.label.text = valueString;
self.label.accessibilityValue = valueString;
Helps those people that use Voice Over too ;-)
thanks for the workaround. Doesn't look like this bug has been fixed.
Came across this while writing Appium test for the iOS app. The element found by the driver somehow only contains accessibilityLabel and accessibilityIdentifier but not the actual text that's shown on the screen.
<XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value=<accessibilityLabel> name=<accessibilityIdentifier> label=<accessibilityLabel> .../>
Has someone found if this issue has been logged with apple?
EDIT: Refer to this answer and the comment underneath. https://stackoverflow.com/a/11411803/4725937
Basically need to use [accessibilityValue]: https://developer.apple.com/documentation/uikit/uiaccessibilityelement/1619583-accessibilityvalue for accessible components for the display text to show up as XCUIElementTypeStaticText.value in the page source.
For eg:
someUILabel.accessibiityLabel = "This is used for voice-over"
someUILabel.accessibilityValue = "This is displayed text"

Resources