This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func ImageUpload(UrlString:String,ImageParams:Dictionary<String, String>,ImageData:NSData,ReqToVar:String){ | |
//增加 group 的進入次數,group同上方宣告的group | |
dispach_group_enter(group) | |
var urlRequest = urlRequestWithComponents(UrlString, parameters: ImageParams, imageData: ImageData) | |
var FileUrl:JSON! | |
Alamofire.upload(urlRequest.0, urlRequest.1) | |
.progress { (bytesWritten, totalBytesWritten, totalBytesExpectedToWrite) in | |
// println("\(totalBytesWritten) / \(totalBytesExpectedToWrite)") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// parkingDate.swift | |
// stopTest | |
// | |
// Created by Laibit on 2015/7/28. | |
// Copyright (c) 2015年 Laibit. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.m | |
// Matrix | |
// | |
// Created by Grady Zhuo on 2015/9/6. | |
// Copyright © 2015年 Grady Zhuo. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <Accelerate/Accelerate.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Launch application using ios-sim and set up environment to inject test bundle into application | |
# Source: http://stackoverflow.com/a/12682617/504494 | |
if [ "$RUN_APPLICATION_TESTS_WITH_IOS_SIM" = "YES" ]; then | |
test_bundle_path="$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.$WRAPPER_EXTENSION" | |
environment_args="--setenv DYLD_INSERT_LIBRARIES=/../../Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection --setenv XCInjectBundle=$test_bundle_path --setenv XCInjectBundleInto=$TEST_HOST" | |
ios-sim launch $(dirname $TEST_HOST) $environment_args --args -SenTest All $test_bundle_path | |
echo "Finished running tests with ios-sim" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func doAsyncAction(completionHandler:(callback:AnyObject)->Void){ | |
let delay = Int64(NSEC_PER_MSEC*100) | |
let afterTime = dispatch_time(DISPATCH_TIME_NOW, delay) | |
let queue = dispatch_get_global_queue(0, 0) | |
//等待100毫秒(0.1秒)後再執行 | |
dispatch_after(afterTime, queue) { () -> Void in | |
completionHandler(callback: "Hello world") | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSOperationQueue *queue = [[NSOperationQueue alloc] init]; | |
queue.maxConcurrentOperationCount = 1; | |
NSInteger inputValue = 5; | |
NSMutableArray<NSOperation *> *operations = [NSMutableArray<NSOperation *> array]; | |
for (NSInteger i=0; i<inputValue; i++){ | |
NSOperation *operation = [NSBlockOperation blockOperationWithBlock:^{ | |
NSLog(@".Running operation %d", i); | |
[NSThread sleepForTimeInterval:1]; | |
}]; |