简体   繁体   English

通过蓝牙从iOS应用发送联系人

[英]Sending a contact from an iOS app via bluetooth

I am trying to allow a user, who is running my app, to send a contacts vcard (vcf) via bluetooth to another iOS device. 我试图允许正在运行我的应用程序的用户通过蓝牙将联系人vcard(vcf)发送到另一个iOS设备。 The problem is, that the receiving device should not be required to run the same app. 问题是,不要求接收设备运行相同的应用程序。

Is there a possibiliy to accomplish this? 是否有可能实现这一目标?

If there is not - is it at least possible to have Gamekit to establish a session, when the receiving device is running the same app, but without requiring the (receiving) user to start the peerPicker-dialog? 如果没有-当接收设备运行相同的应用程序时,至少有可能让Gamekit建立会话,而无需(接收)用户启动peerPicker-dialog?

Any help and hints are appreciated! 任何帮助和提示表示赞赏!

First option: seems to be impossible. 第一种选择:似乎是不可能的。

Second option: Works. 第二种选择:有效。 I implemented a GKSessionDelegate for receiving incoming connections. 我实现了一个GKSessionDelegate来接收传入的连接。 This session is startet together with the app. 该会话与应用程序一起启动。 For establishing the connection with a receiver, I used the well known GKPeerPickerControllerDelegate. 为了建立与接收器的连接,我使用了众所周知的GKPeerPickerControllerDelegate。

One remainig problem is, that the sender sees itself in the list of available peers (because it has also a receiver running in the background). 一个剩余的问题是,发件人会在可用对等方列表中看到自己(因为它在后台还运行着一个收件人)。 My solution for this is to set its GKSession.available=NO, as soon as the sender starts its GKPeerPickerController. 我的解决方案是在发送方启动其GKPeerPickerController后立即设置其GKSession.available = NO。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM