菜鸟教程小白 发表于 2022-12-13 06:54:58

ios - 使用 iBeacon 打开应用


                                            <p><p>我对 iOs 7.1 的新版本感到非常兴奋,它对 iBeacon 进行了重大更改,如下所述:<a href="http://beekn.net/2014/03/apple-ios-7-1-launches-major-ibeacon-improvement/" rel="noreferrer noopener nofollow">http://beekn.net/2014/03/apple-ios-7-1-launches-major-ibeacon-improvement/</a> </p>

<p>这里:<a href="http://beekn.net/2014/03/prisoners-dilemma-ios-7-1-challenges-ibeacon-developers/" rel="noreferrer noopener nofollow">http://beekn.net/2014/03/prisoners-dilemma-ios-7-1-challenges-ibeacon-developers/</a> </p>

<p>根据话题,他们说</p>

<blockquote>
<p>In iOS 7.0 you could just close off the app and it would stop sending
you messages. Now, the app doesn’t even need to be open or in the
background to work.</p>
</blockquote>

<p>据我所知,当应用程序关闭(不在后台)或发送任何本地通知时,您无法执行任何操作。 </p>

<p>那么您如何知道 iOs 7.1 设备是否已进入 iBeacon 区域?
如果你能在一个关闭的应用进入 iBeacon 区域时捕捉到它,你能唤醒它(打开它)吗?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>简而言之,是的。
我已经在一个应用程序中实现了这一点,并在进入信标范围后调用:</p>

<pre><code>- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region;
</code></pre>

<p>那时我的应用程序在后台。如果它被终止重新打开但留在后台。我设置为 CLLocationManager 委托(delegate)的类接收到上述方法的回调,并在我的情况下发布本地通知。
但是,您也可以直接触发打开应用程序。</p>

<p>商店中有一个很棒的小示例应用程序,名为 Hide My iPhone by John Yorke。他开源了代码<a href="https://github.com/johnyorke/HideMyPhone" rel="noreferrer noopener nofollow">here</a>它展示了如何在应用程序中设置和响应信标。 </p>

<p>我还使用了 Apple 的指南 <a href="https://developer.apple.com/library/ios/documentation/userexperience/conceptual/LocationAwarenessPG/Introduction/Introduction.html" rel="noreferrer noopener nofollow">here</a>了解更多信息。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 使用 iBeacon 打开应用,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/22475402/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/22475402/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 使用 iBeacon 打开应用