Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
OffcnIMSDKiOS
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
opensource
OffcnIMSDKiOS
Commits
6426bfa1
Commit
6426bfa1
authored
Aug 19, 2020
by
zhangyunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加本地通知
parent
7bd09de4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
AppDelegate.m
OffcnIMSDKiOS/AppDelegate.m
+23
-0
No files found.
OffcnIMSDKiOS/AppDelegate.m
View file @
6426bfa1
...
...
@@ -26,6 +26,18 @@
self
.
window
.
backgroundColor
=
[
UIColor
whiteColor
];
[
self
.
window
makeKeyAndVisible
];
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
5
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
UILocalNotification
*
backgroudMsg
=
[[
UILocalNotification
alloc
]
init
];
if
(
backgroudMsg
)
{
backgroudMsg
.
timeZone
=
[
NSTimeZone
defaultTimeZone
];
backgroudMsg
.
alertBody
=
@"VoIP来电"
;
backgroudMsg
.
alertAction
=
@"查看"
;
NSDictionary
*
infoDic
=
[
NSDictionary
dictionaryWithObject
:
@"name"
forKey
:
@"key"
];
backgroudMsg
.
userInfo
=
infoDic
;
[[
UIApplication
sharedApplication
]
presentLocalNotificationNow
:
backgroudMsg
];
//[self cerateAVAudioPlayer];
}
});
//中公直播使用测试环境设置为YES,正式环境设置为NO或者去掉这个配置
...
...
@@ -159,6 +171,17 @@
NSString
*
message
=
[[
userInfo
objectForKey
:
@"aps"
]
objectForKey
:
@"alert"
];
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示"
message
:
message
delegate
:
self
cancelButtonTitle
:
@"取消"
otherButtonTitles
:
@"确定"
,
nil
];
[
alert
show
];
UILocalNotification
*
backgroudMsg
=
[[
UILocalNotification
alloc
]
init
];
if
(
backgroudMsg
)
{
backgroudMsg
.
timeZone
=
[
NSTimeZone
defaultTimeZone
];
backgroudMsg
.
alertBody
=
@"VoIP来电"
;
backgroudMsg
.
alertAction
=
@"查看"
;
NSDictionary
*
infoDic
=
[
NSDictionary
dictionaryWithObject
:
@"name"
forKey
:
@"key"
];
backgroudMsg
.
userInfo
=
infoDic
;
[[
UIApplication
sharedApplication
]
presentLocalNotificationNow
:
backgroudMsg
];
//[self cerateAVAudioPlayer];
}
}
-
(
void
)
application
:(
UIApplication
*
)
application
didRegisterUserNotificationSettings
:(
UIUserNotificationSettings
*
)
notificationSettings
{
...
...
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