Skip to content

Commit

Permalink
解决七牛云sdk 更新问题
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxtdo committed Nov 27, 2018
1 parent a847c6c commit e9927a4
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 36 deletions.
3 changes: 2 additions & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

def pods
pod 'Qiniu'
pod "Qiniu", "~> 7.2"
pod 'MASPreferences'
pod 'AFNetworking'
pod 'TMCache'
end

Expand Down
36 changes: 18 additions & 18 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
PODS:
- AFNetworking (3.1.0):
- AFNetworking/NSURLSession (= 3.1.0)
- AFNetworking/Reachability (= 3.1.0)
- AFNetworking/Security (= 3.1.0)
- AFNetworking/Serialization (= 3.1.0)
- AFNetworking/UIKit (= 3.1.0)
- AFNetworking/NSURLSession (3.1.0):
- AFNetworking (3.2.1):
- AFNetworking/NSURLSession (= 3.2.1)
- AFNetworking/Reachability (= 3.2.1)
- AFNetworking/Security (= 3.2.1)
- AFNetworking/Serialization (= 3.2.1)
- AFNetworking/UIKit (= 3.2.1)
- AFNetworking/NSURLSession (3.2.1):
- AFNetworking/Reachability
- AFNetworking/Security
- AFNetworking/Serialization
- AFNetworking/Reachability (3.1.0)
- AFNetworking/Security (3.1.0)
- AFNetworking/Serialization (3.1.0)
- HappyDNS (0.3.10)
- AFNetworking/Reachability (3.2.1)
- AFNetworking/Security (3.2.1)
- AFNetworking/Serialization (3.2.1)
- HappyDNS (0.3.14)
- MASPreferences (1.1.4)
- Qiniu (7.1.4):
- AFNetworking (~> 3)
- Qiniu (7.2.4):
- HappyDNS (~> 0.3)
- TMCache (2.1.0)

DEPENDENCIES:
- AFNetworking
- MASPreferences
- Qiniu
- Qiniu (~> 7.2)
- TMCache

SPEC REPOS:
Expand All @@ -33,12 +33,12 @@ SPEC REPOS:
- TMCache

SPEC CHECKSUMS:
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
HappyDNS: 06a9fed2796663fd87626dbf02552933265bf059
AFNetworking: b6f891fdfaed196b46c7a83cf209e09697b94057
HappyDNS: dc6a164ee81979093123c241c6353bcf0218add6
MASPreferences: 7bdcfe891d7840453cf48f95fa866c3e152ace7a
Qiniu: a4c962782035ee25b9da3e195181d8c384bb75be
Qiniu: 65384bca1cdb0480a68d9b9b8f54db53418c0355
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed

PODFILE CHECKSUM: 67254f85860b4a1ca52413c2991e390d206f5656
PODFILE CHECKSUM: 118dcfb5abd42130dde389f59bb2b387ee43dbb4

COCOAPODS: 1.5.2
12 changes: 10 additions & 2 deletions UPImage/AppConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,16 @@ class AppConfig: NSObject ,NSCoding ,DiskCache{
func encode(with aCoder: NSCoder) {

aCoder.encode(linkType.rawValue.description, forKey: "linkType")
aCoder.encode(autoUp.hashValue.description, forKey: "autoUp")
aCoder.encode(useDefServer.hashValue.description, forKey: "useDefServer")
if autoUp {
aCoder.encode("1", forKey: "autoUp")
} else {
aCoder.encode("0", forKey: "autoUp")
}
if useDefServer {
aCoder.encode("1", forKey: "useDefServer")
} else {
aCoder.encode("0", forKey: "useDefServer")
}

}

Expand Down
2 changes: 1 addition & 1 deletion UPImage/ImagePreferencesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class ImagePreferencesViewController: NSViewController, MASPreferencesViewContro
let bck = (bucketTextField.cell?.title)!
let qnConfig = QNConfig(picUrlPrefix: (urlPrefixTextField.cell?.title)!, accessKey: ack, scope: bck, secretKey: sek, mark: (markTextField.cell?.title)!, zone: (QNZonePopButton.selectedItem?.tag)!)
checkButton.title = "验证中"
checkButton.isEnabled = false
checkButton.isEnabled = false
QNService.shared.register(config:qnConfig)
QNService.shared.createToken()
QNService.shared.verifyQNConfig(zone: QNZonePopButton.selectedItem?.tag){ [weak self] (result) in
Expand Down
7 changes: 0 additions & 7 deletions UPImage/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict/>
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017年 chenxt. All rights reserved.</string>
<key>NSMainNibFile</key>
Expand Down
15 changes: 8 additions & 7 deletions UPImage/QNService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,21 @@ class QNService: NSObject {

class func initQNManager(_ zoneType : Int) -> QNUploadManager {
let config = QNConfiguration.build({ (builder: QNConfigurationBuilder?) in
var zone : QNZone!
var zone : QNFixedZone!
switch zoneType {
case 1:
zone = QNZone.zone0() //华东
zone = QNFixedZone.zone0() //华东
case 2:
zone = QNZone.zone1() //华北
zone = QNFixedZone.zone1() //华北
case 3:
zone = QNZone.zone2() //华南
zone = QNFixedZone.zone2() //华南
case 4:
zone = QNZone.zoneNa0() //北美
zone = QNFixedZone.zoneNa0() //北美
default:
zone = QNZone.zone0()
zone = QNFixedZone.zone0()
}
builder?.setZone(zone);

})

let manager = QNUploadManager(configuration: config);
Expand Down Expand Up @@ -94,7 +95,7 @@ class QNService: NSObject {
public func verifyQNConfig(zone:Int? ,completion: @escaping (Result<AnyObject?>) -> Void){
upManager = QNService.initQNManager(zone ?? 1);

upManager.put("1".data(using: .utf8), key: nil, token: QNToken, complete: { (info, key, resp) in
upManager.put("Hello, World!".data(using: .utf8), key: "Hello", token: QNToken, complete: { (info, key, resp) in
guard let _ = info, let _ = resp else {
completion(.failure(nil))
return
Expand Down

0 comments on commit e9927a4

Please sign in to comment.