2019년 11월 9일 토요일

react-native run-ios --simulator="iPhone 6"


react-native run-ios  --simulator="iPhone 6"

2019년 11월 8일 금요일

PHP로, 카카오 주소 -> 좌표 전환, (다음 주소 -> 좌표 전환)






<?php


$address = "부산광역시 연제구 연산동 중앙대로 1001";


$address = urlencode($address);


//$address = urlencode(trim($address));


$url = "https://dapi.kakao.com/v2/local/search/address.json?query=" . $address;


$headers = array("Authorization: KakaoAK 키값",


"Content-Type: application/atom+xml; charset=UTF-8");


$curl = curl_init();


curl_setopt($curl, CURLOPT_URL, $url);


curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);


curl_setopt($curl, CURLOPT_HEADER, 0);


curl_setopt($curl, CURLOPT_HTTPGET, true);


curl_setopt($curl, CURLOPT_POST, false);


curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);


$return_data = curl_exec($curl);


curl_close($curl);


$return_address = json_decode($return_data,TRUE);


//print_r($return_address);


echo $return_address['documents'][0]['x'];


echo "<br>";


echo $return_address['documents'][0]['y'];










?>






2019년 11월 2일 토요일

react-native 이미 실행되어 있는 에뮬레이터에, 간단히, apk 인스톨 하는법

C:\choco\android\app\build\outputs\apk\release>adb install -r app-release.apk


adb install -r app-release.apk

버츄얼 머신, 맥os 시작 에러 해결, E_FAIL (0x80004005)

The VM session was closed before any attempt to power it on.

결과 코드:
E_FAIL (0x80004005)
구성 요소:
SessionMachine
인터페이스:
ISession {c0447716-ff5a-4795-b57a-ecd5fffa18a4}

다른 블로그따라,

확장팩까지 설치한 후에도,

The VM session was closed before any attempt to power it on.
E_FAIL (0x80004005)

이 에러가 떳다

문제의 원인은,

제가,

관리자 권한으로

버츄얼 박스를 실행 하지 않아서 였습니다.



'react-native'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는배치 파일이 아닙니다.

react-native를 깔기 위해서

여러가지 블로그와 검색을 했다.

위 제목과 같은 에러가 계속 떴다

이유는

내가

자바 jdk를 안깔았다는 것과

환경 설정을 안해주었다는것

그 뒤에

꼭!! 중요한것은 

컴퓨터 재부팅을 해주어야 하는 것 이었다.

리액트 네이티브 실행이 안된다면
모든 환경변수 등록후
컴퓨터 재부팅 꼭 하세요.

Unexpected token < in JSON at position 0

오늘 아작스를 이용하는 과정에서

이 에러가 떴다

이유를 찾아 보니

php 부분 헤더 파일로 묶어 놓은 스크립트들이 떠 있어서 그랬다.

예를 들어

<?php

   include "header.php";

   위의 header.php에 코드들이 있어서 그랬다.

   그래서 저위에 인클루드(include)부분을 주석을 걸던지,

   제거를 해야 한다.

   그러면 동작한다


   이런 에러 해결을 위해서는,

   순수하게 mysqli connection 과 query만 있으면 동작하기에, 좋을것 같다.

react-native run-iosCommand `run-ios` unrecognized

윈도우 cmd에서


실행
npm install --save react-native@latest
실행
npm i npm@latest -g

실행
react-native init NewProject    <======   (프로젝트 이름을 원하는것으로 쓰세요.)

실행
react-native run-ios



이렇게 해봤는데 실패 했다.

이유는 윈도우에서

실행 해서 이다.


윈도우에서 ios 에뮬레이터 돌릴리면

vmware 를 쓰거나 버츄얼머신(virtual machine)을 써야 한다.

Compatible side by side NDK version was not found, 그리고 at checkExecSyncError (child_process.js:621:11) at execFileSync (child_process.js:639:15) at runOnAllDevices (C:\petme\node_modules\@react-native-community\cli-platform-android\build\c..

컴파일및 에뮬레이터, 실행시 에러
> Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.

> Task :app:installDebug FAILED
27 actionable tasks: 2 executed, 25 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
com.android.builder.testing.api.DeviceException: No connected devices!

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 46s

error Failed to install the app. Make sure you have an Android emulator running or a device connected. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
com.android.builder.testing.api.DeviceException: No connected devices!

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 46s

    at checkExecSyncError (child_process.js:621:11)
    at execFileSync (child_process.js:639:15)
    at runOnAllDevices (C:\petme\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Command.handleAction (C:\petme\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:164:9)


Compatible side by side NDK version was not found. 
먼저 이 에러는 안드로이드 스튜디오에 들어가서,
File메뉴에, Settings에 들어가서




NDK를 깔았다, 이제 NDK가 INSTALLED 된것을 보고 계십니다.

그리고

BUILD FAILED in 1m 46s 

    at checkExecSyncError (child_process.js:621:11) 
    at execFileSync (child_process.js:639:15) 
    at runOnAllDevices (C:\petme\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39) 
    at processTicksAndRejections (internal/process/task_queues.js:93:5) 
    at async Command.handleAction (C:\petme\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:164:9)

이 에러는

C:\사용자\사용자 이름\.gradle\caches

에서

caches 폴더를 삭제한후

제니모션을 실행한후(나는 제니모션을 쓰고 있다)

실행한다

com.android.ddmlib.InstallException: Unknown failure: Error: Could not access the Package Manager. Is the system running?

해결책은

adb kill-server 를 실행하고

그다음에

adb start-server 를 실행한다

react-native run-ios --simulator="iPhone 6"

react-native run-ios   --simulator="iPhone 6"