2014-04-25 3 views
0

래칫의 push.js를 사용하려하지만 작동하지 않습니다.푸시가 작동하지 않습니다 (오류 : 얻을 수 없음)

[Error] TypeError: 'undefined' is not an object (evaluating 'cacheMapping[PUSH.id].url') 
cachePush (ratchet.js, line 202) 
PUSH (ratchet.js, line 392) 
touchend (ratchet.js, line 258) 

이 모든 실제 장치 테스트 (아이폰 OS 7.1)에서 콘솔 데이터, 래퍼 : 당신이 10 배와 같은 링크를 눌러 경우

[Error] Error: Could not get: file:///var/mobile/Applications/337585D8-89E1-4810-AB37-0A6DD2DA3A34/Gustav.app/www/booking.html 
failure (ratchet.js, line 446) 
onreadystatechange (ratchet.js, line 371) 

는이 수신을 시작합니다 내가 콘솔에서이 코르도바 CLI 3.4.1-0.1.0. 존재 booking.html

파일, 표시되지 않습니다이

[Error] Failed to load resource: The requested URL was not found on this server. (menu.html, line 0) 

같은 기본 사파리에 실패했습니다.

답변

2

push.js은 file : // 프로토콜을 지원하지 않습니다.

Ratchet uses XHR requests to fetch additional pages inside the application. Due to security concerns, modern browsers prevent XHR requests when opening files locally (aka using the file:// protocol); consequently, Ratchet does not work when opened directly as a file. A common solution to this is to simply serve the files from a local server. One convenient way to achieve this is to run python -m SimpleHTTPServer to serve up the files in the current directory to http://localhost:<port>

또한이 코르도바 및 래치를 사용하여있는 일반적인 문제입니다 것 같다 Github에서

에 제출 this issuethis issue를 참조하십시오.

+1

감사합니다. 여기 링크 (https://github.com/artemave/ratchet/commit/5ccfdd765ecd15666b83b0b9abc15e4c120b7713)를 추가하여 file : // support in ratchet를 추가합니다. – lenyapugachev

+0

@lenyapugachev hm은 Cordova와 함께 래칫을 사용하는 것은 실제적으로 의미가 없지만 파일 p. 사용할 수 없습니다. file : //이 지원 될 때를 알고 있습니까? – Kallewallex

+0

ajax 요청은 성공하지만 iOS 7.1에 대한 상태 코드 0을 반환합니다. 'xhr.status === 0 (line 383 : ratchet.js)'는 장치에 설치 될 때 페이지 전환을 허용합니다. – kindasimple

관련 문제