Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
flutter_push
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhuguoming
2025-02-05 16:58:05 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8f5a0d9f74937d19d2dbce0518af81568a1483b3
8f5a0d9f
1 parent
eeb71020
【需求】初始化前先请求权限
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
ios/Classes/FlutterPushPlugin.swift
ios/Classes/FlutterPushPlugin.swift
View file @
8f5a0d9
...
...
@@ -17,9 +17,16 @@ public class FlutterPushPlugin: NSObject, FlutterPlugin {
case
"init"
:
print
(
"init初始化"
)
// 初始化
UNUserNotificationCenter
.
current
()
.
requestAuthorization
(
options
:
[
.
alert
,
.
sound
,
.
badge
])
{
granted
,
_
in
if
granted
{
print
(
"有通知权限"
)
DispatchQueue
.
main
.
async
{
UIApplication
.
shared
.
registerForRemoteNotifications
()
}
}
else
{
print
(
"无用通知权限"
)
}
}
result
(
true
)
case
"checkPermission"
:
print
(
"checkPermission检测权限"
)
...
...
Please
register
or
login
to post a comment