I’m developing an Messages extension. When it comes time to send a message, I want it to show up as something like: “Jeff sent a message.”
However, the MSConversation APIs only give us identifiers. When you use these identifiers in the MSMessage layout, it’s supposed to convert them to a name. When I attempt to do this, I see that it does indeed convert the identifier, but it converts it to the phone number of the participant rather than their name.
In other words, the following:
layout.caption = "$\(uuidOfTheParticipant) sent a message"
Shows up as “+15555551234 sent a message”. I’d like it to show a name instead of the phone number.
I searched the documentation to verify that this should be the behavior. I found out it was documented in the WWDC 2016 session 224 video. This was called “iMessage Apps and Stickers Part 2”. The video has been taken down since, so I had to rely on this transcript, where it states:
similarly, you can use these identifiers in the text passed to the Messages sumamaryText. When Messages displays the UI for the bubbles with this type of formatting in their text, it will replace the identifiers with the contact name of the person that their identifier maps to.
In both cases, it sounds like the name of the participant should be showing up rather than their phone number.
I tried updating my contact’s number to look exactly like the one that’s being output (I.e. “+1” in front), but it’s still showing the phone number rather than the name.
Does the API no longer show names, or am I doing something wrong?
Related
I am developing an iOS application where I am scanning QRCode and showing result to user. I am scanning QRCode by native libraries provided by Apple. I am able to get string/content from QRCode but I am unable to distinguish and parse string/content. I want to get the type of data (distinguish data type) present in QRCode as it may have different types of data, for example url, text, mcard, email data. I also want to parse content i.e. getting fields of data, for example in case of email data, I want to get email, cc, subject and body field. This question How are different content types within QR-Codes distinguished? did not helped because it does not have accepted answer which can help me.
The .stringValue obtained from a AVMetadataObject scan is just that - a "string value." It is up to you to parse the content.
There are a number of predefined data types, such as
a URL, where the string starts with "https://";
an email link, e.g. "mailto:somebody#example.com?subject=Mail%20from%20Our%20Site"
There is also a "VCard" spec, which may be formatted with "field" values:
BEGIN:VCARD
VERSION:3.0
N:Owen;Sean;;;
FN:Sean Owen
TITLE:Software Engineer
EMAIL;TYPE=INTERNET;TYPE=WORK;TYPE=PREF:srowen#google.com
URL;TYPE=Homepage:https://example.com
END:VCARD
for example.
So, you check the start of the string. If it begins with "https://" your app might launch Safari. If it begins with "mailto:" you could launch the mail app. If it begins with "BEGIN:VCARD" then you'd parse the predefined fields and use the data in your app.
There is a good summary of predefined types here (although, it may be a bit out-of-date): https://github.com/zxing/zxing/wiki/Barcode-Contents
Of course, you can create your own types for your own purposes. For example, you can create a QR-Code that contains:
myTypeA:Robert
or:
myTypeB:Driver
then your app would get the string, take one action if it begins with myTypeA: and a different action if it begins with myTypeB:.
I want to be able to design a storeCard that works as a punch card. Every time someone buys a bread one more punch will need to appear on his pass.
Should looks something similar to the design below.
The image withe the circles is strip#2x.png. What is the best way to update that? I am thinking to change the image with a new one every time I sent push notification and the pass gets an update. But from the documentation I am not sure if I can do that... from the documentation:
https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/PassKit_PG/Updating.html#//apple_ref/doc/uid/TP40012195-CH5-SW1
To send the list of serial numbers, do the following:
Look at the registrations table, and determine which passes the device is registered for.
Look at the passes table, and determine which passes have changed since the given tag. Don’t include serial numbers of passes that the device didn’t register for. If no update tag is provided, return all the passes that the device is registered for. For example, you return all registered passes the very first time a device communicates with your server.
Compare the update tags for each pass that has changed and determine which one is the latest. Return the latest update tag to the device.
Respond with this list of serial numbers and the latest update tag in a JSON payload. For example:
{
"serialNumbers" : ["001", "020", "3019"],
"lastUpdated" : "1351981923"
}
How can I approach this? Do I try to update the whole pass every time when a new push message comes? Is that how the update is done or just some bits of the json file (pass.json) are changed? Is there more clever way to achieve this?
We have a database logic, which sends text messages to phone numbers using webservice. Part of the messages is the string "X.net", which is a brand name. However in the telephones when the message is received this gets transformed into an URL and gets blue letters and gets underlined (because of the ".net"). We would like to avoid this, and instead present this as a simple text. Is there any possibility to do this, and if yes, how?
What is the best way to handle QR code's Information, As QR code can have any information, For now, I want to handle only
1 URL and redirect to safari browser--> its fine
2 vCard and open contact book with contact values, But I'm seeing that VCARDS keys name are not unique(not sure if I'm Having improper QR codes). And also, QR value is a string to how to detect which value is for which key of address book?
e.g:
"BEGIN:VCARD
FN:Ashwin kanjariya
TEL:+999-999-9999
EMAIL:you#we.com
URL:http://www.youandme.com
N:kanjariya;ashwin
ADR:any address
ROLE:software developer
VERSION:3.0
END:VCARD"
So, I'm Not sure for VCARD all keys are universal or not? What is the best way to handle it?
I appreciate your any kind of suggest that can help me to figure out VCARD parsing.
Is CFDataCreate with ABPersonCreatePeopleInSourceWithVCardRepresentation best way to go with?(I have support for below IOS 9 as well)
like
let vCardnsdata = CFDataCreate(nil, UnsafePointer<UInt8>(vCard.bytes), vCard.length)
let addressbookDefaultSrc = ABAddressBookCopyDefaultSource(addressBook)
let vCardPeople = ABPersonCreatePeopleInSourceWithVCardRepresentation(defaultSource.takeUnretainedValue(), vCardData).takeRetainedValue() as NSArray
VCARD has several versions with slightly different implementations, keys don't have to be unique, a person can have multiple home or work phone numbers for example, but you should be able to tell what is a phone number and just accept as many as your customer believes is reasonable for their use case.
An extensive list of what you may find in VCARD's is here: https://en.wikipedia.org/wiki/VCard
If you want to make sure that all the data is stored, then you may have to implement lists, or in database terms, store items in different tables so that one to many relationships can be maintained for several items.
When designing a system to store information about people, you may also want to observe some of the Falsehoods Programmers Believe About Names
In the following URL, that unsubscribes a user from a list:
http://xxxxx.us2.list-manage.com/unsubscribe?
u=87f537bccxx35e53a1890e0d9&
id=40dcxx6cd6&
e=c4aaxx1dd6&
c=9a6xx11963
What does each parameter do?
Today I had to learn what each nondescript parameter means so that I could generate URLs for each email I send through Mandrill. It wasn't that easy to discover their meaning, but here are the one's I've come up with and how I found out what they are.
http://xxxxx.us2.list-manage.com/unsubscribe?
u=87f537bccxx35e53a1890e0d9&
id=40dcxx6cd6&
e=c4aaxx1dd6&
c=9a6xx11963
URL format:
Protocol can be http or https.
Your username comes next
In the example, us2 is the MailChimp datacenter where your account resides. That's different for each account. (https://apidocs.mailchimp.com/api/2.0/) It's good practice to specify a DC even though the documentation says that it isn't required. Specifying it will cut down on unnecessary latency.
list-manage[n].com can work with or without the number at the end of the domain, or it can have a 1 or a 2. Changing that doesn't appear to matter, but I think it has something to do with their load balancing.
/unsubscribe can also be /subscribe or /profile (The latter appears to be dependent on the "e" parameter. (See below) When you don't specify it, it states, "List member profiles cannot be updated from test campaigns or archive pages" and if you specify an invalid value, you get an error page.
u Is a unique identifier for your account. Every list on your account uses it. (See http://kb.mailchimp.com/lists/signup-forms/find-the-unsubscribe-link-for-your-list for how you can view the various URLs for your account.)
id is your list ID
e is the euid as documented on https://apidocs.mailchimp.com/api/2.0/lists/subscribe.php
c I haven't seen this one yet, but my guess is that it's the campaign ID.
Also, when you wish to prefill subscribe and unsubscribe forms, you can use the following GET params.
EMAIL Allows you to enter the subscriber's email
MERGE1 Allows you to enter the subscriber's first name
MERGE2 Allows you to enter the subscriber's last name