ios开发小技能

1.数组操作出现报错:NSArray was mutated while being enumerated

NSArray was mutated while being enumerated
这种情况一般是在遍历数组的时候对数组进行增删操作,导致此问题,比如下面的代码

    NSMutableArray *arr_old = @[@"1",@"1",@"0",@"1",@"1"];
    for (NSString *str in arr_old) {
        if ([str isEqualToString:@"0"]) {
            [arr_old removeObject:str];
        }
    }

2.ios 屏幕录制视频添加到相册

解决此问题方法:

重新实例化一个新数组,新数组用attayWithArray实例化,然后对新数组进行遍历,就数组进行增删操作
如下:

    NSMutableArray *arr_old = @[@"1",@"1",@"0",@"1",@"1"];
    SMutableArray *arr_new = [NSMutableArray arrayWithArray:arr_old];
    for (NSString *str in arr_new) {
        if ([str isEqualToString:@"0"]) {
            [arr_old removeObject:str];
        }
    }
NSString *betaCompressionDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.mov"];
    dispatch_async(dispatch_queue_create("videoSave", NULL), ^{
         UISaveVideoAtPathToSavedPhotosAlbum(betaCompressionDirectory, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);
    });

- (void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInf{
    if (error) {
        [XHToast showCenterWithText:VIDEOSAVEDDEFAULT];
    }else{
        [XHToast showCenterWithText:VIDEOSAVED];
    }
}

3.appstore 更改公司名称

前言
有时候由于注册appstore开发者账号,填写公司名称错误或者其他原因导致appstore开发者显示错误,搜索网上的解决方法,却没有一个完完整整的方案,今天就详细的记录一次,仅供参考

  1. 打开itunesconnect https://itunesconnect.apple.com
  2. 点击最下方的 contract us
  3. 具体选项如下图


    ios开发小技能_第1张图片
    屏幕快照 2017-02-28 上午10.27.46
  4. 然后填写需要申请的信息
  5. 点击 submit--->done

欢迎你的小星星!!!
如有不懂得地方添加qq:517769958咨询

你可能感兴趣的:(ios开发小技能)