How to send custom iMessage view with JSON data and possibility to open it in my app? - ios

I have an app. And now I would like to share the data from one user to another via iMessage app and custom messages like this:
What I need to achieve?
share some JSON content and open it in my app if it is installed on iPhone...
JSON data should be sent from within an app directly...
is it possible?

Related

Passing data between an iOS app on different devices

I’m looking for the best and efficient way to pass a Nested Array [[String]], from my app to the same app on another iPhone.
If let say for example, I have this Array saved on my app:
let array = [[“John”, “27”, “First”, “Castle”],[“Tom”, “25”, “Second”, “Boat”]]
I want to add a Share Button on my App that will allow this array to be shared via Bluetooth/Airdrop/Any Convenient Way between 2 iPhones.
Ideally click share, via airdrop, other user click accepts and clicks open with the app. And data is loaded. What is the best approach In order to achieve this. I looked at Share Extension and UIActivityViewController but can’t see what are the differences about them and what is best for my case to simply send data and receive data from and to my app.
Based on what you have said,
You could just use the UIActivityViewController to export your data to AirDrop (or etc)
and using the exported UTI, your app could open it once it detected.
for Sharing, you will have to use a custom data format (or file) and you can refer to this post, Sending custom data via UIActivityViewController
and for reading your custom file, here is a good tutorial of how to implement the Exported UTI https://www.raywenderlich.com/8413525-universal-type-identifiers-tutorial-for-ios-importing-and-exporting-app-data
Cheers,
Kel
One option (and probably the easiest) is to use iCloud, specifically the NSUbiquitousKeyValueStore.
More information here :
https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestore
use UIActivityViewController to export your data using AirDrop. You can read the same in your app on other phone when it detects the exported UTI.

What's the best way to create a custom sharing method on iOS?

A streaming app that I'm using on iOS has a share button that allows me to hook into the sharing app extension. I'd like to be able to send the URL string that it has to a custom API on my server.
Would I need to create an entire app just to have that custom sharing method, or is there another way?
If that's the only way, how can I get that app on my phone without going through the store?
It seems like when I create, build and install apps through Xcode, Apple intentionally breaks the app after a short while?

How can I pass data from app extension to host application and upload it Firebase?

I am using an app extension to allow users to save webpage URLs to my app so I can display them in a UITableView. I have created the action extension but I'm especially struggling with uploading the data to Firebase. I know it is not performance-friendly to upload to Firebase from the Action Extension, so I want to send the URL back to the host app to be processed. The one question I have though -- how can I notify the host app that a new URL has been retrieved using the action extension so I can upload it to Firebase?
I was planning on using delegates and protocols, but there is no way to use them in app groups. I also have looked into MMWormhole, but I am not sure how that would work with my app's needs.
How can I notify the host app that a URL has been retrieved using the action extension so I can upload it to Firebase?

Is it possible to open my application from iMessage app link?

I have an app where you can have your favorite restaurant listed and add their details like name,image,comment,rating,etc.
Now I need to support a feature of share restaurant what I am doing right now is I am storing the data to Firebase so that data can be shared.
What I would like to do is I want to create a link for the same.. which will be sent in the iMessage when clicked on share button and then when the person with whom I shared my restaurant detail clicks on the link in the iMessage I want to open the app in his device ?
So that I can load data of the restaurant from firebase and show them in the app.
P.S. the app is actually offline that is not storing on the server. Just to support the above feature I am sending data to firebase. so that I can retrieve it !
You can use firebase dynamic links for that:
https://firebase.google.com/docs/dynamic-links/?authuser=0
You can also send some parameters in the dynamic link.

Send some data to contact from app (Objective-C, Swift)

Is there any way I can send some data to contact from contacts app? for example some string or integer? E.g. I have an app, when user open it the app shows all contacts from Contacts app. and when he tap one of the contact the app must send data to the persons phone. Must I do it with web service or there is any way to do it without web service?
P.S. sorry for my english!
There is no way to do this using built-in iOS libraries without invoking a UI. You can send an SMS message using the MFMessageComposeViewController class. That displays a UI to the user. If I remember correctly you can prepopulate the view with the content you want to send, but the user can edit it.
Likewise there is the MFMailComposeViewController for sending email, with or without attachments.
If you want to send data to another user without displaying a UI to the user you will need to either use a webservice or come up with your own system (involving a server you manage, a TCP socket connection between copies of your app running on both devices, or some other custom development)

Resources