From 81d7066ecbf65c4f2b95856c3c15492405b7e2f8 Mon Sep 17 00:00:00 2001 From: fengshuo <963787902@qq.com> Date: Wed, 4 Jan 2023 14:43:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E6=95=B0=E7=BB=84=E8=B6=8A=E7=95=8C=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Cell/MineInfo/XPMineDataSkillCardTableViewCell.m | 5 +++-- xplan-ios/Main/Mine/View/Cell/XPMineGameTableViewCell.m | 5 +++-- .../Main/Mine/View/Cell/XPMineHeadItemTableViewCell.m | 5 +++-- .../Mine/View/DressUp/View/XPDressSearchViewController.m | 5 +++-- .../View/DressUp/View/XPDressUpShopCardViewController.m | 3 ++- .../View/DressUp/View/XPDressUpShopListViewController.m | 3 ++- .../Mine/View/DressUp/View/XPDressUpShopViewController.m | 3 ++- .../DressUp/View/XPMineDressUpBubbleViewController.m | 3 ++- .../View/DressUp/View/XPMineDressUpListViewController.m | 9 +++++---- .../Mine/View/DressUp/View/XPMineDressUpViewController.m | 3 ++- .../View/MatchManage/View/XPMatchManageViewController.m | 4 ++-- .../View/MineInfo/XPMineUserInfoAlbumViewController.m | 3 ++- .../View/MineInfo/XPMineUserInfoEditViewController.m | 7 ++++--- .../MineInfo/XPMineUserInfoGiftWallSubViewController.m | 3 ++- .../Mine/View/SubViews/MineInfo/XPMineUserInfoGiftView.m | 3 ++- .../View/SubViews/MineInfo/XPMineUserInfoHeaderView.m | 7 ++++--- .../View/SubViews/MineInfo/XPMineUserInfoVoiceCardView.m | 3 ++- xplan-ios/Main/Mine/View/XPMineFansTeamViewController.m | 5 +++-- xplan-ios/Main/Mine/View/XPMineFootPrintViewController.m | 6 +++--- xplan-ios/Main/Mine/View/XPMineVisitorViewController.m | 7 ++++--- xplan-ios/Main/Mine/View/XPPermissionsViewController.m | 7 ++++--- xplan-ios/Main/Mine/View/XPPrivacyViewController.m | 3 ++- 22 files changed, 61 insertions(+), 41 deletions(-) diff --git a/xplan-ios/Main/Mine/View/Cell/MineInfo/XPMineDataSkillCardTableViewCell.m b/xplan-ios/Main/Mine/View/Cell/MineInfo/XPMineDataSkillCardTableViewCell.m index bf078a7f..1d8079e7 100644 --- a/xplan-ios/Main/Mine/View/Cell/MineInfo/XPMineDataSkillCardTableViewCell.m +++ b/xplan-ios/Main/Mine/View/Cell/MineInfo/XPMineDataSkillCardTableViewCell.m @@ -10,6 +10,7 @@ #import ///Tool #import "ThemeColor.h" +#import "NSArray+Safe.h" ///View #import "XPMineDataSkillDataCollectionViewCell.h" @@ -78,14 +79,14 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPMineDataSkillDataCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMineDataSkillDataCollectionViewCell class]) forIndexPath:indexPath]; - cell.skillInfo = [self.datasourece objectAtIndex:indexPath.row]; + cell.skillInfo = [self.datasourece safeObjectAtIndex1:indexPath.row]; return cell; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.datasourece.count > 0) { - MineSkillCardListInfoModel * skillInfo = [self.datasourece objectAtIndex:indexPath.row]; + MineSkillCardListInfoModel * skillInfo = [self.datasourece safeObjectAtIndex1:indexPath.row]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineDataSkillCardTableViewCell:didSelectItem:)]) { [self.delegate xPMineDataSkillCardTableViewCell:self didSelectItem:skillInfo]; } diff --git a/xplan-ios/Main/Mine/View/Cell/XPMineGameTableViewCell.m b/xplan-ios/Main/Mine/View/Cell/XPMineGameTableViewCell.m index c7af1a8b..c1cf8f52 100644 --- a/xplan-ios/Main/Mine/View/Cell/XPMineGameTableViewCell.m +++ b/xplan-ios/Main/Mine/View/Cell/XPMineGameTableViewCell.m @@ -12,6 +12,7 @@ #import "ThemeColor.h" #import "XPMacro.h" #import "UIImage+Utils.h" +#import "NSArray+Safe.h" ///View #import "XPMIneGameCollectionViewCell.h" @@ -75,7 +76,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPMIneGameCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMIneGameCollectionViewCell class]) forIndexPath:indexPath]; - LittleGameInfoModel * item = [self.datasource objectAtIndex:indexPath.row]; + LittleGameInfoModel * item = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.gameModel = item; return cell; } @@ -83,7 +84,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineGameTableViewCell:didSelectItem:)]) { - LittleGameInfoModel * model = [self.datasource objectAtIndex:indexPath.row]; + LittleGameInfoModel * model = [self.datasource safeObjectAtIndex1:indexPath.row]; [self.delegate xPMineGameTableViewCell:self didSelectItem:model]; } } diff --git a/xplan-ios/Main/Mine/View/Cell/XPMineHeadItemTableViewCell.m b/xplan-ios/Main/Mine/View/Cell/XPMineHeadItemTableViewCell.m index 4ba239c8..fa02facf 100644 --- a/xplan-ios/Main/Mine/View/Cell/XPMineHeadItemTableViewCell.m +++ b/xplan-ios/Main/Mine/View/Cell/XPMineHeadItemTableViewCell.m @@ -11,6 +11,7 @@ ///Tool #import "ThemeColor.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///View #import "XPMineHeadItemCollectionViewCell.h" #import "XPMineHeadFunctionItemLayout.h" @@ -61,7 +62,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPMineHeadItemCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMineHeadItemCollectionViewCell class]) forIndexPath:indexPath]; - XPMineFuntionItemModel * item = [self.datasource objectAtIndex:indexPath.row]; + XPMineFuntionItemModel * item = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.itemModel = item; return cell; } @@ -69,7 +70,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineHeadItemTableViewCell:didSelectItem:)]) { - XPMineFuntionItemModel * model = [self.datasource objectAtIndex:indexPath.row]; + XPMineFuntionItemModel * model = [self.datasource safeObjectAtIndex1:indexPath.row]; [self.delegate xPMineHeadItemTableViewCell:self didSelectItem:model]; } } diff --git a/xplan-ios/Main/Mine/View/DressUp/View/XPDressSearchViewController.m b/xplan-ios/Main/Mine/View/DressUp/View/XPDressSearchViewController.m index fc10d0c2..2263b429 100644 --- a/xplan-ios/Main/Mine/View/DressUp/View/XPDressSearchViewController.m +++ b/xplan-ios/Main/Mine/View/DressUp/View/XPDressSearchViewController.m @@ -12,6 +12,7 @@ #import "ThemeColor.h" #import "XPMacro.h" #import "Api+DressUp.h" +#import "NSArray+Safe.h" ///Model #import "HomeSearchResultModel.h" ///View @@ -91,7 +92,7 @@ if (cell == nil) { cell = [[XPDressShopSearchTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPDressShopSearchTableViewCell class])]; } - HomeSearchResultModel * resultModel = [self.datasource objectAtIndex:indexPath.row]; + HomeSearchResultModel * resultModel = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.data = resultModel; cell.delegate = self; cell.selectionStyle = UITableViewCellSelectionStyleNone; @@ -105,7 +106,7 @@ #pragma mark - XPDressShopSearchTableViewCellDelegate - (void)xPDressShopSearchTableViewCellSendButtonClick:(XPDressShopSearchTableViewCell *)cell { NSIndexPath *indexPath = [self.tableView indexPathForCell:cell]; - HomeSearchResultModel * resultModel = [self.datasource objectAtIndex:indexPath.row]; + HomeSearchResultModel * resultModel = [self.datasource safeObjectAtIndex1:indexPath.row]; [self showLoading]; [Api requestSendDress:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { [self hideHUD]; diff --git a/xplan-ios/Main/Mine/View/DressUp/View/XPDressUpShopCardViewController.m b/xplan-ios/Main/Mine/View/DressUp/View/XPDressUpShopCardViewController.m index 0b5e4a0a..4d6859e0 100644 --- a/xplan-ios/Main/Mine/View/DressUp/View/XPDressUpShopCardViewController.m +++ b/xplan-ios/Main/Mine/View/DressUp/View/XPDressUpShopCardViewController.m @@ -10,6 +10,7 @@ #import ///Tool #import "XPMacro.h" +#import "NSArray+Safe.h" ///View #import "XPMineDressEmptyTableViewCell.h" #import "XPDressUpShopCardTableViewCell.h" @@ -154,7 +155,7 @@ if (cell == nil) { cell = [[XPDressUpShopCardTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPDressUpShopCardTableViewCell class])]; } - cell.nobleCardModel = [self.datasource objectAtIndex:indexPath.row]; + cell.nobleCardModel = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.delegate = self; return cell; } diff --git a/xplan-ios/Main/Mine/View/DressUp/View/XPDressUpShopListViewController.m b/xplan-ios/Main/Mine/View/DressUp/View/XPDressUpShopListViewController.m index 674bed6a..2dd08e61 100644 --- a/xplan-ios/Main/Mine/View/DressUp/View/XPDressUpShopListViewController.m +++ b/xplan-ios/Main/Mine/View/DressUp/View/XPDressUpShopListViewController.m @@ -10,6 +10,7 @@ #import ///Tool #import "XPMacro.h" +#import "NSArray+Safe.h" ///View #import "XPMineDressEmptyCollectionViewCell.h" #import "XPDressUpShopCollectionViewCell.h" @@ -145,7 +146,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { XPDressUpShopCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPDressUpShopCollectionViewCell class]) forIndexPath:indexPath]; - cell.dressUpModel = [self.datasource objectAtIndex:indexPath.row]; + cell.dressUpModel = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.delegate = self; return cell; } diff --git a/xplan-ios/Main/Mine/View/DressUp/View/XPDressUpShopViewController.m b/xplan-ios/Main/Mine/View/DressUp/View/XPDressUpShopViewController.m index 7d796842..05d0cf94 100644 --- a/xplan-ios/Main/Mine/View/DressUp/View/XPDressUpShopViewController.m +++ b/xplan-ios/Main/Mine/View/DressUp/View/XPDressUpShopViewController.m @@ -17,6 +17,7 @@ #import "XPMacro.h" #import "UIImage+Utils.h" #import "AccountInfoStorage.h" +#import "NSArray+Safe.h" ///Model #import "ActivityInfoModel.h" #import "WalletInfoModel.h" @@ -219,7 +220,7 @@ #pragma mark - SDCycleScrollViewDelegate - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index { if (self.activityList.count > index) { - ActivityInfoModel * info = [self.activityList objectAtIndex:index]; + ActivityInfoModel * info = [self.activityList safeObjectAtIndex1:index]; if (info.skipType == ActivitySkipType_Room) { [XPRoomViewController openRoom:info.skipUri viewController:self.navigationController]; } else if(info.skipType == ActivitySkipType_Web) { diff --git a/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpBubbleViewController.m b/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpBubbleViewController.m index 92141b41..eca38be8 100644 --- a/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpBubbleViewController.m +++ b/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpBubbleViewController.m @@ -10,6 +10,7 @@ #import ///Tool #import "XPMacro.h" +#import "NSArray+Safe.h" ///View #import "XPMineDressBubbleCollectionViewCell.h" #import "XPMineDressEmptyCollectionViewCell.h" @@ -93,7 +94,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { XPMineDressBubbleCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMineDressBubbleCollectionViewCell class]) forIndexPath:indexPath]; - cell.bubbleModel = [self.datasource objectAtIndex:indexPath.row]; + cell.bubbleModel = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.delegate = self; return cell; } diff --git a/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpListViewController.m b/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpListViewController.m index afce316c..6aa28755 100644 --- a/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpListViewController.m +++ b/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpListViewController.m @@ -10,6 +10,7 @@ #import ///Tool #import "XPMacro.h" +#import "NSArray+Safe.h" ///View #import "XPMineHeadwearTableViewCell.h" #import "XPMineCarTableViewCell.h" @@ -151,7 +152,7 @@ if (cell == nil) { cell = [[XPMineHeadwearTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineHeadwearTableViewCell class])]; } - cell.headwearModel = [self.datasource objectAtIndex:indexPath.row]; + cell.headwearModel = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.delegate = self; return cell; } else if(self.type == DressUpListType_Car) { @@ -159,7 +160,7 @@ if (cell == nil) { cell = [[XPMineCarTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineCarTableViewCell class])]; } - cell.carInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.carInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.delegate = self; return cell; } else if (self.type == DressUpListType_Noble) { @@ -167,7 +168,7 @@ if (cell == nil) { cell = [[XPMineNobleCardTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineNobleCardTableViewCell class])]; } - cell.nobleCardModel = [self.datasource objectAtIndex:indexPath.row]; + cell.nobleCardModel = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.delegate = self; return cell; } else { @@ -175,7 +176,7 @@ if (cell == nil) { cell = [[XPMineNameplateTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineNameplateTableViewCell class])]; } - cell.nameplateModel = [self.datasource objectAtIndex:indexPath.row]; + cell.nameplateModel = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.delegate = self; return cell; } diff --git a/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpViewController.m b/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpViewController.m index f8fa0f92..4b3398f9 100644 --- a/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpViewController.m +++ b/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpViewController.m @@ -14,6 +14,7 @@ ///Tool #import "ThemeColor.h" #import "Api+DressUp.h" +#import "NSArray+Safe.h" ///Model #import "ActivityInfoModel.h" ///View @@ -141,7 +142,7 @@ #pragma mark - SDCycleScrollViewDelegate - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index { if (self.activityList.count > index) { - ActivityInfoModel * info = [self.activityList objectAtIndex:index]; + ActivityInfoModel * info = [self.activityList safeObjectAtIndex1:index]; if (info.skipType == ActivitySkipType_Room) { [XPRoomViewController openRoom:info.skipUri viewController:self.navigationController]; } else if(info.skipType == ActivitySkipType_Web) { diff --git a/xplan-ios/Main/Mine/View/MatchManage/View/XPMatchManageViewController.m b/xplan-ios/Main/Mine/View/MatchManage/View/XPMatchManageViewController.m index b3f2aea6..d87ba23a 100644 --- a/xplan-ios/Main/Mine/View/MatchManage/View/XPMatchManageViewController.m +++ b/xplan-ios/Main/Mine/View/MatchManage/View/XPMatchManageViewController.m @@ -80,14 +80,14 @@ if (cell == nil) { cell = [[XPMatchManageTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMatchManageTableViewCell class])]; } - XPMineItemModel * item = [self.matchItemArray objectAtIndex:indexPath.row]; + XPMineItemModel * item = [self.matchItemArray safeObjectAtIndex1:indexPath.row]; cell.itemModel = item; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; - XPMineItemModel * model = [self.matchItemArray objectAtIndex:indexPath.row]; + XPMineItemModel * model = [self.matchItemArray safeObjectAtIndex1:indexPath.row]; [self pushViewControllerWithType:model.type]; } diff --git a/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoAlbumViewController.m b/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoAlbumViewController.m index fb732386..3caaa4e6 100644 --- a/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoAlbumViewController.m +++ b/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoAlbumViewController.m @@ -15,6 +15,7 @@ #import "YYUtility.h" ///Tool #import "ThemeColor.h" +#import "NSArray+Safe.h" ///Model #import "UserInfoModel.h" ///View @@ -139,7 +140,7 @@ cell.isEdit = NO; } else { if (self.datasource.count > 0) { - cell.photo = [self.datasource objectAtIndex:indexPath.row - 1]; + cell.photo = [self.datasource safeObjectAtIndex1:indexPath.row - 1]; cell.isEdit = self.isEdit; } } diff --git a/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoEditViewController.m b/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoEditViewController.m index c04b3fa2..344b6502 100644 --- a/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoEditViewController.m +++ b/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoEditViewController.m @@ -14,6 +14,7 @@ #import "TTPopup.h" #import "YYUtility.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "XPMineUserInfoEditModel.h" #import "UserInfoModel.h" @@ -137,7 +138,7 @@ } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - XPMineUserInfoEditModel * model = [self.datasouce objectAtIndex:indexPath.row]; + XPMineUserInfoEditModel * model = [self.datasouce safeObjectAtIndex1:indexPath.row]; if (model.type == XPMineUserInfoEditType_Avatar) { return 60; } else { @@ -150,14 +151,14 @@ if (cell == nil) { cell = [[XPMineUserInfoEditTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineUserInfoEditTableViewCell class])]; } - XPMineUserInfoEditModel * model = [self.datasouce objectAtIndex:indexPath.row]; + XPMineUserInfoEditModel * model = [self.datasouce safeObjectAtIndex1:indexPath.row]; cell.itmeModel = model; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; - XPMineUserInfoEditModel * model = [self.datasouce objectAtIndex:indexPath.row]; + XPMineUserInfoEditModel * model = [self.datasouce safeObjectAtIndex1:indexPath.row]; switch (model.type) { case XPMineUserInfoEditType_Nick: { diff --git a/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoGiftWallSubViewController.m b/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoGiftWallSubViewController.m index 020b7aa3..ad8eb405 100644 --- a/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoGiftWallSubViewController.m +++ b/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoGiftWallSubViewController.m @@ -11,6 +11,7 @@ ///Tool #import "ThemeColor.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///View #import "XPMineUserInfoGiftWallCollectionViewCell.h" #import "XPGuildEmptyCollectionViewCell.h" @@ -59,7 +60,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { XPMineUserInfoGiftWallCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMineUserInfoGiftWallCollectionViewCell class]) forIndexPath:indexPath]; - UserGiftWallInfoModel * giftInfo = [self.datasource objectAtIndex:indexPath.row]; + UserGiftWallInfoModel * giftInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.giftInfo = giftInfo; return cell; diff --git a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoGiftView.m b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoGiftView.m index 774b5337..e1638567 100644 --- a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoGiftView.m +++ b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoGiftView.m @@ -10,6 +10,7 @@ #import ///Tool #import "XPMacro.h" +#import "NSArray+Safe.h" ///View #import "XPMineDataGiftCollectionViewCell.h" #import "XPMineUserInfoEmptyCollectionViewCell.h" @@ -53,7 +54,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { XPMineDataGiftCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMineDataGiftCollectionViewCell class]) forIndexPath:indexPath]; - cell.giftInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.giftInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } diff --git a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoHeaderView.m b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoHeaderView.m index aed91af9..aed68b9a 100644 --- a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoHeaderView.m +++ b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoHeaderView.m @@ -17,6 +17,7 @@ #import "UIImage+ImageEffects.h" #import "UIImage+Utils.h" #import "NetImageView.h" +#import "NSArray+Safe.h" ///Model #import "UserInfoModel.h" @@ -265,7 +266,7 @@ #pragma mark - SDPhotoBrowserDelegate - (NSURL *)photoBrowser:(SDPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index { - NSString * photoUrl = [self.imageUrls objectAtIndex:index]; + NSString * photoUrl = [self.imageUrls safeObjectAtIndex1:index]; return [NSURL URLWithString:photoUrl]; } @@ -276,7 +277,7 @@ #pragma mark - SDCycleScrollViewDelegate -(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index { [self.pageButton setTitle:[NSString stringWithFormat:@"%ld/%lu",(index + 1), (unsigned long)self.imageUrls.count] forState:UIControlStateNormal]; - UserPhoto * photo = [self.userPhtotArray objectAtIndex:index]; + UserPhoto * photo = [self.userPhtotArray safeObjectAtIndex1:index]; self.reviewIcon.hidden = !photo.isReview; } @@ -358,7 +359,7 @@ } if (self.userInfo.privatePhoto.count > 0) { for (int i = 0; i < self.userInfo.privatePhoto.count; i++) { - UserPhoto * photo = [self.userInfo.privatePhoto objectAtIndex:i]; + UserPhoto * photo = [self.userInfo.privatePhoto safeObjectAtIndex1:i]; if (photo.photoUrl.length > 0) { [self.userPhtotArray addObject:photo]; [imageUrls addObject:photo.photoUrl]; diff --git a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoVoiceCardView.m b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoVoiceCardView.m index 0ebc97b3..82a9bbe4 100644 --- a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoVoiceCardView.m +++ b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoVoiceCardView.m @@ -13,6 +13,7 @@ #import "UIImage+Utils.h" #import "UIButton+EnlargeTouchArea.h" #import "ThemeColor.h" +#import "NSArray+Safe.h" ///Model #import "MineSkillCardListInfoModel.h" #import "XPSkillCardPlayerManager.h" @@ -75,7 +76,7 @@ if (!self.isPlaying) { if(self.voiceInfo.propVals.count) { // NSString *fileName = [[self.voiceInfo.name componentsSeparatedByString:@"/"] lastObject]; - NSString * url = [self.voiceInfo.propVals objectAtIndex:0]; + NSString * url = [self.voiceInfo.propVals safeObjectAtIndex1:0]; NSArray * nameArray = [url componentsSeparatedByString:@"/"]; NSString * fileName = @"daeplay"; if (nameArray.count > 0) { diff --git a/xplan-ios/Main/Mine/View/XPMineFansTeamViewController.m b/xplan-ios/Main/Mine/View/XPMineFansTeamViewController.m index 58a73edb..4a890f83 100644 --- a/xplan-ios/Main/Mine/View/XPMineFansTeamViewController.m +++ b/xplan-ios/Main/Mine/View/XPMineFansTeamViewController.m @@ -10,6 +10,7 @@ #import ///Tool #import "ThemeColor.h" +#import "NSArray+Safe.h" ///Model #import "XPMineAnchorFansTeamModel.h" ///View @@ -79,7 +80,7 @@ if (cell == nil) { cell = [[XPMineAnchorFansTeamTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineAnchorFansTeamTableViewCell class])]; } - cell.item = [self.datasource objectAtIndex:indexPath.row]; + cell.item = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } @@ -92,7 +93,7 @@ } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - XPMineAnchorFansTeamModel *item = [self.datasource objectAtIndex:indexPath.row]; + XPMineAnchorFansTeamModel *item = [self.datasource safeObjectAtIndex1:indexPath.row]; XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init]; userInfoVC.uid = item.teamUid; [self.navigationController pushViewController:userInfoVC animated:YES]; diff --git a/xplan-ios/Main/Mine/View/XPMineFootPrintViewController.m b/xplan-ios/Main/Mine/View/XPMineFootPrintViewController.m index 1f0ed165..dfbfe742 100644 --- a/xplan-ios/Main/Mine/View/XPMineFootPrintViewController.m +++ b/xplan-ios/Main/Mine/View/XPMineFootPrintViewController.m @@ -151,7 +151,7 @@ if (cell == nil) { cell = [[XPMineFootPrintTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineFootPrintTableViewCell class])]; } - cell.item = [self.datasource objectAtIndex:indexPath.row]; + cell.item = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } @@ -167,12 +167,12 @@ [tableView setEditing:NO animated:YES]; __weak typeof(self) weakSelf = self; UIContextualAction *deleteAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { - XPMineFootPrintModel *item = [weakSelf.datasource objectAtIndex:indexPath.row]; + XPMineFootPrintModel *item = [weakSelf.datasource safeObjectAtIndex1:indexPath.row]; [weakSelf.presenter cleanFootPrint:item.roomUid]; completionHandler(true); }]; UIContextualAction *collectAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"收藏" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { - XPMineFootPrintModel *item = [weakSelf.datasource objectAtIndex:indexPath.row]; + XPMineFootPrintModel *item = [weakSelf.datasource safeObjectAtIndex1:indexPath.row]; [weakSelf.presenter collectRoomWithRoomUid:item.roomUid]; completionHandler(true); }]; diff --git a/xplan-ios/Main/Mine/View/XPMineVisitorViewController.m b/xplan-ios/Main/Mine/View/XPMineVisitorViewController.m index 8fbac1d4..ee2bd1f3 100644 --- a/xplan-ios/Main/Mine/View/XPMineVisitorViewController.m +++ b/xplan-ios/Main/Mine/View/XPMineVisitorViewController.m @@ -11,6 +11,7 @@ #import ///Tool #import "ThemeColor.h" +#import "NSArray+Safe.h" ///Model #import "XPMineVisitorItemModel.h" ///View @@ -130,7 +131,7 @@ cell.isFirstItem = indexPath.row == 0; cell.isLastItem = indexPath.row == self.datasource.count - 1; cell.delegate = self; - cell.item = [self.datasource objectAtIndex:indexPath.row]; + cell.item = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } @@ -153,7 +154,7 @@ #pragma mark - TTVisitorRecordCellDelegate - (void)onAvatarClick:(XPMineVisitorTableViewCell *)cell { NSIndexPath *indexPath = [self.tableView indexPathForCell:cell]; - XPMineVisitorItemModel *item = [self.datasource objectAtIndex:indexPath.row]; + XPMineVisitorItemModel *item = [self.datasource safeObjectAtIndex1:indexPath.row]; XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init]; userInfoVC.uid = item.uid; [self.navigationController pushViewController:userInfoVC animated:YES]; @@ -161,7 +162,7 @@ - (void)onChatClick:(XPMineVisitorTableViewCell *)cell { NSIndexPath *indexPath = [self.tableView indexPathForCell:cell]; - XPMineVisitorItemModel *item = [self.datasource objectAtIndex:indexPath.row]; + XPMineVisitorItemModel *item = [self.datasource safeObjectAtIndex1:indexPath.row]; NSString * sessionId = [NSString stringWithFormat:@"%lld",item.uid]; NIMSession * session = [NIMSession session:sessionId type:NIMSessionTypeP2P]; SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session]; diff --git a/xplan-ios/Main/Mine/View/XPPermissionsViewController.m b/xplan-ios/Main/Mine/View/XPPermissionsViewController.m index b747de5c..61e6536b 100644 --- a/xplan-ios/Main/Mine/View/XPPermissionsViewController.m +++ b/xplan-ios/Main/Mine/View/XPPermissionsViewController.m @@ -11,6 +11,7 @@ #import #import "XPMacro.h" #import "ThemeColor.h" +#import "NSArray+Safe.h" @interface XPPermissionCell : UITableViewCell @@ -194,9 +195,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSInteger section = indexPath.section; XPPermissionCell * cell = [[XPPermissionCell alloc] init]; - cell.icon.image = [UIImage imageNamed:[self.permissionIcons objectAtIndex:section]]; - cell.name.text = [self.permissionNames objectAtIndex:section]; - cell.tip.text = [self.permissionTips objectAtIndex:section]; + cell.icon.image = [UIImage imageNamed:[self.permissionIcons safeObjectAtIndex1:section]]; + cell.name.text = [self.permissionNames safeObjectAtIndex1:section]; + cell.tip.text = [self.permissionTips safeObjectAtIndex1:section]; return cell; } diff --git a/xplan-ios/Main/Mine/View/XPPrivacyViewController.m b/xplan-ios/Main/Mine/View/XPPrivacyViewController.m index a43761e4..1b71c2f8 100644 --- a/xplan-ios/Main/Mine/View/XPPrivacyViewController.m +++ b/xplan-ios/Main/Mine/View/XPPrivacyViewController.m @@ -12,6 +12,7 @@ #import "XPWebViewController.h" #import "XPPermissionsViewController.h" #import "XPHtmlUrl.h" +#import "NSArray+Safe.h" @interface XPPrivacyViewController () @@ -54,7 +55,7 @@ cell = [[XPMineSettingTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineSettingTableViewCell class])]; } - cell.itemModel = [self.datasource objectAtIndex:indexPath.row]; + cell.itemModel = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; }