From c22ede0a13e80b11cd889a5deb277607016d143d Mon Sep 17 00:00:00 2001 From: fengshuo <963787902@qq.com> Date: Fri, 11 Nov 2022 17:46:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E6=95=B0=E7=BB=84?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E8=B6=8A=E7=95=8C=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xplan-ios/Base/UI/ShareView/XPShareView.m | 5 ++-- .../View/Cell/XPHomeAttentionTableViewCell.m | 5 ++-- .../View/Cell/XPHomeBannerTableViewCell.m | 3 ++- .../Cell/XPHomeCollectRoomTableViewCell.m | 5 ++-- .../View/Cell/XPHomeHapppyRoomTableViewCell.m | 5 ++-- .../View/Cell/XPHomeHotRoomTableViewCell.m | 5 ++-- .../View/Cell/XPHomeLittleGameTableViewCell.m | 5 ++-- .../Home/View/Cell/XPHomeMenuTableViewCell.m | 3 ++- .../View/Cell/XPHomeRecommendTableViewCell.m | 7 +++--- .../Home/View/SubViews/XPHomeLiveHeadView.m | 5 ++-- .../Home/View/XPHomeHappyViewController.m | 7 +++--- .../Home/View/XPHomeHotRoomViewController.m | 7 +++--- .../Main/Home/View/XPHomeLikeViewController.m | 5 ++-- .../View/XPHomeLittleGameViewController.m | 5 ++-- .../Home/View/XPHomeLivePageViewController.m | 5 ++-- .../View/XPHomePartyContainerViewController.m | 5 ++-- .../Home/View/XPHomePartyViewController.m | 5 ++-- .../Home/View/XPHomeRecommendViewController.m | 5 ++-- .../Home/View/XPHomeSearchViewController.m | 5 ++-- .../View/XPRoomSearchRecordViewController.m | 5 ++-- .../View/View/XPSessionFindNewGreetListView.m | 5 ++-- .../View/XPSessionFindNewViewController.m | 7 +++--- .../Message/View/Session/SessionToolbarView.m | 5 ++-- .../View/Session/SessionViewController.m | 11 ++++---- .../SessionList/SessionListViewController.m | 3 ++- .../XPMineCollectPartyRoomViewController.m | 7 +++--- .../Friend/XPMineAttentionViewController.m | 5 ++-- .../View/Friend/XPMineFansViewController.m | 5 ++-- .../View/Friend/XPMineFriendViewController.m | 7 +++--- .../View/Friend/XPRoomMessageBubbleView.m | 5 ++-- .../XPGuildSuperAdminSetTableViewCell.m | 3 ++- .../XPMineGuildIncomeDetailViewController.m | 3 ++- .../XPMineGuildIncomeRecordViewController.m | 10 +++++--- .../XPMineGuildManagerPerViewController.m | 3 ++- .../XPMineGuildManagerSetViewController.m | 3 ++- .../XPMineGuildRemoveMemberViewController.m | 5 ++-- .../Setting/XPMineMangerListViewController.m | 5 ++-- .../Guild/View/SubViews/XPGuildHeaderView.m | 5 ++-- .../SubViews/XPGuildTimeMonthPickerView.m | 18 ++++++------- .../XPMineGuildChooseManagerViewController.m | 3 ++- .../XPMineGuildSuperAdminSetViewController.m | 3 ++- .../Guild/View/XPMineClanViewController.m | 5 ++-- .../View/XPMineGuildSearchViewController.m | 11 ++++---- .../Guild/View/XPMineGuildViewController.m | 5 ++-- .../View/XPMatchManageViewController.m | 1 + .../SubViews/XPNoblePrivilegeContentCell.m | 5 ++-- .../View/SubViews/XPNobleRankUpdateView.m | 3 ++- .../Noble/View/XPNobleCenterViewController.m | 7 +++--- .../Setting/XPMineBlackListViewController.m | 7 +++--- .../Setting/XPMineNotificaViewController.m | 3 ++- .../Setting/XPMineSettingViewController.m | 7 +++--- .../View/SubViews/XPSkillCardListCell.m | 5 ++-- .../View/SubViews/XPSkillCardSelectPropView.m | 5 ++-- .../View/SubViews/XPSkillCardTypeView.m | 5 ++-- .../View/XPSkillCardEditViewController.m | 13 +++++----- .../View/XPSkillCardViewController.m | 13 +++++----- .../View/XPVoiceCardViewController.m | 7 +++--- .../FaceView/Presenter/XPRoomFacePresenter.m | 5 ++-- .../FaceView/Presenter/XPRoomFaceTool.m | 3 ++- .../FaceView/View/XPRoomFaceViewController.m | 15 +++++------ .../SendGiftView/Presenter/XPGiftStorage.m | 4 +-- .../Cell/XPGiftWeekStarCollectionViewCell.m | 5 ++-- .../SendGiftView/View/XPGiftCountView.m | 7 +++--- .../SendGiftView/View/XPGiftInfoView.m | 9 ++++--- .../View/XPGiftLuckyGiftBroadcastView.m | 3 ++- .../SendGiftView/View/XPGiftUsersView.m | 7 +++--- .../SendGiftView/View/XPSendGiftView.m | 3 ++- .../View/Cell/XPMonentsCommentTableViewCell.m | 7 +++--- .../View/Cell/XPMonentsTableViewCell.m | 3 ++- .../View/SubViews/XPMoentsTopicListView.m | 5 ++-- .../View/SubViews/XPMonentsPhotoView.m | 13 +++++----- .../SubViews/XPMonentsRecommendHeaderView.m | 7 +++--- .../View/SubViews/XPMonentsUserInfoView.m | 5 ++-- .../View/XPMoentsTopicListViewController.m | 5 ++-- .../View/XPMonentsAttentionViewController.m | 7 +++--- .../View/XPMonentsDetailViewController.m | 7 +++--- .../View/XPMonentsInteractiveViewController.m | 7 +++--- .../View/XPMonentsLatestViewController.m | 7 +++--- .../View/XPMonentsMineViewController.m | 7 +++--- .../View/XPMonentsPublishViewController.m | 4 ++- .../View/XPMonentsRecommendViewController.m | 7 +++--- .../View/XPMonentsTopicLatestViewController.m | 7 +++--- .../XPMonentsTopicRecommondViewController.m | 7 +++--- xplan-ios/Main/RTC/RtcImpl/ZegoRtcImpl.m | 3 ++- .../View/SubViews/XPAcrossRoomPKResultView.m | 5 ++-- .../View/SubViews/XPAcrpssRoomPKPanelView.m | 9 ++++--- .../View/XPAcrossRoomPKSelectRoomView.m | 3 ++- .../XPRoomActivityContainerView.m | 7 +++--- .../View/SubViews/XPAnchorPKResultView.m | 3 ++- .../View/SubViews/XPAnchorPkPanelView.m | 5 ++-- .../AnchorPK/View/XPAnchorPKSelectRoomView.m | 3 ++- .../AnimationView/XPRoomAnimationHitView.m | 4 +-- .../XPRoomGraffitiGiftAnimationView.m | 4 +-- .../View/XPArrangeMicViewController.m | 3 ++- .../View/SubViews/XPRoomBackMusicPlayerView.m | 9 ++++--- .../View/XPRoomMusicLibraryViewController.m | 7 +++--- .../View/XPRoomTransferMusicViewController.m | 7 +++--- .../XPRoomFunctionContainerView.m | 3 ++- .../View/CandyTree/View/XPCandyTreeMoreView.m | 3 ++- .../View/CandyTree/View/XPCandyTreeRankView.m | 3 ++- .../View/XPCandyTreeViewController.m | 3 ++- .../View/XPFirstRechargeSuccessView.m | 3 ++- .../View/XPFirstRechargeViewController.m | 7 +++--- .../Presenter/Category/NSString+RW.m | 4 +-- .../View/XPLittleGameMiniStageView.m | 3 ++- .../View/XPLittleGameRoomListView.m | 7 +++--- .../View/XPLittleGameRoomOpenView.m | 5 ++-- .../Tool/XPRoomMessageParser.m | 9 ++++--- .../View/XPNetImageYYLabel.m | 5 ++-- .../XPRoomMessageContainerView.m | 7 +++--- .../View/XPRoomMorePlayViewController.m | 5 ++-- .../View/XPRoomMoreMenuViewController.m | 5 ++-- .../NewUserGreet/XPRoomNewUserGreetView.m | 3 ++- .../View/XPReleaseRadioViewController.m | 5 ++-- .../View/SubViews/XPRoomPKPanelUserView.m | 5 ++-- .../View/SubViews/XPRoomPKRecordNickView.m | 5 ++-- .../View/SubViews/XPRoomPKSelectUserView.m | 25 ++++++++++--------- .../View/SubViews/XPRoomPKTimePickerView.m | 13 +++++----- .../View/RoomPK/View/XPRoomPKProgressView.m | 21 ++++++++-------- .../View/XPRoomPKRecordViewController.m | 3 ++- .../View/RoomPK/View/XPRoomPKResultView.m | 5 ++-- .../View/RoomPK/View/XPRoomPKViewController.m | 21 ++++++++-------- .../View/Sailing/View/XPSailingPrizeView.m | 3 ++- .../View/Sailing/View/XPSailingRankSubView.m | 3 ++- .../Sailing/View/XPSailingViewController.m | 5 ++-- .../SendRedPacket/XPReceiveRedPacketView.m | 3 ++- .../View/XPRoomInviteUserViewController.m | 9 ++++--- .../Setting/View/XPRoomOnLineViewController.m | 5 ++-- .../Setting/View/XPRoomRoleViewController.m | 5 ++-- .../View/XPRoomSettingViewController.m | 7 +++--- .../View/Setting/View/XPRoomTagListView.m | 13 +++++----- .../View/XPRoomTagListViewController.m | 13 +++++----- .../Main/Room/View/StageView/StageView.m | 7 +++--- .../View/SubViews/XPUserCardSkillCardView.m | 5 ++-- .../UserCard/View/XPUserCardViewController.m | 5 ++-- .../WishGift/View/View/XPWishGiftEnterView.m | 3 ++- .../WishGift/View/View/XPWishGiftListView.m | 5 ++-- .../View/XPWishGiftCreateItemViewController.m | 5 ++-- .../View/XPWishGiftCreateViewController.m | 3 ++- .../View/XPWishGiftHistoryViewController.m | 9 ++++--- .../WishGift/View/XPWishGiftViewController.m | 9 ++++--- xplan-ios/Main/Room/View/XPMiniRoomView.m | 7 +++--- .../Main/Room/View/XPRoomViewController.m | 3 ++- .../Tabbar/View/AnchorCard/XPAnchorCardView.m | 8 +++--- .../XPNewUserRechargeSucessView.m | 3 ++- .../XPNewUserRechargeViewController.m | 7 +++--- 146 files changed, 515 insertions(+), 371 deletions(-) diff --git a/xplan-ios/Base/UI/ShareView/XPShareView.m b/xplan-ios/Base/UI/ShareView/XPShareView.m index c54f8e91..84aec5cc 100644 --- a/xplan-ios/Base/UI/ShareView/XPShareView.m +++ b/xplan-ios/Base/UI/ShareView/XPShareView.m @@ -16,6 +16,7 @@ #import "ThemeColor.h" #import "XCCurrentVCStackManager.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///View #import "XPShareItemCell.h" #import "XPMineShareViewController.h" @@ -112,7 +113,7 @@ } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ XPShareItemCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPShareItemCell class]) forIndexPath:indexPath]; - XPShareItem * item = [self.items objectAtIndex:indexPath.item]; + XPShareItem * item = [self.items safeObjectAtIndex1:indexPath.item]; if (item.type == XPShareItemTagAppFriends) { item.disable = YES; } else { @@ -123,7 +124,7 @@ } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ [collectionView deselectItemAtIndexPath:indexPath animated:YES]; - XPShareItem * item = [self.items objectAtIndex:indexPath.item]; + XPShareItem * item = [self.items safeObjectAtIndex1:indexPath.item]; if (item.type == XPShareItemTagAppFriends) { [TTPopup dismiss]; XPMineShareViewController * shareVC = [[XPMineShareViewController alloc] init]; diff --git a/xplan-ios/Main/Home/View/Cell/XPHomeAttentionTableViewCell.m b/xplan-ios/Main/Home/View/Cell/XPHomeAttentionTableViewCell.m index ab7bfbea..c4b4ecd3 100644 --- a/xplan-ios/Main/Home/View/Cell/XPHomeAttentionTableViewCell.m +++ b/xplan-ios/Main/Home/View/Cell/XPHomeAttentionTableViewCell.m @@ -8,6 +8,7 @@ #import "XPHomeAttentionTableViewCell.h" ///Third #import +#import "NSArray+Safe.h" ///View #import "XPHomeAttentionCollectionViewCell.h" @@ -42,7 +43,7 @@ #pragma mark - UICollectionViewCellDelegate And UICollectionViewDatasource - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPHomeAttentionCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeAttentionCollectionViewCell class]) forIndexPath:indexPath]; - cell.liveRoom = [self.attentionList objectAtIndex:indexPath.item]; + cell.liveRoom = [self.attentionList safeObjectAtIndex1:indexPath.item]; return cell; } @@ -53,7 +54,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.attentionList.count > 0) { - HomeLiveRoomModel * liveModel = [self.attentionList objectAtIndex:indexPath.item]; + HomeLiveRoomModel * liveModel = [self.attentionList safeObjectAtIndex1:indexPath.item]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPHomeAttentionTableViewCell:didClickItem:)]) { [self.delegate xPHomeAttentionTableViewCell:self didClickItem:liveModel]; } diff --git a/xplan-ios/Main/Home/View/Cell/XPHomeBannerTableViewCell.m b/xplan-ios/Main/Home/View/Cell/XPHomeBannerTableViewCell.m index c720e6f7..c2181e42 100644 --- a/xplan-ios/Main/Home/View/Cell/XPHomeBannerTableViewCell.m +++ b/xplan-ios/Main/Home/View/Cell/XPHomeBannerTableViewCell.m @@ -11,6 +11,7 @@ #import ///Model #import "HomeBannerInfoModel.h" +#import "NSArray+Safe.h" @interface XPHomeBannerTableViewCell () @property (nonatomic, strong) SDCycleScrollView *cycleScrollView; @@ -42,7 +43,7 @@ } #pragma mark - SDCycleScrollViewDelegate - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index { - HomeBannerInfoModel * bannerInfo = [self.bannerList objectAtIndex:index]; + HomeBannerInfoModel * bannerInfo = [self.bannerList safeObjectAtIndex1:index]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPHomeBannerTableViewCell:didClickBanner:)]) { [self.delegate xPHomeBannerTableViewCell:self didClickBanner:bannerInfo]; } diff --git a/xplan-ios/Main/Home/View/Cell/XPHomeCollectRoomTableViewCell.m b/xplan-ios/Main/Home/View/Cell/XPHomeCollectRoomTableViewCell.m index bfd7c901..51adb7c7 100644 --- a/xplan-ios/Main/Home/View/Cell/XPHomeCollectRoomTableViewCell.m +++ b/xplan-ios/Main/Home/View/Cell/XPHomeCollectRoomTableViewCell.m @@ -11,6 +11,7 @@ ///Tool #import "ThemeColor.h" #import "NetImageView.h" +#import "NSArray+Safe.h" #import "UIImage+Utils.h" ///Model #import "HomeCollectRoomModel.h" @@ -183,9 +184,9 @@ if (_roomInfo.micUsers.count > 0) { self.micContainerView.hidden = NO; for (NSInteger i = 0; i < self.micUserArray.count; i++) { - NetImageView * imageView = [self.micUserArray objectAtIndex:i]; + NetImageView * imageView = [self.micUserArray safeObjectAtIndex1:i]; if (i< _roomInfo.micUsers.count) { - HomePlayMicUserModel * micUserInfo = [_roomInfo.micUsers objectAtIndex:i]; + HomePlayMicUserModel * micUserInfo = [_roomInfo.micUsers safeObjectAtIndex1:i]; imageView.imageUrl = micUserInfo.avatar; imageView.hidden = NO; } else { diff --git a/xplan-ios/Main/Home/View/Cell/XPHomeHapppyRoomTableViewCell.m b/xplan-ios/Main/Home/View/Cell/XPHomeHapppyRoomTableViewCell.m index 7e27ed8d..100140df 100644 --- a/xplan-ios/Main/Home/View/Cell/XPHomeHapppyRoomTableViewCell.m +++ b/xplan-ios/Main/Home/View/Cell/XPHomeHapppyRoomTableViewCell.m @@ -12,6 +12,7 @@ #import "ThemeColor.h" #import "NetImageView.h" #import "XPHomeGradientLabel.h" +#import "NSArray+Safe.h" ///Model #import "HomePlayRoomModel.h" @@ -194,9 +195,9 @@ } for (int i = 0; i < self.stackView.subviews.count; i++) { - NetImageView * imageView = [self.stackView.subviews objectAtIndex:i]; + NetImageView * imageView = [self.stackView.subviews safeObjectAtIndex1:i]; if (i < _roomInfo.micUsers.count) { - HomePlayMicUserModel * userInfo = [_roomInfo.micUsers objectAtIndex:i]; + HomePlayMicUserModel * userInfo = [_roomInfo.micUsers safeObjectAtIndex1:i]; imageView.imageUrl = userInfo.avatar; imageView.hidden = NO; } else { diff --git a/xplan-ios/Main/Home/View/Cell/XPHomeHotRoomTableViewCell.m b/xplan-ios/Main/Home/View/Cell/XPHomeHotRoomTableViewCell.m index f59a0c20..d818763a 100644 --- a/xplan-ios/Main/Home/View/Cell/XPHomeHotRoomTableViewCell.m +++ b/xplan-ios/Main/Home/View/Cell/XPHomeHotRoomTableViewCell.m @@ -12,6 +12,7 @@ #import "XPMacro.h" #import "ThemeColor.h" #import "UIImage+Utils.h" +#import "NSArray+Safe.h" ///View #import "XPHomeHotRoomCollectionViewCell.h" @@ -62,7 +63,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPHomeHotRoomCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeHotRoomCollectionViewCell class]) forIndexPath:indexPath]; - HomeRecommendRoomModel * info = [self.hotAnchorList objectAtIndex:indexPath.row]; + HomeRecommendRoomModel * info = [self.hotAnchorList safeObjectAtIndex1:indexPath.row]; cell.hotRoomInfo = info; cell.indexPathRow = indexPath.row; return cell; @@ -71,7 +72,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.hotAnchorList.count > 0) { - HomeRecommendRoomModel * info = [self.hotAnchorList objectAtIndex:indexPath.row]; + HomeRecommendRoomModel * info = [self.hotAnchorList safeObjectAtIndex1:indexPath.row]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPHomeHotRoomTableViewCell:didClickItem:)]) { [self.delegate xPHomeHotRoomTableViewCell:self didClickItem:info]; } diff --git a/xplan-ios/Main/Home/View/Cell/XPHomeLittleGameTableViewCell.m b/xplan-ios/Main/Home/View/Cell/XPHomeLittleGameTableViewCell.m index 0394c9f8..743b5f31 100644 --- a/xplan-ios/Main/Home/View/Cell/XPHomeLittleGameTableViewCell.m +++ b/xplan-ios/Main/Home/View/Cell/XPHomeLittleGameTableViewCell.m @@ -13,6 +13,7 @@ #import "NetImageView.h" #import "XPMacro.h" #import "UIImage+Utils.h" +#import "NSArray+Safe.h" #import "XPHomeGradientLabel.h" ///Model #import "HomeLittleGameRoomModel.h" @@ -172,9 +173,9 @@ if (_gameInfo.micUsers.count > 0) { self.micContainerView.hidden = NO; for (NSInteger i = 0; i < self.micUserArray.count; i++) { - NetImageView * imageView = [self.micUserArray objectAtIndex:i]; + NetImageView * imageView = [self.micUserArray safeObjectAtIndex1:i]; if (i< _gameInfo.micUsers.count) { - HomeLittleGameMicUserModel * micUserInfo = [_gameInfo.micUsers objectAtIndex:i]; + HomeLittleGameMicUserModel * micUserInfo = [_gameInfo.micUsers safeObjectAtIndex1:i]; imageView.imageUrl = micUserInfo.avatar; imageView.hidden = NO; } else { diff --git a/xplan-ios/Main/Home/View/Cell/XPHomeMenuTableViewCell.m b/xplan-ios/Main/Home/View/Cell/XPHomeMenuTableViewCell.m index 5a1b835d..33c1915a 100644 --- a/xplan-ios/Main/Home/View/Cell/XPHomeMenuTableViewCell.m +++ b/xplan-ios/Main/Home/View/Cell/XPHomeMenuTableViewCell.m @@ -12,6 +12,7 @@ #import "ThemeColor.h" #import "NetImageView.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "HomeMenuInfoModel.h" @@ -66,7 +67,7 @@ #pragma mark - Event Response - (void)onTapMenuRecognizer:(UITapGestureRecognizer *)tap { UIView * view = [tap view]; - HomeMenuInfoModel * homeInfoModel = [self.menuList objectAtIndex:view.tag -1000]; + HomeMenuInfoModel * homeInfoModel = [self.menuList safeObjectAtIndex1:view.tag -1000]; if (homeInfoModel && self.delegate && [self.delegate respondsToSelector:@selector(xPHomeMenuTableViewCell:didClickMenuInfo:)]) { [self.delegate xPHomeMenuTableViewCell:self didClickMenuInfo:homeInfoModel]; } diff --git a/xplan-ios/Main/Home/View/Cell/XPHomeRecommendTableViewCell.m b/xplan-ios/Main/Home/View/Cell/XPHomeRecommendTableViewCell.m index 3cbe080b..c19e7038 100644 --- a/xplan-ios/Main/Home/View/Cell/XPHomeRecommendTableViewCell.m +++ b/xplan-ios/Main/Home/View/Cell/XPHomeRecommendTableViewCell.m @@ -10,6 +10,7 @@ #import ///Tool #import "XPMacro.h" +#import "NSArray+Safe.h" ///View #import "XPHomeRedommendCollectionViewCell.h" @@ -48,7 +49,7 @@ - (void)tapRecognizer:(UITapGestureRecognizer *)tap { NSInteger index = tap.view.tag - 1001; if (index < self.recommendList.count) { - HomeRecommendRoomModel * recommend = [_recommendList objectAtIndex:index]; + HomeRecommendRoomModel * recommend = [_recommendList safeObjectAtIndex1:index]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPHomeRecommendTableViewCell:didClickItem:)]) { [self.delegate xPHomeRecommendTableViewCell:self didClickItem:recommend]; } @@ -66,7 +67,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPHomeRedommendCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeRedommendCollectionViewCell class]) forIndexPath:indexPath]; - HomeRecommendRoomModel * info = [self.recommendList objectAtIndex:indexPath.row]; + HomeRecommendRoomModel * info = [self.recommendList safeObjectAtIndex1:indexPath.row]; cell.recommendRoomInfo = info; return cell; } @@ -74,7 +75,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.recommendList.count > 0) { - HomeRecommendRoomModel * recommend = [self.recommendList objectAtIndex:indexPath.row]; + HomeRecommendRoomModel * recommend = [self.recommendList safeObjectAtIndex1:indexPath.row]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPHomeRecommendTableViewCell:didClickItem:)]) { [self.delegate xPHomeRecommendTableViewCell:self didClickItem:recommend]; } diff --git a/xplan-ios/Main/Home/View/SubViews/XPHomeLiveHeadView.m b/xplan-ios/Main/Home/View/SubViews/XPHomeLiveHeadView.m index f48d3d64..8b5badeb 100644 --- a/xplan-ios/Main/Home/View/SubViews/XPHomeLiveHeadView.m +++ b/xplan-ios/Main/Home/View/SubViews/XPHomeLiveHeadView.m @@ -11,6 +11,7 @@ #import #import "ThemeColor.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///View #import "XPHomeLiveRecordCell.h" #import "StatisticsServiceHelper.h" @@ -82,7 +83,7 @@ #pragma mark - UICollectionViewCellDelegate And UICollectionViewDatasource - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPHomeLiveRecordCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeLiveRecordCell class]) forIndexPath:indexPath]; - cell.recordRoom = [self.roomList objectAtIndex:indexPath.item]; + cell.recordRoom = [self.roomList safeObjectAtIndex1:indexPath.item]; return cell; } @@ -93,7 +94,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.roomList.count > 0) { - HomeRecommendRoomModel * liveModel = [self.roomList objectAtIndex:indexPath.item]; + HomeRecommendRoomModel * liveModel = [self.roomList safeObjectAtIndex1:indexPath.item]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPHomeLiveHeadViewDidClickItem:)]) { NSMutableDictionary * dic = [NSMutableDictionary dictionary]; [dic safeSetObject:liveModel.uid forKey:@"roomUid"]; diff --git a/xplan-ios/Main/Home/View/XPHomeHappyViewController.m b/xplan-ios/Main/Home/View/XPHomeHappyViewController.m index 8e219cae..cda4765e 100644 --- a/xplan-ios/Main/Home/View/XPHomeHappyViewController.m +++ b/xplan-ios/Main/Home/View/XPHomeHappyViewController.m @@ -11,6 +11,7 @@ #import ///Tool #import "ThemeColor.h" +#import "NSArray+Safe.h" ///View #import "XPHomeHapppyRoomTableViewCell.h" #import "XPHomeBannerTableViewCell.h" @@ -67,7 +68,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.roomList.count > 0) { - HomePlayRoomModel * model = [self.roomList objectAtIndex:indexPath.row]; + HomePlayRoomModel * model = [self.roomList safeObjectAtIndex1:indexPath.row]; if (model.isBanner) { return 80; } @@ -78,7 +79,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.roomList.count > 0) { - HomePlayRoomModel * model = [self.roomList objectAtIndex:indexPath.row]; + HomePlayRoomModel * model = [self.roomList safeObjectAtIndex1:indexPath.row]; if (model.isBanner) { XPHomeBannerTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPHomeBannerTableViewCell class])]; if (cell == nil) { @@ -106,7 +107,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.roomList.count > 0) { - HomePlayRoomModel * model = [self.roomList objectAtIndex:indexPath.row]; + HomePlayRoomModel * model = [self.roomList safeObjectAtIndex1:indexPath.row]; if (!model.isBanner && model.uid.integerValue > 0) { [XPRoomViewController openRoom:model.uid fromNick:nil fromType:UserEnterRoomFromType_Home_Recommend fromUid:nil viewController:self]; } diff --git a/xplan-ios/Main/Home/View/XPHomeHotRoomViewController.m b/xplan-ios/Main/Home/View/XPHomeHotRoomViewController.m index 19562595..8c6a1cce 100644 --- a/xplan-ios/Main/Home/View/XPHomeHotRoomViewController.m +++ b/xplan-ios/Main/Home/View/XPHomeHotRoomViewController.m @@ -8,6 +8,7 @@ #import "XPHomeHotRoomViewController.h" ///Third #import +#import "NSArray+Safe.h" ///View #import "XPHomeHapppyRoomTableViewCell.h" #import "XPHomeListEmptyTableViewCell.h" @@ -56,7 +57,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.roomList.count > 0) { - HomePlayRoomModel * model = [self.roomList objectAtIndex:indexPath.row]; + HomePlayRoomModel * model = [self.roomList safeObjectAtIndex1:indexPath.row]; if (model.isBanner) { return 80; } @@ -67,7 +68,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.roomList.count > 0) { - HomePlayRoomModel * model = [self.roomList objectAtIndex:indexPath.row]; + HomePlayRoomModel * model = [self.roomList safeObjectAtIndex1:indexPath.row]; if (model.isBanner) { XPHomeBannerTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPHomeBannerTableViewCell class])]; if (cell == nil) { @@ -95,7 +96,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.roomList.count > 0) { - HomePlayRoomModel * model = [self.roomList objectAtIndex:indexPath.row]; + HomePlayRoomModel * model = [self.roomList safeObjectAtIndex1:indexPath.row]; if (!model.isBanner && model.uid.integerValue > 0) { [XPRoomViewController openRoom:model.uid fromNick:model.title fromType:UserEnterRoomFromType_Home_Recommend fromUid:nil viewController:self]; } diff --git a/xplan-ios/Main/Home/View/XPHomeLikeViewController.m b/xplan-ios/Main/Home/View/XPHomeLikeViewController.m index 839535d2..27e196f7 100644 --- a/xplan-ios/Main/Home/View/XPHomeLikeViewController.m +++ b/xplan-ios/Main/Home/View/XPHomeLikeViewController.m @@ -12,6 +12,7 @@ ///Tool #import "XPMacro.h" #import "ThemeColor.h" +#import "NSArray+Safe.h" ///Model #import "HomeLiveRoomModel.h" #import "HomeCollectRoomModel.h" @@ -186,7 +187,7 @@ if (cell == nil) { cell = [[XPHomeCollectRoomTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPHomeCollectRoomTableViewCell class])]; } - cell.roomInfo = [self.collectRoomList objectAtIndex:indexPath.row]; + cell.roomInfo = [self.collectRoomList safeObjectAtIndex1:indexPath.row]; return cell; } else { XPHomeLikeEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPHomeLikeEmptyTableViewCell class])]; @@ -201,7 +202,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (indexPath.section == 1 && self.collectRoomList.count > 0) { - HomeCollectRoomModel * roomInfo = [self.collectRoomList objectAtIndex:indexPath.row]; + HomeCollectRoomModel * roomInfo = [self.collectRoomList safeObjectAtIndex1:indexPath.row]; if (roomInfo.roomUid.integerValue > 0) { [XPRoomViewController openRoom:roomInfo.roomUid viewController:self]; } diff --git a/xplan-ios/Main/Home/View/XPHomeLittleGameViewController.m b/xplan-ios/Main/Home/View/XPHomeLittleGameViewController.m index 108ff7ea..9a6bea83 100644 --- a/xplan-ios/Main/Home/View/XPHomeLittleGameViewController.m +++ b/xplan-ios/Main/Home/View/XPHomeLittleGameViewController.m @@ -12,6 +12,7 @@ ///Tool #import "ThemeColor.h" #import "UIImage+Utils.h" +#import "NSArray+Safe.h" ///Model #import "HomeLittleGameRoomModel.h" ///View @@ -114,7 +115,7 @@ if (cell == nil) { cell = [[XPHomeLittleGameTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPHomeLittleGameTableViewCell class])]; } - cell.gameInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.gameInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } XPHomeListEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPHomeListEmptyTableViewCell class])]; @@ -127,7 +128,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - HomeLittleGameRoomModel * gameInfo = [self.datasource objectAtIndex:indexPath.row]; + HomeLittleGameRoomModel * gameInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; if (gameInfo.uid.length > 0) { [XPRoomViewController openRoom:gameInfo.uid viewController:self]; } diff --git a/xplan-ios/Main/Home/View/XPHomeLivePageViewController.m b/xplan-ios/Main/Home/View/XPHomeLivePageViewController.m index 996cb861..fd8e93cf 100644 --- a/xplan-ios/Main/Home/View/XPHomeLivePageViewController.m +++ b/xplan-ios/Main/Home/View/XPHomeLivePageViewController.m @@ -13,6 +13,7 @@ #import "ThemeColor.h" #import "XPMacro.h" #import "XCHUDTool.h" +#import "NSArray+Safe.h" ///View #import "XPHomeHapppyRoomTableViewCell.h" #import "XPHomeBannerTableViewCell.h" @@ -91,7 +92,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { XPHomeListCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeListCollectionViewCell class]) forIndexPath:indexPath]; - HomeRecommendRoomModel * model = [self.datasource objectAtIndex:indexPath.item]; + HomeRecommendRoomModel * model = [self.datasource safeObjectAtIndex1:indexPath.item]; cell.roomModel = model; return cell; } @@ -104,7 +105,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - HomeRecommendRoomModel * model = [self.datasource objectAtIndex:indexPath.item]; + HomeRecommendRoomModel * model = [self.datasource safeObjectAtIndex1:indexPath.item]; NSString *roomUid = model.uid; if (roomUid.length > 0) { [XPRoomViewController openRoom:roomUid viewController:self]; diff --git a/xplan-ios/Main/Home/View/XPHomePartyContainerViewController.m b/xplan-ios/Main/Home/View/XPHomePartyContainerViewController.m index 2457b740..1b8f5fdc 100644 --- a/xplan-ios/Main/Home/View/XPHomePartyContainerViewController.m +++ b/xplan-ios/Main/Home/View/XPHomePartyContainerViewController.m @@ -15,6 +15,7 @@ #import "XPMacro.h" #import "ThemeColor.h" #import "XPHtmlUrl.h" +#import "NSArray+Safe.h" ///Model #import "HomeTagModel.h" ///View @@ -97,7 +98,7 @@ UIKIT_EXTERN NSString * kHomeMoreScrollPageKey; } - (id)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index { - HomeTagModel * hometag = [self.tagList objectAtIndex:index]; + HomeTagModel * hometag = [self.tagList safeObjectAtIndex1:index]; UIViewController * list = (UIViewController *)[self.contentView.validListDict objectForKey:[NSNumber numberWithInteger:index]]; if (list) { return list; @@ -118,7 +119,7 @@ UIKIT_EXTERN NSString * kHomeMoreScrollPageKey; } - (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index { - HomeTagModel * hometag = [self.tagList objectAtIndex:index]; + HomeTagModel * hometag = [self.tagList safeObjectAtIndex1:index]; if (![hometag.name isEqualToString:@"喜欢"] && ![hometag.name isEqualToString:@"小游戏"]) { XPHomePartyViewController * list = (XPHomePartyViewController *)[self.contentView.validListDict objectForKey:[NSNumber numberWithInteger:index]];; if ([hometag.name isEqualToString:@"个播"]) { diff --git a/xplan-ios/Main/Home/View/XPHomePartyViewController.m b/xplan-ios/Main/Home/View/XPHomePartyViewController.m index e8a623a7..fdf20602 100644 --- a/xplan-ios/Main/Home/View/XPHomePartyViewController.m +++ b/xplan-ios/Main/Home/View/XPHomePartyViewController.m @@ -12,6 +12,7 @@ ///Tool #import "XPMacro.h" #import "ThemeColor.h" +#import "NSArray+Safe.h" ///Model #import "HomeRecommendRoomModel.h" ///View @@ -111,7 +112,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { XPHomeListCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeListCollectionViewCell class]) forIndexPath:indexPath]; - HomeRecommendRoomModel * model = [self.datasource objectAtIndex:indexPath.item]; + HomeRecommendRoomModel * model = [self.datasource safeObjectAtIndex1:indexPath.item]; cell.roomModel = model; return cell; } @@ -124,7 +125,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - HomeRecommendRoomModel * model = [self.datasource objectAtIndex:indexPath.item]; + HomeRecommendRoomModel * model = [self.datasource safeObjectAtIndex1:indexPath.item]; NSString * roomUid; if (self.isAnchor) { roomUid = model.uid; diff --git a/xplan-ios/Main/Home/View/XPHomeRecommendViewController.m b/xplan-ios/Main/Home/View/XPHomeRecommendViewController.m index 2fad83ee..229cf9b0 100644 --- a/xplan-ios/Main/Home/View/XPHomeRecommendViewController.m +++ b/xplan-ios/Main/Home/View/XPHomeRecommendViewController.m @@ -19,6 +19,7 @@ #import "XPWeakTimer.h" #import "ClientConfig.h" #import "UIImage+Utils.h" +#import "NSArray+Safe.h" ///View #import "XPHomeRecommendHeaderView.h" ///P @@ -206,7 +207,7 @@ - (id)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index { UIViewController *viewController; - NSString * title= [self.titles objectAtIndex:index]; + NSString * title= [self.titles safeObjectAtIndex1:index]; if ([title isEqualToString:@"开黑畅聊"]) { viewController = self.personalRoomVC; } else { @@ -216,7 +217,7 @@ } - (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index { - NSString * title= [self.titles objectAtIndex:index]; + NSString * title= [self.titles safeObjectAtIndex1:index]; if ([title isEqualToString:@"开黑畅聊"]) { [self.presenter getPlayGameWithTeam:1]; } else { diff --git a/xplan-ios/Main/Home/View/XPHomeSearchViewController.m b/xplan-ios/Main/Home/View/XPHomeSearchViewController.m index dd7ce896..881354f9 100644 --- a/xplan-ios/Main/Home/View/XPHomeSearchViewController.m +++ b/xplan-ios/Main/Home/View/XPHomeSearchViewController.m @@ -11,6 +11,7 @@ ///Tool #import "ThemeColor.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "HomeSearchResultModel.h" ///View @@ -79,14 +80,14 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey; if (cell == nil) { cell = [[XPSearchListTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPSearchListTableViewCell class])]; } - HomeSearchResultModel * resultModel = [self.datasource objectAtIndex:indexPath.row]; + HomeSearchResultModel * resultModel = [self.datasource safeObjectAtIndex1:indexPath.row]; [cell configData:resultModel type:self.type]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; - HomeSearchResultModel * resultModel = [self.datasource objectAtIndex:indexPath.row]; + HomeSearchResultModel * resultModel = [self.datasource safeObjectAtIndex1:indexPath.row]; BOOL result = [[NSUserDefaults standardUserDefaults] boolForKey:kFromSearchToHomeViewKey]; if (!result) { [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kFromSearchToHomeViewKey]; diff --git a/xplan-ios/Main/Home/View/XPRoomSearchRecordViewController.m b/xplan-ios/Main/Home/View/XPRoomSearchRecordViewController.m index 023d2690..fe8d6889 100644 --- a/xplan-ios/Main/Home/View/XPRoomSearchRecordViewController.m +++ b/xplan-ios/Main/Home/View/XPRoomSearchRecordViewController.m @@ -12,6 +12,7 @@ #import "ThemeColor.h" #import "AccountInfoStorage.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///View #import "XPHomeAttentionCollectionViewCell.h" #import "XPHomeSearchRecordCell.h" @@ -157,7 +158,7 @@ NSString * const XPConstSearchRecordStoreKey = @"XPConstSearchRecordStoreKey"; - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { if (collectionView == self.searchCollectionView) { XPHomeSearchRecordCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeSearchRecordCell class]) forIndexPath:indexPath]; - cell.recordString = [self.searchList objectAtIndex:indexPath.row]; + cell.recordString = [self.searchList safeObjectAtIndex1:indexPath.row]; return cell; } else { XPHomeAttentionCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeAttentionCollectionViewCell class]) forIndexPath:indexPath]; @@ -187,7 +188,7 @@ NSString * const XPConstSearchRecordStoreKey = @"XPConstSearchRecordStoreKey"; - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { if (collectionView == self.searchCollectionView) { - NSString *str = [self.searchList objectAtIndex:indexPath.row]; + NSString *str = [self.searchList safeObjectAtIndex1:indexPath.row]; CGFloat width = [str boundingRectWithSize:CGSizeMake(200, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]} context:nil].size.width; return CGSizeMake(width + 26, 26); } else { diff --git a/xplan-ios/Main/Message/View/FindNew/View/View/XPSessionFindNewGreetListView.m b/xplan-ios/Main/Message/View/FindNew/View/View/XPSessionFindNewGreetListView.m index c27d7887..9b7d88d6 100644 --- a/xplan-ios/Main/Message/View/FindNew/View/View/XPSessionFindNewGreetListView.m +++ b/xplan-ios/Main/Message/View/FindNew/View/View/XPSessionFindNewGreetListView.m @@ -15,6 +15,7 @@ #import "XCHUDTool.h" #import "Api+FindNew.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "FindNewGreetListModel.h" ///View @@ -132,7 +133,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { XPSessionFindNewGreetTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPSessionFindNewGreetTableViewCell class])]; - FindNewGreetModel * model = [self.datasource objectAtIndex:indexPath.row]; + FindNewGreetModel * model = [self.datasource safeObjectAtIndex1:indexPath.row]; if (model.fId == self.selectModel.fId) { model.isSelect = YES; } else { @@ -145,7 +146,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - FindNewGreetModel * model = [self.datasource objectAtIndex:indexPath.row]; + FindNewGreetModel * model = [self.datasource safeObjectAtIndex1:indexPath.row]; self.selectModel = model; [self.tableView reloadData]; } diff --git a/xplan-ios/Main/Message/View/FindNew/View/XPSessionFindNewViewController.m b/xplan-ios/Main/Message/View/FindNew/View/XPSessionFindNewViewController.m index a7e1696d..bc02366f 100644 --- a/xplan-ios/Main/Message/View/FindNew/View/XPSessionFindNewViewController.m +++ b/xplan-ios/Main/Message/View/FindNew/View/XPSessionFindNewViewController.m @@ -12,6 +12,7 @@ #import "ThemeColor.h" #import "TTPopup.h" #import "XCCurrentVCStackManager.h" +#import "NSArray+Safe.h" ///Model #import "FindNewUserInfoModel.h" ///View @@ -93,7 +94,7 @@ if (cell == nil) { cell = [[XPSessionFindNewTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPSessionFindNewTableViewCell class])]; } - cell.userInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.userInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.delegate = self; return cell; } @@ -147,7 +148,7 @@ ///兼容房间内私聊的 UIWindow * currentWindow; for (int i = 0; i < [UIApplication sharedApplication].windows.count; i++) { - UIWindow * window = [[UIApplication sharedApplication].windows objectAtIndex:i]; + UIWindow * window = [[UIApplication sharedApplication].windows safeObjectAtIndex1:i]; if(window.tag == 1000) { currentWindow = window; break; @@ -200,7 +201,7 @@ ///兼容房间内私聊的 UIWindow * currentWindow; for (int i = 0; i < [UIApplication sharedApplication].windows.count; i++) { - UIWindow * window = [[UIApplication sharedApplication].windows objectAtIndex:i]; + UIWindow * window = [[UIApplication sharedApplication].windows safeObjectAtIndex1:i]; if(window.tag == 1000) { currentWindow = window; break; diff --git a/xplan-ios/Main/Message/View/Session/SessionToolbarView.m b/xplan-ios/Main/Message/View/Session/SessionToolbarView.m index 56907b24..dabf03f6 100644 --- a/xplan-ios/Main/Message/View/Session/SessionToolbarView.m +++ b/xplan-ios/Main/Message/View/Session/SessionToolbarView.m @@ -12,6 +12,7 @@ ///Tool #import "ThemeColor.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "MessageMenuModel.h" ///View @@ -154,7 +155,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { MessageToolMenuCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([MessageToolMenuCollectionViewCell class]) forIndexPath:indexPath]; - MessageMenuModel * model = [self.menuList objectAtIndex:indexPath.row]; + MessageMenuModel * model = [self.menuList safeObjectAtIndex1:indexPath.row]; cell.imageName = model.imageName; return cell; } @@ -162,7 +163,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.menuList.count > 0) { - MessageMenuModel * model = [self.menuList objectAtIndex:indexPath.row]; + MessageMenuModel * model = [self.menuList safeObjectAtIndex1:indexPath.row]; if (self.delegate && [self.delegate respondsToSelector:@selector(didSelectMenuItem:)]) { [self.delegate didSelectMenuItem:model]; } diff --git a/xplan-ios/Main/Message/View/Session/SessionViewController.m b/xplan-ios/Main/Message/View/Session/SessionViewController.m index a627c23f..73bef567 100644 --- a/xplan-ios/Main/Message/View/Session/SessionViewController.m +++ b/xplan-ios/Main/Message/View/Session/SessionViewController.m @@ -16,6 +16,7 @@ #import "XPMacro.h" #import "UITableView+NIMScrollToBottom.h" #import "ThemeColor.h" +#import "NSArray+Safe.h" ///Model #import "RoomInfoModel.h" #import "UserInfoModel.h" @@ -115,7 +116,7 @@ [self.sessionTableView.mj_header endRefreshing]; if (error == nil && messages.count > 0) { for (int i = ((int)messages.count -1); i > 0; i--) { - NIMMessage * message = [messages objectAtIndex:i]; + NIMMessage * message = [messages safeObjectAtIndex1:i]; [self.messages insertObject:message atIndex:0]; } } @@ -350,7 +351,7 @@ } - (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath { - NIMMessage * message = [self.messages objectAtIndex:indexPath.row]; + NIMMessage * message = [self.messages safeObjectAtIndex1:indexPath.row]; NSString * identifier = [MessageCell cellContent:message]; ///从复用池中获取所需要的cell MessageCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier]; @@ -361,12 +362,12 @@ cell = [tableView dequeueReusableCellWithIdentifier:identifier]; } cell.delegate = self; - [cell renderWithMessage:[self.messages objectAtIndex:indexPath.row]]; + [cell renderWithMessage:[self.messages safeObjectAtIndex1:indexPath.row]]; return cell; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - NIMMessage *msg = [self.messages objectAtIndex:indexPath.row]; + NIMMessage *msg = [self.messages safeObjectAtIndex1:indexPath.row]; return [MessageCell measureHeight:msg]; } @@ -498,7 +499,7 @@ UIWindow * currentWindow; for (int i = 0; i < [UIApplication sharedApplication].windows.count; i++) { - UIWindow * window = [[UIApplication sharedApplication].windows objectAtIndex:i]; + UIWindow * window = [[UIApplication sharedApplication].windows safeObjectAtIndex1:i]; if(window.tag == 1000) { currentWindow = window; break; diff --git a/xplan-ios/Main/Message/View/SessionList/SessionListViewController.m b/xplan-ios/Main/Message/View/SessionList/SessionListViewController.m index eaec2f22..e7603093 100644 --- a/xplan-ios/Main/Message/View/SessionList/SessionListViewController.m +++ b/xplan-ios/Main/Message/View/SessionList/SessionListViewController.m @@ -14,6 +14,7 @@ #import "ClientConfig.h" #import "Api+Mine.h" #import "AccountInfoStorage.h" +#import "NSArray+Safe.h" ///Model #import "UserInfoModel.h" ///View @@ -223,7 +224,7 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey"; - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewRowAction * deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { - NIMRecentSession * session = [self.recentSessions objectAtIndex:indexPath.row]; + NIMRecentSession * session = [self.recentSessions safeObjectAtIndex1:indexPath.row]; [[NIMSDK sharedSDK].conversationManager deleteRecentSession:session]; }]; deleteAction.title = @"删除"; diff --git a/xplan-ios/Main/Mine/View/CollectRoom/XPMineCollectPartyRoomViewController.m b/xplan-ios/Main/Mine/View/CollectRoom/XPMineCollectPartyRoomViewController.m index 795ff1d7..207c5269 100644 --- a/xplan-ios/Main/Mine/View/CollectRoom/XPMineCollectPartyRoomViewController.m +++ b/xplan-ios/Main/Mine/View/CollectRoom/XPMineCollectPartyRoomViewController.m @@ -12,6 +12,7 @@ ///Tool #import "ThemeColor.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "HomeCollectRoomModel.h" ///P @@ -138,14 +139,14 @@ if (cell == nil) { cell = [[XPMineCollectRoomEditCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineCollectRoomEditCell class])]; } - cell.roomInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.roomInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } else { XPMineCollectRoomCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineCollectRoomCell class])]; if (cell == nil) { cell = [[XPMineCollectRoomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineCollectRoomCell class])]; } - cell.roomInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.roomInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } } @@ -163,7 +164,7 @@ } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - HomeCollectRoomModel * roomInfo = [self.datasource objectAtIndex:indexPath.row]; + HomeCollectRoomModel * roomInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; if (self.isEdit) { roomInfo.isSelected = !roomInfo.isSelected; [tableView reloadData]; diff --git a/xplan-ios/Main/Mine/View/Friend/XPMineAttentionViewController.m b/xplan-ios/Main/Mine/View/Friend/XPMineAttentionViewController.m index f0aedb69..64d37695 100644 --- a/xplan-ios/Main/Mine/View/Friend/XPMineAttentionViewController.m +++ b/xplan-ios/Main/Mine/View/Friend/XPMineAttentionViewController.m @@ -12,6 +12,7 @@ ///Tool #import "ThemeColor.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "FansInfoModel.h" ///View @@ -142,7 +143,7 @@ cell = [[XPMineAttentionTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineAttentionTableViewCell class])]; } cell.delegate = self; - FansInfoModel * fansInfo = [self.datasource objectAtIndex:indexPath.row]; + FansInfoModel * fansInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; fansInfo.useingType = self.type; cell.fansInfo = fansInfo; return cell; @@ -159,7 +160,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - FansInfoModel * fansInfoModel = [self.datasource objectAtIndex:indexPath.row]; + FansInfoModel * fansInfoModel = [self.datasource safeObjectAtIndex1:indexPath.row]; if (self.type == ContactUseingType_In_Room) { SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:[NIMSession session:fansInfoModel.uid type:NIMSessionTypeP2P]]; sessionVC.openType = SessionListOpenTypeRoom; diff --git a/xplan-ios/Main/Mine/View/Friend/XPMineFansViewController.m b/xplan-ios/Main/Mine/View/Friend/XPMineFansViewController.m index 9daf4657..604ff070 100644 --- a/xplan-ios/Main/Mine/View/Friend/XPMineFansViewController.m +++ b/xplan-ios/Main/Mine/View/Friend/XPMineFansViewController.m @@ -12,6 +12,7 @@ ///Tool #import "ThemeColor.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "FansInfoModel.h" ///View @@ -152,7 +153,7 @@ cell = [[XPMineFansTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineFansTableViewCell class])]; } cell.delegate = self; - FansInfoModel * fansInfo = [self.datasource objectAtIndex:indexPath.row]; + FansInfoModel * fansInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; fansInfo.useingType = self.type; cell.fansInfo = fansInfo; return cell; @@ -169,7 +170,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - FansInfoModel * fansInfoModel = [self.datasource objectAtIndex:indexPath.row]; + FansInfoModel * fansInfoModel = [self.datasource safeObjectAtIndex1:indexPath.row]; if (self.type == ContactUseingType_In_Room) { SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:[NIMSession session:fansInfoModel.uid type:NIMSessionTypeP2P]]; sessionVC.openType = SessionListOpenTypeRoom; diff --git a/xplan-ios/Main/Mine/View/Friend/XPMineFriendViewController.m b/xplan-ios/Main/Mine/View/Friend/XPMineFriendViewController.m index 5583dba0..fbbdb103 100644 --- a/xplan-ios/Main/Mine/View/Friend/XPMineFriendViewController.m +++ b/xplan-ios/Main/Mine/View/Friend/XPMineFriendViewController.m @@ -13,6 +13,7 @@ ///Tool #import "ThemeColor.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "UserInfoModel.h" ///View @@ -50,7 +51,7 @@ if (array.count > 0) { NSMutableArray * uids = [NSMutableArray array]; for (int i = 0; i< array.count; i++) { - NIMUser * user = [array objectAtIndex:i]; + NIMUser * user = [array safeObjectAtIndex1:i]; [uids addObject:user.userId]; } [self.presenter getUserListInfo:uids]; @@ -84,7 +85,7 @@ if (cell == nil) { cell = [[XPMineFriendTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineFriendTableViewCell class])]; } - cell.userInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.userInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } @@ -99,7 +100,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - UserInfoModel * userInfo = [self.datasource objectAtIndex:indexPath.row]; + UserInfoModel * userInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; if (self.type == ContactUseingType_Share) { if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineFriendViewController:didSelectItem:)]) { [self.delegate xPMineFriendViewController:self didSelectItem:userInfo]; diff --git a/xplan-ios/Main/Mine/View/Friend/XPRoomMessageBubbleView.m b/xplan-ios/Main/Mine/View/Friend/XPRoomMessageBubbleView.m index dc54ae5e..b2d6acbd 100644 --- a/xplan-ios/Main/Mine/View/Friend/XPRoomMessageBubbleView.m +++ b/xplan-ios/Main/Mine/View/Friend/XPRoomMessageBubbleView.m @@ -13,6 +13,7 @@ #import "ThemeColor.h" #import "NetImageView.h" #import "NIMMessageUtils.h" +#import "NSArray+Safe.h" @interface XPRoomMessageBubbleCollectionViewCell : UICollectionViewCell @@ -169,13 +170,13 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPRoomMessageBubbleCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPRoomMessageBubbleCollectionViewCell class]) forIndexPath:indexPath]; - cell.session = [self.datasource objectAtIndex:indexPath.row]; + cell.session = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomMessageBubbleView:didSelectSession:)]) { - NIMRecentSession * session = [self.datasource objectAtIndex:indexPath.row]; + NIMRecentSession * session = [self.datasource safeObjectAtIndex1:indexPath.row]; [self.delegate xPRoomMessageBubbleView:self didSelectSession:session]; [self animationFinish]; } diff --git a/xplan-ios/Main/Mine/View/Guild/View/Cell/SuperAdmin/XPGuildSuperAdminSetTableViewCell.m b/xplan-ios/Main/Mine/View/Guild/View/Cell/SuperAdmin/XPGuildSuperAdminSetTableViewCell.m index 01f38598..e15a7dd7 100644 --- a/xplan-ios/Main/Mine/View/Guild/View/Cell/SuperAdmin/XPGuildSuperAdminSetTableViewCell.m +++ b/xplan-ios/Main/Mine/View/Guild/View/Cell/SuperAdmin/XPGuildSuperAdminSetTableViewCell.m @@ -8,6 +8,7 @@ #import "XPGuildSuperAdminSetTableViewCell.h" ///Third #import +#import "NSArray+Safe.h" ///Tool #import "ThemeColor.h" ///Tool @@ -123,7 +124,7 @@ -(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPGuildSuperAdminRoomCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGuildSuperAdminRoomCollectionViewCell class]) forIndexPath:indexPath]; - GuildRoomInfoModel * roomInfo = [self.managerInfo.roomList objectAtIndex:indexPath.row]; + GuildRoomInfoModel * roomInfo = [self.managerInfo.roomList safeObjectAtIndex1:indexPath.row]; cell.roomInfo = roomInfo; return cell; } diff --git a/xplan-ios/Main/Mine/View/Guild/View/IncomeStatis/XPMineGuildIncomeDetailViewController.m b/xplan-ios/Main/Mine/View/Guild/View/IncomeStatis/XPMineGuildIncomeDetailViewController.m index d76f82d6..9a0a0c48 100644 --- a/xplan-ios/Main/Mine/View/Guild/View/IncomeStatis/XPMineGuildIncomeDetailViewController.m +++ b/xplan-ios/Main/Mine/View/Guild/View/IncomeStatis/XPMineGuildIncomeDetailViewController.m @@ -13,6 +13,7 @@ #import "NetImageView.h" #import "ThemeColor.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "GuildPersonIncomeRecordModel.h" ///View @@ -104,7 +105,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { if (self.datasouce.count > 0) { XPGuildIncomeDetailCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGuildIncomeDetailCollectionViewCell class]) forIndexPath:indexPath]; - cell.incomeDetailInfo= [self.datasouce objectAtIndex:indexPath.row]; + cell.incomeDetailInfo= [self.datasouce safeObjectAtIndex1:indexPath.row]; return cell; } diff --git a/xplan-ios/Main/Mine/View/Guild/View/IncomeStatis/XPMineGuildIncomeRecordViewController.m b/xplan-ios/Main/Mine/View/Guild/View/IncomeStatis/XPMineGuildIncomeRecordViewController.m index d816d479..f50270be 100644 --- a/xplan-ios/Main/Mine/View/Guild/View/IncomeStatis/XPMineGuildIncomeRecordViewController.m +++ b/xplan-ios/Main/Mine/View/Guild/View/IncomeStatis/XPMineGuildIncomeRecordViewController.m @@ -9,12 +9,14 @@ ///Third #import #import + ///Tool #import "ThemeColor.h" #import "PLTimeUtil.h" #import "TTPopup.h" #import "NSDate+DateUtils.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "GuildIncomeRecordModel.h" #import "GuildPersonIncomeRecordModel.h" @@ -179,14 +181,14 @@ cell = [[XPGuildIncomeRecordTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPGuildIncomeRecordTableViewCell class])]; } cell.rankNumber = indexPath.row; - cell.userInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.userInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } else if(self.incomeType == GuildIncomeType_Hall) { XPGuildPersonIncomeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPGuildPersonIncomeTableViewCell class])]; if (cell == nil) { cell = [[XPGuildPersonIncomeTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPGuildPersonIncomeTableViewCell class])]; } - cell.userInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.userInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } else if(self.incomeType == GuildIncomeType_Anchor) { XPGuildSingleRoomIncomeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPGuildSingleRoomIncomeTableViewCell class])]; @@ -194,7 +196,7 @@ cell = [[XPGuildSingleRoomIncomeTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPGuildSingleRoomIncomeTableViewCell class])]; } - cell.userInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.userInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.rankNumber = indexPath.row; return cell; } @@ -236,7 +238,7 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.incomeType == GuildIncomeType_Hall) { if (self.datasource.count > 0) { - GuildPersonIncomeUserInfoModel * memberInfo = [self.datasource objectAtIndex:indexPath.row]; + GuildPersonIncomeUserInfoModel * memberInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; XPMineGuildIncomeDetailViewController * incomeDetailVC = [[XPMineGuildIncomeDetailViewController alloc] init]; incomeDetailVC.hallId = self.guidId; incomeDetailVC.startTime = self.startTimeStr; diff --git a/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineGuildManagerPerViewController.m b/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineGuildManagerPerViewController.m index 10131c5c..d7a0c478 100644 --- a/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineGuildManagerPerViewController.m +++ b/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineGuildManagerPerViewController.m @@ -13,6 +13,7 @@ #import "XPMacro.h" #import "NetImageView.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "ClanMemberDetailInfoModel.h" #import "GuildAuthModel.h" @@ -138,7 +139,7 @@ if (cell == nil) { cell = [[XPMineGuildManagerPerTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineGuildManagerPerTableViewCell class])]; } - GuildAuthModel * authInfo = [self.datasource objectAtIndex:indexPath.row]; + GuildAuthModel * authInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.authInfo = authInfo; cell.delegate = self; if (authInfo.status) { diff --git a/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineGuildManagerSetViewController.m b/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineGuildManagerSetViewController.m index 102eff78..9ac90715 100644 --- a/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineGuildManagerSetViewController.m +++ b/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineGuildManagerSetViewController.m @@ -12,6 +12,7 @@ ///Tool #import "ThemeColor.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///View #import "XPClanMemberTableViewCell.h" ///P @@ -159,7 +160,7 @@ } cell.delegate = self; cell.cellType = ClanMemberTableViewCellType_Manager_Add_Remove; - ClanMemberInfoModel * memberInfo = [self.datasource objectAtIndex:indexPath.row]; + ClanMemberInfoModel * memberInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; if (memberInfo.roleType == GuildRoleType_Manager) { self.managerNumber += 1; } diff --git a/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineGuildRemoveMemberViewController.m b/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineGuildRemoveMemberViewController.m index 247790e9..cde14318 100644 --- a/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineGuildRemoveMemberViewController.m +++ b/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineGuildRemoveMemberViewController.m @@ -12,6 +12,7 @@ ///Tool #import "ThemeColor.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///View #import "XPClanMemberTableViewCell.h" #import "XPMineGuildEmptyTableViewCell.h" @@ -136,7 +137,7 @@ } cell.delegate = self; cell.cellType = ClanMemberTableViewCellType_Remove_Member; - ClanMemberInfoModel * memberInfo = [self.datasource objectAtIndex:indexPath.row]; + ClanMemberInfoModel * memberInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.memberInfo = memberInfo; return cell; } @@ -148,7 +149,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - ClanMemberInfoModel * memberInfo = [self.datasource objectAtIndex:indexPath.row]; + ClanMemberInfoModel * memberInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; XPMineUserInfoViewController * mineUserVC = [[XPMineUserInfoViewController alloc] init]; mineUserVC.uid = memberInfo.uid.integerValue; [self.navigationController pushViewController:mineUserVC animated:YES]; diff --git a/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineMangerListViewController.m b/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineMangerListViewController.m index ccd197bc..0f168291 100644 --- a/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineMangerListViewController.m +++ b/xplan-ios/Main/Mine/View/Guild/View/Setting/XPMineMangerListViewController.m @@ -12,6 +12,7 @@ ///Tool #import "ThemeColor.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///View #import "XPClanMemberTableViewCell.h" #import "XPMineGuildEmptyTableViewCell.h" @@ -120,7 +121,7 @@ cell = [[XPClanMemberTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPClanMemberTableViewCell class])]; } cell.cellType = ClanMemberTableViewCellType_Manager_Set; - ClanMemberInfoModel * memberInfo = [self.datasource objectAtIndex:indexPath.row]; + ClanMemberInfoModel * memberInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.memberInfo = memberInfo; return cell; } @@ -140,7 +141,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - ClanMemberInfoModel * memberInfo = [self.datasource objectAtIndex:indexPath.row]; + ClanMemberInfoModel * memberInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; XPMineGuildManagerPerViewController * managerAuthVC = [[XPMineGuildManagerPerViewController alloc] init]; managerAuthVC.guildId = self.guildId; managerAuthVC.managerInfo = memberInfo; diff --git a/xplan-ios/Main/Mine/View/Guild/View/SubViews/XPGuildHeaderView.m b/xplan-ios/Main/Mine/View/Guild/View/SubViews/XPGuildHeaderView.m index b672949c..e95e57bc 100644 --- a/xplan-ios/Main/Mine/View/Guild/View/SubViews/XPGuildHeaderView.m +++ b/xplan-ios/Main/Mine/View/Guild/View/SubViews/XPGuildHeaderView.m @@ -13,6 +13,7 @@ #import "NetImageView.h" #import "XPMacro.h" #import "AccountInfoStorage.h" +#import "NSArray+Safe.h" ///Model #import "ClanDetailInfoModel.h" ///View @@ -165,14 +166,14 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPClanRoomCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([ XPClanRoomCollectionViewCell class]) forIndexPath:indexPath]; - cell.guildInfo = [self.clanRoomList objectAtIndex:indexPath.row]; + cell.guildInfo = [self.clanRoomList safeObjectAtIndex1:indexPath.row]; return cell; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.clanRoomList.count > 0) { - GuildInfoModel * guildInfo = [self.clanRoomList objectAtIndex:indexPath.row]; + GuildInfoModel * guildInfo = [self.clanRoomList safeObjectAtIndex1:indexPath.row]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPGuildHeaderView:dicSelectGuild:)]) { [self.delegate xPGuildHeaderView:self dicSelectGuild:guildInfo]; } diff --git a/xplan-ios/Main/Mine/View/Guild/View/SubViews/XPGuildTimeMonthPickerView.m b/xplan-ios/Main/Mine/View/Guild/View/SubViews/XPGuildTimeMonthPickerView.m index 7371a0b6..baa59c44 100644 --- a/xplan-ios/Main/Mine/View/Guild/View/SubViews/XPGuildTimeMonthPickerView.m +++ b/xplan-ios/Main/Mine/View/Guild/View/SubViews/XPGuildTimeMonthPickerView.m @@ -7,7 +7,7 @@ #import "XPGuildTimeMonthPickerView.h" #import "ThemeColor.h" - +#import "NSArray+Safe.h" extern NSString *const kDateFormatYYYYMMDD; // Constants : static NSString * const kSureButtonItemTitle = @"确定"; @@ -256,7 +256,7 @@ typedef NS_ENUM(NSInteger,ScrollViewTagValue) { for (int i = 0; i < _days.count; i++) { - NSString *day = (NSString*)[_days objectAtIndex:i]; + NSString *day = (NSString*)[_days safeObjectAtIndex1:i]; UILabel *labelDay = [[UILabel alloc] initWithFrame:CGRectMake(0, (i * kHooDatePickerScrollViewItemHeight) + offsetContentScrollView, _scrollViewDays.frame.size.width, kHooDatePickerScrollViewItemHeight)]; labelDay.text = day; @@ -334,7 +334,7 @@ typedef NS_ENUM(NSInteger,ScrollViewTagValue) { for (int i = 0; i < self.months.count; i++) { - NSString *day = (NSString*)[self.months objectAtIndex:i]; + NSString *day = (NSString*)[self.months safeObjectAtIndex1:i]; UILabel *labelDay = [[UILabel alloc] initWithFrame:CGRectMake(0.0, (i * kHooDatePickerScrollViewItemHeight) + offsetContentScrollView, _scrollViewMonths.frame.size.width, kHooDatePickerScrollViewItemHeight)]; labelDay.text = day; @@ -411,7 +411,7 @@ typedef NS_ENUM(NSInteger,ScrollViewTagValue) { for (int i = 0; i < _years.count; i++) { - NSString *day = (NSString*)[_years objectAtIndex:i]; + NSString *day = (NSString*)[_years safeObjectAtIndex1:i]; UILabel *labelDay = [[UILabel alloc] initWithFrame:CGRectMake(0.0, (i * kHooDatePickerScrollViewItemHeight) + offsetContentScrollView, _scrollViewYears.frame.size.width, kHooDatePickerScrollViewItemHeight)]; labelDay.text = day; @@ -492,7 +492,7 @@ typedef NS_ENUM(NSInteger,ScrollViewTagValue) { for (int i = 0; i < _dates.count; i++) { - NSDate *date = [_dates objectAtIndex:i]; + NSDate *date = [_dates safeObjectAtIndex1:i]; NSString *hour = [dateFormatter stringFromDate:date]; @@ -570,7 +570,7 @@ typedef NS_ENUM(NSInteger,ScrollViewTagValue) { for (int i = 0; i < self.hours.count; i++) { - NSString *hour = (NSString*)[self.hours objectAtIndex:i]; + NSString *hour = (NSString*)[self.hours safeObjectAtIndex1:i]; UILabel *labelHour = [[UILabel alloc] initWithFrame:CGRectMake(0, (i * kHooDatePickerScrollViewItemHeight) + offsetContentScrollView, _scrollViewHours.frame.size.width, kHooDatePickerScrollViewItemHeight)]; labelHour.text = hour; @@ -646,7 +646,7 @@ typedef NS_ENUM(NSInteger,ScrollViewTagValue) { for (int i = 0; i < self.minutes.count; i++) { - NSString *minute = (NSString*)[self.minutes objectAtIndex:i]; + NSString *minute = (NSString*)[self.minutes safeObjectAtIndex1:i]; UILabel *labelMinute = [[UILabel alloc] initWithFrame:CGRectMake(0, (i * kHooDatePickerScrollViewItemHeight) + offsetContentScrollView, _scrollViewMinutes.frame.size.width, kHooDatePickerScrollViewItemHeight)]; labelMinute.text = minute; @@ -722,7 +722,7 @@ typedef NS_ENUM(NSInteger,ScrollViewTagValue) { for (int i = 0; i < self.seconds.count; i++) { - NSString *second = (NSString*)[self.seconds objectAtIndex:i]; + NSString *second = (NSString*)[self.seconds safeObjectAtIndex1:i]; UILabel *labelSecond = [[UILabel alloc] initWithFrame:CGRectMake(0, (i * kHooDatePickerScrollViewItemHeight) + offsetContentScrollView, _scrollViewSeconds.frame.size.width, kHooDatePickerScrollViewItemHeight)]; labelSecond.text = second; @@ -1269,7 +1269,7 @@ typedef NS_ENUM(NSInteger,ScrollViewTagValue) { if (index < 0) return; for (int i = 0; i < labels.count; i++) { - UILabel *label = (UILabel *)[labels objectAtIndex:i]; + UILabel *label = (UILabel *)[labels safeObjectAtIndex1:i]; if (i != index) { label.textColor = self.tintColor; label.font = kHooDatePickerLabelFont; diff --git a/xplan-ios/Main/Mine/View/Guild/View/SuperAdmin/XPMineGuildChooseManagerViewController.m b/xplan-ios/Main/Mine/View/Guild/View/SuperAdmin/XPMineGuildChooseManagerViewController.m index 6c128e58..0f06505b 100644 --- a/xplan-ios/Main/Mine/View/Guild/View/SuperAdmin/XPMineGuildChooseManagerViewController.m +++ b/xplan-ios/Main/Mine/View/Guild/View/SuperAdmin/XPMineGuildChooseManagerViewController.m @@ -13,6 +13,7 @@ #import "XPMacro.h" #import "TTPopup.h" #import "UIImage+Utils.h" +#import "NSArray+Safe.h" ///Model #import "GuildRoomInfoModel.h" ///View @@ -108,7 +109,7 @@ cell = [[XPGuildChooseManagerRoomTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPGuildChooseManagerRoomTableViewCell class])]; } cell.delegate = self; - GuildRoomInfoModel* roomInfo = [self.datasource objectAtIndex:indexPath.row]; + GuildRoomInfoModel* roomInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.roomInfo = roomInfo; if (roomInfo.hasManage) { if (![self.chooseArray containsObject:roomInfo.hallRoomUid]) { diff --git a/xplan-ios/Main/Mine/View/Guild/View/SuperAdmin/XPMineGuildSuperAdminSetViewController.m b/xplan-ios/Main/Mine/View/Guild/View/SuperAdmin/XPMineGuildSuperAdminSetViewController.m index 135998ce..b286b322 100644 --- a/xplan-ios/Main/Mine/View/Guild/View/SuperAdmin/XPMineGuildSuperAdminSetViewController.m +++ b/xplan-ios/Main/Mine/View/Guild/View/SuperAdmin/XPMineGuildSuperAdminSetViewController.m @@ -13,6 +13,7 @@ #import "ThemeColor.h" #import "XPMacro.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "GuildSuperAdminInfoModel.h" ///View @@ -82,7 +83,7 @@ cell = [[XPGuildSuperAdminSetTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPGuildSuperAdminSetTableViewCell class])]; } cell.delegate = self; - GuildSuperAdminInfoModel * info= [self.datasource objectAtIndex:indexPath.row]; + GuildSuperAdminInfoModel * info= [self.datasource safeObjectAtIndex1:indexPath.row]; cell.managerInfo = info; return cell; } diff --git a/xplan-ios/Main/Mine/View/Guild/View/XPMineClanViewController.m b/xplan-ios/Main/Mine/View/Guild/View/XPMineClanViewController.m index 74bfbf54..c3eb0cb2 100644 --- a/xplan-ios/Main/Mine/View/Guild/View/XPMineClanViewController.m +++ b/xplan-ios/Main/Mine/View/Guild/View/XPMineClanViewController.m @@ -13,6 +13,7 @@ #import "XPMacro.h" #import "ThemeColor.h" #import "AccountInfoStorage.h" +#import "NSArray+Safe.h" ///Model #import "ClanDetailInfoModel.h" #import "ClanMemberDetailInfoModel.h" @@ -150,7 +151,7 @@ cell = [[XPClanMemberTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPClanMemberTableViewCell class])]; } cell.cellType = ClanMemberTableViewCellType_Normal; - ClanMemberInfoModel * memberInfo = [self.datasource objectAtIndex:indexPath.row]; + ClanMemberInfoModel * memberInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.isLast = (self.datasource.count -1) == indexPath.row; cell.memberInfo = memberInfo; return cell; @@ -189,7 +190,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - ClanMemberInfoModel * memberInfo = [self.datasource objectAtIndex:indexPath.row]; + ClanMemberInfoModel * memberInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init]; userInfoVC.uid = memberInfo.uid.integerValue; [self.navigationController pushViewController:userInfoVC animated:YES]; diff --git a/xplan-ios/Main/Mine/View/Guild/View/XPMineGuildSearchViewController.m b/xplan-ios/Main/Mine/View/Guild/View/XPMineGuildSearchViewController.m index 515fb6a6..e3571825 100644 --- a/xplan-ios/Main/Mine/View/Guild/View/XPMineGuildSearchViewController.m +++ b/xplan-ios/Main/Mine/View/Guild/View/XPMineGuildSearchViewController.m @@ -12,6 +12,7 @@ #import "XPMacro.h" #import "ThemeColor.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "ClanMemberDetailInfoModel.h" #import "GuildSearchUserInfoModel.h" @@ -97,7 +98,7 @@ cell = [[XPClanMemberTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPClanMemberTableViewCell class])]; } cell.cellType = ClanMemberTableViewCellType_Normal; - ClanMemberInfoModel * memberInfo = [self.datasource objectAtIndex:indexPath.row]; + ClanMemberInfoModel * memberInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.memberInfo = memberInfo; return cell; }else if(self.searchType == GuildSearchType_Guild_Add_Member) { @@ -106,7 +107,7 @@ cell = [[XPMineGuildSearchMemberTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineGuildSearchMemberTableViewCell class])]; } cell.delegate = self; - GuildSearchUserInfoModel * userInfo = [self.datasource objectAtIndex:indexPath.row]; + GuildSearchUserInfoModel * userInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.userInfo = userInfo; return cell; } else if(self.searchType == GuildSearchType_Clan_Add_Super_Admin) { @@ -115,7 +116,7 @@ cell = [[XPGuildSearchSuperAdminTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPGuildSearchSuperAdminTableViewCell class])]; } cell.delegate = self; - GuildSearchSuperAdminModel * userInfo = [self.datasource objectAtIndex:indexPath.row]; + GuildSearchSuperAdminModel * userInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.userInfo = userInfo; return cell; } @@ -141,7 +142,7 @@ switch (self.searchType) { case GuildSearchType_Clan_All_Member: { - ClanMemberInfoModel * memberInfo = [self.datasource objectAtIndex:indexPath.row]; + ClanMemberInfoModel * memberInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init]; userInfoVC.uid = memberInfo.uid.integerValue; [((UINavigationController *)self.presentingViewController) pushViewController:userInfoVC animated:YES]; @@ -150,7 +151,7 @@ break; case GuildSearchType_Guild_Add_Member: { - GuildSearchUserInfoModel * userInfo = [self.datasource objectAtIndex:indexPath.row]; + GuildSearchUserInfoModel * userInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init]; userInfoVC.uid = userInfo.uid.integerValue; [((UINavigationController *)self.presentingViewController) pushViewController:userInfoVC animated:YES]; diff --git a/xplan-ios/Main/Mine/View/Guild/View/XPMineGuildViewController.m b/xplan-ios/Main/Mine/View/Guild/View/XPMineGuildViewController.m index b0c57743..f9054a09 100644 --- a/xplan-ios/Main/Mine/View/Guild/View/XPMineGuildViewController.m +++ b/xplan-ios/Main/Mine/View/Guild/View/XPMineGuildViewController.m @@ -15,6 +15,7 @@ #import "NetImageView.h" #import "AccountInfoStorage.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "ClanDetailInfoModel.h" #import "ClanMemberDetailInfoModel.h" @@ -281,7 +282,7 @@ cell = [[XPClanMemberTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPClanMemberTableViewCell class])]; } cell.cellType = ClanMemberTableViewCellType_Normal; - ClanMemberInfoModel * memberInfo = [self.datasource objectAtIndex:indexPath.row]; + ClanMemberInfoModel * memberInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.isLast = (self.datasource.count -1) == indexPath.row; cell.memberInfo = memberInfo; return cell; @@ -319,7 +320,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - ClanMemberInfoModel * memberInfo = [self.datasource objectAtIndex:indexPath.row]; + ClanMemberInfoModel * memberInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init]; userInfoVC.uid = memberInfo.uid.integerValue; [self.navigationController pushViewController:userInfoVC animated:YES]; diff --git a/xplan-ios/Main/Mine/View/MatchManage/View/XPMatchManageViewController.m b/xplan-ios/Main/Mine/View/MatchManage/View/XPMatchManageViewController.m index 06a6d948..b3f2aea6 100644 --- a/xplan-ios/Main/Mine/View/MatchManage/View/XPMatchManageViewController.m +++ b/xplan-ios/Main/Mine/View/MatchManage/View/XPMatchManageViewController.m @@ -13,6 +13,7 @@ #import "XPMacro.h" #import "XPHtmlUrl.h" #import "StatisticsServiceHelper.h" +#import "NSArray+Safe.h" ///Model #import "XPMineItemModel.h" ///P diff --git a/xplan-ios/Main/Mine/View/Noble/View/SubViews/XPNoblePrivilegeContentCell.m b/xplan-ios/Main/Mine/View/Noble/View/SubViews/XPNoblePrivilegeContentCell.m index fb01169f..3aa642b2 100644 --- a/xplan-ios/Main/Mine/View/Noble/View/SubViews/XPNoblePrivilegeContentCell.m +++ b/xplan-ios/Main/Mine/View/Noble/View/SubViews/XPNoblePrivilegeContentCell.m @@ -9,6 +9,7 @@ ///Third #import #import "TTPopup.h" +#import "NSArray+Safe.h" ///Tool #import "ThemeColor.h" #import "XPMacro.h" @@ -70,7 +71,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPNoblePrivilegeCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass(XPNoblePrivilegeCell.class) forIndexPath:indexPath]; - NobleAuthInfo *info = [self.vipAuthInfos objectAtIndex:indexPath.row]; + NobleAuthInfo *info = [self.vipAuthInfos safeObjectAtIndex1:indexPath.row]; if ([self.vipInfo.ownAuthTypes containsObject:@(info.authType)]) { cell.isOwn = YES; } @@ -79,7 +80,7 @@ } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { - NobleAuthInfo *info = [self.vipAuthInfos objectAtIndex:indexPath.row]; + NobleAuthInfo *info = [self.vipAuthInfos safeObjectAtIndex1:indexPath.row]; XPNobleAuthorityDescView *alertView = [[XPNobleAuthorityDescView alloc] initWithFrame:CGRectMake(0, 0, 300, 286)]; alertView.vipInfo = info; TTPopupService * config = [[TTPopupService alloc] init]; diff --git a/xplan-ios/Main/Mine/View/Noble/View/SubViews/XPNobleRankUpdateView.m b/xplan-ios/Main/Mine/View/Noble/View/SubViews/XPNobleRankUpdateView.m index c8876565..12129108 100644 --- a/xplan-ios/Main/Mine/View/Noble/View/SubViews/XPNobleRankUpdateView.m +++ b/xplan-ios/Main/Mine/View/Noble/View/SubViews/XPNobleRankUpdateView.m @@ -14,6 +14,7 @@ ///Tool #import "ThemeColor.h" #import "NetImageView.h" +#import "NSArray+Safe.h" ///Model #import "NobleRankListModel.h" @@ -154,7 +155,7 @@ - (void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view { XPNobleRankUpdateViewCell *myCell = (XPNobleRankUpdateViewCell *)cell; - NObleRankUserModel * info = [self.nobleList objectAtIndex:index]; + NObleRankUserModel * info = [self.nobleList safeObjectAtIndex1:index]; myCell.userInfo = info; } diff --git a/xplan-ios/Main/Mine/View/Noble/View/XPNobleCenterViewController.m b/xplan-ios/Main/Mine/View/Noble/View/XPNobleCenterViewController.m index ca5db6d7..88ef9fcc 100644 --- a/xplan-ios/Main/Mine/View/Noble/View/XPNobleCenterViewController.m +++ b/xplan-ios/Main/Mine/View/Noble/View/XPNobleCenterViewController.m @@ -25,6 +25,7 @@ #import "XPHtmlUrl.h" #import "TTPopup.h" #import "StatisticsServiceHelper.h" +#import "NSArray+Safe.h" ///View #import "XPNobleCenterListViewController.h" #import "XPNobleCenterNavView.h" @@ -198,7 +199,7 @@ NSInteger defaultSelectIndex = 0; NobleInfo * currentAuth; for (int index = 0; index < model.vipInfos.count; index++) { - NobleInfo *tagInfo = [model.vipInfos objectAtIndex:index]; + NobleInfo *tagInfo = [model.vipInfos safeObjectAtIndex1:index]; [names addObject:tagInfo.vipName]; if (tagInfo.vipLevel == model.currLevel) { defaultSelectIndex = index; @@ -321,7 +322,7 @@ - (id)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index { XPNobleCenterListViewController *VC = [[XPNobleCenterListViewController alloc] init]; VC.isOpenNoble = self.userInfo.userVipInfoVO.vipLevel; - NobleInfo *vipInfo = [self.model.vipInfos objectAtIndex:index]; + NobleInfo *vipInfo = [self.model.vipInfos safeObjectAtIndex1:index]; VC.vipInfo = vipInfo; if (vipInfo.comingSoon != 2) { VC.vipAuthInfos = self.model.vipAuthInfos; @@ -381,7 +382,7 @@ #pragma mark - events - (void)onOpenNobleButtonClick:(UITapGestureRecognizer *)button { [StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventVipOpenClick]; - RechargeListModel *rechargeModel = [self.rechargeModel.list objectAtIndex:0]; + RechargeListModel *rechargeModel = [self.rechargeModel.list safeObjectAtIndex1:0]; [self showLoading]; [self.presenter requestNobleIAPRechargeOrderWithChargeProdId:rechargeModel.chargeProdId roomUid:self.roomUid ? [NSString stringWithFormat:@"%zd", self.roomUid] : nil]; } diff --git a/xplan-ios/Main/Mine/View/Setting/XPMineBlackListViewController.m b/xplan-ios/Main/Mine/View/Setting/XPMineBlackListViewController.m index 8dc3c6dc..98061fb2 100644 --- a/xplan-ios/Main/Mine/View/Setting/XPMineBlackListViewController.m +++ b/xplan-ios/Main/Mine/View/Setting/XPMineBlackListViewController.m @@ -11,6 +11,7 @@ #import #import "XPMineBlackListTableViewCell.h" #import "XPMineFriendEmptyTableViewCell.h" +#import "NSArray+Safe.h" ///Model #import "UserInfoModel.h" ///P @@ -36,7 +37,7 @@ if (array.count > 0) { NSMutableArray * uids = [NSMutableArray array]; for (int i = 0; i< array.count; i++) { - NIMUser * user = [array objectAtIndex:i]; + NIMUser * user = [array safeObjectAtIndex1:i]; [uids addObject:user.userId]; } [self.presenter getUserListInfo:uids]; @@ -68,7 +69,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { XPMineBlackListTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineBlackListTableViewCell class])]; - cell.userInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.userInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } XPMineFriendEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineFriendEmptyTableViewCell class])]; @@ -89,7 +90,7 @@ -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ if (editingStyle ==UITableViewCellEditingStyleDelete){ if (self.datasource.count > 0) { - UserInfoModel *userInfo = [self.datasource objectAtIndex:indexPath.row]; + UserInfoModel *userInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; [[NIMSDK sharedSDK].userManager removeFromBlackBlackList:[NSString stringWithFormat:@"%ld", userInfo.uid] completion:^(NSError * _Nullable error) { if (error == nil) { [self.datasource removeObject:userInfo]; diff --git a/xplan-ios/Main/Mine/View/Setting/XPMineNotificaViewController.m b/xplan-ios/Main/Mine/View/Setting/XPMineNotificaViewController.m index 99c8087f..40362c68 100644 --- a/xplan-ios/Main/Mine/View/Setting/XPMineNotificaViewController.m +++ b/xplan-ios/Main/Mine/View/Setting/XPMineNotificaViewController.m @@ -12,6 +12,7 @@ ///Tool #import "ThemeColor.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "XPMineNotificationItemModel.h" ///View @@ -83,7 +84,7 @@ } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - XPMineNotificationItemModel *item = [self.dataModelArray objectAtIndex:indexPath.row]; + XPMineNotificationItemModel *item = [self.dataModelArray safeObjectAtIndex1:indexPath.row]; XPMineNotificationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineNotificationTableViewCell class]) forIndexPath:indexPath]; cell.delegate = self; cell.itemModel = item; diff --git a/xplan-ios/Main/Mine/View/Setting/XPMineSettingViewController.m b/xplan-ios/Main/Mine/View/Setting/XPMineSettingViewController.m index 1ff835f0..68998e47 100644 --- a/xplan-ios/Main/Mine/View/Setting/XPMineSettingViewController.m +++ b/xplan-ios/Main/Mine/View/Setting/XPMineSettingViewController.m @@ -14,6 +14,7 @@ ///Tool #import "ThemeColor.h" #import "XPMacro.h" +#import "NSArray+Safe.h" #import "XPHtmlUrl.h" ///Model #import "XPMineSettingItemModel.h" @@ -225,8 +226,8 @@ if (cell == nil) { cell = [[XPMineSettingTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineSettingTableViewCell class])]; } - NSArray * array = [self.datasource objectAtIndex:indexPath.section]; - XPMineSettingItemModel * model = [array objectAtIndex:indexPath.row]; + NSArray * array = [self.datasource safeObjectAtIndex1:indexPath.section]; + XPMineSettingItemModel * model = [array safeObjectAtIndex1:indexPath.row]; cell.itemModel = model; return cell; } @@ -260,7 +261,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - XPMineSettingItemModel * model = [[self.datasource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row]; + XPMineSettingItemModel * model = [[self.datasource safeObjectAtIndex1:indexPath.section] safeObjectAtIndex1:indexPath.row]; [self pushViewControllerWithType:model.type]; } } diff --git a/xplan-ios/Main/Mine/View/SkillCard/View/SubViews/XPSkillCardListCell.m b/xplan-ios/Main/Mine/View/SkillCard/View/SubViews/XPSkillCardListCell.m index c1cd4f02..3ffe2bc7 100644 --- a/xplan-ios/Main/Mine/View/SkillCard/View/SubViews/XPSkillCardListCell.m +++ b/xplan-ios/Main/Mine/View/SkillCard/View/SubViews/XPSkillCardListCell.m @@ -13,6 +13,7 @@ #import "NetImageView.h" #import "XPMacro.h" #import "TTPopup.h" +#import "NSArray+Safe.h" //View #import "XPSkillCardListPropCell.h" #import "XPSkillCardSelectPropView.h" @@ -111,7 +112,7 @@ cell = [[XPSkillCardListPropCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPSkillCardListPropCell class])]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; - cell.model = [self.dataArray objectAtIndex:indexPath.row]; + cell.model = [self.dataArray safeObjectAtIndex1:indexPath.row]; cell.isLast = self.dataArray.count == indexPath.row + 1; return cell; } @@ -125,7 +126,7 @@ } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - XPSkillCardRecordPropModel *item = [self.dataArray objectAtIndex:indexPath.row]; + XPSkillCardRecordPropModel *item = [self.dataArray safeObjectAtIndex1:indexPath.row]; return [self layoutCellHeightWithItem:item]; } diff --git a/xplan-ios/Main/Mine/View/SkillCard/View/SubViews/XPSkillCardSelectPropView.m b/xplan-ios/Main/Mine/View/SkillCard/View/SubViews/XPSkillCardSelectPropView.m index cb4feef4..07804d08 100644 --- a/xplan-ios/Main/Mine/View/SkillCard/View/SubViews/XPSkillCardSelectPropView.m +++ b/xplan-ios/Main/Mine/View/SkillCard/View/SubViews/XPSkillCardSelectPropView.m @@ -12,6 +12,7 @@ #import "ThemeColor.h" #import "UIImage+Utils.h" #import "XCHUDTool.h" +#import "NSArray+Safe.h" // View #import "XPSkillCardSelectPropCell.h" // Model @@ -79,7 +80,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPSkillCardSelectPropCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPSkillCardSelectPropCell class]) forIndexPath:indexPath]; - XPSkillCardSourcePropDetailModel * item = [self.sourceArray objectAtIndex:indexPath.row]; + XPSkillCardSourcePropDetailModel * item = [self.sourceArray safeObjectAtIndex1:indexPath.row]; cell.model = item; cell.isSelected = [self.selectPropNameArray containsObject:item.propVal]; return cell; @@ -87,7 +88,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; - XPSkillCardSourcePropDetailModel *item = [self.sourceArray objectAtIndex:indexPath.row]; + XPSkillCardSourcePropDetailModel *item = [self.sourceArray safeObjectAtIndex1:indexPath.row]; if ([self.selectPropNameArray containsObject:item.propVal]) {///取消选中 [self.selectPropNameArray removeObject:item.propVal]; NSInteger index = 0; diff --git a/xplan-ios/Main/Mine/View/SkillCard/View/SubViews/XPSkillCardTypeView.m b/xplan-ios/Main/Mine/View/SkillCard/View/SubViews/XPSkillCardTypeView.m index aa740966..bbff4c0f 100644 --- a/xplan-ios/Main/Mine/View/SkillCard/View/SubViews/XPSkillCardTypeView.m +++ b/xplan-ios/Main/Mine/View/SkillCard/View/SubViews/XPSkillCardTypeView.m @@ -10,6 +10,7 @@ #import #import "XPMacro.h" #import "ThemeColor.h" +#import "NSArray+Safe.h" // View #import "XPSkillCardTypeCollectionViewCell.h" @@ -55,7 +56,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPSkillCardTypeCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPSkillCardTypeCollectionViewCell class]) forIndexPath:indexPath]; - XPSkillCardTypeModel * item = [self.array objectAtIndex:indexPath.row]; + XPSkillCardTypeModel * item = [self.array safeObjectAtIndex1:indexPath.row]; cell.itemModel = item; return cell; } @@ -63,7 +64,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPSkillCardTypeViewDidSelectItem:)]) { - XPSkillCardTypeModel * model = [self.array objectAtIndex:indexPath.row]; + XPSkillCardTypeModel * model = [self.array safeObjectAtIndex1:indexPath.row]; [self.delegate xPSkillCardTypeViewDidSelectItem:model]; } } diff --git a/xplan-ios/Main/Mine/View/SkillCard/View/XPSkillCardEditViewController.m b/xplan-ios/Main/Mine/View/SkillCard/View/XPSkillCardEditViewController.m index 2a21efc1..104465a2 100644 --- a/xplan-ios/Main/Mine/View/SkillCard/View/XPSkillCardEditViewController.m +++ b/xplan-ios/Main/Mine/View/SkillCard/View/XPSkillCardEditViewController.m @@ -26,6 +26,7 @@ #import "ThemeColor.h" #import "UIImage+Utils.h" #import "NetImageView.h" +#import "NSArray+Safe.h" @interface XPSkillCardEditViewController () < @@ -242,7 +243,7 @@ XPMineCustomNavViewDelegate } cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.defaultModel = self.model; - cell.model = [self.propArray objectAtIndex:indexPath.row]; + cell.model = [self.propArray safeObjectAtIndex1:indexPath.row]; cell.isLast = (self.propArray.count == indexPath.row + 1); cell.delegate = self; return cell; @@ -262,8 +263,8 @@ XPMineCustomNavViewDelegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [self.tableView endEditing:YES]; - XPSkillCardResourcePropModel *sourceProp = [self.model.props objectAtIndex:indexPath.row]; - XPSkillCardPropModel *editProp = [self.propArray objectAtIndex:indexPath.row]; + XPSkillCardResourcePropModel *sourceProp = [self.model.props safeObjectAtIndex1:indexPath.row]; + XPSkillCardPropModel *editProp = [self.propArray safeObjectAtIndex1:indexPath.row]; if (editProp.state == 0 || editProp.state == 2) { //单选\多选 [self showSkillListWithSourceProps:sourceProp.propDictVos propModel:editProp selectArray:editProp.refPropVos editIndex:indexPath.row]; } @@ -287,14 +288,14 @@ XPMineCustomNavViewDelegate #pragma mark - XPSkillCardEditPropCellDelegate - (void)xPSkillCardPropCellPropValChange:(XPSkillCardEditPropCell *)cell selectArray:(NSArray *)selectArray { NSIndexPath *indexPath = [self.tableView indexPathForCell:cell]; - XPSkillCardPropModel *model = [self.propArray objectAtIndex:indexPath.row]; + XPSkillCardPropModel *model = [self.propArray safeObjectAtIndex1:indexPath.row]; model.refPropVos = [NSMutableArray arrayWithArray:selectArray]; } #pragma mark - XPSkillCardSelectPropViewDelegate - (void)xPSkillCardSelectPropViewCompleteSelect:(NSArray *)selectArray editIndex:(NSInteger)editIndex { [TTPopup dismiss]; - XPSkillCardPropModel *model = [self.propArray objectAtIndex:editIndex]; + XPSkillCardPropModel *model = [self.propArray safeObjectAtIndex1:editIndex]; model.refPropVos = [NSMutableArray arrayWithArray:selectArray]; [self.tableView reloadData]; } @@ -311,7 +312,7 @@ XPMineCustomNavViewDelegate for (int i = 0; i #import "NSObject+MJExtension.h" #import "RoomFaceInfoModel.h" +#import "NSArray+Safe.h" #define FileHashDefaultChunkSizeForReadingData 1024*8 // 8K NSString * const kRoomFaceVersion = @"kRoomFaceVersion"; @@ -43,7 +44,7 @@ NSString * const kRoomFaceVersion = @"kRoomFaceVersion"; - (void)downFaceDataCompletion:(nullable void (^)(NSString * nullable))completion { //获取沙盒doucument路径 NSArray*pathsss =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); - NSString *documentsDirectory = [pathsss objectAtIndex:0]; + NSString *documentsDirectory = [pathsss safeObjectAtIndex1:0]; NSString*faceDirectory = [documentsDirectory stringByAppendingPathComponent:@"Face"]; ///首先判断 本地的数据是否 需要更新了 NSString *version = [[NSUserDefaults standardUserDefaults]objectForKey: kRoomFaceVersion]; diff --git a/xplan-ios/Main/ModuleKit/FaceView/View/XPRoomFaceViewController.m b/xplan-ios/Main/ModuleKit/FaceView/View/XPRoomFaceViewController.m index 40e91a99..dc00c3cb 100644 --- a/xplan-ios/Main/ModuleKit/FaceView/View/XPRoomFaceViewController.m +++ b/xplan-ios/Main/ModuleKit/FaceView/View/XPRoomFaceViewController.m @@ -13,6 +13,7 @@ #import "ThemeColor.h" #import "XPRoomFaceTool.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "RoomFaceTitleItemModel.h" #import "RoomFaceInfoModel.h" @@ -241,7 +242,7 @@ #pragma mark - UICollectionViewDelegate And UICollectionViewDatasource - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { if (collectionView == self.titleCollectionView) { - RoomFaceTitleItemModel * itemModel = [self.titleList objectAtIndex:indexPath.row]; + RoomFaceTitleItemModel * itemModel = [self.titleList safeObjectAtIndex1:indexPath.row]; CGSize size = [itemModel.title boundingRectWithSize:CGSizeMake(100, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13]} context:nil].size; return CGSizeMake(size.width + 10, size.height); @@ -260,7 +261,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { if (collectionView == self.titleCollectionView) { XPRoomFaceTitleCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPRoomFaceTitleCollectionViewCell class]) forIndexPath:indexPath]; - RoomFaceTitleItemModel * model = [self.titleList objectAtIndex:indexPath.item]; + RoomFaceTitleItemModel * model = [self.titleList safeObjectAtIndex1:indexPath.item]; if (model == self.selectTitleItem) { model.isSelect = YES; } else { @@ -273,9 +274,9 @@ XPRoomFaceCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPRoomFaceCollectionViewCell class]) forIndexPath:indexPath]; RoomFaceInfoModel * faceInfo; if (self.selectTitleItem.faceType == RoomFaceTitleItemType_Normal) { - faceInfo = [self.faceList objectAtIndex:indexPath.row]; + faceInfo = [self.faceList safeObjectAtIndex1:indexPath.row]; } else { - faceInfo = [self.nobelFaceList objectAtIndex:indexPath.row]; + faceInfo = [self.nobelFaceList safeObjectAtIndex1:indexPath.row]; } cell.vipLevel = self.userInfo.userVipInfoVO.vipLevel; cell.faceInfo =faceInfo; @@ -284,7 +285,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { if (collectionView == self.titleCollectionView) { - RoomFaceTitleItemModel * titleModel = [self.titleList objectAtIndex:indexPath.row]; + RoomFaceTitleItemModel * titleModel = [self.titleList safeObjectAtIndex1:indexPath.row]; self.selectTitleItem = titleModel; [self.titleCollectionView reloadData]; NSArray * list = titleModel.faceType == RoomFaceTitleItemType_Normal ? self.faceList : self.nobelFaceList; @@ -292,11 +293,11 @@ [self.faceCollectionView reloadData]; } else { if (self.selectTitleItem.faceType == RoomFaceTitleItemType_Normal) { - RoomFaceInfoModel * faceInfo = [self.faceList objectAtIndex:indexPath.row]; + RoomFaceInfoModel * faceInfo = [self.faceList safeObjectAtIndex1:indexPath.row]; [self sendFaceCustomMessage:faceInfo]; } else { if (indexPath.row < self.nobelFaceList.count) { - RoomFaceInfoModel * faceInfo = [self.nobelFaceList objectAtIndex:indexPath.row]; + RoomFaceInfoModel * faceInfo = [self.nobelFaceList safeObjectAtIndex1:indexPath.row]; if (faceInfo.faceVipInfo.vipLevel > self.userInfo.userVipInfoVO.vipLevel) { TTAlertConfig *config = [[TTAlertConfig alloc] init]; config.message = [NSString stringWithFormat:@"尚未达到发送%@所需贵族等级,\n 所需贵族等级:%@", faceInfo.name,faceInfo.faceVipInfo.vipName]; diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftStorage.m b/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftStorage.m index d8eea6a3..ce7438d6 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftStorage.m +++ b/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftStorage.m @@ -8,7 +8,7 @@ #import "XPGiftStorage.h" #import "GiftInfoModel.h" #import "NSObject+MJExtension.h" - +#import "NSArray+Safe.h" @interface XPGiftStorage () ///key:房间id value:房间对应的礼物列表 @property (nonatomic, strong) NSCache *> *roomGiftCache; @@ -97,7 +97,7 @@ [fileManager createDirectoryAtPath:giftDirPath withIntermediateDirectories:YES attributes:nil error:nil]; } for (int i = 0; i< array.count; i++) { - GiftInfoModel * giftInfoModel = [array objectAtIndex:i]; + GiftInfoModel * giftInfoModel = [array safeObjectAtIndex1:i]; NSString *giftPath = [giftDirPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%ld", giftInfoModel.giftId]]; [NSKeyedArchiver archiveRootObject:giftInfoModel.model2dictionary toFile:giftPath]; } diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/View/Cell/XPGiftWeekStarCollectionViewCell.m b/xplan-ios/Main/ModuleKit/SendGiftView/View/Cell/XPGiftWeekStarCollectionViewCell.m index aae9b58a..58c46f1f 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/View/Cell/XPGiftWeekStarCollectionViewCell.m +++ b/xplan-ios/Main/ModuleKit/SendGiftView/View/Cell/XPGiftWeekStarCollectionViewCell.m @@ -14,6 +14,7 @@ #import "XPMacro.h" #import "ThemeColor+SendGift.h" #import "XPGiftCollectionViewFlowLayout.h" +#import "NSArray+Safe.h" ///Model #import "GiftInfoModel.h" ///View @@ -71,7 +72,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPGiftItemCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGiftItemCollectionViewCell class]) forIndexPath:indexPath]; GiftInfoModel * giftInfo; - giftInfo= [self.weekStarGiftList objectAtIndex:indexPath.item]; + giftInfo= [self.weekStarGiftList safeObjectAtIndex1:indexPath.item]; if (giftInfo.giftId == self.selectGiftInfo.giftId) { giftInfo.isSelected = YES; } else { @@ -84,7 +85,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.weekStarGiftList.count > 0) { - GiftInfoModel * giftInfo= [self.weekStarGiftList objectAtIndex:indexPath.item]; + GiftInfoModel * giftInfo= [self.weekStarGiftList safeObjectAtIndex1:indexPath.item]; self.selectGiftInfo = giftInfo; [self.collectionView reloadData]; diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftCountView.m b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftCountView.m index d39e4391..296931aa 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftCountView.m +++ b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftCountView.m @@ -8,6 +8,7 @@ #import "XPGiftCountView.h" ///Third #import +#import "NSArray+Safe.h" ///Model #import "XPGiftCountModel.h" ///View @@ -106,7 +107,7 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPGiftCountCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGiftCountCollectionViewCell class]) forIndexPath:indexPath]; - XPGiftCountModel *countItem = [self.giftCountArray objectAtIndex:indexPath.item]; + XPGiftCountModel *countItem = [self.giftCountArray safeObjectAtIndex1:indexPath.item]; cell.countModel = countItem; return cell; } @@ -114,7 +115,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPGiftCountView:didClickItem:)]) { - XPGiftCountModel *countItem = [self.giftCountArray objectAtIndex:indexPath.item]; + XPGiftCountModel *countItem = [self.giftCountArray safeObjectAtIndex1:indexPath.item]; [self.delegate xPGiftCountView:self didClickItem:countItem]; } } @@ -128,7 +129,7 @@ } if (self.delegate && [self.delegate respondsToSelector:@selector(xPGiftCountView:didClickItem:)]) { - XPGiftCountModel *countItem = [self.giftCountArray objectAtIndex:0]; + XPGiftCountModel *countItem = [self.giftCountArray safeObjectAtIndex1:0]; [self.delegate xPGiftCountView:self didClickItem:countItem]; } diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftInfoView.m b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftInfoView.m index 3e0dd9c8..3e62368f 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftInfoView.m +++ b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftInfoView.m @@ -12,6 +12,7 @@ #import "XPMacro.h" #import "XPHtmlUrl.h" #import "ThemeColor+SendGift.h" +#import "NSArray+Safe.h" ///Model #import "GiftInfoModel.h" #import "GiftReceiveInfoModel.h" @@ -252,7 +253,7 @@ // 根据礼物id查找 - (GiftInfoModel *)findGiftInfoByGiftId:(NSInteger)giftId { for (int i=0; i 0) { [self resetSelectGift:self.datasource]; - GiftInfoModel * giftInfo= [self.datasource objectAtIndex:indexPath.item]; + GiftInfoModel * giftInfo= [self.datasource safeObjectAtIndex1:indexPath.item]; [self dealSelectGift:giftInfo]; [self.giftcollectionView reloadData]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPGiftInfoView:didClickItem:type:)]) { @@ -396,7 +397,7 @@ if (self.datasource.count > 0) { if (self.defaultSelectGiftId.length && (self.segmentType == GiftSegmentType_Normal | self.segmentType == GiftSegmentType_Pack)) { for (int i = 0 ; i ///Tool #import "ThemeColor.h" +#import "NSArray+Safe.h" ///Model #import "GiftLuckyBroadcastModel.h" @@ -151,7 +152,7 @@ - (void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view { XPGiftLuckyGiftBroadcastCell *myCell = (XPGiftLuckyGiftBroadcastCell *)cell; - GiftLuckyBroadcastModel * info = [self.records objectAtIndex:index]; + GiftLuckyBroadcastModel * info = [self.records safeObjectAtIndex1:index]; myCell.giftInfo = info; } diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftUsersView.m b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftUsersView.m index 7716d718..5532f359 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftUsersView.m +++ b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftUsersView.m @@ -13,6 +13,7 @@ #import "NetImageView.h" #import "ThemeColor.h" #import "UIImage+Utils.h" +#import "NSArray+Safe.h" ///Model #import "UserInfoModel.h" #import "XPGiftUserInfoModel.h" @@ -127,7 +128,7 @@ }]; for (int i = 0; i < newArray.count; i++) { - XPGiftUserInfoModel * userInfo = [newArray objectAtIndex:i]; + XPGiftUserInfoModel * userInfo = [newArray safeObjectAtIndex1:i]; if (userInfo && userInfo.uid > 0 && userInfo.uid != uid.integerValue) { ///自己在麦上不显示在送礼物列表中 NSString * uid = [NSString stringWithFormat:@"%ld", userInfo.uid]; if (userInfo.isSelect) { @@ -162,14 +163,14 @@ -(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPGiftUserCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGiftUserCollectionViewCell class]) forIndexPath:indexPath]; - XPGiftUserInfoModel * queue = [self.userArray objectAtIndex:indexPath.row]; + XPGiftUserInfoModel * queue = [self.userArray safeObjectAtIndex1:indexPath.row]; cell.userInfo = queue; return cell; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; - XPGiftUserInfoModel * queue = [self.userArray objectAtIndex:indexPath.row]; + XPGiftUserInfoModel * queue = [self.userArray safeObjectAtIndex1:indexPath.row]; queue.isSelect = !queue.isSelect; [self.collectionView reloadData]; NSString * selectUid = [NSString stringWithFormat:@"%ld", queue.uid]; diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPSendGiftView.m b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPSendGiftView.m index 2b067c80..c50f9826 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPSendGiftView.m +++ b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPSendGiftView.m @@ -18,6 +18,7 @@ #import "StatisticsServiceHelper.h" #import "XPHtmlUrl.h" #import "AccountInfoStorage.h" +#import "NSArray+Safe.h" ///Model #import "GiftInfoModel.h" #import "XPGiftCountModel.h" @@ -180,7 +181,7 @@ AttachmentModel * attachment = [[AttachmentModel alloc] init]; attachment.first = CustomMessageType_AllMicroSend; attachment.second = Custom_Message_Sub_AllMicroLuckySend; - NSDictionary * obj = [luckyBagGifts objectAtIndex:i]; + NSDictionary * obj = [luckyBagGifts safeObjectAtIndex1:i]; [data1 setObject:i == 0 ? @(YES):@(NO) forKey:@"isShowAnimation"]; [data1 setObject:obj forKey:@"luckyGiftList"]; [data1 setObject:receiveModel.gift.giftName forKey:@"giftName"]; diff --git a/xplan-ios/Main/Monents/View/Cell/XPMonentsCommentTableViewCell.m b/xplan-ios/Main/Monents/View/Cell/XPMonentsCommentTableViewCell.m index a8986809..9fa72187 100644 --- a/xplan-ios/Main/Monents/View/Cell/XPMonentsCommentTableViewCell.m +++ b/xplan-ios/Main/Monents/View/Cell/XPMonentsCommentTableViewCell.m @@ -16,6 +16,7 @@ #import "NSString+Utils.h" #import "QEmotionHelper.h" #import "AccountInfoStorage.h" +#import "NSArray+Safe.h" ///Model #import "MonentsCommentModel.h" ///View @@ -136,7 +137,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 0) { - MonentsReplyModel * replayinfo = [self.datasource objectAtIndex:indexPath.row]; + MonentsReplyModel * replayinfo = [self.datasource safeObjectAtIndex1:indexPath.row]; return replayinfo.replyRowHeight; } return 44; @@ -145,7 +146,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 0) { XPMonentsReplyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsReplyTableViewCell class])]; - cell.replyInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.replyInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.delegate = self; return cell; } @@ -158,7 +159,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (indexPath.section == 0 && self.datasource.count > 0) { - MonentsReplyModel * replyInfo = [self.datasource objectAtIndex:indexPath.row]; + MonentsReplyModel * replyInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; if (replyInfo.uid.integerValue != [AccountInfoStorage instance].getUid.integerValue && self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsCommentTableViewCell:didClickCommon:)]) { [self.delegate xPMonentsCommentTableViewCell:self didClickCommon:replyInfo]; } diff --git a/xplan-ios/Main/Monents/View/Cell/XPMonentsTableViewCell.m b/xplan-ios/Main/Monents/View/Cell/XPMonentsTableViewCell.m index 1055367d..b411f02e 100644 --- a/xplan-ios/Main/Monents/View/Cell/XPMonentsTableViewCell.m +++ b/xplan-ios/Main/Monents/View/Cell/XPMonentsTableViewCell.m @@ -15,6 +15,7 @@ #import "XPMonentsLayoutConfig.h" #import "SDPhotoBrowser.h" #import "XCCurrentVCStackManager.h" +#import "NSArray+Safe.h" ///Model #import "MonentsInfoModel.h" ///View @@ -140,7 +141,7 @@ #pragma mark - SDPhotoBrowserDelegate - (NSURL *)photoBrowser:(SDPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index { - MonentsPicInfoModel *picinfo = [self.monentsInfo.dynamicResList objectAtIndex:index]; + MonentsPicInfoModel *picinfo = [self.monentsInfo.dynamicResList safeObjectAtIndex1:index]; return [NSURL URLWithString:picinfo.resUrl]; } diff --git a/xplan-ios/Main/Monents/View/SubViews/XPMoentsTopicListView.m b/xplan-ios/Main/Monents/View/SubViews/XPMoentsTopicListView.m index 7a2f552d..4ad91ed2 100644 --- a/xplan-ios/Main/Monents/View/SubViews/XPMoentsTopicListView.m +++ b/xplan-ios/Main/Monents/View/SubViews/XPMoentsTopicListView.m @@ -17,6 +17,7 @@ #import "AccountInfoStorage.h" #import "MonentsTopicModel.h" #import "XPMacro.h" +#import "NSArray+Safe.h" @interface XPMoentsTopicListTableViewCell : UITableViewCell ///头像 @@ -216,7 +217,7 @@ if (cell == nil) { cell = [[XPMoentsTopicListTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMoentsTopicListTableViewCell class])]; } - cell.topicInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.topicInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } @@ -227,7 +228,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - MonentsTopicModel * infor = [self.datasource objectAtIndex:indexPath.row]; + MonentsTopicModel * infor = [self.datasource safeObjectAtIndex1:indexPath.row]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPMoentsTopicListView:didSelectItem:)]) { [self.delegate xPMoentsTopicListView:self didSelectItem:infor]; } diff --git a/xplan-ios/Main/Monents/View/SubViews/XPMonentsPhotoView.m b/xplan-ios/Main/Monents/View/SubViews/XPMonentsPhotoView.m index 507b4ec7..e8042a34 100644 --- a/xplan-ios/Main/Monents/View/SubViews/XPMonentsPhotoView.m +++ b/xplan-ios/Main/Monents/View/SubViews/XPMonentsPhotoView.m @@ -12,6 +12,7 @@ #import "ThemeColor.h" #import "NetImageView.h" #import "XPMonentsLayoutConfig.h" +#import "NSArray+Safe.h" ///Model #import "MonentsInfoModel.h" @@ -88,7 +89,7 @@ make.size.mas_equalTo(CGSizeMake(kMONENTS_PIC_ONE_WIDTH, kMONENTS_PIC_ONE_WIDTH)); make.left.top.mas_equalTo(self); }]; - MonentsPicInfoModel * picInfo = [_dynamicResList objectAtIndex:0]; + MonentsPicInfoModel * picInfo = [_dynamicResList safeObjectAtIndex1:0]; self.firstImageView.imageUrl = picInfo.resUrl; } else if(_dynamicResList.count == 2) { self.firstImageView.hidden = NO; @@ -98,7 +99,7 @@ make.left.top.mas_equalTo(self); }]; - MonentsPicInfoModel * picInfo = [_dynamicResList objectAtIndex:0]; + MonentsPicInfoModel * picInfo = [_dynamicResList safeObjectAtIndex1:0]; self.firstImageView.imageUrl = picInfo.resUrl; self.secondImageView.hidden = NO; @@ -108,14 +109,14 @@ make.left.mas_equalTo(self.firstImageView.mas_right).offset(kMONENTS_PIC_SPACE); }]; - MonentsPicInfoModel * secondPicInfo = [_dynamicResList objectAtIndex:1]; + MonentsPicInfoModel * secondPicInfo = [_dynamicResList safeObjectAtIndex1:1]; self.secondImageView.imageUrl = secondPicInfo.resUrl; } else{ for (int i = 0; i < _dynamicResList.count; i++) { - MonentsPicInfoModel * picInfo = [_dynamicResList objectAtIndex:i]; + MonentsPicInfoModel * picInfo = [_dynamicResList safeObjectAtIndex1:i]; if (i < self.subViewArray.count) { - NetImageView * imageView = [self.subViewArray objectAtIndex:i]; + NetImageView * imageView = [self.subViewArray safeObjectAtIndex1:i]; imageView.hidden = NO; imageView.imageUrl = picInfo.resUrl; } @@ -125,7 +126,7 @@ for (int i = 0; i < self.subViewArray.count; i++) { NSInteger page = i % 3; NSInteger line = i / 3; - NetImageView * imageView = [self.subViewArray objectAtIndex:i]; + NetImageView * imageView = [self.subViewArray safeObjectAtIndex1:i]; [imageView mas_remakeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(itemWidth, itemWidth)); make.left.mas_equalTo(page * (itemWidth + kMONENTS_PIC_SPACE)); diff --git a/xplan-ios/Main/Monents/View/SubViews/XPMonentsRecommendHeaderView.m b/xplan-ios/Main/Monents/View/SubViews/XPMonentsRecommendHeaderView.m index e0ad26f6..befb356e 100644 --- a/xplan-ios/Main/Monents/View/SubViews/XPMonentsRecommendHeaderView.m +++ b/xplan-ios/Main/Monents/View/SubViews/XPMonentsRecommendHeaderView.m @@ -10,6 +10,7 @@ #import ///Tool #import "ThemeColor.h" +#import "NSArray+Safe.h" ///Model #import "MonentsTopicModel.h" ///View @@ -69,21 +70,21 @@ } - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { - MonentsTopicModel * topicModel = [self.topicList objectAtIndex:indexPath.row]; + MonentsTopicModel * topicModel = [self.topicList safeObjectAtIndex1:indexPath.row]; CGFloat itemWidth = [topicModel.name boundingRectWithSize:CGSizeMake(100, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10 weight:UIFontWeightBold]} context:nil].size.width; return CGSizeMake(itemWidth +34, 26); } - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPMonentsTopicCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMonentsTopicCollectionViewCell class]) forIndexPath:indexPath]; - cell.topicInfo = [self.topicList objectAtIndex:indexPath.row]; + cell.topicInfo = [self.topicList safeObjectAtIndex1:indexPath.row]; return cell; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.topicList.count > 0) { - MonentsTopicModel * topicInfo = [self.topicList objectAtIndex:indexPath.row]; + MonentsTopicModel * topicInfo = [self.topicList safeObjectAtIndex1:indexPath.row]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsRecommendHeaderView:didSelectItem:)]) { [self.delegate xPMonentsRecommendHeaderView:self didSelectItem:topicInfo]; } diff --git a/xplan-ios/Main/Monents/View/SubViews/XPMonentsUserInfoView.m b/xplan-ios/Main/Monents/View/SubViews/XPMonentsUserInfoView.m index 204d1ccf..ea868077 100644 --- a/xplan-ios/Main/Monents/View/SubViews/XPMonentsUserInfoView.m +++ b/xplan-ios/Main/Monents/View/SubViews/XPMonentsUserInfoView.m @@ -15,6 +15,7 @@ #import "XPMacro.h" ///Model #import "MonentsInfoModel.h" +#import "NSArray+Safe.h" @interface XPMonentsUserInfoView () /// @@ -250,9 +251,9 @@ self.secondTagImageView.hidden = YES; self.thirdTagImageView.hidden = YES; for (int i = 0; i< _monentsInfo.labelList.count; i++) { - NSString * imageUrl = [_monentsInfo.labelList objectAtIndex:i]; + NSString * imageUrl = [_monentsInfo.labelList safeObjectAtIndex1:i]; if (i < self.tagStackView.subviews.count) { - NetImageView * image = [self.tagStackView.subviews objectAtIndex:i]; + NetImageView * image = [self.tagStackView.subviews safeObjectAtIndex1:i]; image.hidden = NO; image.imageUrl = imageUrl; } diff --git a/xplan-ios/Main/Monents/View/XPMoentsTopicListViewController.m b/xplan-ios/Main/Monents/View/XPMoentsTopicListViewController.m index 0188c2c9..4eb16afa 100644 --- a/xplan-ios/Main/Monents/View/XPMoentsTopicListViewController.m +++ b/xplan-ios/Main/Monents/View/XPMoentsTopicListViewController.m @@ -11,6 +11,7 @@ #import ///Tool #import "ThemeColor.h" +#import "NSArray+Safe.h" ///Model #import "MonentsTopicModel.h" ///View @@ -92,7 +93,7 @@ if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([UITableViewCell class])]; } - MonentsTopicModel * topicModel = [self.datasource objectAtIndex:indexPath.row]; + MonentsTopicModel * topicModel = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.textLabel.text = [NSString stringWithFormat:@"#%@", topicModel.name]; cell.textLabel.textColor = [ThemeColor mainTextColor]; cell.textLabel.font = [UIFont systemFontOfSize:13]; @@ -102,7 +103,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - MonentsTopicModel * topicModel = [self.datasource objectAtIndex:indexPath.row]; + MonentsTopicModel * topicModel = [self.datasource safeObjectAtIndex1:indexPath.row]; XPMonentTopicContainerViewController * topicVC = [[XPMonentTopicContainerViewController alloc] init]; topicVC.worldId = topicModel.tId; [self.navigationController pushViewController:topicVC animated:YES]; diff --git a/xplan-ios/Main/Monents/View/XPMonentsAttentionViewController.m b/xplan-ios/Main/Monents/View/XPMonentsAttentionViewController.m index a19fe72b..85a1c3bb 100644 --- a/xplan-ios/Main/Monents/View/XPMonentsAttentionViewController.m +++ b/xplan-ios/Main/Monents/View/XPMonentsAttentionViewController.m @@ -14,6 +14,7 @@ #import "XPMacro.h" #import "XPMonentsLayoutConfig.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "MonentsListInfoModel.h" ///P @@ -105,7 +106,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { - MonentsInfoModel * monentInfo= [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row]; [XPMonentsLayoutConfig layoutMonentsModel:monentInfo]; return monentInfo.rowHeight; } @@ -115,7 +116,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])]; - MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.delegate = self; cell.monentsInfo = monentsInfo; return cell; @@ -128,7 +129,7 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init]; - MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; detailVC.monentsInfo = monentsInfo; detailVC.delegate = self; [self.navigationController pushViewController:detailVC animated:YES]; diff --git a/xplan-ios/Main/Monents/View/XPMonentsDetailViewController.m b/xplan-ios/Main/Monents/View/XPMonentsDetailViewController.m index bd597b88..c73beb84 100644 --- a/xplan-ios/Main/Monents/View/XPMonentsDetailViewController.m +++ b/xplan-ios/Main/Monents/View/XPMonentsDetailViewController.m @@ -15,6 +15,7 @@ #import "QEmotionHelper.h" #import "QKeyboardManager.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "MonentsInfoModel.h" #import "MonentsCommentModel.h" @@ -164,7 +165,7 @@ return self.monentsInfo.rowHeight; } else if(indexPath.section == 1) { if (self.datasource.count > 0) { - MonentsCommentModel * commentInfo = [self.datasource objectAtIndex:indexPath.row]; + MonentsCommentModel * commentInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; return [XPMonentsLayoutConfig commentCommentRowHeight:commentInfo]; } else { return 400; @@ -202,7 +203,7 @@ } else { if (self.datasource.count > 0) { XPMonentsCommentTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsCommentTableViewCell class])]; - cell.commentInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.commentInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.delegate = self; return cell; } else { @@ -216,7 +217,7 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (indexPath.section == 1) { if (self.datasource.count > 0) { - MonentsCommentModel* monent = [self.datasource objectAtIndex:indexPath.row]; + MonentsCommentModel* monent = [self.datasource safeObjectAtIndex1:indexPath.row]; self.commentId = monent.commentId; self.inputBarView.inputTextView.placeholder = [NSString stringWithFormat:@"回复: %@", monent.nick]; [self.inputBarView textViewBecomeFirstResponder]; diff --git a/xplan-ios/Main/Monents/View/XPMonentsInteractiveViewController.m b/xplan-ios/Main/Monents/View/XPMonentsInteractiveViewController.m index 6d7e030f..d883c1da 100644 --- a/xplan-ios/Main/Monents/View/XPMonentsInteractiveViewController.m +++ b/xplan-ios/Main/Monents/View/XPMonentsInteractiveViewController.m @@ -13,6 +13,7 @@ #import "ThemeColor.h" #import "TTPopup.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "MonentsInteractiveModel.h" ///P @@ -105,7 +106,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { - MonentsInteractiveModel * model = [self.datasource objectAtIndex:indexPath.row]; + MonentsInteractiveModel * model = [self.datasource safeObjectAtIndex1:indexPath.row]; return model.worldName.length > 0? 130 : 90; } return KScreenHeight - kNavigationHeight; @@ -114,7 +115,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { XPMonentsInteractiveTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsInteractiveTableViewCell class])]; - MonentsInteractiveModel * model = [self.datasource objectAtIndex:indexPath.row]; + MonentsInteractiveModel * model = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.interactiveInfo = model; return cell; } @@ -126,7 +127,7 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init]; - MonentsInteractiveModel * model = [self.datasource objectAtIndex:indexPath.row]; + MonentsInteractiveModel * model = [self.datasource safeObjectAtIndex1:indexPath.row]; MonentsInfoModel * monents = [[MonentsInfoModel alloc] init]; monents.dynamicId = model.dynamicId; detailVC.monentsInfo = monents; diff --git a/xplan-ios/Main/Monents/View/XPMonentsLatestViewController.m b/xplan-ios/Main/Monents/View/XPMonentsLatestViewController.m index 0ebba6d9..66036543 100644 --- a/xplan-ios/Main/Monents/View/XPMonentsLatestViewController.m +++ b/xplan-ios/Main/Monents/View/XPMonentsLatestViewController.m @@ -14,6 +14,7 @@ #import "XPMacro.h" #import "XPMonentsLayoutConfig.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "MonentsListInfoModel.h" ///P @@ -109,7 +110,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { - MonentsInfoModel * monentInfo= [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row]; [XPMonentsLayoutConfig layoutMonentsModel:monentInfo]; return monentInfo.rowHeight; } @@ -119,7 +120,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])]; - MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.monentsInfo = monentsInfo; cell.delegate = self; return cell; @@ -132,7 +133,7 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init]; - MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; detailVC.monentsInfo = monentsInfo; detailVC.delegate = self; [self.navigationController pushViewController:detailVC animated:YES]; diff --git a/xplan-ios/Main/Monents/View/XPMonentsMineViewController.m b/xplan-ios/Main/Monents/View/XPMonentsMineViewController.m index 752f2ac8..c2e02eb0 100644 --- a/xplan-ios/Main/Monents/View/XPMonentsMineViewController.m +++ b/xplan-ios/Main/Monents/View/XPMonentsMineViewController.m @@ -14,6 +14,7 @@ #import "XPMacro.h" #import "XPMonentsLayoutConfig.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "MonentsListInfoModel.h" ///P @@ -69,7 +70,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { - MonentsInfoModel * monentInfo= [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row]; [XPMonentsLayoutConfig layoutMonentsModel:monentInfo]; return monentInfo.rowHeight; } @@ -79,7 +80,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])]; - MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.delegate = self; cell.monentsInfo = monentsInfo; return cell; @@ -92,7 +93,7 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init]; - MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; detailVC.monentsInfo = monentsInfo; detailVC.delegate = self; [self.navigationController pushViewController:detailVC animated:YES]; diff --git a/xplan-ios/Main/Monents/View/XPMonentsPublishViewController.m b/xplan-ios/Main/Monents/View/XPMonentsPublishViewController.m index bd423789..c90fbd42 100644 --- a/xplan-ios/Main/Monents/View/XPMonentsPublishViewController.m +++ b/xplan-ios/Main/Monents/View/XPMonentsPublishViewController.m @@ -17,6 +17,7 @@ #import "Api+Mine.h" #import "UploadImage.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "MonentsTopicModel.h" #import "MonentsPicResInfo.h" @@ -25,6 +26,7 @@ #import "XPMonentsPublishTopicView.h" #import "XPMoentsTopicListView.h" #import "XPMonentPublishSuccessView.h" + ///P #import "XPMonentsPublishPresenter.h" #import "XPMonentsPublishProtocol.h" @@ -233,7 +235,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPMonentsPublishCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMonentsPublishCollectionViewCell class]) forIndexPath:indexPath]; - UIImage * image = [self.datasource objectAtIndex:indexPath.row]; + UIImage * image = [self.datasource safeObjectAtIndex1:indexPath.row]; if (indexPath.row == (self.datasource.count -1)) { cell.isShowDelete = self.datasource.count == 9; } else { diff --git a/xplan-ios/Main/Monents/View/XPMonentsRecommendViewController.m b/xplan-ios/Main/Monents/View/XPMonentsRecommendViewController.m index 3f5a25cb..be5ab76c 100644 --- a/xplan-ios/Main/Monents/View/XPMonentsRecommendViewController.m +++ b/xplan-ios/Main/Monents/View/XPMonentsRecommendViewController.m @@ -14,6 +14,7 @@ #import "XPMacro.h" #import "XPMonentsLayoutConfig.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "MonentsInfoModel.h" #import "MonentsTopicModel.h" @@ -111,7 +112,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { - MonentsInfoModel * monentInfo= [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row]; [XPMonentsLayoutConfig layoutMonentsModel:monentInfo]; return monentInfo.rowHeight; } @@ -121,7 +122,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])]; - MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.monentsInfo = monentsInfo; cell.delegate = self; return cell; @@ -134,7 +135,7 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init]; - MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; detailVC.monentsInfo = monentsInfo; detailVC.delegate = self; [self.navigationController pushViewController:detailVC animated:YES]; diff --git a/xplan-ios/Main/Monents/View/XPMonentsTopicLatestViewController.m b/xplan-ios/Main/Monents/View/XPMonentsTopicLatestViewController.m index f6695f95..c61d4ab1 100644 --- a/xplan-ios/Main/Monents/View/XPMonentsTopicLatestViewController.m +++ b/xplan-ios/Main/Monents/View/XPMonentsTopicLatestViewController.m @@ -14,6 +14,7 @@ #import "XPMacro.h" #import "XPMonentsLayoutConfig.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "MonentsListInfoModel.h" ///P @@ -101,7 +102,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { - MonentsInfoModel * monentInfo= [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row]; [XPMonentsLayoutConfig layoutMonentsModel:monentInfo]; return monentInfo.rowHeight; } @@ -111,7 +112,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])]; - MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.delegate = self; cell.monentsInfo = monentsInfo; return cell; @@ -124,7 +125,7 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init]; - MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; detailVC.monentsInfo = monentsInfo; detailVC.delegate = self; [self.navigationController pushViewController:detailVC animated:YES]; diff --git a/xplan-ios/Main/Monents/View/XPMonentsTopicRecommondViewController.m b/xplan-ios/Main/Monents/View/XPMonentsTopicRecommondViewController.m index 9b791033..d2da9353 100644 --- a/xplan-ios/Main/Monents/View/XPMonentsTopicRecommondViewController.m +++ b/xplan-ios/Main/Monents/View/XPMonentsTopicRecommondViewController.m @@ -14,6 +14,7 @@ #import "XPMacro.h" #import "XPMonentsLayoutConfig.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "MonentsListInfoModel.h" ///P @@ -101,7 +102,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { - MonentsInfoModel * monentInfo= [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row]; [XPMonentsLayoutConfig layoutMonentsModel:monentInfo]; return monentInfo.rowHeight; } @@ -111,7 +112,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])]; - MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.delegate = self; cell.monentsInfo = monentsInfo; return cell; @@ -124,7 +125,7 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init]; - MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row]; + MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; detailVC.monentsInfo = monentsInfo; detailVC.delegate = self; [self.navigationController pushViewController:detailVC animated:YES]; diff --git a/xplan-ios/Main/RTC/RtcImpl/ZegoRtcImpl.m b/xplan-ios/Main/RTC/RtcImpl/ZegoRtcImpl.m index f31cc90e..361d85d6 100644 --- a/xplan-ios/Main/RTC/RtcImpl/ZegoRtcImpl.m +++ b/xplan-ios/Main/RTC/RtcImpl/ZegoRtcImpl.m @@ -7,6 +7,7 @@ #import "ZegoRtcImpl.h" #import +#import "NSArray+Safe.h" @interface ZegoRtcImpl() @@ -210,7 +211,7 @@ NSString *uid = nil; NSArray *strArray = [userInfo.streamID componentsSeparatedByString:@"-"]; if (strArray.count >= 2) { - uid = [strArray objectAtIndex:1]; + uid = [strArray safeObjectAtIndex1:1]; if (userInfo.soundLevel > 0) { [uids addObject:uid]; } diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKResultView.m b/xplan-ios/Main/Room/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKResultView.m index 2019c9d2..62a024b2 100644 --- a/xplan-ios/Main/Room/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKResultView.m +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKResultView.m @@ -12,6 +12,7 @@ #import "ThemeColor.h" #import "NetImageView.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "AcrossRoomPKPanelModel.h" @@ -277,14 +278,14 @@ self.redValueLabel.text = [NSString stringWithFormat:@"%lld", data.cAmount]; self.blueValueLabel.text = [NSString stringWithFormat:@"%lld", data.aAmount]; if (data.csRank.count > 0) {//有贡献 - AcrossRoomPkRankModel *contributeInfo = [data.csRank objectAtIndex:0]; + AcrossRoomPkRankModel *contributeInfo = [data.csRank safeObjectAtIndex1:0]; self.contributeNick.text = contributeInfo.nick ? contributeInfo.nick : @""; self.contributeValue.text = [NSString stringWithFormat:@"神豪值:%@", contributeInfo.amount? contributeInfo.amount : @""]; self.contributeAvatar.imageUrl = contributeInfo.avatar; } if (data.crRank.count > 0) { - AcrossRoomPkRankModel *charmInfo = [data.crRank objectAtIndex:0]; + AcrossRoomPkRankModel *charmInfo = [data.crRank safeObjectAtIndex1:0]; self.charmNick.text = charmInfo.nick ? charmInfo.nick : @""; self.charmValue.text = [NSString stringWithFormat:@"魅力值:%@", charmInfo.amount? charmInfo.amount : @""]; self.charmAvatar.imageUrl = charmInfo.avatar; diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/View/SubViews/XPAcrpssRoomPKPanelView.m b/xplan-ios/Main/Room/View/AcrossRoomPK/View/SubViews/XPAcrpssRoomPKPanelView.m index 640e7d3a..5cdbb98f 100644 --- a/xplan-ios/Main/Room/View/AcrossRoomPK/View/SubViews/XPAcrpssRoomPKPanelView.m +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/View/SubViews/XPAcrpssRoomPKPanelView.m @@ -16,6 +16,7 @@ #import "UIImage+Utils.h" #import "UIButton+EnlargeTouchArea.h" #import "Timestamp.h" +#import "NSArray+Safe.h" ///Model #import "UserInfoModel.h" #import "AcrossRoomPKPanelModel.h" @@ -565,7 +566,7 @@ self.blueAvatarImageView.imageUrl = _pkPanelInfo.aAvatar; self.buleCountLabel.text = [NSString stringWithFormat:@"%lld", _pkPanelInfo.aAmount]; for (int i = 0; i<_pkPanelInfo.csRank.count; i++) { - AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.csRank objectAtIndex:i]; + AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.csRank safeObjectAtIndex1:i]; if (i >= self.redContributeStackView.subviews.count) { break; } @@ -573,7 +574,7 @@ userView.panelInfo = rankModel; } for (int i = 0; i<_pkPanelInfo.crRank.count; i++) { - AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.crRank objectAtIndex:i]; + AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.crRank safeObjectAtIndex1:i]; if (i >= self.redCharmStackView.subviews.count) { break; } @@ -582,7 +583,7 @@ } for (int i = 0; i<_pkPanelInfo.asRank.count; i++) { - AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.asRank objectAtIndex:i]; + AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.asRank safeObjectAtIndex1:i]; if (i >= self.blueContributeStackView.subviews.count) { break; } @@ -591,7 +592,7 @@ } for (int i = 0; i<_pkPanelInfo.arRank.count; i++) { - AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.arRank objectAtIndex:i]; + AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.arRank safeObjectAtIndex1:i]; if (i >= self.blueCharmStackView.subviews.count) { break; } diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKSelectRoomView.m b/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKSelectRoomView.m index cbf2b287..26aa51ae 100644 --- a/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKSelectRoomView.m +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKSelectRoomView.m @@ -15,6 +15,7 @@ #import "UIImage+Utils.h" #import "Api+AcrossRoomPK.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "AcrossRoomPKInfoModel.h" ///View @@ -189,7 +190,7 @@ cell = [[XPAcrossRoomPKTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPAcrossRoomPKTableViewCell class])]; } cell.delegate = self; - AcrossRoomPKInfoModel * pkRoomInfo = [self.datasource objectAtIndex:indexPath.row]; + AcrossRoomPKInfoModel * pkRoomInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; if (pkRoomInfo.uid.integerValue == self.selectRoomInfo.uid.integerValue) { pkRoomInfo.hadSelected = YES; } else { diff --git a/xplan-ios/Main/Room/View/ActivityContainerView/XPRoomActivityContainerView.m b/xplan-ios/Main/Room/View/ActivityContainerView/XPRoomActivityContainerView.m index 1810d026..8a3a101b 100644 --- a/xplan-ios/Main/Room/View/ActivityContainerView/XPRoomActivityContainerView.m +++ b/xplan-ios/Main/Room/View/ActivityContainerView/XPRoomActivityContainerView.m @@ -18,6 +18,7 @@ #import "XCHUDTool.h" #import "XPMacro.h" #import "StatisticsServiceHelper.h" +#import "NSArray+Safe.h" ///Model #import "UserInfoModel.h" #import "RoomInfoModel.h" @@ -110,7 +111,7 @@ - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { for (NSInteger i = (self.subviews.count - 1) ; i >= 0 ; i--) { - UIView * subView = [self.subviews objectAtIndex:i]; + UIView * subView = [self.subviews safeObjectAtIndex1:i]; CGPoint convertPoint = [subView convertPoint:point fromView:self]; if (CGRectContainsPoint(subView.bounds, convertPoint)) { return [subView hitTest:convertPoint withEvent:event]; @@ -357,7 +358,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]; [StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_banner_click eventAttributes:@{@"bannerName": info.bannerName}]; if([info.bannerName isEqualToString:@"首充有礼"]) { [self firstRechargeTapRecognizer]; @@ -387,7 +388,7 @@ /** 图片滚动回调 */ - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index { if (self.activityList.count > index) { - ActivityInfoModel * info = [self.activityList objectAtIndex:index]; + ActivityInfoModel * info = [self.activityList safeObjectAtIndex1:index]; [StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_banner_show eventAttributes:@{@"bannerName": info.bannerName}]; } } diff --git a/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPKResultView.m b/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPKResultView.m index f1c6681b..12e6a9f9 100644 --- a/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPKResultView.m +++ b/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPKResultView.m @@ -13,6 +13,7 @@ #import "NetImageView.h" #import "TTPopup.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "AcrossRoomPKPanelModel.h" @@ -283,7 +284,7 @@ self.contributeTitleLabel.hidden = NO; self.noneContrbuteLabel.hidden = YES; for (int i = 0; i= self.redContributeStackView.subviews.count) { break; } @@ -468,7 +469,7 @@ } for (int i = 0; i<_pkPanelInfo.asRank.count; i++) { - AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.asRank objectAtIndex:i]; + AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.asRank safeObjectAtIndex1:i]; if (i >= self.blueContributeStackView.subviews.count) { break; } diff --git a/xplan-ios/Main/Room/View/AnchorPK/View/XPAnchorPKSelectRoomView.m b/xplan-ios/Main/Room/View/AnchorPK/View/XPAnchorPKSelectRoomView.m index 5d6e4553..6aa53ddb 100644 --- a/xplan-ios/Main/Room/View/AnchorPK/View/XPAnchorPKSelectRoomView.m +++ b/xplan-ios/Main/Room/View/AnchorPK/View/XPAnchorPKSelectRoomView.m @@ -15,6 +15,7 @@ #import "UIImage+Utils.h" #import "Api+AnchorPk.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "AcrossRoomPKInfoModel.h" ///View @@ -178,7 +179,7 @@ cell = [[XPAnchorPKTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPAnchorPKTableViewCell class])]; } cell.delegate = self; - AcrossRoomPKInfoModel * pkRoomInfo = [self.datasource objectAtIndex:indexPath.row]; + AcrossRoomPKInfoModel * pkRoomInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; if (pkRoomInfo.uid.integerValue == self.selectRoomInfo.uid.integerValue) { pkRoomInfo.hadSelected = YES; } else { diff --git a/xplan-ios/Main/Room/View/AnimationView/XPRoomAnimationHitView.m b/xplan-ios/Main/Room/View/AnimationView/XPRoomAnimationHitView.m index 31f40398..bf9207cb 100644 --- a/xplan-ios/Main/Room/View/AnimationView/XPRoomAnimationHitView.m +++ b/xplan-ios/Main/Room/View/AnimationView/XPRoomAnimationHitView.m @@ -6,13 +6,13 @@ // #import "XPRoomAnimationHitView.h" - +#import "NSArray+Safe.h" @implementation XPRoomAnimationHitView - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { for (NSInteger i = (self.subviews.count - 1) ; i >= 0 ; i--) { - UIView * subView = [self.subviews objectAtIndex:i]; + UIView * subView = [self.subviews safeObjectAtIndex1:i]; CGPoint convertPoint = [subView convertPoint:point fromView:self]; if (CGRectContainsPoint(subView.bounds, convertPoint)) { return [subView hitTest:convertPoint withEvent:event]; diff --git a/xplan-ios/Main/Room/View/AnimationView/XPRoomGraffitiGiftAnimationView.m b/xplan-ios/Main/Room/View/AnimationView/XPRoomGraffitiGiftAnimationView.m index a199d1b9..294ec714 100644 --- a/xplan-ios/Main/Room/View/AnimationView/XPRoomGraffitiGiftAnimationView.m +++ b/xplan-ios/Main/Room/View/AnimationView/XPRoomGraffitiGiftAnimationView.m @@ -8,7 +8,7 @@ #import "XPRoomGraffitiGiftAnimationView.h" #import "XPWeakTimer.h" #import "XPMacro.h" - +#import "NSArray+Safe.h" @interface XPRoomGraffitiGiftAnimationView () @property (nonatomic,strong) NSTimer *timer; @@ -65,7 +65,7 @@ }); return; } - NSValue * valeu= [self.datasource objectAtIndex:self.index]; + NSValue * valeu= [self.datasource safeObjectAtIndex1:self.index]; CGPoint point = valeu.CGPointValue; UIImageView * imageView = [[UIImageView alloc] init]; imageView.layer.masksToBounds = YES; diff --git a/xplan-ios/Main/Room/View/ArrangeMic/View/XPArrangeMicViewController.m b/xplan-ios/Main/Room/View/ArrangeMic/View/XPArrangeMicViewController.m index 0460d6dd..e5e8ea62 100644 --- a/xplan-ios/Main/Room/View/ArrangeMic/View/XPArrangeMicViewController.m +++ b/xplan-ios/Main/Room/View/ArrangeMic/View/XPArrangeMicViewController.m @@ -18,6 +18,7 @@ #import "XPHtmlUrl.h" #import "ApiHost.h" #import "UIImage+Utils.h" +#import "NSArray+Safe.h" ///Model #import "ArrangeMicModel.h" #import "AttachmentModel.h" @@ -611,7 +612,7 @@ if (cell == nil) { cell = [[XPArrangeMicTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPArrangeMicTableViewCell class])]; } - ArrangeMicUserModel * userInfo = [self.datasource objectAtIndex:indexPath.row]; + ArrangeMicUserModel * userInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; userInfo.arrangeMicType = self.userInfo.type; cell.isManager = self.userInfo.isManager; userInfo.number = indexPath.row + 1; diff --git a/xplan-ios/Main/Room/View/BackMusic/View/SubViews/XPRoomBackMusicPlayerView.m b/xplan-ios/Main/Room/View/BackMusic/View/SubViews/XPRoomBackMusicPlayerView.m index c8836bb3..cd6bf446 100644 --- a/xplan-ios/Main/Room/View/BackMusic/View/SubViews/XPRoomBackMusicPlayerView.m +++ b/xplan-ios/Main/Room/View/BackMusic/View/SubViews/XPRoomBackMusicPlayerView.m @@ -16,6 +16,7 @@ #import "RtcManager.h" #import "XPConstant.h" #import "XCHUDTool.h" +#import "NSArray+Safe.h" ///Model #import "Music+CoreDataClass.h" ///View @@ -135,11 +136,11 @@ UIKIT_EXTERN NSString * kRoomBackMusicPlayMusicOrderKey; if (!self.isPlaying && self.currentMusic) { self.isPlaying = [[RtcManager instance] changePlayState:BackMusicPlayState_Resume]; } else { - Music * music = [array objectAtIndex:index]; + Music * music = [array safeObjectAtIndex1:index]; [self playCurrentMusic:music index:index]; } } else { - Music * music = [array objectAtIndex:index]; + Music * music = [array safeObjectAtIndex1:index]; [self playCurrentMusic:music index:index]; } } @@ -213,7 +214,7 @@ UIKIT_EXTERN NSString * kRoomBackMusicPlayMusicOrderKey; { if (self.isPlaying == NO && self.currentMusic == nil) { NSArray * array = [[XPCoreDataManager shareInstance].managedObjectContext executeFetchRequest:self.request error:nil]; - Music * music = [array objectAtIndex:0]; + Music * music = [array safeObjectAtIndex1:0]; [self playCurrentMusic:music index:0]; } else { if (self.isPlaying) { @@ -228,7 +229,7 @@ UIKIT_EXTERN NSString * kRoomBackMusicPlayMusicOrderKey; { NSArray * array = [[XPCoreDataManager shareInstance].managedObjectContext executeFetchRequest:self.request error:nil]; if (self.isPlaying == NO && self.currentMusic == nil) { - Music * music = [array objectAtIndex:0]; + Music * music = [array safeObjectAtIndex1:0]; [self playCurrentMusic:music index:0]; } else { NSInteger index = self.currentIndex + 1; diff --git a/xplan-ios/Main/Room/View/BackMusic/View/XPRoomMusicLibraryViewController.m b/xplan-ios/Main/Room/View/BackMusic/View/XPRoomMusicLibraryViewController.m index ea32f4dd..c7ef8dca 100644 --- a/xplan-ios/Main/Room/View/BackMusic/View/XPRoomMusicLibraryViewController.m +++ b/xplan-ios/Main/Room/View/BackMusic/View/XPRoomMusicLibraryViewController.m @@ -15,6 +15,7 @@ #import "XPMacro.h" #import "XPCoreDataManager.h" #import "ThemeColor.h" +#import "NSArray+Safe.h" ///Model #import "Music+CoreDataClass.h" ///View @@ -112,7 +113,7 @@ UIKIT_EXTERN NSString * kRoomBackMusicCaptureVolumeKey; - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { XPRoomMusicLibraryTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPRoomMusicLibraryTableViewCell class])]; - Music * musicInfo = [self.datasource objectAtIndex:indexPath.row]; + Music * musicInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; if (musicInfo.musicId == self.selectMusic.musicId) { cell.isSelect = YES; } else { @@ -133,7 +134,7 @@ UIKIT_EXTERN NSString * kRoomBackMusicCaptureVolumeKey; - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { - Music * musicInfo = [self.datasource objectAtIndex:indexPath.row]; + Music * musicInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; self.selectMusic = musicInfo; self.playView.music = musicInfo; [self.tableView reloadData]; @@ -184,7 +185,7 @@ UIKIT_EXTERN NSString * kRoomBackMusicCaptureVolumeKey; - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { - Music * music = [self.datasource objectAtIndex:indexPath.row]; + Music * music = [self.datasource safeObjectAtIndex1:indexPath.row]; [self showLoading]; if ([music.musicId isEqualToString:self.currentMusic.musicId]) { self.playView.music = nil; diff --git a/xplan-ios/Main/Room/View/BackMusic/View/XPRoomTransferMusicViewController.m b/xplan-ios/Main/Room/View/BackMusic/View/XPRoomTransferMusicViewController.m index bb987700..9c001d4d 100644 --- a/xplan-ios/Main/Room/View/BackMusic/View/XPRoomTransferMusicViewController.m +++ b/xplan-ios/Main/Room/View/BackMusic/View/XPRoomTransferMusicViewController.m @@ -19,6 +19,7 @@ #import "SJXCSMIPHelper.h" #import "XPCoreDataManager.h" #import "GCDHelper.h" +#import "NSArray+Safe.h" ///Model #import "Music+CoreDataClass.h" @interface XPRoomTransferMusicViewController () @@ -200,21 +201,21 @@ NSArray *albumNames = [AVMetadataItem metadataItemsFromArray:mp3Asset.commonMetadata withKey:AVMetadataCommonKeyArtwork keySpace:AVMetadataKeySpaceCommon]; NSArray *titles = [AVMetadataItem metadataItemsFromArray:mp3Asset.commonMetadata withKey:AVMetadataCommonKeyTitle keySpace:AVMetadataKeySpaceCommon]; if (artists.count > 0) { - AVMetadataItem *artist = [artists objectAtIndex:0]; + AVMetadataItem *artist = [artists safeObjectAtIndex1:0]; singer = [artist.value copyWithZone:nil]; }else{ singer = @"未知歌手"; } if (albumNames.count > 0) { - AVMetadataItem *artist = [albumNames objectAtIndex:0]; + AVMetadataItem *artist = [albumNames safeObjectAtIndex1:0]; image = [UIImage imageWithData:[artist.value copyWithZone:nil]]; }else{ image = [UIImage imageNamed:@"common_avatar"]; } if (titles.count > 0) { - AVMetadataItem *artist = [titles objectAtIndex:0]; + AVMetadataItem *artist = [titles safeObjectAtIndex1:0]; songName = [artist.value copyWithZone:nil]; }else{ songName = @"未知"; diff --git a/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m b/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m index d778ca50..c24e87bb 100644 --- a/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m +++ b/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m @@ -32,6 +32,7 @@ #import "Api+WishGift.h" #import "StatisticsServiceHelper.h" #import "NSObject+MJExtension.h" +#import "NSArray+Safe.h" ///Model #import "RoomInfoModel.h" #import "MicroQueueModel.h" @@ -173,7 +174,7 @@ - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { for (NSInteger i = (self.subviews.count - 1) ; i >= 0 ; i--) { - UIView * subView = [self.subviews objectAtIndex:i]; + UIView * subView = [self.subviews safeObjectAtIndex1:i]; CGPoint convertPoint = [subView convertPoint:point fromView:self]; if (CGRectContainsPoint(subView.bounds, convertPoint)) { return [subView hitTest:convertPoint withEvent:event]; diff --git a/xplan-ios/Main/Room/View/CandyTree/View/XPCandyTreeMoreView.m b/xplan-ios/Main/Room/View/CandyTree/View/XPCandyTreeMoreView.m index 0bd6ec7b..ebc2286a 100644 --- a/xplan-ios/Main/Room/View/CandyTree/View/XPCandyTreeMoreView.m +++ b/xplan-ios/Main/Room/View/CandyTree/View/XPCandyTreeMoreView.m @@ -14,6 +14,7 @@ #import "XPHtmlUrl.h" #import "TTPopup.h" #import "XCHUDTool.h" +#import "NSArray+Safe.h" ///View #import "XPRoomHalfWebView.h" #import "XPCandyTreeMoreRuleCell.h" @@ -86,7 +87,7 @@ NSString * const kCandyTreeHideMessage = @"kCandyTreeHideMessage"; cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([UITableViewCell class])]; } cell.backgroundColor = [UIColor whiteColor]; - cell.textLabel.text = [self.datasource objectAtIndex:indexPath.row]; + cell.textLabel.text = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.textLabel.textColor = [ThemeColor alertTitleColor]; cell.textLabel.font = [UIFont systemFontOfSize:15]; return cell; diff --git a/xplan-ios/Main/Room/View/CandyTree/View/XPCandyTreeRankView.m b/xplan-ios/Main/Room/View/CandyTree/View/XPCandyTreeRankView.m index 80ae443c..04bdf1a4 100644 --- a/xplan-ios/Main/Room/View/CandyTree/View/XPCandyTreeRankView.m +++ b/xplan-ios/Main/Room/View/CandyTree/View/XPCandyTreeRankView.m @@ -13,6 +13,7 @@ #import "ThemeColor.h" #import "XCHudTool.h" #import "Api+CandyTree.h" +#import "NSArray+Safe.h" ///Model #import "CandyTreeRecordModel.h" ///View @@ -143,7 +144,7 @@ if (cell == nil) { cell = [[XPCandyTreeRankTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPCandyTreeRankTableViewCell class])]; } - cell.roomRankModel = [self.datasource objectAtIndex:indexPath.row]; + cell.roomRankModel = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } diff --git a/xplan-ios/Main/Room/View/CandyTree/View/XPCandyTreeViewController.m b/xplan-ios/Main/Room/View/CandyTree/View/XPCandyTreeViewController.m index 0a68bbce..dec85663 100644 --- a/xplan-ios/Main/Room/View/CandyTree/View/XPCandyTreeViewController.m +++ b/xplan-ios/Main/Room/View/CandyTree/View/XPCandyTreeViewController.m @@ -14,6 +14,7 @@ #import "XPMacro.h" #import "ThemeColor.h" #import "TTPopup.h" +#import "NSArray+Safe.h" #import "XPHtmlUrl.h" ///Model #import "RoomInfoModel.h" @@ -152,7 +153,7 @@ [self.animationView.subviews.firstObject removeFromSuperview]; } for (int i=0; i < self.animationView.subviews.count; i++) { - XPCandyTreeGiftView * view = [self.animationView.subviews objectAtIndex:i]; + XPCandyTreeGiftView * view = [self.animationView.subviews safeObjectAtIndex1:i]; NSInteger offsetY= (self.animationView.subviews.count - i) * KitemHeight; [UIView animateWithDuration:0.1 animations:^{ CGRect rect = view.frame; diff --git a/xplan-ios/Main/Room/View/FirstRecharge/View/XPFirstRechargeSuccessView.m b/xplan-ios/Main/Room/View/FirstRecharge/View/XPFirstRechargeSuccessView.m index d7603b68..c83ff04f 100644 --- a/xplan-ios/Main/Room/View/FirstRecharge/View/XPFirstRechargeSuccessView.m +++ b/xplan-ios/Main/Room/View/FirstRecharge/View/XPFirstRechargeSuccessView.m @@ -13,6 +13,7 @@ #import "ThemeColor+FirstRecharge.h" #import "XPFirstRechargeFlowLayout.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "FirstRechargeModel.h" ///View @@ -107,7 +108,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPFirstRechargeCollectionViewCell * cell= [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPFirstRechargeCollectionViewCell class]) forIndexPath:indexPath]; - cell.rewardInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.rewardInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } diff --git a/xplan-ios/Main/Room/View/FirstRecharge/View/XPFirstRechargeViewController.m b/xplan-ios/Main/Room/View/FirstRecharge/View/XPFirstRechargeViewController.m index 7b327311..7b5ac20c 100644 --- a/xplan-ios/Main/Room/View/FirstRecharge/View/XPFirstRechargeViewController.m +++ b/xplan-ios/Main/Room/View/FirstRecharge/View/XPFirstRechargeViewController.m @@ -13,6 +13,7 @@ #import "ThemeColor+FirstRecharge.h" #import "UIImage+Utils.h" #import "XPFirstRechargeFlowLayout.h" +#import "NSArray+Safe.h" ///Model #import "FirstRechargeModel.h" ///View @@ -179,7 +180,7 @@ }]; } for (int i = 0 ; i < array.count; i++) { - FirstRechargeModel * modelInfo = [array objectAtIndex:i]; + FirstRechargeModel * modelInfo = [array safeObjectAtIndex1:i]; NSString * title = [NSString stringWithFormat:@"%ld元", modelInfo.chargeMoney]; UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setTitleColor:[ThemeColor rewardSegmentTextColor] forState:UIControlStateSelected]; @@ -208,7 +209,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPFirstRechargeCollectionViewCell * cell= [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPFirstRechargeCollectionViewCell class]) forIndexPath:indexPath]; - cell.rewardInfo = [self.rewardArray objectAtIndex:indexPath.row]; + cell.rewardInfo = [self.rewardArray safeObjectAtIndex1:indexPath.row]; return cell; } @@ -230,7 +231,7 @@ - (void)buttonAction:(UIButton *)sender { if (sender.tag <= self.originArray.count) { - FirstRechargeModel * model = [self.originArray objectAtIndex:sender.tag]; + FirstRechargeModel * model = [self.originArray safeObjectAtIndex1:sender.tag]; [self createExtraRewardAttrebute:model]; self.rewardArray = model.firstChargeRewardList; [self.collectionView reloadData]; diff --git a/xplan-ios/Main/Room/View/LittleGame/Presenter/Category/NSString+RW.m b/xplan-ios/Main/Room/View/LittleGame/Presenter/Category/NSString+RW.m index 960c4779..583fcc93 100644 --- a/xplan-ios/Main/Room/View/LittleGame/Presenter/Category/NSString+RW.m +++ b/xplan-ios/Main/Room/View/LittleGame/Presenter/Category/NSString+RW.m @@ -5,7 +5,7 @@ #import "NSString+RW.h" #import "NSData+RW.h" - +#import "NSArray+Safe.h" @implementation NSString (RW) @@ -244,7 +244,7 @@ [reString appendString:@"{"]; NSMutableArray *keyValues = [NSMutableArray array]; for(int i=0; i<[keys count]; i++) { - NSString *name = [keys objectAtIndex:i]; + NSString *name = [keys safeObjectAtIndex1:i]; id valueObj = [dictionary objectForKey:name]; NSString *value = [NSString jsonStringWithObject:valueObj]; if(value) { diff --git a/xplan-ios/Main/Room/View/LittleGame/View/XPLittleGameMiniStageView.m b/xplan-ios/Main/Room/View/LittleGame/View/XPLittleGameMiniStageView.m index 9a7e3402..1671a4ec 100644 --- a/xplan-ios/Main/Room/View/LittleGame/View/XPLittleGameMiniStageView.m +++ b/xplan-ios/Main/Room/View/LittleGame/View/XPLittleGameMiniStageView.m @@ -11,6 +11,7 @@ ///Tool #import "ThemeColor.h" #import "NetImageView.h" +#import "NSArray+Safe.h" ///Model #import "UserInfoModel.h" #import "MicroQueueModel.h" @@ -82,7 +83,7 @@ UIKIT_EXTERN NSString * const kRoomRoomLittleGameMiniStageNotificationKey; - (void)needRefreshPosition:(NSMutableDictionary *)micQueue { for (int i = 0; i 0) { diff --git a/xplan-ios/Main/Room/View/LittleGame/View/XPLittleGameRoomListView.m b/xplan-ios/Main/Room/View/LittleGame/View/XPLittleGameRoomListView.m index 4c75accf..cd006418 100644 --- a/xplan-ios/Main/Room/View/LittleGame/View/XPLittleGameRoomListView.m +++ b/xplan-ios/Main/Room/View/LittleGame/View/XPLittleGameRoomListView.m @@ -11,6 +11,7 @@ ///Tool #import "ThemeColor.h" #import "Api+LittleGame.h" +#import "NSArray+Safe.h" ///Model #import "LittleGameInfoModel.h" #import "XPLittleGameTableViewCell.h" @@ -76,7 +77,7 @@ - (NSArray *)handleGameListData:(NSArray *)array { NSMutableArray * dataArray= [NSMutableArray array]; for (int i = 0; i 0) { self.tableView.hidden = YES; self.gamePlayButton.selected = NO; - LittleGameInfoModel *info = [self.datasource objectAtIndex:indexPath.row]; + LittleGameInfoModel *info = [self.datasource safeObjectAtIndex1:indexPath.row]; if (info.mgId.integerValue != self.mgId.integerValue) { if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomLittleGameListView:didSelectItem:)]) { [self.delegate xPRoomLittleGameListView:self didSelectItem:info]; diff --git a/xplan-ios/Main/Room/View/LittleGame/View/XPLittleGameRoomOpenView.m b/xplan-ios/Main/Room/View/LittleGame/View/XPLittleGameRoomOpenView.m index 5f4ff756..464f06a9 100644 --- a/xplan-ios/Main/Room/View/LittleGame/View/XPLittleGameRoomOpenView.m +++ b/xplan-ios/Main/Room/View/LittleGame/View/XPLittleGameRoomOpenView.m @@ -19,6 +19,7 @@ #import "XPConstant.h" #import "Api+RoomSetting.h" #import "XCHudTool.h" +#import "NSArray+Safe.h" ///Model #import "LittleGameInfoModel.h" #import "RoomInfoModel.h" @@ -156,7 +157,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPCreateLittleGameCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPCreateLittleGameCollectionViewCell class]) forIndexPath:indexPath]; - LittleGameInfoModel * gameInfo = [self.datasource objectAtIndex:indexPath.row]; + LittleGameInfoModel * gameInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; if (gameInfo.mgId == self.selectGameInfo.mgId) { gameInfo.isSelect = YES; } else { @@ -168,7 +169,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; - LittleGameInfoModel * gameInfo = [self.datasource objectAtIndex:indexPath.row]; + LittleGameInfoModel * gameInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; self.selectGameInfo = gameInfo; [self.collectionView reloadData]; self.createRoomButton.enabled = YES; diff --git a/xplan-ios/Main/Room/View/MessageContainerView/Tool/XPRoomMessageParser.m b/xplan-ios/Main/Room/View/MessageContainerView/Tool/XPRoomMessageParser.m index d9ca92bc..4b9adea4 100644 --- a/xplan-ios/Main/Room/View/MessageContainerView/Tool/XPRoomMessageParser.m +++ b/xplan-ios/Main/Room/View/MessageContainerView/Tool/XPRoomMessageParser.m @@ -18,6 +18,7 @@ #import "XPRoomFaceTool.h" #import "TTPopup.h" #import "Api+WishGift.h" +#import "NSArray+Safe.h" ///Model #import "XPMessageRemoteExtModel.h" #import "AttachmentModel.h" @@ -405,7 +406,7 @@ RoomPKTeamModel * blueTeam; RoomPKTeamModel * redTeam; for (int i = 0 ; i < model.teams.count; i++) { - RoomPKTeamModel * team = [model.teams objectAtIndex:i]; + RoomPKTeamModel * team = [model.teams safeObjectAtIndex1:i]; if (team.team == GroupType_Red) { redTeam = team; }else{ @@ -439,7 +440,7 @@ RoomPKTeamModel * victoryTeam; RoomPKTeamModel * failTeam; for (int i = 0 ; i < model.teams.count; i++) { - RoomPKTeamModel * team = [model.teams objectAtIndex:i]; + RoomPKTeamModel * team = [model.teams safeObjectAtIndex1:i]; if (team.team == (GroupType)model.result) { victoryTeam = team; }else{ @@ -513,7 +514,7 @@ if ([attachment.data[@"data"] isKindOfClass:[NSArray class]]) { NSArray * array = [RoomFaceSendInfoModel modelsWithArray:attachment.data[@"data"]]; for (int i = 0; i< array.count; i++) { - RoomFaceSendInfoModel * sendFaceInfo = [array objectAtIndex:i]; + RoomFaceSendInfoModel * sendFaceInfo = [array safeObjectAtIndex1:i]; [attribute appendAttributedString:[self createTextAttribute:sendFaceInfo.nick color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createTextAttribute:@":" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createTextAttribute:@"\n" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]]; @@ -825,7 +826,7 @@ [attribute appendAttributedString:[self createTextAttribute:@" 打赏 " color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createSapceAttribute:2]]; for (int i = 0; i < info.targetUsers.count; i++) { - GiftReceiveUserInfoModel *targetInfo = [info.targetUsers objectAtIndex:i]; + GiftReceiveUserInfoModel *targetInfo = [info.targetUsers safeObjectAtIndex1:i]; //nick [attribute appendAttributedString:[self createNickAtrribute:targetInfo.nick uid:targetInfo.uid]]; [attribute appendAttributedString:[self createSapceAttribute:2]]; diff --git a/xplan-ios/Main/Room/View/MessageContainerView/View/XPNetImageYYLabel.m b/xplan-ios/Main/Room/View/MessageContainerView/View/XPNetImageYYLabel.m index dc972b83..ac881578 100644 --- a/xplan-ios/Main/Room/View/MessageContainerView/View/XPNetImageYYLabel.m +++ b/xplan-ios/Main/Room/View/MessageContainerView/View/XPNetImageYYLabel.m @@ -8,6 +8,7 @@ #import "XPNetImageYYLabel.h" #import "NetImageView.h" #import "XPRoomMessageConstant.h" +#import "NSArray+Safe.h" @implementation XPNetImageYYLabel @@ -17,10 +18,10 @@ YYTextLayout * layout = [YYTextLayout layoutWithContainerSize:maxSize text:attributedText]; for (int i = 0; i< layout.attachments.count; i++) { - YYTextAttachment * attachment = [layout.attachments objectAtIndex:i]; + YYTextAttachment * attachment = [layout.attachments safeObjectAtIndex1:i]; if (!attachment || ![attachment.content isKindOfClass:[NetImageView class]]) continue; NetImageView* imageView = attachment.content; - NSValue * value = [layout.attachmentRanges objectAtIndex:i]; + NSValue * value = [layout.attachmentRanges safeObjectAtIndex1:i]; NSRange range = value.rangeValue; if (!imageView.imageUrl) continue; diff --git a/xplan-ios/Main/Room/View/MessageContainerView/XPRoomMessageContainerView.m b/xplan-ios/Main/Room/View/MessageContainerView/XPRoomMessageContainerView.m index c7995374..26061dd4 100644 --- a/xplan-ios/Main/Room/View/MessageContainerView/XPRoomMessageContainerView.m +++ b/xplan-ios/Main/Room/View/MessageContainerView/XPRoomMessageContainerView.m @@ -21,6 +21,7 @@ #import "ClientConfig.h" #import #import "ThemeColor+Room.h" +#import "NSArray+Safe.h" ///Model #import "RoomInfoModel.h" #import "AttachmentModel.h" @@ -347,7 +348,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; if ([attachment.data[@"data"] isKindOfClass:[NSArray class]]) { NSArray * array = [RoomFaceSendInfoModel modelsWithArray:attachment.data[@"data"]]; for (int i = 0; i< array.count; i++) { - RoomFaceSendInfoModel * sendInfo = [array objectAtIndex:i]; + RoomFaceSendInfoModel * sendInfo = [array safeObjectAtIndex1:i]; if (sendInfo.resultIndexes.count <=0) { return NO; } @@ -841,14 +842,14 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - XPMessageInfoModel* mesageInfo = [self.datasource objectAtIndex:indexPath.row]; + XPMessageInfoModel* mesageInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; return mesageInfo.rowHeight; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { XPRoomMessageTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPRoomMessageTableViewCell class])]; cell.delegate = self; - XPMessageInfoModel* attr = [self.datasource objectAtIndex:indexPath.row]; + XPMessageInfoModel* attr = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.messageInfo = attr; cell.roomType = self.hostDelegate.getRoomInfo.type; return cell; diff --git a/xplan-ios/Main/Room/View/MorePlay/View/XPRoomMorePlayViewController.m b/xplan-ios/Main/Room/View/MorePlay/View/XPRoomMorePlayViewController.m index 8d8c1def..80af402d 100644 --- a/xplan-ios/Main/Room/View/MorePlay/View/XPRoomMorePlayViewController.m +++ b/xplan-ios/Main/Room/View/MorePlay/View/XPRoomMorePlayViewController.m @@ -12,6 +12,7 @@ #import "XPMacro.h" #import "UIView+Corner.h" #import "StatisticsServiceHelper.h" +#import "NSArray+Safe.h" ///Model #import "XPRoomActivityPlayModel.h" #import "RoomInfoModel.h" @@ -92,14 +93,14 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPRoomMorePlayCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPRoomMorePlayCollectionViewCell class]) forIndexPath:indexPath]; - cell.playModel = [self.datasource objectAtIndex:indexPath.row]; + cell.playModel = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - XPRoomActivityPlayModel * info = [self.datasource objectAtIndex:indexPath.row]; + XPRoomActivityPlayModel * info = [self.datasource safeObjectAtIndex1:indexPath.row]; switch (info.playType) { case RoomActivityPlayTypeCandyTree: { diff --git a/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m b/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m index 9a0309d9..590a8613 100644 --- a/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m +++ b/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m @@ -22,6 +22,7 @@ #import "AttachmentModel.h" #import "GuildSuperAdminInfoModel.h" #import "AccountInfoStorage.h" +#import "NSArray+Safe.h" ///View #import "XPRoomMoreMenuCollectionViewCell.h" #import "XPRoomInviteFansView.h" @@ -220,13 +221,13 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPRoomMoreMenuCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPRoomMoreMenuCollectionViewCell class]) forIndexPath:indexPath]; - cell.itemModel = [self.datasource objectAtIndex:indexPath.row]; + cell.itemModel = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; - XPRoomMoreItemModel * item = [self.datasource objectAtIndex:indexPath.row]; + XPRoomMoreItemModel * item = [self.datasource safeObjectAtIndex1:indexPath.row]; NSString * roomUid = [NSString stringWithFormat:@"%ld",self.roomInfo.uid]; NSString * roomId = [NSString stringWithFormat:@"%ld", self.roomInfo.roomId]; switch (item.type) { diff --git a/xplan-ios/Main/Room/View/NewUserGreet/XPRoomNewUserGreetView.m b/xplan-ios/Main/Room/View/NewUserGreet/XPRoomNewUserGreetView.m index 0cdd88df..56ceb946 100644 --- a/xplan-ios/Main/Room/View/NewUserGreet/XPRoomNewUserGreetView.m +++ b/xplan-ios/Main/Room/View/NewUserGreet/XPRoomNewUserGreetView.m @@ -12,6 +12,7 @@ #import "ThemeColor.h" #import "NetImageView.h" #import "XPMacro.h" +#import "NSArray+Safe.h" @interface XPRoomNewUserGreetView () ///背景 @@ -113,7 +114,7 @@ } for (int i = 0; i < sayHelloUserAvatarList.count; i++) { - NSString * avatar = [sayHelloUserAvatarList objectAtIndex:i]; + NSString * avatar = [sayHelloUserAvatarList safeObjectAtIndex1:i]; NetImageView * avatarImageView = [[NetImageView alloc] init]; NetImageConfig * config = [[NetImageConfig alloc]init]; config.imageType = ImageTypeUserIcon; diff --git a/xplan-ios/Main/Room/View/ReleaseRadio/View/XPReleaseRadioViewController.m b/xplan-ios/Main/Room/View/ReleaseRadio/View/XPReleaseRadioViewController.m index 3b976188..c4c15171 100644 --- a/xplan-ios/Main/Room/View/ReleaseRadio/View/XPReleaseRadioViewController.m +++ b/xplan-ios/Main/Room/View/ReleaseRadio/View/XPReleaseRadioViewController.m @@ -14,6 +14,7 @@ ///Third #import #import "UIImage+Utils.h" +#import "NSArray+Safe.h" ///view #import "XPReleaseRadioTableViewCell.h" ///P @@ -114,7 +115,7 @@ static NSString *const KXPReleaseRadioTableViewCellIdentifier = @"KXPReleaseRadi - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { XPReleaseRadioTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:KXPReleaseRadioTableViewCellIdentifier]; - cell.title = [self.model.recommends objectAtIndex:indexPath.row]; + cell.title = [self.model.recommends safeObjectAtIndex1:indexPath.row]; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.delegate = self; return cell; @@ -131,7 +132,7 @@ static NSString *const KXPReleaseRadioTableViewCellIdentifier = @"KXPReleaseRadi #pragma mark - XPReleaseRadioTableViewCellDelegate - (void)xPReleaseRadioTableViewCellDidSelectCell:(XPReleaseRadioTableViewCell *)cell { NSIndexPath *indexPath = [self.tableView indexPathForCell:cell]; - self.radioTextView.text = [self.model.recommends objectAtIndex:indexPath.row]; + self.radioTextView.text = [self.model.recommends safeObjectAtIndex1:indexPath.row]; [self.radioTextView endEditing:YES]; } diff --git a/xplan-ios/Main/Room/View/RoomPK/View/SubViews/XPRoomPKPanelUserView.m b/xplan-ios/Main/Room/View/RoomPK/View/SubViews/XPRoomPKPanelUserView.m index 6a956d1e..9cde5b2a 100644 --- a/xplan-ios/Main/Room/View/RoomPK/View/SubViews/XPRoomPKPanelUserView.m +++ b/xplan-ios/Main/Room/View/RoomPK/View/SubViews/XPRoomPKPanelUserView.m @@ -11,6 +11,7 @@ ///Tool #import "NetImageView.h" #import "ThemeColor.h" +#import "NSArray+Safe.h" ///Model #import "RoomPKChooseUserModel.h" @@ -108,9 +109,9 @@ self.userView.hidden = NO; self.addButton.hidden = YES; for (int i = 0 ; i< self.viewArray.count; i++) { - NetImageView * view = [self.viewArray objectAtIndex:i]; + NetImageView * view = [self.viewArray safeObjectAtIndex1:i]; if (i < self.userArray.count) { - RoomPKChooseUserModel * userInfo = [self.userArray objectAtIndex:i]; + RoomPKChooseUserModel * userInfo = [self.userArray safeObjectAtIndex1:i]; view.hidden = NO; view.imageUrl = userInfo.avatar; } else { diff --git a/xplan-ios/Main/Room/View/RoomPK/View/SubViews/XPRoomPKRecordNickView.m b/xplan-ios/Main/Room/View/RoomPK/View/SubViews/XPRoomPKRecordNickView.m index b5248ab1..d24d3fc4 100644 --- a/xplan-ios/Main/Room/View/RoomPK/View/SubViews/XPRoomPKRecordNickView.m +++ b/xplan-ios/Main/Room/View/RoomPK/View/SubViews/XPRoomPKRecordNickView.m @@ -10,6 +10,7 @@ #import ///Model #import "RoomPKTeamModel.h" +#import "NSArray+Safe.h" @interface XPRoomPKRecordNickView () ///容器 @@ -134,8 +135,8 @@ self.lineImageView.hidden = NO; } for (int i = 0; i < _userList.count; i++) { - RoomPKTeamUserModel * userInfo = [_userList objectAtIndex:i]; - UILabel * label = [self.viewArray objectAtIndex:i]; + RoomPKTeamUserModel * userInfo = [_userList safeObjectAtIndex1:i]; + UILabel * label = [self.viewArray safeObjectAtIndex1:i]; label.text = userInfo.nick; } } diff --git a/xplan-ios/Main/Room/View/RoomPK/View/SubViews/XPRoomPKSelectUserView.m b/xplan-ios/Main/Room/View/RoomPK/View/SubViews/XPRoomPKSelectUserView.m index 77deb4d5..89b12d7b 100644 --- a/xplan-ios/Main/Room/View/RoomPK/View/SubViews/XPRoomPKSelectUserView.m +++ b/xplan-ios/Main/Room/View/RoomPK/View/SubViews/XPRoomPKSelectUserView.m @@ -13,6 +13,7 @@ #import "NetImageView.h" #import "XPMacro.h" #import "UIImage+Utils.h" +#import "NSArray+Safe.h" ///Model #import "RoomPKChooseUserModel.h" #import "MicroQueueModel.h" @@ -121,14 +122,14 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPRoomPKUserCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPRoomPKUserCollectionViewCell class]) forIndexPath:indexPath]; - RoomPKChooseUserModel * model = [self.userPositionArray objectAtIndex:indexPath.row]; + RoomPKChooseUserModel * model = [self.userPositionArray safeObjectAtIndex1:indexPath.row]; cell.userInfo = model; return cell; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; - RoomPKChooseUserModel * model = [self.userPositionArray objectAtIndex:indexPath.row]; + RoomPKChooseUserModel * model = [self.userPositionArray safeObjectAtIndex1:indexPath.row]; if (!model.isEnableChoose) {return;} if (model.uid.length > 0) { model.isSelect = !model.isSelect; @@ -210,12 +211,12 @@ - (void)setMicroQueueArray:(NSArray *)microQueueArray { _microQueueArray = microQueueArray; for (int i = 0; i< microQueueArray.count; i++) { - MicroQueueModel * microModel = [microQueueArray objectAtIndex:i]; + MicroQueueModel * microModel = [microQueueArray safeObjectAtIndex1:i]; if (microModel.userInfo && microModel.userInfo.uid > 0) { int position = microModel.microState.position; if (position < self.userPositionArray.count) { - RoomPKChooseUserModel * userInfoModel = [self.userPositionArray objectAtIndex:position]; + RoomPKChooseUserModel * userInfoModel = [self.userPositionArray safeObjectAtIndex1:position]; userInfoModel.title = microModel.userInfo.nick; userInfoModel.avatar = microModel.userInfo.avatar; userInfoModel.uid = [NSString stringWithFormat:@"%ld", microModel.userInfo.uid]; @@ -225,28 +226,28 @@ userInfoModel.isEnableChoose = YES; if (self.groupType == GroupType_Red) { for (int i = 0; i @@ -115,17 +116,17 @@ } - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { - RoomPKTimeItemModel * model = [[self.datasource objectAtIndex:component] objectAtIndex:row]; + RoomPKTimeItemModel * model = [[self.datasource safeObjectAtIndex1:component] safeObjectAtIndex1:row]; return model.title; } #pragma mark - UIPickerViewDelegate - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { if (component == 0) { - RoomPKTimeItemModel * model = [[self.datasource objectAtIndex:component] objectAtIndex:row]; + RoomPKTimeItemModel * model = [[self.datasource safeObjectAtIndex1:component] safeObjectAtIndex1:row]; self.selectMinModel = model; if ([model.title isEqualToString:@"0分钟"]) { self.selectSecondModel = self.thirdModel; - NSMutableArray * array = [self.datasource objectAtIndex:1]; + NSMutableArray * array = [self.datasource safeObjectAtIndex1:1]; if ([array containsObject:self.zeroModel]) { [array removeObject:self.zeroModel]; } @@ -135,7 +136,7 @@ } }else if ([model.title isEqualToString:@"30分钟"]) { self.selectSecondModel = self.zeroModel; - NSMutableArray * array = [self.datasource objectAtIndex:1]; + NSMutableArray * array = [self.datasource safeObjectAtIndex1:1]; if ([array containsObject:self.thirdModel]) { [array removeObject:self.thirdModel]; } @@ -145,7 +146,7 @@ } } else { self.selectSecondModel = self.zeroModel; - NSMutableArray * array = [self.datasource objectAtIndex:1]; + NSMutableArray * array = [self.datasource safeObjectAtIndex1:1]; if (![array containsObject:self.zeroModel]) { [array insertObject:self.zeroModel atIndex:0]; } @@ -156,7 +157,7 @@ } [pickerView reloadComponent:1]; } else { - RoomPKTimeItemModel * model = [[self.datasource objectAtIndex:component] objectAtIndex:row]; + RoomPKTimeItemModel * model = [[self.datasource safeObjectAtIndex1:component] safeObjectAtIndex1:row]; self.selectSecondModel = model; } } diff --git a/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKProgressView.m b/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKProgressView.m index 70f8eff0..b21995fa 100644 --- a/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKProgressView.m +++ b/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKProgressView.m @@ -20,6 +20,7 @@ #import "GiftReceiveInfoModel.h" #import "GiftInfoModel.h" #import "XCCurrentVCStackManager.h" +#import "NSArray+Safe.h" ///Model #import "RoomPKDetailInfoModel.h" #import "MicroQueueModel.h" @@ -244,11 +245,11 @@ NSMutableArray * blueArray = [NSMutableArray array]; if (self.roomPKInfo.pkStatus == RoomPKStatusType_Playing) { for (int i = 0; i < self.roomPKInfo.teams.count; i++) { - RoomPKTeamModel * teamInfo = [self.roomPKInfo.teams objectAtIndex:i]; + RoomPKTeamModel * teamInfo = [self.roomPKInfo.teams safeObjectAtIndex1:i]; if (teamInfo.team == GroupType_Red) { self.redTeamScore = teamInfo.score; for (int i = 0; i < teamInfo.teamMembers.count; i++) { - RoomPKTeamUserModel * teamUserModel = [teamInfo.teamMembers objectAtIndex:i]; + RoomPKTeamUserModel * teamUserModel = [teamInfo.teamMembers safeObjectAtIndex1:i]; RoomPKChooseUserModel * redInfo = [[RoomPKChooseUserModel alloc] init]; redInfo.avatar = teamUserModel.avatar; redInfo.uid = teamUserModel.uid; @@ -260,7 +261,7 @@ } else if(teamInfo.team == GroupType_Blue) { self.blueTeamScore = teamInfo.score; for (int i = 0; i < teamInfo.teamMembers.count; i++) { - RoomPKTeamUserModel * teamUserModel = [teamInfo.teamMembers objectAtIndex:i]; + RoomPKTeamUserModel * teamUserModel = [teamInfo.teamMembers safeObjectAtIndex1:i]; RoomPKChooseUserModel * blueInfo = [[RoomPKChooseUserModel alloc] init]; blueInfo.avatar = teamUserModel.avatar; blueInfo.uid = teamUserModel.uid; @@ -274,7 +275,7 @@ [self configRedTeamScore:self.redTeamScore blueTeamScore:self.blueTeamScore]; } else { for (int i = 0 ; i < queue.allValues.count; i++) { - MicroQueueModel * micModel = [queue.allValues objectAtIndex:i]; + MicroQueueModel * micModel = [queue.allValues safeObjectAtIndex1:i]; if (micModel.userInfo && micModel.userInfo.uid > 0) { UserInfoModel * userInfo = micModel.userInfo; if (userInfo.groupType == GroupType_Red) { @@ -431,7 +432,7 @@ - (BOOL)isOnMicro:(NSString *)uid { for (int i = 0; i < self.micQueue.allValues.count; i++) { - MicroQueueModel * micModel = [self.micQueue.allValues objectAtIndex:i]; + MicroQueueModel * micModel = [self.micQueue.allValues safeObjectAtIndex1:i]; if (micModel.userInfo && micModel.userInfo.uid > 0 && micModel.userInfo.uid == uid.integerValue) { return YES; } @@ -634,7 +635,7 @@ - (NSString *)roomPKTeamJsonString { NSMutableArray * teamArray = [NSMutableArray array]; for (int i = 0; i < self.redChooseArray.count; i++) { - RoomPKChooseUserModel * userInfo = [self.redChooseArray objectAtIndex:i]; + RoomPKChooseUserModel * userInfo = [self.redChooseArray safeObjectAtIndex1:i]; NSMutableDictionary * redDic = [NSMutableDictionary dictionary]; [redDic setObject:userInfo.uid forKey:@"uid"]; [redDic setObject:@(userInfo.groupType) forKey:@"type"]; @@ -642,7 +643,7 @@ } for (int i = 0; i < self.blueChooseArray.count; i++) { - RoomPKChooseUserModel * userInfo = [self.blueChooseArray objectAtIndex:i]; + RoomPKChooseUserModel * userInfo = [self.blueChooseArray safeObjectAtIndex1:i]; NSMutableDictionary * blueDic = [NSMutableDictionary dictionary]; [blueDic setObject:userInfo.uid forKey:@"uid"]; [blueDic setObject:@(userInfo.groupType) forKey:@"type"]; @@ -786,7 +787,7 @@ if (self.redChooseArray.count > 0 || self.blueChooseArray.count > 0) { NSMutableDictionary * dic = [NSMutableDictionary dictionary]; for (int i = 0 ; i< self.redChooseArray.count; i++) { - RoomPKChooseUserModel * model = [self.redChooseArray objectAtIndex:i]; + RoomPKChooseUserModel * model = [self.redChooseArray safeObjectAtIndex1:i]; if (model.uid.integerValue <= 0) { continue; } @@ -800,7 +801,7 @@ } for (int i = 0 ; i< self.blueChooseArray.count; i++) { - RoomPKChooseUserModel * model = [self.blueChooseArray objectAtIndex:i]; + RoomPKChooseUserModel * model = [self.blueChooseArray safeObjectAtIndex1:i]; if (model.uid.integerValue <= 0) { continue; } @@ -932,7 +933,7 @@ NSMutableArray * redArray = [NSMutableArray array]; NSMutableArray * blueArray = [NSMutableArray array]; for (int i = 0 ; i < _micQueue.allValues.count; i++) { - MicroQueueModel * micModel = [_micQueue.allValues objectAtIndex:i]; + MicroQueueModel * micModel = [_micQueue.allValues safeObjectAtIndex1:i]; if (micModel.userInfo && micModel.userInfo.uid > 0) { UserInfoModel * userInfo = micModel.userInfo; if (userInfo.groupType == GroupType_Red) { diff --git a/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKRecordViewController.m b/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKRecordViewController.m index 7a0cc996..180a0226 100644 --- a/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKRecordViewController.m +++ b/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKRecordViewController.m @@ -12,6 +12,7 @@ ///Tool #import "ThemeColor.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "RoomPKRecordModel.h" ///View @@ -105,7 +106,7 @@ if (cell == nil) { cell = [[XPRoomPKRecordTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPRoomPKRecordTableViewCell class])]; } - RoomPKRecordModel * recordModel = [self.datasource objectAtIndex:indexPath.row]; + RoomPKRecordModel * recordModel = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.pkDetailInfo = recordModel; return cell; } diff --git a/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKResultView.m b/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKResultView.m index 1efab1d5..5bcc3a1c 100644 --- a/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKResultView.m +++ b/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKResultView.m @@ -13,6 +13,7 @@ #import "NetImageView.h" #import "AccountInfoStorage.h" #import "ThemeColor.h" +#import "NSArray+Safe.h" ///Model #import "RoomPKInfoModel.h" ///View @@ -208,9 +209,9 @@ - (void)loadTeamMemberUserAvatar:(NSArray *)members mvpUserId:(NSInteger)mvpUserId{ self.mvpImageView.hidden = YES; for (int i = 0; i< self.userViewArray.count; i++) { - NetImageView * imageView = [self.userViewArray objectAtIndex:i]; + NetImageView * imageView = [self.userViewArray safeObjectAtIndex1:i]; if (i < members.count) { - RoomPKTeamUserModel * userInfo = [members objectAtIndex:i]; + RoomPKTeamUserModel * userInfo = [members safeObjectAtIndex1:i]; imageView.imageUrl = userInfo.avatar; imageView.hidden = NO; if (mvpUserId == userInfo.uid.integerValue) { diff --git a/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKViewController.m b/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKViewController.m index 2f29d9a3..a641b9ce 100644 --- a/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKViewController.m +++ b/xplan-ios/Main/Room/View/RoomPK/View/XPRoomPKViewController.m @@ -14,6 +14,7 @@ #import "ThemeColor.h" #import "UIImage+Utils.h" #import "NSObject+MJExtension.h" +#import "NSArray+Safe.h" ///Model #import "RoomPKTimeItemModel.h" #import "RoomInfoModel.h" @@ -87,8 +88,8 @@ self.duraTime = 30; self.voteType = RoomPKVoteModeType_GiftValue; NSArray * array = self.hostDelegate.getRoomPKGroupTeamList; - self.redUserArray = [array objectAtIndex:0]; - self.blueUserArray = [array objectAtIndex:1]; + self.redUserArray = [array safeObjectAtIndex1:0]; + self.blueUserArray = [array safeObjectAtIndex1:1]; for (RoomPKChooseUserModel * userInfo in self.redUserArray) { userInfo.groupType = GroupType_default; } @@ -258,23 +259,23 @@ if (self.redUserArray.count > 0) { for (int i = 0; i< self.redTeamViews.count; i++) { - XPRoomPKUserView * userView = [self.redTeamViews objectAtIndex:i]; + XPRoomPKUserView * userView = [self.redTeamViews safeObjectAtIndex1:i]; userView.userInfo = nil; } } if (self.blueUserArray.count > 0) { for (int i = 0; i< self.blueTeamViews.count; i++) { - XPRoomPKUserView * userView = [self.blueTeamViews objectAtIndex:i]; + XPRoomPKUserView * userView = [self.blueTeamViews safeObjectAtIndex1:i]; userView.userInfo = nil; } } for (int i = 0; i < self.redUserArray.count; i++) { - RoomPKChooseUserModel * userInfo = [self.redUserArray objectAtIndex:i]; + RoomPKChooseUserModel * userInfo = [self.redUserArray safeObjectAtIndex1:i]; if (i < self.redTeamViews.count) { - XPRoomPKUserView * userView = [self.redTeamViews objectAtIndex:i]; + XPRoomPKUserView * userView = [self.redTeamViews safeObjectAtIndex1:i]; if (userInfo.groupType == GroupType_Red) { userView.userInfo = userInfo; } else { @@ -284,9 +285,9 @@ } } for (int i = 0; i < self.blueUserArray.count; i++) { - RoomPKChooseUserModel * userInfo = [self.blueUserArray objectAtIndex:i]; + RoomPKChooseUserModel * userInfo = [self.blueUserArray safeObjectAtIndex1:i]; if (i < self.blueTeamViews.count) { - XPRoomPKUserView * userView = [self.blueTeamViews objectAtIndex:i]; + XPRoomPKUserView * userView = [self.blueTeamViews safeObjectAtIndex1:i]; if (userInfo.groupType == GroupType_Blue) { userView.userInfo = userInfo; } else { @@ -312,7 +313,7 @@ if (self.redUserArray.count > 0 || self.blueUserArray.count > 0) { NSMutableDictionary * dic = [NSMutableDictionary dictionary]; for (int i = 0 ; i< self.redUserArray.count; i++) { - RoomPKChooseUserModel * model = [self.redUserArray objectAtIndex:i]; + RoomPKChooseUserModel * model = [self.redUserArray safeObjectAtIndex1:i]; if (model.uid.integerValue <= 0) { continue; } @@ -326,7 +327,7 @@ } for (int i = 0 ; i< self.blueUserArray.count; i++) { - RoomPKChooseUserModel * model = [self.blueUserArray objectAtIndex:i]; + RoomPKChooseUserModel * model = [self.blueUserArray safeObjectAtIndex1:i]; if (model.uid.integerValue <= 0) { continue; } diff --git a/xplan-ios/Main/Room/View/Sailing/View/XPSailingPrizeView.m b/xplan-ios/Main/Room/View/Sailing/View/XPSailingPrizeView.m index d9cfa2c9..1a98685d 100644 --- a/xplan-ios/Main/Room/View/Sailing/View/XPSailingPrizeView.m +++ b/xplan-ios/Main/Room/View/Sailing/View/XPSailingPrizeView.m @@ -10,6 +10,7 @@ #import ///Tool #import "ThemeColor.h" +#import "NSArray+Safe.h" ///Model #import "RoomSailingPrizeListModel.h" ///View @@ -60,7 +61,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPSailingPrizeCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPSailingPrizeCollectionViewCell class]) forIndexPath:indexPath]; - cell.prizeModel = [self.prizeInfo.prizeItemList objectAtIndex:indexPath.row]; + cell.prizeModel = [self.prizeInfo.prizeItemList safeObjectAtIndex1:indexPath.row]; return cell; } #pragma mark - Getters And Setters diff --git a/xplan-ios/Main/Room/View/Sailing/View/XPSailingRankSubView.m b/xplan-ios/Main/Room/View/Sailing/View/XPSailingRankSubView.m index a09950db..e89a2d2d 100644 --- a/xplan-ios/Main/Room/View/Sailing/View/XPSailingRankSubView.m +++ b/xplan-ios/Main/Room/View/Sailing/View/XPSailingRankSubView.m @@ -13,6 +13,7 @@ #import "ThemeColor.h" #import "Api+Sailing.h" #import "XCHUDTool.h" +#import "NSArray+Safe.h" ///Model #import "RoomSailingRankModel.h" ///View @@ -127,7 +128,7 @@ if (cell == nil) { cell = [[XPSailingRankTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPSailingRankTableViewCell class])]; } - cell.rankInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.rankInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } XPSailingEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPSailingEmptyTableViewCell class])]; diff --git a/xplan-ios/Main/Room/View/Sailing/View/XPSailingViewController.m b/xplan-ios/Main/Room/View/Sailing/View/XPSailingViewController.m index 01e6c221..4c6e8b4a 100644 --- a/xplan-ios/Main/Room/View/Sailing/View/XPSailingViewController.m +++ b/xplan-ios/Main/Room/View/Sailing/View/XPSailingViewController.m @@ -16,6 +16,7 @@ #import "TTPopup.h" #import "XPHtmlUrl.h" #import "UIButton+EnlargeTouchArea.h" +#import "NSArray+Safe.h" ///Model #import "RoomSailingInfoModel.h" #import "RoomSailingPrizeListModel.h" @@ -329,7 +330,7 @@ NSString * const kSailingPrizeAlertKey = @"kSailingPrizeAlertKey"; [self.animationView.subviews.firstObject removeFromSuperview]; } for (int i=0; i < self.animationView.subviews.count; i++) { - XPSailingGiftView * view = [self.animationView.subviews objectAtIndex:i]; + XPSailingGiftView * view = [self.animationView.subviews safeObjectAtIndex1:i]; NSInteger offsetY= (self.animationView.subviews.count - i) * KitemHeight; [UIView animateWithDuration:0.1 animations:^{ CGRect rect = view.frame; @@ -478,7 +479,7 @@ NSString * const kSailingPrizeAlertKey = @"kSailingPrizeAlertKey"; } else { self.addButton.enabled = YES; } - NSString * count = [self.levelArray objectAtIndex:_exploreCount]; + NSString * count = [self.levelArray safeObjectAtIndex1:_exploreCount]; self.textField.text = count; self.consumLabel.text = [NSString stringWithFormat:@"消耗%@燃油连续探索", count]; } diff --git a/xplan-ios/Main/Room/View/SendRedPacket/XPReceiveRedPacketView.m b/xplan-ios/Main/Room/View/SendRedPacket/XPReceiveRedPacketView.m index d00013aa..bfa80ff9 100644 --- a/xplan-ios/Main/Room/View/SendRedPacket/XPReceiveRedPacketView.m +++ b/xplan-ios/Main/Room/View/SendRedPacket/XPReceiveRedPacketView.m @@ -23,6 +23,7 @@ #import "RoomInfoModel.h" #import "XPRedPacketModel.h" #import "XPConstant.h" +#import "NSArray+Safe.h" @interface XPReceiveRedPacketView() @@ -329,7 +330,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ XPOpenRedPacketCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPOpenRedPacketCell class]) forIndexPath:indexPath]; cell.selectionStyle = UITableViewCellSelectionStyleNone; - XPRedPacketPersonReceiveModel *model = [self.resultData.redEnvelopeItemVOs objectAtIndex:indexPath.row]; + XPRedPacketPersonReceiveModel *model = [self.resultData.redEnvelopeItemVOs safeObjectAtIndex1:indexPath.row]; cell.model = model; cell.backgroundColor = [UIColor clearColor]; return cell; diff --git a/xplan-ios/Main/Room/View/Setting/View/XPRoomInviteUserViewController.m b/xplan-ios/Main/Room/View/Setting/View/XPRoomInviteUserViewController.m index 78a951af..1becbcbc 100644 --- a/xplan-ios/Main/Room/View/Setting/View/XPRoomInviteUserViewController.m +++ b/xplan-ios/Main/Room/View/Setting/View/XPRoomInviteUserViewController.m @@ -16,6 +16,7 @@ #import "XPMacro.h" #import "AccountInfoStorage.h" #import "Api.h" +#import "NSArray+Safe.h" ///Model #import "UserInfoModel.h" #import "MicroQueueModel.h" @@ -98,7 +99,7 @@ NSArray * tmpList = x; [self.datasource addObjectsFromArray:tmpList]; for (NSInteger i = (self.datasource.count - 1); i >= 0; i--) { - NIMChatroomMember * member = [self.datasource objectAtIndex:i]; + NIMChatroomMember * member = [self.datasource safeObjectAtIndex1:i]; for (UserInfoModel * userInfo in queueArray) { if (member.userId.integerValue == userInfo.uid) { [self.datasource removeObject:member]; @@ -134,7 +135,7 @@ }]; for (NSInteger i = (self.datasource.count - 1); i >= 0; i--) { - NIMChatroomMember * member = [self.datasource objectAtIndex:i]; + NIMChatroomMember * member = [self.datasource safeObjectAtIndex1:i]; for (UserInfoModel * userInfo in self.micQueueArray) { if (member.userId.integerValue == userInfo.uid) { [self.datasource removeObject:member]; @@ -273,7 +274,7 @@ if (cell == nil) { cell = [[XPRoomOnlineTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPRoomOnlineTableViewCell class])]; } - NIMChatroomMember * member = [self.datasource objectAtIndex:indexPath.row]; + NIMChatroomMember * member = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.member = member; cell.onlineType = RoomOnLineType_Invite_User; return cell; @@ -298,7 +299,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - NIMChatroomMember * member = [self.datasource objectAtIndex:indexPath.row]; + NIMChatroomMember * member = [self.datasource safeObjectAtIndex1:indexPath.row]; if ([AccountInfoStorage instance].getUid.integerValue == member.userId.integerValue) { [Api getUserInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { if (code == 200) { diff --git a/xplan-ios/Main/Room/View/Setting/View/XPRoomOnLineViewController.m b/xplan-ios/Main/Room/View/Setting/View/XPRoomOnLineViewController.m index 8f9d93b3..4e78b2ab 100644 --- a/xplan-ios/Main/Room/View/Setting/View/XPRoomOnLineViewController.m +++ b/xplan-ios/Main/Room/View/Setting/View/XPRoomOnLineViewController.m @@ -15,6 +15,7 @@ #import "ThemeColor.h" #import "XPMacro.h" #import "UIButton+EnlargeTouchArea.h" +#import "NSArray+Safe.h" ///Model #import "UserInfoModel.h" #import "MicroQueueModel.h" @@ -327,7 +328,7 @@ if (cell == nil) { cell = [[XPRoomOnlineTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPRoomOnlineTableViewCell class])]; } - NIMChatroomMember * member = [self.datasource objectAtIndex:indexPath.row]; + NIMChatroomMember * member = [self.datasource safeObjectAtIndex1:indexPath.row]; cell.isOnMicro = [self memberIsOnMicro:member.userId]; cell.member = member; return cell; @@ -352,7 +353,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { - NIMChatroomMember * member = [self.datasource objectAtIndex:indexPath.row]; + NIMChatroomMember * member = [self.datasource safeObjectAtIndex1:indexPath.row]; NSDictionary * extDic = [member.roomExt toJSONObject]; XPMessageRemoteExtModel * userInfo = [XPMessageRemoteExtModel modelWithDictionary:[extDic objectForKey:member.userId]]; if (userInfo.enterHide) { diff --git a/xplan-ios/Main/Room/View/Setting/View/XPRoomRoleViewController.m b/xplan-ios/Main/Room/View/Setting/View/XPRoomRoleViewController.m index 270a30c6..e99891db 100644 --- a/xplan-ios/Main/Room/View/Setting/View/XPRoomRoleViewController.m +++ b/xplan-ios/Main/Room/View/Setting/View/XPRoomRoleViewController.m @@ -13,6 +13,7 @@ #import "XPRoomRoleTableViewCell.h" #import "XPRoomRoleEmptyTableViewCell.h" #import "GuildSuperAdminInfoModel.h" +#import "NSArray+Safe.h" @interface XPRoomRoleViewController () ///总的数据 @@ -77,7 +78,7 @@ - (BOOL)isRoomSuperAdmin:(NSString *)uid { BOOL isSuperAdmin = NO; for (int i = 0; i< self.superAdmminList.count; i++) { - GuildSuperAdminInfoModel * superAdminInfo = [self.superAdmminList objectAtIndex:i]; + GuildSuperAdminInfoModel * superAdminInfo = [self.superAdmminList safeObjectAtIndex1:i]; if ([superAdminInfo.uid isEqualToString:uid]) { isSuperAdmin = YES; break; @@ -98,7 +99,7 @@ cell = [[XPRoomRoleTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPRoomRoleTableViewCell class])]; } cell.delegate = self; - cell.member = [self.datasource objectAtIndex:indexPath.row]; + cell.member = [self.datasource safeObjectAtIndex1:indexPath.row]; if (indexPath.row == (self.datasource.count -1)) { cell.lineView.hidden = YES; } else { diff --git a/xplan-ios/Main/Room/View/Setting/View/XPRoomSettingViewController.m b/xplan-ios/Main/Room/View/Setting/View/XPRoomSettingViewController.m index 18210552..f175cdd5 100644 --- a/xplan-ios/Main/Room/View/Setting/View/XPRoomSettingViewController.m +++ b/xplan-ios/Main/Room/View/Setting/View/XPRoomSettingViewController.m @@ -15,6 +15,7 @@ #import "DESEncrypt.h" #import "XPConstant.h" #import "AccountInfoStorage.h" +#import "NSArray+Safe.h" ///Model #import "RoomInfoModel.h" #import "XPRoomSettingItemModel.h" @@ -175,12 +176,12 @@ cell = [[XPRoomSettingTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPRoomSettingTableViewCell class])]; } cell.delegate = self; - cell.itemModel = [[self.datasource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row]; + cell.itemModel = [[self.datasource safeObjectAtIndex1:indexPath.section] safeObjectAtIndex1:indexPath.row]; return cell; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { -XPRoomSettingItemModel * itemModel = [[self.datasource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row]; +XPRoomSettingItemModel * itemModel = [[self.datasource safeObjectAtIndex1:indexPath.section] safeObjectAtIndex1:indexPath.row]; if (itemModel.type == RoomSettingItemType_Leave_Model && itemModel.switchState) { return 60; } @@ -199,7 +200,7 @@ XPRoomSettingItemModel * itemModel = [[self.datasource objectAtIndex:indexPath.s - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; - XPRoomSettingItemModel * itemModel = [[self.datasource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row]; + XPRoomSettingItemModel * itemModel = [[self.datasource safeObjectAtIndex1:indexPath.section] safeObjectAtIndex1:indexPath.row]; NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid]; NSString * roomId = [NSString stringWithFormat:@"%ld", self.roomInfo.roomId]; NSString * roomTag = [NSString stringWithFormat:@"%ld", self.roomInfo.tagId]; diff --git a/xplan-ios/Main/Room/View/Setting/View/XPRoomTagListView.m b/xplan-ios/Main/Room/View/Setting/View/XPRoomTagListView.m index 7945534d..c3cf2f04 100644 --- a/xplan-ios/Main/Room/View/Setting/View/XPRoomTagListView.m +++ b/xplan-ios/Main/Room/View/Setting/View/XPRoomTagListView.m @@ -13,6 +13,7 @@ #import "XPMacro.h" #import "TTPopup.h" #import "UIImage+Utils.h" +#import "NSArray+Safe.h" ///Model #import "RoomTagModel.h" #import "RoomClassifyModel.h" @@ -124,7 +125,7 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPRoomSettingTagCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPRoomSettingTagCell class]) forIndexPath:indexPath]; if (self.tagType == RoomSettingSelectTagTypeTag) { - RoomTagModel *homeTag = [self.datasource objectAtIndex:indexPath.row]; + RoomTagModel *homeTag = [self.datasource safeObjectAtIndex1:indexPath.row]; if (self.selectTagInfo) { if (homeTag.tid.intValue == self.selectTagInfo.tid.intValue) { homeTag.isSelect = YES; @@ -140,7 +141,7 @@ } cell.roomTag = homeTag; } else { - RoomClassifyModel *homeTag = [self.datasource objectAtIndex:indexPath.row]; + RoomClassifyModel *homeTag = [self.datasource safeObjectAtIndex1:indexPath.row]; if (self.selectClassifyInfo) { if (homeTag.cid.intValue == self.selectClassifyInfo.cid.intValue) { homeTag.isSelect = YES; @@ -165,11 +166,11 @@ - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { if (self.tagType == RoomSettingSelectTagTypeTag) { - RoomTagModel *homeTag = [self.datasource objectAtIndex:indexPath.row]; + RoomTagModel *homeTag = [self.datasource safeObjectAtIndex1:indexPath.row]; CGFloat width = [homeTag.name boundingRectWithSize:CGSizeMake(200, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]} context:nil].size.width; return CGSizeMake(width + 26, 26); } else { - RoomClassifyModel *homeTag = [self.datasource objectAtIndex:indexPath.row]; + RoomClassifyModel *homeTag = [self.datasource safeObjectAtIndex1:indexPath.row]; CGFloat width = [homeTag.sortName boundingRectWithSize:CGSizeMake(200, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]} context:nil].size.width; return CGSizeMake(width + 26, 26); } @@ -179,10 +180,10 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.tagType == RoomSettingSelectTagTypeTag) { - RoomTagModel * roomTag = [self.datasource objectAtIndex:indexPath.row]; + RoomTagModel * roomTag = [self.datasource safeObjectAtIndex1:indexPath.row]; self.selectTagInfo = roomTag; } else { - RoomClassifyModel *roomClassify = [self.datasource objectAtIndex:indexPath.row]; + RoomClassifyModel *roomClassify = [self.datasource safeObjectAtIndex1:indexPath.row]; self.selectClassifyInfo = roomClassify; } [collectionView reloadData]; diff --git a/xplan-ios/Main/Room/View/Setting/View/XPRoomTagListViewController.m b/xplan-ios/Main/Room/View/Setting/View/XPRoomTagListViewController.m index 8838d950..4ce74884 100644 --- a/xplan-ios/Main/Room/View/Setting/View/XPRoomTagListViewController.m +++ b/xplan-ios/Main/Room/View/Setting/View/XPRoomTagListViewController.m @@ -11,6 +11,7 @@ ///Tool #import "ThemeColor.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "RoomTagModel.h" #import "RoomClassifyModel.h" @@ -115,7 +116,7 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPRoomSettingTagCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPRoomSettingTagCell class]) forIndexPath:indexPath]; if (self.tagType == RoomSettingTagTypeTag) { - RoomTagModel *homeTag = [self.datasource objectAtIndex:indexPath.row]; + RoomTagModel *homeTag = [self.datasource safeObjectAtIndex1:indexPath.row]; if (self.selectTagInfo) { if (homeTag.tid.intValue == self.selectTagInfo.tid.intValue) { homeTag.isSelect = YES; @@ -131,7 +132,7 @@ } cell.roomTag = homeTag; } else { - RoomClassifyModel *homeTag = [self.datasource objectAtIndex:indexPath.row]; + RoomClassifyModel *homeTag = [self.datasource safeObjectAtIndex1:indexPath.row]; if (self.selectClassifyInfo) { if (homeTag.cid.intValue == self.selectClassifyInfo.cid.intValue) { homeTag.isSelect = YES; @@ -156,11 +157,11 @@ - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { if (self.tagType == RoomSettingTagTypeTag) { - RoomTagModel *homeTag = [self.datasource objectAtIndex:indexPath.row]; + RoomTagModel *homeTag = [self.datasource safeObjectAtIndex1:indexPath.row]; CGFloat width = [homeTag.name boundingRectWithSize:CGSizeMake(200, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]} context:nil].size.width; return CGSizeMake(width + 26, 26); } else { - RoomClassifyModel *homeTag = [self.datasource objectAtIndex:indexPath.row]; + RoomClassifyModel *homeTag = [self.datasource safeObjectAtIndex1:indexPath.row]; CGFloat width = [homeTag.sortName boundingRectWithSize:CGSizeMake(200, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]} context:nil].size.width; return CGSizeMake(width + 26, 26); } @@ -170,10 +171,10 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [collectionView deselectItemAtIndexPath:indexPath animated:YES]; if (self.tagType == RoomSettingTagTypeTag) { - RoomTagModel * roomTag = [self.datasource objectAtIndex:indexPath.row]; + RoomTagModel * roomTag = [self.datasource safeObjectAtIndex1:indexPath.row]; self.selectTagInfo = roomTag; } else { - RoomClassifyModel *roomClassify = [self.datasource objectAtIndex:indexPath.row]; + RoomClassifyModel *roomClassify = [self.datasource safeObjectAtIndex1:indexPath.row]; self.selectClassifyInfo = roomClassify; } [collectionView reloadData]; diff --git a/xplan-ios/Main/Room/View/StageView/StageView.m b/xplan-ios/Main/Room/View/StageView/StageView.m index a3b82072..72df8ac5 100644 --- a/xplan-ios/Main/Room/View/StageView/StageView.m +++ b/xplan-ios/Main/Room/View/StageView/StageView.m @@ -20,6 +20,7 @@ #import "AccountInfoStorage.h" #import "XPRoomMiniManager.h" #import "StatisticsServiceHelper.h" +#import "NSArray+Safe.h" // Models #import "RoomInfoModel.h" #import "UserInfoModel.h" @@ -250,7 +251,7 @@ - (void)giftValueUpdate:(NSDictionary *)dic { GiftValueInfoModel * model = [GiftValueInfoModel modelWithDictionary:dic]; for (int i = 0; i < model.giftValueVos.count; i++) { - GiftValueDetailModel * giftValueModel = [model.giftValueVos objectAtIndex:i]; + GiftValueDetailModel * giftValueModel = [model.giftValueVos safeObjectAtIndex1:i]; UIView * view = [self findMicroViewByUid:giftValueModel.uid]; if (self.hostDelegate.getRoomInfo.leaveMode && giftValueModel.uid.integerValue == self.hostDelegate.getRoomInfo.uid) { view = [self findMicroViewByIndex:0]; @@ -489,7 +490,7 @@ if ([faceDic[@"data"] isKindOfClass:[NSArray class]]) { NSArray *arr = faceDic[@"data"]; for (int i = 0; i < arr.count; i++) { - NSDictionary *dict = [arr objectAtIndex:i]; + NSDictionary *dict = [arr safeObjectAtIndex1:i]; RoomFaceSendInfoModel * receiveInfo = [RoomFaceSendInfoModel modelWithDictionary:dict]; UIView * view = [self findMicroViewByUid:[NSString stringWithFormat:@"%ld",receiveInfo.uid]]; if (view == nil) continue; @@ -726,7 +727,7 @@ - (UIView *)findMicroViewByIndex:(NSInteger)index { if (self.microViews && self.microViews.count > index) { - return [self.microViews objectAtIndex:index]; + return [self.microViews safeObjectAtIndex1:index]; } return nil; } diff --git a/xplan-ios/Main/Room/View/UserCard/View/SubViews/XPUserCardSkillCardView.m b/xplan-ios/Main/Room/View/UserCard/View/SubViews/XPUserCardSkillCardView.m index f6ea3a1b..608125a1 100644 --- a/xplan-ios/Main/Room/View/UserCard/View/SubViews/XPUserCardSkillCardView.m +++ b/xplan-ios/Main/Room/View/UserCard/View/SubViews/XPUserCardSkillCardView.m @@ -12,6 +12,7 @@ ///Tool #import "XPMacro.h" #import "ThemeColor+UserCard.h" +#import "NSArray+Safe.h" @interface XPUserCardSkillCardView() @@ -46,7 +47,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPUserCardSkillCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPUserCardSkillCollectionViewCell class]) forIndexPath:indexPath]; - cell.imageView.imageUrl = [self.dataArray objectAtIndex:indexPath.item]; + cell.imageView.imageUrl = [self.dataArray safeObjectAtIndex1:indexPath.item]; return cell; } @@ -60,7 +61,7 @@ CGFloat scale = image.size.width / image.size.height; return CGSizeMake(20 * scale, height); } else { - NSURL *imgUrl = [NSURL URLWithString:[self.dataArray objectAtIndex:indexPath.item]]; + NSURL *imgUrl = [NSURL URLWithString:[self.dataArray safeObjectAtIndex1:indexPath.item]]; UIImage *myImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:imgUrl]]; CGFloat scale = myImage.size.width / myImage.size.height; if (scale == 0) { diff --git a/xplan-ios/Main/Room/View/UserCard/View/XPUserCardViewController.m b/xplan-ios/Main/Room/View/UserCard/View/XPUserCardViewController.m index 9c1eeb4f..ecd1eaa8 100644 --- a/xplan-ios/Main/Room/View/UserCard/View/XPUserCardViewController.m +++ b/xplan-ios/Main/Room/View/UserCard/View/XPUserCardViewController.m @@ -19,6 +19,7 @@ #import "UIImage+Utils.h" #import "XCCurrentVCStackManager.h" #import "StatisticsServiceHelper.h" +#import "NSArray+Safe.h" ///Model #import "UserInfoModel.h" #import "XPUserCardItemModel.h" @@ -733,7 +734,7 @@ } } if (self.datasource.count > 0) { - XPUserCardItemModel * model = [self.datasource objectAtIndex:indexPath.item]; + XPUserCardItemModel * model = [self.datasource safeObjectAtIndex1:indexPath.item]; NSString * roomId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId];; NSString * roomUid = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.uid];; switch (model.type) { @@ -948,7 +949,7 @@ #pragma mark - UICollectionViewDataSource - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPUserCardItemCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPUserCardItemCollectionViewCell class]) forIndexPath:indexPath]; - cell.itemModel = [self.datasource objectAtIndex:indexPath.item]; + cell.itemModel = [self.datasource safeObjectAtIndex1:indexPath.item]; return cell; } diff --git a/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftEnterView.m b/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftEnterView.m index 96068781..8723878c 100644 --- a/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftEnterView.m +++ b/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftEnterView.m @@ -15,6 +15,7 @@ #import "NetImageView.h" #import "UIImage+Utils.h" #import "UIView+Corner.h" +#import "NSArray+Safe.h" ///Model #import "WishGiftInfoModel.h" @@ -192,7 +193,7 @@ - (void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view { XPWishGiftEnterCell *myCell = (XPWishGiftEnterCell *)cell; - WishGiftInfoModel * info = [self.giftList objectAtIndex:index]; + WishGiftInfoModel * info = [self.giftList safeObjectAtIndex1:index]; myCell.giftInfo = info; } #pragma mark - Getters And Setters diff --git a/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftListView.m b/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftListView.m index 4950261f..a255cfc9 100644 --- a/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftListView.m +++ b/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftListView.m @@ -11,6 +11,7 @@ ///Tool #import "ThemeColor.h" #import "Api+LittleGame.h" +#import "NSArray+Safe.h" ///Model #import "WishGiftInfoModel.h" @@ -151,7 +152,7 @@ cell = [[XPWishGiftListTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPWishGiftListTableViewCell class])]; } if (self.datasource.count > 0 ) { - WishGiftInfoModel * giftInfo = [self.datasource objectAtIndex:indexPath.row]; + WishGiftInfoModel * giftInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; if (giftInfo.level > 0) { cell.titleLabel.text = giftInfo.levelName; } else { @@ -169,7 +170,7 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { if (self.delegate && [self.delegate respondsToSelector:@selector(xPWishGiftListView:didSelectItem:)]) { - WishGiftInfoModel * giftInfo = [self.datasource objectAtIndex:indexPath.row]; + WishGiftInfoModel * giftInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; [self configDefaultInfo:giftInfo]; [self.delegate xPWishGiftListView:self didSelectItem:giftInfo]; } diff --git a/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateItemViewController.m b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateItemViewController.m index abc25a8d..3c35b725 100644 --- a/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateItemViewController.m +++ b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateItemViewController.m @@ -11,6 +11,7 @@ ///Tool #import "ThemeColor.h" #import "UIImage+Utils.h" +#import "NSArray+Safe.h" ///View #import "XPWishGiftListView.h" #import "WishGiftInfoModel.h" @@ -198,7 +199,7 @@ - (void)handleLevleDatasource:(WishGiftLevel)levele { NSMutableArray * array = [self.levelLists mutableCopy]; for (int i = 0;i < self.levelLists.count;i++) { - WishGiftInfoModel * infor = [self.levelLists objectAtIndex:i]; + WishGiftInfoModel * infor = [self.levelLists safeObjectAtIndex1:i]; if (infor.level == levele) { [array removeObject:infor]; } @@ -209,7 +210,7 @@ - (void)handleGiftDatasource:(NSArray *)levels giftId:(NSInteger)giftId { NSMutableArray * array = [levels mutableCopy]; for (int i = 0;i < levels.count;i++) { - WishGiftInfoModel * infor = [levels objectAtIndex:i]; + WishGiftInfoModel * infor = [levels safeObjectAtIndex1:i]; if (infor.giftId == giftId) { [array removeObject:infor]; } diff --git a/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateViewController.m b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateViewController.m index e1eb7b07..52ee748d 100644 --- a/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateViewController.m +++ b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateViewController.m @@ -13,6 +13,7 @@ #import "UIImage+Utils.h" #import "TTPopup.h" #import "XPMacro.h" +#import "NSArray+Safe.h" ///Model #import "WishGiftInfoModel.h" #import "RoomInfoModel.h" @@ -137,7 +138,7 @@ if (cell == nil) { cell = [[XPWishGiftTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPWishGiftTableViewCell class])]; } - WishGiftInfoModel *giftInfo = [self.datasource objectAtIndex:indexPath.row]; + WishGiftInfoModel *giftInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; giftInfo.row = indexPath.row + 1; cell.giftInfo = giftInfo; cell.delegate = self; diff --git a/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftHistoryViewController.m b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftHistoryViewController.m index b7213d18..21278183 100644 --- a/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftHistoryViewController.m +++ b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftHistoryViewController.m @@ -12,6 +12,7 @@ #import "ThemeColor.h" #import "XPMacro.h" #import "PLTimeUtil.h" +#import "NSArray+Safe.h" ///Model #import "WishGiftHistoryModel.h" ///View @@ -72,7 +73,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (self.datasource.count > 0) { - WishGiftHistoryModel *info = [self.datasource objectAtIndex:section]; + WishGiftHistoryModel *info = [self.datasource safeObjectAtIndex1:section]; return info.gifts.count; } return 0; @@ -84,8 +85,8 @@ if (cell == nil) { cell = [[XPWishGiftHistoryTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPWishGiftHistoryTableViewCell class])]; } - WishGiftHistoryModel *historyInfo = [self.datasource objectAtIndex:indexPath.section]; - WishGiftInfoModel * info= [historyInfo.gifts objectAtIndex:indexPath.row]; + WishGiftHistoryModel *historyInfo = [self.datasource safeObjectAtIndex1:indexPath.section]; + WishGiftInfoModel * info= [historyInfo.gifts safeObjectAtIndex1:indexPath.row]; info.row = (indexPath.row + 1); cell.giftInfo = info; if (indexPath.row == 0) { @@ -125,7 +126,7 @@ if (self.datasource.count > 0) { XPWishGiftSectionView * view = [[XPWishGiftSectionView alloc] init]; view.frame = CGRectMake(0, 0, KScreenWidth, 45); - WishGiftHistoryModel *historyInfo = [self.datasource objectAtIndex:section]; + WishGiftHistoryModel *historyInfo = [self.datasource safeObjectAtIndex1:section]; view.title = historyInfo.createDate; return view; } diff --git a/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftViewController.m b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftViewController.m index 8e5e99da..8a435b73 100644 --- a/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftViewController.m +++ b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftViewController.m @@ -13,6 +13,7 @@ #import "NetImageView.h" #import "XPMacro.h" #import "StatisticsServiceHelper.h" +#import "NSArray+Safe.h" ///View #import "XPWishGiftInfoView.h" ///Model @@ -185,9 +186,9 @@ #pragma mark - XPWishGiftProtocol - (void)getWishGiftAssistUserListSuccess:(NSArray *)list { for (int i = 0; i < self.userStackView.arrangedSubviews.count; i++) { - NetImageView * imageView = [self.userStackView.subviews objectAtIndex:i]; + NetImageView * imageView = [self.userStackView.subviews safeObjectAtIndex1:i]; if (i < list.count) { - WishGiftUserModel * userInfo = [list objectAtIndex:i]; + WishGiftUserModel * userInfo = [list safeObjectAtIndex1:i]; imageView.hidden = NO; imageView.imageUrl = userInfo.avatar; }else { @@ -220,9 +221,9 @@ } for (int i = 0; i < self.giftViews.count; i++) { - XPWishGiftInfoView * view = [self.giftViews objectAtIndex:i]; + XPWishGiftInfoView * view = [self.giftViews safeObjectAtIndex1:i]; if(i < list.count) { - WishGiftInfoModel * info = [list objectAtIndex:i]; + WishGiftInfoModel * info = [list safeObjectAtIndex1:i]; view.giftInfo = info; view.hidden = NO; } else { diff --git a/xplan-ios/Main/Room/View/XPMiniRoomView.m b/xplan-ios/Main/Room/View/XPMiniRoomView.m index d68922ea..b6c54b76 100644 --- a/xplan-ios/Main/Room/View/XPMiniRoomView.m +++ b/xplan-ios/Main/Room/View/XPMiniRoomView.m @@ -22,6 +22,7 @@ #import "Api+ArrangeMic.h" #import "Api+Room.h" #import "XPCoreDataManager.h" +#import "NSArray+Safe.h" ///Model #import "RoomInfoModel.h" #import "MicroQueueModel.h" @@ -232,7 +233,7 @@ UIKIT_EXTERN NSString * kRoomBackMusicPlayMusicOrderKey; if ([attachment.data[@"data"] isKindOfClass:[NSArray class]]) { NSArray * array = [RoomFaceSendInfoModel modelsWithArray:attachment.data[@"data"]]; for (int i = 0; i< array.count; i++) { - RoomFaceSendInfoModel * sendInfo = [array objectAtIndex:i]; + RoomFaceSendInfoModel * sendInfo = [array safeObjectAtIndex1:i]; if (sendInfo.resultIndexes.count <=0) { return NO; } @@ -766,11 +767,11 @@ UIKIT_EXTERN NSString * kRoomBackMusicPlayMusicOrderKey; if (self.currentMusic) { [[RtcManager instance] changePlayState:BackMusicPlayState_Resume]; } else { - Music * music = [array objectAtIndex:index]; + Music * music = [array safeObjectAtIndex1:index]; [self playCurrentMusic:music index:index]; } } else { - Music * music = [array objectAtIndex:index]; + Music * music = [array safeObjectAtIndex1:index]; [self playCurrentMusic:music index:index]; } } diff --git a/xplan-ios/Main/Room/View/XPRoomViewController.m b/xplan-ios/Main/Room/View/XPRoomViewController.m index 0dbdfcf1..5b61d37a 100644 --- a/xplan-ios/Main/Room/View/XPRoomViewController.m +++ b/xplan-ios/Main/Room/View/XPRoomViewController.m @@ -20,6 +20,7 @@ #import "Api+Room.h" #import "DESEncrypt.h" #import "StatisticsServiceHelper.h" +#import "NSArray+Safe.h" ///Model #import "RoomInfoModel.h" #import "UserInfoModel.h" @@ -1597,7 +1598,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出 [self.view endEditing:YES]; [self showAnchorLoading]; if (self.anchorIndex < self.anchorRoomList.count) { - NSString * roomUid = [self.anchorRoomList objectAtIndex:self.anchorIndex]; + NSString * roomUid = [self.anchorRoomList safeObjectAtIndex1:self.anchorIndex]; [self.presenter getCurrentRoomInfo:roomUid]; self.anchorIndex --; }else { diff --git a/xplan-ios/Main/Tabbar/View/AnchorCard/XPAnchorCardView.m b/xplan-ios/Main/Tabbar/View/AnchorCard/XPAnchorCardView.m index 95c414f0..bb52d2af 100644 --- a/xplan-ios/Main/Tabbar/View/AnchorCard/XPAnchorCardView.m +++ b/xplan-ios/Main/Tabbar/View/AnchorCard/XPAnchorCardView.m @@ -17,6 +17,8 @@ #import "XPSkillCardPlayerManager.h" #import #import "StatisticsServiceHelper.h" +///P +#import "NSArray+Safe.h" ///View #import "XPAnchorCardSkillCollectionViewCell.h" ///Model @@ -207,7 +209,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPAnchorCardSkillCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPAnchorCardSkillCollectionViewCell class]) forIndexPath:indexPath]; - cell.imageView.imageUrl = [self.cardInfo.absCardPics objectAtIndex:indexPath.item]; + cell.imageView.imageUrl = [self.cardInfo.absCardPics safeObjectAtIndex1:indexPath.item]; return cell; } @@ -221,7 +223,7 @@ CGFloat scale = image.size.width / image.size.height; return CGSizeMake(15 * scale, height); } else { - NSURL *imgUrl = [NSURL URLWithString:[self.cardInfo.absCardPics objectAtIndex:indexPath.item]]; + NSURL *imgUrl = [NSURL URLWithString:[self.cardInfo.absCardPics safeObjectAtIndex1:indexPath.item]]; UIImage *myImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:imgUrl]]; CGFloat scale = myImage.size.width / myImage.size.height; if (scale == 0) { @@ -240,7 +242,7 @@ if(self.cardInfo.voiceCard.propVals.count) { NSString *fileName = [[self.cardInfo.voiceCard.name componentsSeparatedByString:@"/"] lastObject]; fileName = [NSString stringWithFormat:@"%zd_%@", self.cardInfo.uid, fileName]; - NSString * url = [self.cardInfo.voiceCard.propVals objectAtIndex:0]; + NSString * url = [self.cardInfo.voiceCard.propVals safeObjectAtIndex1:0]; NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"mineSkillCardVoice"]; NSString *fullPath = [filePath stringByAppendingPathComponent:fileName]; if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]) { diff --git a/xplan-ios/Main/Tabbar/View/NewUserRecharge/XPNewUserRechargeSucessView.m b/xplan-ios/Main/Tabbar/View/NewUserRecharge/XPNewUserRechargeSucessView.m index 2eb0fabf..654ff284 100644 --- a/xplan-ios/Main/Tabbar/View/NewUserRecharge/XPNewUserRechargeSucessView.m +++ b/xplan-ios/Main/Tabbar/View/NewUserRecharge/XPNewUserRechargeSucessView.m @@ -13,6 +13,7 @@ #import "ThemeColor+FirstRecharge.h" #import "XPFirstRechargeFlowLayout.h" #import "TTPopup.h" +#import "NSArray+Safe.h" ///Model #import "FirstRechargeModel.h" ///View @@ -88,7 +89,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPNewUserRechargeCollectionViewCell * cell= [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPNewUserRechargeCollectionViewCell class]) forIndexPath:indexPath]; - cell.rewardInfo = [self.datasource objectAtIndex:indexPath.row]; + cell.rewardInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; return cell; } diff --git a/xplan-ios/Main/Tabbar/View/NewUserRecharge/XPNewUserRechargeViewController.m b/xplan-ios/Main/Tabbar/View/NewUserRecharge/XPNewUserRechargeViewController.m index 7cd1738f..6db73815 100644 --- a/xplan-ios/Main/Tabbar/View/NewUserRecharge/XPNewUserRechargeViewController.m +++ b/xplan-ios/Main/Tabbar/View/NewUserRecharge/XPNewUserRechargeViewController.m @@ -15,6 +15,7 @@ #import "XPFirstRechargeFlowLayout.h" #import "Timestamp.h" #import "StatisticsServiceHelper.h" +#import "NSArray+Safe.h" ///Model #import "NewUserRechargeModel.h" ///View @@ -192,7 +193,7 @@ }]; } for (int i = 0 ; i < self.originArray.count; i++) { - FirstRechargeModel * modelInfo = [self.originArray objectAtIndex:i]; + FirstRechargeModel * modelInfo = [self.originArray safeObjectAtIndex1:i]; NSString * title = [NSString stringWithFormat:@"%ld元", modelInfo.chargeMoney]; UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected]; @@ -256,7 +257,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { XPNewUserRechargeCollectionViewCell * cell= [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPNewUserRechargeCollectionViewCell class]) forIndexPath:indexPath]; - cell.rewardInfo = [self.rewardArray objectAtIndex:indexPath.row]; + cell.rewardInfo = [self.rewardArray safeObjectAtIndex1:indexPath.row]; return cell; } @@ -274,7 +275,7 @@ - (void)buttonAction:(UIButton *)sender { if (sender.tag <= self.originArray.count) { - FirstRechargeModel * model = [self.originArray objectAtIndex:sender.tag]; + FirstRechargeModel * model = [self.originArray safeObjectAtIndex1:sender.tag]; self.rechargeButton.enabled = !model.finishCharge; [self.extraButton setTitle:model.chargeProdTitle forState:UIControlStateNormal]; self.rewardArray = model.firstChargeRewardList;