This file contains hidden or 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
# TARGET_NAME = "MyApp" | |
# Clean and Building both architectures. | |
xcodebuild -configuration "Release" -target "${TARGET_NAME}" -sdk iphoneos clean build | |
xcodebuild -configuration "Release" -target "${TARGET_NAME}" -sdk iphonesimulator clean build | |
# Uses the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product. | |
lipo -create "${DEVICE_DIR}/${FMK_NAME}.a" "${SIMULATOR_DIR}/${FMK_NAME}.a" -output "${INSTALL_DIR}/${FMK_NAME}.a" | |
# Search supported architectures of library | |
lipo -info "/library/file/path" |
This file contains hidden or 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
+ (NSArray<NSString *> *)allSupportedCountries { | |
NSArray<NSString *> *codes = NSLocale.ISOCountryCodes; | |
NSMutableArray<NSString *> *names = [NSMutableArray arrayWithCapacity:codes.count]; | |
for (NSString *code in codes ) { | |
NSString *name = [code uppercaseString]; | |
[names addObject:name]; | |
NSLog(@"country >> code:%@ - name:%@", code, name); | |
} | |
return [names copy]; |
This file contains hidden or 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
/** | |
作者:ITCodeShare | |
链接:https://www.jianshu.com/p/99c3e6a6c033 | |
來源:简书 | |
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。 | |
*/ | |
- (NSData *)compressQualityWithMaxLength:(NSInteger)maxLength { | |
CGFloat compression = 1; |
This file contains hidden or 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
// https://blog.helftone.com/demystifying-inner-shadows-in-quartz/ | |
// Drawing the shadow in the same image | |
func roundedImage(for image: UIImage, bounds: CGRect, withShadow shadow: Bool) -> UIImage { | |
UIGraphicsBeginImageContextWithOptions(bounds.size, false, 0.0) | |
defer { | |
UIGraphicsEndImageContext() | |
} | |
let context = UIGraphicsGetCurrentContext() |
This file contains hidden or 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 appendStringToFile() { | |
let dir:NSURL = NSFileManager.defaultManager().URLsForDirectory(NSSearchPathDirectory.CachesDirectory, inDomains: NSSearchPathDomainMask.UserDomainMask).last as NSURL | |
let fileurl = dir.URLByAppendingPathComponent("file.txt") | |
let string = "\(NSDate())\n" | |
let data = string.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)! | |
if NSFileManager.defaultManager().fileExistsAtPath(fileurl.path!) { | |
var error:NSError? | |
if let fileHandle = NSFileHandle(forWritingToURL: fileurl, error: &error) { |
This file contains hidden or 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 test() { | |
print("Lepton Test") | |
} | |
This file contains hidden or 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
/** 跳转AppStore app */ | |
- (void)goAppStore:(NSString *)appId { | |
if (!appId || appId.length == 0) { | |
logError(@">> TTAD: AppId不能为空"); | |
return; | |
} | |
logInfo(@">> TTAD: 跳转到内置appstore页: %@", appId); | |
NSString *urlStr = [NSString stringWithFormat:@"https://itunes.apple.com/cn/app/id%@", appId]; | |
NSURL *openURL = [NSURL URLWithString:urlStr]; |
This file contains hidden or 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
/** 跳转AppStore app */ | |
- (void)goAppStore:(NSString *)appId { | |
if (!appId || appId.length == 0) { | |
logError(@">> TTAD: AppId不能为空"); | |
return; | |
} | |
logInfo(@">> TTAD: 跳转到内置appstore页: %@", appId); | |
NSString *urlStr = [NSString stringWithFormat:@"https://itunes.apple.com/cn/app/id%@", appId]; | |
NSURL *openURL = [NSURL URLWithString:urlStr]; |
This file contains hidden or 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
// Create a UIImage from sample buffer data | |
- (UIImage *) imageFromSampleBuffer:(CMSampleBufferRef) sampleBuffer { | |
// Get a CMSampleBuffer's Core Video image buffer for the media data | |
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); | |
// Lock the base address of the pixel buffer | |
CVPixelBufferLockBaseAddress(imageBuffer, 0); | |
// Get the number of bytes per row for the pixel buffer | |
void *baseAddress = CVPixelBufferGetBaseAddress(imageBuffer); |
This file contains hidden or 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
import AssetsLibrary | |
import MobileCoreServices | |
/// 保存gif图到相册 | |
func saveGif2Album() { | |
let gifPath = Bundle.main.path(forResource: "name", ofType: "gif") | |
let gifData = NSData(contentsOfFile: gifPath!) as Data | |
let library = ALAssetsLibrary() |
NewerOlder