wenweiwei 4 years ago
parent
commit
276cbfb54a

+ 1 - 1
BFNetRequestKit.podspec

@@ -8,7 +8,7 @@
 
 Pod::Spec.new do |s|
   s.name             = 'BFNetRequestKit'
-  s.version          = '0.1.1'
+  s.version          = '0.1.2'
   s.summary          = '使用Alamofire封装网络请求库'
   s.swift_version    = '5.0'
 # This description is used to generate tags and improve search results.

+ 2 - 0
BFNetRequestKit/Classes/SWNetRequest.swift

@@ -87,10 +87,12 @@ public class SWNetRequest: NSObject {
             switch jsonResponse.result {
             case .success:
                 let jsonData: Any = try! JSONSerialization.jsonObject(with: jsonResponse.data!, options: JSONSerialization.ReadingOptions.mutableContainers)
+                debugPrint("response-success = \(jsonData)")
                 response(jsonData, nil, jsonResponse.metrics?.taskInterval.duration)
             case .failure:
                 let code: Int? = jsonResponse.response?.statusCode
                 response(nil, PQError(msg: (code == -1009 || code == -1001) ? "网络不可用" : jsonResponse.error?.localizedDescription, code: code ?? 10001), jsonResponse.metrics?.taskInterval.duration)
+                debugPrint("response-failure = \(String(describing: jsonResponse.error))")
             }
         }
     }

+ 5 - 0
Example/BFNetRequestKit/Info.plist

@@ -2,6 +2,11 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
+	<key>NSAppTransportSecurity</key>
+	<dict>
+		<key>NSAllowsArbitraryLoads</key>
+		<true/>
+	</dict>
 	<key>CFBundleDevelopmentRegion</key>
 	<string>en</string>
 	<key>CFBundleExecutable</key>

+ 33 - 1
Example/BFNetRequestKit/ViewController.swift

@@ -14,8 +14,40 @@ class ViewController: UIViewController {
     override func viewDidLoad() {
         super.viewDidLoad()
         // Do any additional setup after loading the view, typically from a nib.
+        BFNetRequestAdaptor.postRequestData(url: "https://speed.piaoquantv.com/longvideoapi/sys/app/config", parames: nil,commonParams: commonParams()) { respose, extData, error, duration in
+            
+        }
+    }
+    public func commonParams() -> [String: Any] {
+        let model = UIDevice.current.model
+        let systemName = UIDevice.current.systemName
+        let systemVersion = UIDevice.current.systemVersion
+        let localizedModel = UIDevice.current.localizedModel
+        let machineInfo: [String: Any] = [
+            "model": model, "system": systemName + " " + systemVersion, "brand": localizedModel, "platform": "iOS", "networkType": SWNetRequest.networkStatusDescription(), "clientIp": SWNetRequest.ipAddressDescription(),
+        ]
+        let commParams: [String: Any] = [
+            "appVersionCode": "1.1.0",
+            "versionCode": "1.1.0",
+            "system": systemName + " " + systemVersion,
+            "systemVersion": systemName + " " + systemVersion,
+            "appType": 13,
+            "appId": 111111,
+            "machineCode": "getMachineCode()sdsdsdsdsd",
+            "networkType": SWNetRequest.networkStatusDescription(),
+            "ipAddress": SWNetRequest.ipAddressDescription(),
+            "clientTimestamp": Int64(Date().timeIntervalSince1970 * 1000),
+            "platform": "iOS",
+            "versionName": "1.1.0",
+    //        "sessionId": PQSingletoMemoryUtil.shared.sessionId,
+    //        "subSessionId": PQSingletoMemoryUtil.shared.subSessionid ?? PQSingletoMemoryUtil.shared.sessionId,
+            "mid": "getMachineCode()sdsdsdsdsd",
+            "machineInfo": "",
+    //        "abInfoData": dictionaryToJsonString(PQSingletoMemoryUtil.shared.abInfoData) ?? "",
+            "requestId": "423232323232323",
+            "idfv": UIDevice.current.identifierForVendor?.uuidString ?? ""]
+        return commParams
     }
-
     override func didReceiveMemoryWarning() {
         super.didReceiveMemoryWarning()
         // Dispose of any resources that can be recreated.

+ 2 - 2
Example/Podfile.lock

@@ -1,6 +1,6 @@
 PODS:
   - Alamofire (5.4.3)
-  - BFNetRequestKit (0.1.0):
+  - BFNetRequestKit (0.1.1):
     - Alamofire (= 5.4.3)
 
 DEPENDENCIES:
@@ -16,7 +16,7 @@ EXTERNAL SOURCES:
 
 SPEC CHECKSUMS:
   Alamofire: e447a2774a40c996748296fa2c55112fdbbc42f9
-  BFNetRequestKit: 9132dfac067fdb36f71f289cb50b3472367ebf65
+  BFNetRequestKit: 6341be50554434f6ec91d3ba60184d1a7e3ff87d
 
 PODFILE CHECKSUM: f2f55378f6a02f1920f1df1e5625b20f47cdf783
 

+ 2 - 2
Example/Pods/Local Podspecs/BFNetRequestKit.podspec.json

@@ -1,6 +1,6 @@
 {
   "name": "BFNetRequestKit",
-  "version": "0.1.0",
+  "version": "0.1.1",
   "summary": "使用Alamofire封装网络请求库",
   "swift_versions": "5.0",
   "description": "TODO: Add long description of the pod here.",
@@ -14,7 +14,7 @@
   },
   "source": {
     "git": "https://git.yishihui.com/wenweiwei/BFNetRequestKit.git",
-    "tag": "0.1.0"
+    "tag": "0.1.1"
   },
   "platforms": {
     "ios": "10.0"

+ 2 - 2
Example/Pods/Manifest.lock

@@ -1,6 +1,6 @@
 PODS:
   - Alamofire (5.4.3)
-  - BFNetRequestKit (0.1.0):
+  - BFNetRequestKit (0.1.1):
     - Alamofire (= 5.4.3)
 
 DEPENDENCIES:
@@ -16,7 +16,7 @@ EXTERNAL SOURCES:
 
 SPEC CHECKSUMS:
   Alamofire: e447a2774a40c996748296fa2c55112fdbbc42f9
-  BFNetRequestKit: 9132dfac067fdb36f71f289cb50b3472367ebf65
+  BFNetRequestKit: 6341be50554434f6ec91d3ba60184d1a7e3ff87d
 
 PODFILE CHECKSUM: f2f55378f6a02f1920f1df1e5625b20f47cdf783
 

+ 1 - 1
Example/Pods/Target Support Files/BFNetRequestKit/BFNetRequestKit-Info.plist

@@ -15,7 +15,7 @@
   <key>CFBundlePackageType</key>
   <string>FMWK</string>
   <key>CFBundleShortVersionString</key>
-  <string>0.1.0</string>
+  <string>0.1.1</string>
   <key>CFBundleSignature</key>
   <string>????</string>
   <key>CFBundleVersion</key>