2015-01-30 5 views
1

cordova geolocation API를 사용하여 Jquery 모바일 애플리케이션을 개발 중입니다.코르도바 Geolocation API가 작동하지 않습니다 IOS 8

코르도바 : 3.6.3, 위치 정보 : 1.4.4

암이 다음 코드

를 사용하여 정확한 현재 위치를 점점 : 코르도바 플러그인은 org.apache.cordova.geolocation (최신 버전),
jQuery를 모바일을 추가
navigator.geolocation.getCurrentPosition(drawMap,handleError, { 
     enableHighAccuracy: true, 
     maximumAge : 0, 
     timeout : 60000 
    }); 

감시 위치에 문제가 있어도 알 수없는 오류가 발생합니다. IOS-6

watchProcess = navigator.geolocation.watchPosition(handleSuccess, 

    handleError, { 
       enableHighAccuracy: true, 
       maximumAge : 0, 
       timeout : 60000 
      }); 
switch(error.code) 
    { 
     case error.PERMISSION_DENIED: 
      alert("User did not share geolocation data"); 
      $(".ajax-loader").hide(); 
      break; 
     case error.POSITION_UNAVAILABLE: 
      alert("Could not detect current position"); 
      $(".ajax-loader").hide(); 
      break; 
     case error.TIMEOUT: 
      alert("Retrieving position timed out, could not detect your location"); 
      $(".ajax-loader").hide(); 
      break; 
     default: 
      alert("Unknown Error"); // Always getting Unknown Error 
      $(".ajax-loader").hide(); 
      break; 
    } 
에서 잘 작동 동일한 코드 는 추가 내 플랫폼/IOS/NavSustain/config.xml 파일의 코드하지만 행운 다음 시도

<gap:config-file platform="ios" parent="NSLocationAlwaysUsageDescription" overwrite="false"> <array> <string>Allow GPS</string> </array> </gap:config-file> 

내 config.xml 파일은

입니다

<?xml version='1.0' encoding='utf-8'?> 
<widget id="com.navsustain.navsustain" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> 


    <preference name="AllowInlineMediaPlayback" value="false" /> 
    <preference name="AutoHideSplashScreen" value="true" /> 
    <preference name="BackupWebStorage" value="cloud" /> 
    <preference name="DisallowOverscroll" value="false" /> 
    <preference name="EnableViewportScale" value="false" /> 
    <preference name="FadeSplashScreen" value="true" /> 
    <preference name="FadeSplashScreenDuration" value=".25" /> 
    <preference name="KeyboardDisplayRequiresUserAction" value="true" /> 
    <preference name="MediaPlaybackRequiresUserAction" value="false" /> 
    <preference name="ShowSplashScreenSpinner" value="true" /> 
    <preference name="SuppressesIncrementalRendering" value="false" /> 
    <preference name="TopActivityIndicator" value="gray" /> 
    <preference name="GapBetweenPages" value="0" /> 
    <preference name="PageLength" value="0" /> 
    <preference name="PaginationBreakingMode" value="page" /> 
    <preference name="PaginationMode" value="unpaginated" /> 
    <feature name="LocalStorage"> 
     <param name="ios-package" value="CDVLocalStorage" /> 
    </feature> 
    <feature name="Geolocation"> 
     <param name="ios-package" value="CDVLocation" /> 
    </feature> 
    <name>NavSustain</name> 
    <description> 
     A sample Apache Cordova application that responds to the deviceready event. 
    </description> 

    <gap:config-file platform="ios" parent="NSLocationAlwaysUsageDescription" overwrite="false"> <array> <string>Allow GPS</string> </array> </gap:config-file> 

    <author email="[email protected]" href="http://cordova.io"> 
     Apache Cordova Team 
    </author> 
    <content src="index.html" /> 
    <access origin="*" /> 
    <feature name="NetworkStatus"> 
     <param name="ios-package" value="CDVConnection" /> 
    </feature> 
    <feature name="Notification"> 
     <param name="ios-package" value="CDVNotification" /> 
    </feature> 
    <feature name="SplashScreen"> 
     <param name="ios-package" value="CDVSplashScreen" /> 
     <param name="onload" value="true" /> 
    </feature> 
</widget> 

귀하의 도움에 감사드립니다. 고마워요

답변

0

마지막으로 문제가 발견되었습니다. Xcode를 최신 버전 인 Xcode 6으로 업데이트했습니다. 이제 정상적으로 작동합니다.

관련 문제