![](/img/trans.png)
[英]HttpClient post withcredentials not working in ionic ios app
[英]POST requests not working on IOS in Ionic2 App
我遇到了 HTTP 請求的問題。 在 Ionic View、瀏覽器和 Android 中一切正常,但不適用於 IOS。 GET 請求在 IOS 上也能正常工作。 任何猜測,那可能是什么?
我可以為您提供更多信息,只需告訴我您需要什么信息。 這是我在 package.json 中的內容:
"dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/compiler-cli": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/platform-server": "2.2.1",
"@ionic/cloud-angular": "0.7.0",
"@ionic/storage": "1.1.7",
"@types/moment-timezone": "0.2.32",
"ionic-angular": "2.0.0-rc.4",
"ionic-native": "2.4.1",
"ionicons": "3.0.0",
"moment": "2.15.1",
"moment-timezone": "0.5.7",
"ng2-translate": "5.0.0",
"rxjs": "^5.0.0-beta.12",
"zone.js": "0.6.26"
},
"devDependencies": {
"@ionic/app-scripts": "^1.0.0",
"sw-toolbox": "^3.4.0",
"typescript": "2.0.9"
},
后端接收發布請求的空白正文。 這是我的回復:
ERROR: {"_body":"{\"error\":\"Sign up error\",\"message\":{\"first_name\":[\"First Name cannot be blank.\"],\"last_name\":[\"Last Name cannot be blank.\"],\"email\":[\"Email cannot be blank.\"],\"device_id\":[\"Device Id cannot be blank.\"]}}","status":422,"ok":false,"statusText":"Bad Request","headers":{"Content-Type":["application/json; charset=UTF-8"],"Pragma":["no-cache"]},"type":2,"url":"http://app.EDITED"}
隨時問任何問題,感謝您的幫助!
更新:我們將后端移至 HTTPS,現在一切正常:)
官方答案似乎在這里:
Apple 只是決定強制使用 HTTPS。 我懷疑 Cordova / Ionic 目前根本沒有處理好(也就是沒有拋出錯誤,沒有記錄等)
請記住,safari 檢查器將顯示數據正在發送到服務器 -這是不正確的,所有發送的數據都在 iOS 應用程序中被刪除(整個正文)(我為此浪費了一天)。
正如 Dmytro Garastovych 提到的,正確(也是唯一)的解決方案是遷移到 HTTPS
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.