Commit d12a1e54 authored by yuzheng.tz's avatar yuzheng.tz

修正编译警告;适配iOS11

parent 843337bc
...@@ -541,7 +541,7 @@ ...@@ -541,7 +541,7 @@
"$(PROJECT_DIR)/TZImagePickerController", "$(PROJECT_DIR)/TZImagePickerController",
); );
INFOPLIST_FILE = TZImagePickerController/Info.plist; INFOPLIST_FILE = TZImagePickerController/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 6.0; IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = tanzhen.TZImagePickerController; PRODUCT_BUNDLE_IDENTIFIER = tanzhen.TZImagePickerController;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
...@@ -562,7 +562,7 @@ ...@@ -562,7 +562,7 @@
"$(PROJECT_DIR)/TZImagePickerController", "$(PROJECT_DIR)/TZImagePickerController",
); );
INFOPLIST_FILE = TZImagePickerController/Info.plist; INFOPLIST_FILE = TZImagePickerController/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 6.0; IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = tanzhen.TZImagePickerController; PRODUCT_BUNDLE_IDENTIFIER = tanzhen.TZImagePickerController;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
......
...@@ -39,6 +39,11 @@ ...@@ -39,6 +39,11 @@
"idiom" : "iphone", "idiom" : "iphone",
"size" : "60x60", "size" : "60x60",
"scale" : "3x" "scale" : "3x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
} }
], ],
"info" : { "info" : {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.7.8</string> <string>1.8.1</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
...@@ -24,10 +24,10 @@ ...@@ -24,10 +24,10 @@
<true/> <true/>
<key>NSCameraUsageDescription</key> <key>NSCameraUsageDescription</key>
<string>访问相机以拍照</string> <string>访问相机以拍照</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>访问相册以选择照片</string>
<key>NSLocationWhenInUseUsageDescription</key> <key>NSLocationWhenInUseUsageDescription</key>
<string>允许定位以把位置保存到照片中</string> <string>允许定位以把位置保存到照片中</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>访问相册以选择照片</string>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
#import "TZPhotoPreviewCell.h" #import "TZPhotoPreviewCell.h"
#import "TZImageManager.h" #import "TZImageManager.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@interface TZGifPhotoPreviewController () { @interface TZGifPhotoPreviewController () {
UIView *_toolBar; UIView *_toolBar;
UIButton *_doneButton; UIButton *_doneButton;
...@@ -124,4 +127,6 @@ ...@@ -124,4 +127,6 @@
} }
} }
#pragma clang diagnostic pop
@end @end
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
#import <AVFoundation/AVFoundation.h> #import <AVFoundation/AVFoundation.h>
#import <Photos/Photos.h> #import <Photos/Photos.h>
NS_ASSUME_NONNULL_BEGIN
@class TZAlbumModel,TZAssetModel; @class TZAlbumModel,TZAssetModel;
@protocol TZImagePickerControllerDelegate; @protocol TZImagePickerControllerDelegate;
@interface TZImageManager : NSObject @interface TZImageManager : NSObject
...@@ -20,6 +18,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -20,6 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, strong) PHCachingImageManager *cachingImageManager; @property (nonatomic, strong) PHCachingImageManager *cachingImageManager;
+ (instancetype)manager NS_SWIFT_NAME(default()); + (instancetype)manager NS_SWIFT_NAME(default());
+ (void)deallocManager;
@property (assign, nonatomic) id<TZImagePickerControllerDelegate> pickerDelegate; @property (assign, nonatomic) id<TZImagePickerControllerDelegate> pickerDelegate;
...@@ -76,7 +75,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -76,7 +75,7 @@ NS_ASSUME_NONNULL_BEGIN
/// Get video 获得视频 /// Get video 获得视频
- (void)getVideoWithAsset:(id)asset completion:(void (^)(AVPlayerItem * playerItem, NSDictionary * info))completion; - (void)getVideoWithAsset:(id)asset completion:(void (^)(AVPlayerItem * playerItem, NSDictionary * info))completion;
- (void)getVideoWithAsset:(id)asset progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler completion:(void (^)(AVPlayerItem * _Nullable, NSDictionary * _Nullable))completion; - (void)getVideoWithAsset:(id)asset progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler completion:(void (^)(AVPlayerItem *, NSDictionary *))completion;
/// Export video 导出视频 /// Export video 导出视频
- (void)getVideoOutputPathWithAsset:(id)asset completion:(void (^)(NSString *outputPath))completion; - (void)getVideoOutputPathWithAsset:(id)asset completion:(void (^)(NSString *outputPath))completion;
...@@ -99,8 +98,6 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -99,8 +98,6 @@ NS_ASSUME_NONNULL_BEGIN
@end @end
NS_ASSUME_NONNULL_END
//@interface TZSortDescriptor : NSSortDescriptor //@interface TZSortDescriptor : NSSortDescriptor
// //
//@end //@end
...@@ -23,9 +23,10 @@ static CGSize AssetGridThumbnailSize; ...@@ -23,9 +23,10 @@ static CGSize AssetGridThumbnailSize;
static CGFloat TZScreenWidth; static CGFloat TZScreenWidth;
static CGFloat TZScreenScale; static CGFloat TZScreenScale;
static TZImageManager *manager;
static dispatch_once_t onceToken;
+ (instancetype)manager { + (instancetype)manager {
static TZImageManager *manager;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{ dispatch_once(&onceToken, ^{
manager = [[self alloc] init]; manager = [[self alloc] init];
if (iOS8Later) { if (iOS8Later) {
...@@ -43,6 +44,11 @@ static CGFloat TZScreenScale; ...@@ -43,6 +44,11 @@ static CGFloat TZScreenScale;
return manager; return manager;
} }
+ (void)deallocManager {
onceToken = 0;
manager = nil;
}
- (void)setColumnNumber:(NSInteger)columnNumber { - (void)setColumnNumber:(NSInteger)columnNumber {
_columnNumber = columnNumber; _columnNumber = columnNumber;
CGFloat margin = 4; CGFloat margin = 4;
...@@ -375,7 +381,7 @@ static CGFloat TZScreenScale; ...@@ -375,7 +381,7 @@ static CGFloat TZScreenScale;
for (NSInteger i = 0; i < photos.count; i++) { for (NSInteger i = 0; i < photos.count; i++) {
TZAssetModel *model = photos[i]; TZAssetModel *model = photos[i];
if ([model.asset isKindOfClass:[PHAsset class]]) { if ([model.asset isKindOfClass:[PHAsset class]]) {
[[PHImageManager defaultManager] requestImageDataForAsset:model.asset options:nil resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) { [[PHImageManager defaultManager] requestImageDataForAsset:model.asset options:nil resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
if (model.type != TZAssetModelMediaTypeVideo) dataLength += imageData.length; if (model.type != TZAssetModelMediaTypeVideo) dataLength += imageData.length;
assetCount ++; assetCount ++;
if (assetCount >= photos.count) { if (assetCount >= photos.count) {
...@@ -455,7 +461,7 @@ static CGFloat TZScreenScale; ...@@ -455,7 +461,7 @@ static CGFloat TZScreenScale;
// 下面两行代码,来自hsjcom,他的github是:https://github.com/hsjcom 表示感谢 // 下面两行代码,来自hsjcom,他的github是:https://github.com/hsjcom 表示感谢
PHImageRequestOptions *option = [[PHImageRequestOptions alloc] init]; PHImageRequestOptions *option = [[PHImageRequestOptions alloc] init];
option.resizeMode = PHImageRequestOptionsResizeModeFast; option.resizeMode = PHImageRequestOptionsResizeModeFast;
int32_t imageRequestID = [[PHImageManager defaultManager] requestImageForAsset:asset targetSize:imageSize contentMode:PHImageContentModeAspectFill options:option resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) { int32_t imageRequestID = [[PHImageManager defaultManager] requestImageForAsset:asset targetSize:imageSize contentMode:PHImageContentModeAspectFill options:option resultHandler:^(UIImage *result, NSDictionary *info) {
if (result) { if (result) {
image = result; image = result;
} }
...@@ -476,7 +482,7 @@ static CGFloat TZScreenScale; ...@@ -476,7 +482,7 @@ static CGFloat TZScreenScale;
}; };
options.networkAccessAllowed = YES; options.networkAccessAllowed = YES;
options.resizeMode = PHImageRequestOptionsResizeModeFast; options.resizeMode = PHImageRequestOptionsResizeModeFast;
[[PHImageManager defaultManager] requestImageDataForAsset:asset options:options resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) { [[PHImageManager defaultManager] requestImageDataForAsset:asset options:options resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
UIImage *resultImage = [UIImage imageWithData:imageData scale:0.1]; UIImage *resultImage = [UIImage imageWithData:imageData scale:0.1];
resultImage = [self scaleImage:resultImage toSize:imageSize]; resultImage = [self scaleImage:resultImage toSize:imageSize];
if (!resultImage) { if (!resultImage) {
...@@ -544,7 +550,7 @@ static CGFloat TZScreenScale; ...@@ -544,7 +550,7 @@ static CGFloat TZScreenScale;
PHImageRequestOptions *option = [[PHImageRequestOptions alloc]init]; PHImageRequestOptions *option = [[PHImageRequestOptions alloc]init];
option.networkAccessAllowed = YES; option.networkAccessAllowed = YES;
option.resizeMode = PHImageRequestOptionsResizeModeFast; option.resizeMode = PHImageRequestOptionsResizeModeFast;
[[PHImageManager defaultManager] requestImageForAsset:asset targetSize:PHImageManagerMaximumSize contentMode:PHImageContentModeAspectFit options:option resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) { [[PHImageManager defaultManager] requestImageForAsset:asset targetSize:PHImageManagerMaximumSize contentMode:PHImageContentModeAspectFit options:option resultHandler:^(UIImage *result, NSDictionary *info) {
BOOL downloadFinined = (![[info objectForKey:PHImageCancelledKey] boolValue] && ![info objectForKey:PHImageErrorKey]); BOOL downloadFinined = (![[info objectForKey:PHImageCancelledKey] boolValue] && ![info objectForKey:PHImageErrorKey]);
if (downloadFinined && result) { if (downloadFinined && result) {
result = [self fixOrientation:result]; result = [self fixOrientation:result];
...@@ -572,7 +578,7 @@ static CGFloat TZScreenScale; ...@@ -572,7 +578,7 @@ static CGFloat TZScreenScale;
PHImageRequestOptions *option = [[PHImageRequestOptions alloc] init]; PHImageRequestOptions *option = [[PHImageRequestOptions alloc] init];
option.networkAccessAllowed = YES; option.networkAccessAllowed = YES;
option.resizeMode = PHImageRequestOptionsResizeModeFast; option.resizeMode = PHImageRequestOptionsResizeModeFast;
[[PHImageManager defaultManager] requestImageDataForAsset:asset options:option resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) { [[PHImageManager defaultManager] requestImageDataForAsset:asset options:option resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
BOOL downloadFinined = (![[info objectForKey:PHImageCancelledKey] boolValue] && ![info objectForKey:PHImageErrorKey]); BOOL downloadFinined = (![[info objectForKey:PHImageCancelledKey] boolValue] && ![info objectForKey:PHImageErrorKey]);
if (downloadFinined && imageData) { if (downloadFinined && imageData) {
if (completion) completion(imageData,info,NO); if (completion) completion(imageData,info,NO);
...@@ -606,7 +612,7 @@ static CGFloat TZScreenScale; ...@@ -606,7 +612,7 @@ static CGFloat TZScreenScale;
request.location = location; request.location = location;
} }
request.creationDate = [NSDate date]; request.creationDate = [NSDate date];
} completionHandler:^(BOOL success, NSError * _Nullable error) { } completionHandler:^(BOOL success, NSError *error) {
dispatch_sync(dispatch_get_main_queue(), ^{ dispatch_sync(dispatch_get_main_queue(), ^{
if (success && completion) { if (success && completion) {
completion(nil); completion(nil);
...@@ -640,11 +646,11 @@ static CGFloat TZScreenScale; ...@@ -640,11 +646,11 @@ static CGFloat TZScreenScale;
#pragma mark - Get Video #pragma mark - Get Video
/// Get Video / 获取视频 /// Get Video / 获取视频
- (void)getVideoWithAsset:(id)asset completion:(void (^)(AVPlayerItem * _Nullable, NSDictionary * _Nullable))completion { - (void)getVideoWithAsset:(id)asset completion:(void (^)(AVPlayerItem *, NSDictionary *))completion {
[self getVideoWithAsset:asset progressHandler:nil completion:completion]; [self getVideoWithAsset:asset progressHandler:nil completion:completion];
} }
- (void)getVideoWithAsset:(id)asset progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler completion:(void (^)(AVPlayerItem * _Nullable, NSDictionary * _Nullable))completion { - (void)getVideoWithAsset:(id)asset progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler completion:(void (^)(AVPlayerItem *, NSDictionary *))completion {
if ([asset isKindOfClass:[PHAsset class]]) { if ([asset isKindOfClass:[PHAsset class]]) {
PHVideoRequestOptions *option = [[PHVideoRequestOptions alloc] init]; PHVideoRequestOptions *option = [[PHVideoRequestOptions alloc] init];
option.networkAccessAllowed = YES; option.networkAccessAllowed = YES;
...@@ -655,7 +661,7 @@ static CGFloat TZScreenScale; ...@@ -655,7 +661,7 @@ static CGFloat TZScreenScale;
} }
}); });
}; };
[[PHImageManager defaultManager] requestPlayerItemForVideo:asset options:option resultHandler:^(AVPlayerItem * _Nullable playerItem, NSDictionary * _Nullable info) { [[PHImageManager defaultManager] requestPlayerItemForVideo:asset options:option resultHandler:^(AVPlayerItem *playerItem, NSDictionary *info) {
if (completion) completion(playerItem,info); if (completion) completion(playerItem,info);
}]; }];
} else if ([asset isKindOfClass:[ALAsset class]]) { } else if ([asset isKindOfClass:[ALAsset class]]) {
...@@ -993,6 +999,7 @@ static CGFloat TZScreenScale; ...@@ -993,6 +999,7 @@ static CGFloat TZScreenScale;
CGImageRelease(cgimg); CGImageRelease(cgimg);
return img; return img;
} }
#pragma clang diagnostic pop #pragma clang diagnostic pop
@end @end
......
...@@ -629,6 +629,7 @@ ...@@ -629,6 +629,7 @@
[self.navigationController pushViewController:photoPickerVc animated:YES]; [self.navigationController pushViewController:photoPickerVc animated:YES];
[tableView deselectRowAtIndexPath:indexPath animated:NO]; [tableView deselectRowAtIndexPath:indexPath animated:NO];
} }
#pragma clang diagnostic pop #pragma clang diagnostic pop
@end @end
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
} }
@end @end
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@implementation TZVideoPlayerController @implementation TZVideoPlayerController
- (void)viewDidLoad { - (void)viewDidLoad {
...@@ -167,4 +170,6 @@ ...@@ -167,4 +170,6 @@
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
} }
#pragma clang diagnostic pop
@end @end
...@@ -625,6 +625,7 @@ ...@@ -625,6 +625,7 @@
- (UIInterfaceOrientationMask)supportedInterfaceOrientations { - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait; return UIInterfaceOrientationMaskPortrait;
} }
#pragma clang diagnostic pop #pragma clang diagnostic pop
@end @end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment