Intellij 가 실행되지 않을때 

(heap 사이즈를 과도하게 올려서 실행이 되지 않을 경우...)

 

/Users/userName/Library/Preferences/IntelliJIdea****.*/idea.vmoptions

 

에서 heap size를 수정하면된다.

'Development > Kotlin' 카테고리의 다른 글

Kotlin Sha256  (0) 2019.10.16
Find numbers in string in kotlin  (0) 2019.07.02
Kotlin run,with,let,apply  (0) 2018.04.09
Kotlin Study Link  (0) 2018.04.03

wkwebview에서 http request post 호출이 되지 않기 떄문에

임의로 post용 html 을 생성 한 후 javascript를 이용해 post로 넘기는 방법으로 처리한다.




func makePostRequest(url: String, payload: Dictionary<String, Any>) {

    let jsonPayload: String

    do {

        let data = try JSONSerialization.data(

            withJSONObject: payload,

            options: JSONSerialization.WritingOptions(rawValue: 0))

        jsonPayload = String(data: data, encoding: String.Encoding.utf8)!

    } catch {

        jsonPayload = "{}"

    }

    

    webView.loadHTMLString(postMakingHTML(url: url, payload: jsonPayload), baseURL: nil)

}


    

private func postMakingHTML(url: String, payload: String) -> String {

    return "<html><head><script>function post(path,params,method){method = method || 'post';var form=document.createElement('form');form.setAttribute('method', method);form.setAttribute('action',path);for(var key in params){if(params.hasOwnProperty(key)){var hiddenField=document.createElement('input');hiddenField.setAttribute('type', 'hidden');hiddenField.setAttribute('name', key);hiddenField.setAttribute('value', params[key]);form.appendChild(hiddenField);}}document.body.appendChild(form);form.submit();}</script></head><body></body></html><script>post('\(url)',\(payload),'post');</script>"

}





출처 : https://blog.brainsandbeards.com/debugging-wkwebviews-5b122091db00


+ Recent posts