I am writing a program using Xcode 8.3.3 with Swift 3.1 for iOS 10. This program is a messenger, so it can send and receive messages from other users. This application has several screens (contacts, stats, chats, etc.) and one background thread which receives incoming messages. I need to determine should I show to user a new incoming message or not. I mean if Single Chat Screen with somebody is open I do not need to show user a message, but on any other screen I need to show pop up view. So I need to determine, which View is currently open and receive variable from this view (in my case it is var chat: Chat!, it contains chat ID) to determine which chat received a message. Every messenger has similar functionality: WhatsApp, Viber. Does anybody knows how to do this?
I will be thankful for any help or advice.
I do not understand: why this question is going down? Whats wrong with it?
I think for your case each of your views must have his own chatID and when you receiving some message you have to compare the chatID of your message and your view
Related
have an interesting problem I need to solve, I was hoping if anyone could give me some sort of an idea.
For example, if I get a text from someone saying (string) “URGENT” on my iPhone, I want to call them immediately.
So say I get a message, it could be any message but if their message says “urgent”, I need to call them ASAP, even when my phone is turned off.
Is there a way to do this, using API or anything?? I have no idea!!
Example say I get a messages saying:
Number 042XXXXX sends me a text:
"Hi Name, I have some urgent work for you"
Number 1300 XXX XXX sends me a text:
"Urgent help needed"
Both of these messages would be read by iPhone and their respective numbers would be dialled urgently.
Is there such a way to do this/automate this??
Any advice would be appreciated!!
I have no idea what to do, I am blank!!
I think the problem you have needs an indirect solution because, as Paulw11 points out, Apple don't allow you to inspect the message directly.
It would be possible to make use of Twilio's Programmable SMS API to setup a special phone number that customers could send text messages to. Then you use the APIs of Twilio to read the messages and then send an Apple Push Notification message for those the had "urgent" in the message.
You could then write an iOS app which receives push notification messages and takes the actions you desire. For example, it could present a screen which could automatically dial the number in question.
I have searched and have not been able to find a definitive answer. I know that it is not possible to get the phone number of the current caller using Objective-C, but I don't need the number.
I want to send a text message to the current caller. Does iOS have a method to allow you to send a text message from an app to the current caller.
The scenario is this:
End user calls another user
They put the person they called on speaker phone and navigate to my app
The app has a button that allows them to share information via SMS to the person they are talking to while they are talking to them without having to do anything more than click a button (the user doesn't have to type the other person's phone number manually to send the SMS).
Sukhdeep is correct.iOS will never allow you to perform Messaging without user involvement.
The answer is No.
Apple will never allow you this.
Is it possible to send a text immediately inside an app. I have implemented the sms send. I just want to bypass the screen where the user has to press send.
There is no way to bypass the MFMessageViewController screen where the user has to tap "send." I assume Apple has designed it this way to prevent an app from potentially spamming a user's contact list.
In addition, there is no way to detect income SMS. Both these features are strictly reserved for the native Messages app.
For more information on sending an SMS on iOS check this out.
One alternative is to implement sending and receiving messages within your app using a web service to store and retrieve messages. For example, you could use a messages library like JSQMessagesViewController documented here and for simplicity's sake, you could use a BaaS like Parse.
This screen display an authentification code even on the lock screen.
I've googled it and found absolutely nothing about it. I even don't know the name of the component.
Is it possible to be a special push notification ?
I need to know which class provide this view that is displayed on the lockscreen.
Found the answer !
This is a "Class 0 sms", that is displayed as full screen by the OS.
Class 0 SMS: This message is displayed on the mobile phone immediately
and a message delivery report is sent back to the SC. The message does
not have to be saved in the mobile phone or on the SIM card (unless
selected to do so by the mobile user). This type is also referred to
as Flash SMS.
See for details :
http://www.ozekisms.com/index.php?owpn=544
From what I can tell, this is not possible, but I wanted to ask in case there were any potential workarounds that have cropped up recently.
Ultimately, I want to programmatically send a message (of some kind) to whoever is calling (while my app is active).
Thank you for any help.
Not possible. Neither is programmatically sending a text message (assuming you mean sending a message from the user's phone).