Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
L
LuckFarm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lmj
LuckFarm
Commits
e1ff4d76
Commit
e1ff4d76
authored
Nov 21, 2020
by
zhangshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
注释调试信息
删掉没用的代码 封装一清除广告对象的方法
parent
99f97c44
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
52 deletions
+36
-52
IOSADManager.m
GYDemo/GYDemo/SCAds/IOSADManager.m
+30
-51
WelfareCenterVC.m
GYDemo/GYDemo/ViewController/Welfare/WelfareCenterVC.m
+6
-1
No files found.
GYDemo/GYDemo/SCAds/IOSADManager.m
View file @
e1ff4d76
...
...
@@ -233,19 +233,16 @@ static IOSADManager * manager = nil;
/// @param loadADModel 广告对象
/// @param AdType 广告类型
-
(
void
)
loadAdWithData
:
(
GYAdsTrackModel
*
)
loadADModel
withADType
:
(
eADType
)
AdType
;{
NSLog
(
@">>>>>>> 准备缓存 平台 = %@ ID = %@ type= %@ <<<<<<<<<"
,
loadADModel
.
adPlatform
,
loadADModel
.
codeId
,
loadADModel
.
slotName
);
if
(
AdType
==
ADType_Video
)
{
NSLog
(
@">>>>>>> 🆚 %@ %@"
,[
NSDate
date
],
loadADModel
.
adPlatform
);
}
//
NSLog(@">>>>>>> 准备缓存 平台 = %@ ID = %@ type= %@ <<<<<<<<<",loadADModel.adPlatform,loadADModel.codeId,loadADModel.slotName);
//
if (AdType == ADType_Video) {
//
NSLog(@">>>>>>> 🆚 %@ %@",[NSDate date],loadADModel.adPlatform);
//
}
self
.
haveLodeAD
=
YES
;
loadADModel
.
loadADType
=
AdType
;
if
([
self
.
loadADDataArray
count
]
>
6
)
{
[
self
.
loadADDataArray
removeObject
:
self
.
loadADDataArray
.
firstObject
];
}
if
(
AdType
==
ADType_Video
)
{
#pragma mark - 延迟 做超时
[
NSObject
cancelPreviousPerformRequestsWithTarget
:
self
];
[
self
performSelector
:
@selector
(
overtimeWith
:)
withObject
:
self
.
videoModels
.
firstObject
afterDelay
:
TIMEOUT
];
}
WEAKSELF
;
...
...
@@ -270,7 +267,7 @@ static IOSADManager * manager = nil;
AddCSJADManager
*
csjAd
=
[[
AddCSJADManager
alloc
]
init
];
weakSelf
.
csjAd
=
csjAd
;
[
weakSelf
.
loadADDataArray
addObject
:
csjAd
];
NSLog
(
@">>>>>>>%@ alloc codeid = %@"
,
csjAd
,
loadADModel
.
codeId
);
//
NSLog(@">>>>>>>%@ alloc codeid = %@",csjAd,loadADModel.codeId);
csjAd
.
loadSuccessCallbackBlock
=
^
(
GYAdsTrackModel
*
_Nonnull
model
,
BOOL
success
)
{
[
weakSelf
blockResultLoadWithData
:
model
andSuccess
:
success
];
...
...
@@ -292,7 +289,7 @@ static IOSADManager * manager = nil;
AddGDTADManager
*
csjAd
=
[[
AddGDTADManager
alloc
]
init
];
self
.
gdtAd
=
csjAd
;
[
self
.
loadADDataArray
addObject
:
csjAd
];
NSLog
(
@">>>>>>>%@ alloc codeid = %@"
,
csjAd
,
loadADModel
.
codeId
);
//
NSLog(@">>>>>>>%@ alloc codeid = %@",csjAd,loadADModel.codeId);
csjAd
.
loadSuccessCallbackBlock
=
^
(
GYAdsTrackModel
*
_Nonnull
model
,
BOOL
success
)
{
...
...
@@ -314,7 +311,7 @@ static IOSADManager * manager = nil;
AddSigmobADManager
*
csjAd
=
[[
AddSigmobADManager
alloc
]
init
];
self
.
sigmobAd
=
csjAd
;
[
self
.
loadADDataArray
addObject
:
csjAd
];
NSLog
(
@">>>>>>>%@ alloc codeid = %@"
,
csjAd
,
loadADModel
.
codeId
);
//
NSLog(@">>>>>>>%@ alloc codeid = %@",csjAd,loadADModel.codeId);
csjAd
.
loadSuccessCallbackBlock
=
^
(
GYAdsTrackModel
*
_Nonnull
model
,
BOOL
success
)
{
...
...
@@ -337,7 +334,7 @@ static IOSADManager * manager = nil;
AddRuiShiADManager
*
csjAd
=
[[
AddRuiShiADManager
alloc
]
init
];
self
.
ruishiAd
=
csjAd
;
[
self
.
loadADDataArray
addObject
:
csjAd
];
NSLog
(
@">>>>>>>%@ alloc codeid = %@"
,
csjAd
,
loadADModel
.
codeId
);
//
NSLog(@">>>>>>>%@ alloc codeid = %@",csjAd,loadADModel.codeId);
csjAd
.
loadSuccessCallbackBlock
=
^
(
GYAdsTrackModel
*
_Nonnull
model
,
BOOL
success
)
{
...
...
@@ -354,7 +351,7 @@ static IOSADManager * manager = nil;
if
(
self
.
videoModels
.
count
>
self
.
cachevideo
.
count
)
{
GYAdsTrackModel
*
adData
=
self
.
videoModels
[
self
.
cachevideo
.
count
];
NSLog
(
@">>>>>>> 缓存 失败 %@ 不支持"
,
adData
.
adPlatform
);
//
NSLog(@">>>>>>> 缓存 失败 %@ 不支持",adData.adPlatform);
if
(
adData
.
firstFailure
==
NO
)
{
adData
.
firstFailure
=
YES
;
}
else
{
...
...
@@ -418,7 +415,7 @@ static IOSADManager * manager = nil;
/// @param adType 广告类型
-
(
void
)
showAdWithData
:
(
GYAdsTrackModel
*
)
showData
withADType
:
(
eADType
)
adType
;{
if
(
adType
==
ADType_Video
)
{
// 视频
NSLog
(
@">>>>>>> 正在播放 成功 平台 = %@ ID = %@ type =%@ <<<<<<<<<"
,
showData
.
adPlatform
,
showData
.
codeId
,
showData
.
slotName
);
//
NSLog(@">>>>>>> 正在播放 成功 平台 = %@ ID = %@ type =%@ <<<<<<<<<",showData.adPlatform,showData.codeId,showData.slotName);
WEAKSELF
;
if
(
self
.
advertisingSpace
)
{
[[
CGUserManager
shared
]
addADLocCollection
:
self
.
advertisingSpace
value
:
@"show_reward_video_ad"
andADData
:
showData
];
...
...
@@ -642,7 +639,6 @@ static IOSADManager * manager = nil;
if
(
model
.
loadADType
==
ADType_Video
){
[
NSObject
cancelPreviousPerformRequestsWithTarget
:
self
];
weakSelf
.
haveLodeAD
=
NO
;
dispatch_async
(
dispatch_get_main_queue
(),
^
{
...
...
@@ -655,7 +651,7 @@ static IOSADManager * manager = nil;
if
(
weakSelf
.
showNow
){
[
weakSelf
showADType
:
ADType_Video
resultBlock
:
weakSelf
.
adShowBlock
];
}
NSLog
(
@">>>>>>> ✅ %@ %@"
,[
NSDate
date
],
model
.
adPlatform
);
//
NSLog(@">>>>>>> ✅ %@ %@",[NSDate date],model.adPlatform);
}
else
{
...
...
@@ -717,21 +713,14 @@ static IOSADManager * manager = nil;
}
if
(
success
)
{
//埋点
[
self
trackingADWith
:
model
.
pullsucc_tracking
.
firstObject
];
NSLog
(
@">>>>>>> 缓存 成功 平台 = %@ ID = %@ type= %@ <<<<<<<<<"
,
model
.
adPlatform
,
model
.
codeId
,
model
.
slotName
);
//
NSLog(@">>>>>>> 缓存 成功 平台 = %@ ID = %@ type= %@ <<<<<<<<<",model.adPlatform,model.codeId,model.slotName);
model
.
cacheDate
=
[
NSDate
date
];
// 缓存成功时间
}
else
{
[
self
trackingADWith
:
model
.
pullfail_tracking
.
firstObject
];
NSLog
(
@">>>>>>> 缓存 失败 平台 = %@ ID = %@ type= %@ <<<<<<<<<"
,
model
.
adPlatform
,
model
.
codeId
,
model
.
slotName
);
for
(
int
i
=
0
;
i
<
self
.
loadADDataArray
.
count
;
i
++
)
{
IOSADManager
*
adManager
=
[
self
.
loadADDataArray
objectAtIndex
:
i
];
if
([
adManager
.
currentData
isEqual
:
model
]
)
{
[
self
.
loadADDataArray
removeObject
:
adManager
];
continue
;;
}
}
// NSLog(@">>>>>>> 缓存 失败 平台 = %@ ID = %@ type= %@ <<<<<<<<<",model.adPlatform,model.codeId,model.slotName);
[
self
clearShowOrErrorDataWith
:
model
];
}
...
...
@@ -745,11 +734,11 @@ static IOSADManager * manager = nil;
-
(
void
)
blockResultShowWithData
:
(
GYAdsTrackModel
*
)
model
andSuccess
:
(
BOOL
)
success
;{
WEAKSELF
;
if
(
success
)
{
//埋点
NSLog
(
@">>>>>>> 展示 成功 平台 = %@ ID = %@ type = %@ <<<<<<<<<"
,
model
.
adPlatform
,
model
.
codeId
,
model
.
slotName
);
//
NSLog(@">>>>>>> 展示 成功 平台 = %@ ID = %@ type = %@ <<<<<<<<<",model.adPlatform,model.codeId,model.slotName);
[
self
trackingADWith
:
model
.
imp_tracking
.
firstObject
];
[
self
trackingADWith
:
model
.
playcomplete_trackings
.
firstObject
];
}
else
{
NSLog
(
@">>>>>>> 展示 失败 平台 = %@ ID = %@ %@ type = %@ <<<<<<<<<"
,
model
.
adPlatform
,
model
.
codeId
,
model
.
ADError
,
model
.
slotName
);
// NSLog(@">>>>>>> 展示 失败 平台 = %@ ID = %@ %@ type = %@ <<<<<<<<<",model.adPlatform,model.codeId,model.ADError.localizedDescription
,model.slotName);
[
self
trackingADWith
:
model
.
showfail_tracking
.
firstObject
];
MBProgressHUD
*
hud
=
[
MBProgressHUD
showMessage
:
@"请稍等..."
];
hud
.
minShowTime
=
3
;
...
...
@@ -758,8 +747,6 @@ static IOSADManager * manager = nil;
if
(
model
.
loadADType
==
ADType_Video
){
// [NSObject cancelPreviousPerformRequestsWithTarget:self];
weakSelf
.
adShowBlock
(
success
);
if
(
success
)
{
...
...
@@ -776,12 +763,10 @@ static IOSADManager * manager = nil;
self
.
showNow
=
YES
;
[[
CGUserManager
shared
]
addLocCollection
:
@"reward_request"
value
:
@"reward_display_failed"
];
if
(
model
.
ADError
)
{
NSLog
(
@"%@"
,
model
.
ADError
);
}
if
(
self
.
advertisingSpace
)
{
NSString
*
errorValue
=
[
NSString
stringWithFormat
:
@"show_fail_reward_video_ad_%@_%@_%@"
,
model
.
adPlatform
,
model
.
codeId
,
model
.
ADError
];
NSString
*
errorValue
=
[
NSString
stringWithFormat
:
@"show_fail_reward_video_ad_%@_%@_%@"
,
model
.
adPlatform
,
model
.
codeId
,
model
.
ADError
.
localizedDescription
];
[[
CGUserManager
shared
]
addADLocCollection
:
self
.
advertisingSpace
value
:
errorValue
andADData
:
model
];
}
...
...
@@ -823,14 +808,8 @@ static IOSADManager * manager = nil;
}
for
(
int
i
=
0
;
i
<
self
.
loadADDataArray
.
count
;
i
++
)
{
IOSADManager
*
adManager
=
[
self
.
loadADDataArray
objectAtIndex
:
i
];
if
([
adManager
.
currentData
isEqual
:
model
]
)
{
[
self
.
loadADDataArray
removeObject
:
adManager
];
continue
;;
}
}
[
self
clearShowOrErrorDataWith
:
model
];
}
...
...
@@ -855,19 +834,19 @@ static IOSADManager * manager = nil;
}
// 广告超时
-
(
void
)
overtimeWith
:
(
GYAdsTrackModel
*
)
model
{
return
;
if
(
model
.
loadADType
==
ADType_Video
)
{
//MARK: 删除 广告对象从预加载中
-
(
void
)
clearShowOrErrorDataWith
:
(
GYAdsTrackModel
*
)
model
{
for
(
int
i
=
0
;
i
<
self
.
loadADDataArray
.
count
;
i
++
)
{
IOSADManager
*
adManager
=
[
self
.
loadADDataArray
objectAtIndex
:
i
];
self
.
isTimeOut
=
YES
;
if
([
adManager
.
currentData
isEqual
:
model
]
)
{
[
self
.
loadADDataArray
removeObject
:
adManager
];
continue
;;
}
}
}
@end
GYDemo/GYDemo/ViewController/Welfare/WelfareCenterVC.m
View file @
e1ff4d76
...
...
@@ -362,7 +362,12 @@
}
}
failure
:^
(
NSError
*
_Nonnull
error
)
{
// NSLog(@"domain =%@",error.domain);
// NSLog(@"domain =%@",error.localizedDescription);
//
// NSLog(@"userInfo =%@",error.userInfo);
// NSLog(@"userInfo =%@",error.userInfo[@"NSLocalizedDescription"]);
}];
}
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment