[英]Push Notification without using internet,wifi,APNS and apple push notification server
I need to write an IOS app to let a few IOS devices to send local notifications to each other WITHOUT external Internet connection (without using APNS -- apple push notification server). 我需要编写一个IOS应用程序,让一些IOS设备在没有外部Internet连接的情况下相互发送本地通知(不使用APNS - 苹果推送通知服务器)。 The environment will be a private internal WIFI network with a dedicated server...
环境将是一个私人内部WIFI网络,带有专用服务器......
Scanario Scanario
we work in a bank office all 14 people using Iphones Person A send notification to rest of the 13 people all will recieve the notification one person in the group (for example, Person H) reply back and Person A can recieve Person H's reply not external internet all iphone what we have is a private wifi network, set up by a server . 我们在银行办公室工作所有14个人使用Iphone人员A发送通知给13个人中的其他人都将收到通知组中的一个人(例如,人H)回复和A人可以收到人H的回复而不是外部互联网所有iphone我们拥有的是一个私人wifi网络,由服务器设置。 TOTALLY NO LINK to outside world..no link to outside internet
完全没有链接到外面的世界..没有链接到外部互联网
If it is possible in ios app. 如果有可能在ios应用程序中。 using swift 3.0.
使用swift 3.0。 If It's possible can you please guide me.
如果有可能请指导我。
You can implement this kind of functionality by using a combination Background fetch ( Apple documentation ) and local notifications , if you have a server inside the network that contains the information which is needed to show the notification. 如果网络中的服务器包含显示通知所需的信息,则可以使用组合后台提取 ( Apple文档 )和本地通知来实现此类功能。 Conceptually this would work like this:
从概念上讲,这将是这样的:
There are three things to remember in this approach, though. 但是,这种方法有三点要记住。
EDIT: For example like this: 编辑:例如这样:
AppDelegate.didFinishWithLaunchOptions
method, for example: AppDelegate.didFinishWithLaunchOptions
方法中设置最小间隔,例如: UIApplication.shared.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum)
func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping
(UIBackgroundFetchResult) -> Void {
fetchData() { data in
if data.needsToBeNotified {
sendLocalNotification()
}
completionHandler(.newData)
}
}
RayWenderlich have a nice tutorial about the background modes: https://www.raywenderlich.com/143128/background-modes-tutorial-getting-started RayWenderlich有一个很好的关于背景模式的教程: https ://www.raywenderlich.com/143128/background-modes-tutorial-getting-started
The scenario can be addressed using MQTT Protocol within the Wi-Fi network. 可以使用Wi-Fi网络内的MQTT协议来解决该场景。 You will have to set up an MQTT Broker within the network and Make an MQTT Client in your iOs App.
您必须在网络中设置MQTT Broker并在您的iOs应用程序中创建MQTT客户端。 You can subscribe the MQTT Client to the MQTT broker on a topic same as GCM works and use MQTT Broker to send Push Notification to topics subscribed by MQTT Clients.
您可以在与GCM相同的主题上将MQTT客户端订阅到MQTT代理,并使用MQTT Broker将推送通知发送到MQTT客户端订阅的主题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.