我在XCode 8中以不同格式生成JSON響應,因爲它用於出現在XCode 7.3中如何在swift 3.0中獲得Json響應?
因此,我的應用程序停止響應。我正在分享我的回覆的截圖。
這是我使用
func MobileNumber(_ notification : Notification){
activityIndicator.stopAnimating()
if let notificationDict = (notification as NSNotification).userInfo{
print(notificationDict)
if let dataDict = notificationDict["Data"] as? NSDictionary{
print(dataDict)
if let status = dataDict["response"] as? Int{
switch status{
case 1:
if let data = dataDict["data"] as? NSDictionary{
if let mobileNumber = data["phone"] as? String{
UserDefaults.standard.set(mobileNumber, forKey: DefaultsKey.phoneNumber.rawValue)
print(mobileNumber)
}
UpdateFrame1()
}
JSON響應代碼:
Data]: 243 bytes
[Result]: SUCCESS: {
data = {
"__v" = 0;
"_id" = 5833e131de2fe2342b0d0410;
code = "<null>";
"created_at" = "2016-11-22T06:09:53.097Z";
"expiry_date" = "2016-11-22T06:09:53.097Z";
phone = 9********;
status = active;
};
message = "Resending your unused auth code";
response = 1;
}
[Timeline]: Timeline: { "Request Start Time": 501493300.746, "Initial Response Time": 501493302.862, "Request Completed Time": 501493302.868, "Serialization Completed Time": 501493302.872, "Latency": 2.116 secs, "Request Duration": 2.122 secs, "Serialization Duration": 0.003 secs, "Total Duration": 2.126 secs }
告訴我們,您使用的代碼。 –
另外顯示舊的和新的JSON響應。並將其作爲文本複製並粘貼到問題中(而不是使用屏幕截圖)。 – Codo
由於xcode更新和時間短缺,無法顯示舊響應。 –