2016-04-06 11 views
0


現在、ハイブリッドアプリケーション(Ionic)に取り組んでおり、iOS(現在9.2で開発中)でiBeaconsを検出する際に問題があります。ビーコンを検出するためにcordova-plugin-estimote(https://github.com/evothings/phonegap-estimotebeacons)を使用していて、そのドキュメントに従っていますが、Androidではすべて正常に動作しますが、iOSでは正常に動作しません。ビーコンは単に検出されません。エラーはありません。何も見つかりません。

楽しい事実:iPhoneで元の推定アプリケーションをダウンロードしたときに、ログインするまでiBeaconsも検出されませんでした。その後、正常に検出され始めました。なぜこうなった?iOSアプリケーションがiOS上でiBeaconsを検出していない

プラグインのドキュメントに基づいて、私のAngularJSコードの関連部分:

$scope.init = function() { 
    bluetoothSerial.isEnabled(scanBeacons, errorBluetooth); 
} 

function scanBeacons() { 
    startScanning(); 
    updateList = $interval(updateView, 5000); 
} 

function startScanning() { 
    console.log("requesting permissions"); 
    estimote.beacons.requestAlwaysAuthorization(successAuth, errorAuth); 
} 

function successAuth(){ 
    console.log("success auth, starting scan"); 
    estimote.beacons.startRangingBeaconsInRegion(
     {}, 
     onMonitoringSuccess, 
     onError); 
} 

function errorAuth(){ 
    console.log("error auth"); 
    popupService.showPopup("Authorization error", "Location services required to perform scanning"); 
} 

function onMonitoringSuccess(regionState) { 
    console.log("monitoring success: "+JSON.stringify(regionState)); 
    var successHandler = function (response) { 
    $scope.downloadedlist = response; 
    $scope.offline = false; 
    }; 
    var errorHandler = function (response) { 
    $scope.beaconList = regionState.beacons; 
    }; 
    eventService.getBeaconList(regionState.beacons, storageService.getEventId()) 
    .then(successHandler) 
    .catch(errorHandler); 
} 

function onError(response) { 
    console.log("monitoring error: "+JSON.stringify(response)); 
    popupService.showPopup('popup.error.title', 'popup.error.server'); 
} 

あなたが見ることができるように、私はいくつかにconsole.logステートメントを持っている(それはこの方法を行う必要があり)、私は要求して「取得しています直ちに "成功認証、開始スキャン"が続きます。認可ポップアップが表示されているが、コードがユーザーの入力を待たずに自動的に成功ハンドラ(successAuth)関数を起動するだけで、それは異常です。監視の成功、エラーなし、ビーコンが見つからないログはこれ以上ありません。

助けてください。ありがとう。

答えて

0

最後に解決策が見つかりました。問題はここにあった:

estimote.beacons.startRangingBeaconsInRegion(
    {}, 
    onMonitoringSuccess, 
    onError); 

は、Androidには、次のような機能で、{}パラメータ(すべての地域を探し意味)することができますが、iOS版にはない判明します。地域を指定すると、私のアプリケーションは成功裏にビーコンを見つけます。

例:

function successAuth(){ 
console.log("success auth, starting scan"); 
var region = { uuid: 'YOUR_UUID_HERE' } 
estimote.beacons.startRangingBeaconsInRegion(
    region, 
    onMonitoringSuccess, 
    onError); 
} 

Estimoteデベロッパーの引用:

のiOSのみ、あなたが知っているUUIDそのビーコンをスキャンすることができます。すべてのEstimoteビーコンには、デフォルトのUUID「B9407F30-F5F8-466E-AFF9-25556B57FE6D」が付属しています。これはログインしていなくてもレーダーで見ることができるビーコンです。このUUIDを別のものに変更すると、 EstimoteアプリがあなたのビーコンのUUIDを知ることができるようにログインしておき、デフォルトのUUIDに加えてそれをスキャンします。

出典:。Estimoteアプリケーションはログイン後にiBeaconsを検出し始めた理由も説明してhttps://forums.estimote.com/t/beacons-not-detected-using-estimote-ios-app/1580/5

関連する問題