瀏覽代碼

修复iOS 17 UIGraphicsBeginImageContextWithOptions 崩溃的问题

Steven 1 年之前
父節點
當前提交
464c6a348f

二進制
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/PlayerImage/merge_music_bg.imageset/merge_music_bg@2x.png


二進制
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/PlayerImage/merge_music_bg.imageset/merge_music_bg@3x.png


+ 1 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSAccompanyWebViewController.m

@@ -534,6 +534,7 @@
                 
                 if (canOpenCamera == PREMISSIONTYPE_YES) {
                     self.isCameraOpen = YES;
+                    [self.videoRecordManager setIgnoreAudio:YES];
                     [self.videoRecordManager configSessiondisplayInView:self.viewContainer];
                     [self postMessage:parm];
                 }

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSBaseWKWebViewController.m

@@ -759,7 +759,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     else if ([typeStr isEqualToString:@"mp3"]) {
         [self chooseDocumentWithType:CHOOSETYPE_MP3 bucket:bucket];
     }
-    else if ([typeStr isEqualToString:@"xml"]) {
+    else if ([typeStr isEqualToString:@"xml"] || [typeStr isEqualToString:@"musicxml"]) {
         [self chooseDocumentWithType:CHOOSETYPE_XML bucket:bucket];
     }
 }

+ 6 - 4
KulexiuForTeacher/KulexiuForTeacher/Common/LoadingManager/KSCustomLoadingView.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina6_12" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -16,8 +16,8 @@
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ftd-2r-orp">
                     <rect key="frame" x="146.66666666666666" y="376" width="100" height="100"/>
                     <subviews>
-                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="上传中..." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jQZ-bq-s4l">
-                            <rect key="frame" x="26" y="70" width="48" height="15"/>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="上传中..." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jQZ-bq-s4l">
+                            <rect key="frame" x="2" y="70" width="96" height="14.333333333333329"/>
                             <fontDescription key="fontDescription" type="system" pointSize="12"/>
                             <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
                             <nil key="highlightedColor"/>
@@ -37,8 +37,10 @@
                         <constraint firstAttribute="height" constant="100" id="7LV-ix-8dR"/>
                         <constraint firstItem="jQZ-bq-s4l" firstAttribute="centerX" secondItem="Ftd-2r-orp" secondAttribute="centerX" id="BZp-te-gfI"/>
                         <constraint firstAttribute="width" constant="100" id="E8b-Gp-LDR"/>
+                        <constraint firstAttribute="trailing" secondItem="jQZ-bq-s4l" secondAttribute="trailing" constant="2" id="YpK-FP-G3Q"/>
                         <constraint firstItem="2VA-sp-63Q" firstAttribute="top" secondItem="Ftd-2r-orp" secondAttribute="top" constant="5" id="aS3-r0-aMu"/>
                         <constraint firstItem="jQZ-bq-s4l" firstAttribute="top" secondItem="2VA-sp-63Q" secondAttribute="bottom" constant="10" id="lLr-cs-u9n"/>
+                        <constraint firstItem="jQZ-bq-s4l" firstAttribute="leading" secondItem="Ftd-2r-orp" secondAttribute="leading" constant="2" id="w6a-hx-sAr"/>
                     </constraints>
                     <userDefinedRuntimeAttributes>
                         <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Common/LoadingManager/KSProgressLoadingView.m

@@ -79,7 +79,7 @@
 }
 
 - (UIImage *)createGradientImageWithColor:(NSArray *)colors rect:(CGRect)rect start:(CGPoint)start end:(CGPoint)end {
-    if (!colors.count || CGRectEqualToRect(rect, CGRectZero)) {
+    if (!colors.count || rect.size.width <= 0 || rect.size.height <= 0) {
         return nil;
     }
     CAGradientLayer *gradientLayer = [CAGradientLayer layer];

+ 3 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/MediaMerge/AudioMerge/UIView+KSCovertImage.m

@@ -10,6 +10,9 @@
 @implementation UIView (KSCovertImage)
 
 + (UIImage *)convertViewToImage:(UIView *)view {
+    if (view.size.width <= 0 || view.size.height <= 0) {
+        return nil;
+    }
     UIImage *image = [[UIImage alloc] init];
     UIGraphicsBeginImageContextWithOptions(view.frame.size, NO, [UIScreen mainScreen].scale);
     [view.layer renderInContext:UIGraphicsGetCurrentContext()];

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Common/MediaMerge/MusicPlayer/kSNewPlayer.m

@@ -44,7 +44,7 @@
 
 - (void)preparePlaySongWithUrl:(NSString *)urlStr {
     self.cacheFinish = NO;
-    urlStr = [UrlDecode encodeUrlStringWithString:urlStr];
+    urlStr = [urlStr getUrlEndcodeString];
     AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:[NSURL URLWithString:urlStr] options:nil];
     if (_songItem) {
         [self removeAllNoticeAndObserver];

+ 6 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/Extension/UIImage+Color.m

@@ -11,6 +11,9 @@
 @implementation UIImage (Color)
 
 + (UIImage *)imageWithColor:(UIColor *)color {
+    if (self.size.width <= 0 || self.size.height <= 0) {
+        return nil;
+    }
     CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
     UIGraphicsBeginImageContext(rect.size);
     CGContextRef context = UIGraphicsGetCurrentContext();
@@ -22,6 +25,9 @@
 }
 
 - (UIImage *)maskWithColor:(UIColor *)color {
+    if (self.size.width <= 0 || self.size.height <= 0) {
+        return nil;
+    }
     UIGraphicsBeginImageContextWithOptions(self.size, NO, self.scale);
     [color setFill];
     CGRect bounds = CGRectMake(0, 0, self.size.width, self.size.height);

+ 7 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/Extension/UIImage+KSScreenShot.m

@@ -21,6 +21,9 @@
 }
 
 + (UIImage *)getCurrentViewShot:(UIView *)view {
+    if (view.size.width <= 0 || view.size.height <= 0) {
+        return nil;
+    }
     CGSize size = view.frame.size;
     CGFloat scale = [UIScreen mainScreen].scale;
     UIGraphicsBeginImageContextWithOptions(size, YES, scale);
@@ -30,6 +33,9 @@
     return image;
 }
 + (UIImage *)getCurrentScrollviewShot:(UIScrollView *)scrollview {
+    if (scrollview.contentSize.width <= 0 || scrollview.contentSize.height <= 0) {
+        return nil;
+    }
     CGSize size = scrollview.contentSize;
     CGFloat scale = [UIScreen mainScreen].scale;
     UIGraphicsBeginImageContextWithOptions(size, YES, scale);
@@ -53,6 +59,7 @@
 
 //获得某个范围内的屏幕图像
 + (UIImage *)getCurrentInnerViewShot:(UIView *) innerView atFrame:(CGRect)rect {
+
     UIGraphicsBeginImageContext(innerView.frame.size);
     CGContextRef context = UIGraphicsGetCurrentContext();
     CGContextSaveGState(context);

+ 8 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/Extension/UIImageView+CornerRadius.m

@@ -62,6 +62,10 @@ const char kProcessedImage;
  * @brief clip the cornerRadius with image, UIImageView must be setFrame before, no off-screen-rendered
  */
 - (void)cornerRadiusWithImage:(UIImage *)image cornerRadius:(CGFloat)cornerRadius rectCornerType:(UIRectCorner)rectCornerType {
+    if (self.bounds.size.width <= 0 || self.bounds.size.height <= 0) {
+        self.image = [[UIImage alloc] init];
+        return;
+    }
     CGSize size = self.bounds.size;
     CGFloat scale = [UIScreen mainScreen].scale;
     CGSize cornerRadii = CGSizeMake(cornerRadius, cornerRadius);
@@ -89,6 +93,10 @@ const char kProcessedImage;
  * @brief clip the cornerRadius with image, draw the backgroundColor you want, UIImageView must be setFrame before, no off-screen-rendered, no Color Blended layers
  */
 - (void)zy_cornerRadiusWithImage:(UIImage *)image cornerRadius:(CGFloat)cornerRadius rectCornerType:(UIRectCorner)rectCornerType backgroundColor:(UIColor *)backgroundColor {
+    if (self.bounds.size.width <= 0 || self.bounds.size.height <= 0) {
+        self.image = [[UIImage alloc] init];
+        return;
+    }
     CGSize size = self.bounds.size;
     CGFloat scale = [UIScreen mainScreen].scale;
     CGSize cornerRadii = CGSizeMake(cornerRadius, cornerRadius);

+ 8 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/KSUploadManager.m

@@ -200,6 +200,14 @@
 
 
 - (void)uploadFileToOssWithSource:(NSString *)fileName fileData:(NSData *)fileData progress:(KSUploadProgress)uploadProgress successCallback:(void(^)(NSString *fileUrl))success faliure:(void(^)(void))faliure {
+    if (fileData == nil) {
+        if (faliure) {
+            dispatch_main_async_safe(^{
+                faliure();
+            });
+        }
+        return;
+    }
     self.cosFileName = fileName;
     QCloudCOSXMLUploadObjectRequest *put = [QCloudCOSXMLUploadObjectRequest new];
     put.bucket = self.cosBucketName;