# push-notification-ios **Repository Path**: rn-mi/push-notification-ios ## Basic Information - **Project Name**: push-notification-ios - **Description**: MJ项目push-notification-ios仓库 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-18 - **Last Updated**: 2025-06-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README > 模板版本:v0.3.0

@ohmi/push-notification-ios

Supported platforms License

本项目基于 [@react-native-community/push-notification-ios@1.11.0](https://github.com/react-native-push-notification/ios) 开发。 [Gitee地址](https://gitee.com/rn-mi/push-notification-ios) ## 1. 安装与使用 进入到工程目录并输入以下命令: #### **npm** ```bash npm install @ohmi/push-notification-ios ``` #### **yarn** ```bash yarn add @ohmi/push-notification-ios ``` 下面的代码展示了这个库的基本使用场景: > [!WARNING] 使用时 import 的库名不变。 ```js import React, { useState } from "react"; import { View, Text, Button } from "react-native"; import PushNotification from "@react-native-community/push-notification-ios"; export const App = () => { const [data, setData] = useState({}); const presentLocalNotification = () => { PushNotification.presentLocalNotification({ id: "test", title: "title", subtitle: "subtitle", body: "body", repeats: true, }); }; const addSilentNotificationRequest = () => { PushNotification.presentLocalNotification({ id: "test-4", title: "title", subtitle: "subtitle", body: "body", isSilent: true, repeats: true, userInfo: { data: "123456", }, }); }; const addMultipleRequests = () => { PushNotification.presentLocalNotification({ id: "test-1", title: "First", subtitle: "subtitle", body: "First Notification out of 3", repeats: true, }); PushNotification.presentLocalNotification({ id: "test-2", title: "Second", subtitle: "subtitle", body: "Second Notification out of 3", repeats: true, }); PushNotification.presentLocalNotification({ id: "test-3", title: "Third", subtitle: "subtitle", body: "Third Notification out of 3", repeats: true, }); }; const removeAllDeliveredNotifications = () => { PushNotification.removeAllDeliveredNotifications(); }; const removeDeliveredNotifications = () => { PushNotification.removeDeliveredNotifications(["test-1", "test-2"]); }; const getDeliveredNotifications = () => { PushNotification.getDeliveredNotifications((data) => { if (data) { setData(data); } else { console.log("failed"); } }); }; return (