✨실행
Npm run iOS
❌ 발생한 에러
Use of undeclared identifier 'RNNotifications'
✅ 해결방법
코드 푸시 import 부분을 #ifdef FB_SONARKIT_ENABLED 위로 옮겨주는 해결이 되는 문제였다.
✨
Npm run ios
IOS 시뮬레이터에서 발생
❌
Error: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo=0x4b48b00 {NSLocalizedDescription=remote notifications are not supported in the simulator}
✅
실제 디바이스 연결해야함
✨
Iphone 6s 15.6에서 빌드
❌
Showing All Messages
Signing for "DayChallenge" requires a development team. Select a development team in the Signing & Capabilities editor.
✅
https://github.com/eagle705/rn-day-challenge/issues/11
✨
Iphone 6s 15.6에서 빌드
❌
각종 오류
✅
아이폰 업데이트, XCode업데이트
✨
Iphone 6s 15.6에서 빌드
❌
아이폰에서 Unturusted Developer 알림창 뜸
✅
https://fixsy.org/ko/%EC%8B%A0%EB%A2%B0%ED%95%A0-%EC%88%98-%EC%97%86%EB%8A%94-%EA%B0%9C%EB%B0%9C%EC%9E%90-%EB%A9%94%EC%8B%9C%EC%A7%80%EB%A5%BC-%EC%88%98%EC%A0%95%ED%95%98%EA%B8%B0-%EC%9C%84%ED%95%B4-iphone-%EB%B0%8F-ipa
위 링크대로 아이폰에 세팅 잘하기
✨
Iphone 6s 15.6에서 빌드
❌
Error: Error Domain=NSCocoaErrorDomain Code=3000
✅
//AppDelegate.mm
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[RNNotifications didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
[RNNotifications didFailToRegisterForRemoteNotificationsWithError:error];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
[RNNotifications didReceiveBackgroundNotification:userInfo withCompletionHandler:completionHandler];
}
//App.tsx 에 다음 추가
useEffect(() => {
// Request permissions on iOS, refresh token on Android
if (Platform.OS === 'android') {
Notifications.registerRemoteNotifications();
} else if (Platform.OS === 'ios') {
Notifications.ios.registerRemoteNotifications({
providesAppNotificationSettings: true,
provisional: true,
carPlay: true,
criticalAlert: true,
});
Notifications.ios.checkPermissions().then((currentPermissions) => {
console.log('Badges enabled: ' + !!currentPermissions.badge);
console.log('Sounds enabled: ' + !!currentPermissions.sound);
console.log('Alerts enabled: ' + !!currentPermissions.alert);
console.log('Car Play enabled: ' + !!currentPermissions.carPlay);
console.log('Critical Alerts enabled: ' + !!currentPermissions.criticalAlert);
console.log('Provisional enabled: ' + !!currentPermissions.provisional);
console.log('Provides App Notification Settings enabled: ' + !!currentPermissions.providesAppNotificationSettings);
console.log('Announcement enabled: ' + !!currentPermissions.announcement);
});
}
Notifications.events().registerNotificationReceivedForeground((notification, completion) => {
console.log(`Notification received in foreground: ${notification.title} : ${notification.body}`);
completion({ alert: true, sound: true, badge: true });
});
Notifications.events().registerNotificationOpened((notification, completion) => {
console.log(`Notification opened: ${notification.payload}`);
completion();
});
}, [])
<Button
onPress={() => {
console.log('hi2')
if (Platform.OS === 'ios') {
const tDate = new Date()
Notifications.postLocalNotification({
body: "Local notification!",
title: "Local Notification Title",
sound: "chime.aiff",
type: "??",
payload: "??",
thread: "??",
badge: 123,
// userInfo: { },
identifier: "??",
fireDate: tDate.setMinutes(tDate.getMinutes() + 1),
});
} else if (Platform.OS === 'android') {
const tDate = new Date()
Notifications.postLocalNotification({
body: "Local notification!",
title: "Local Notification Title",
sound: "chime.aiff",
type: "??",
payload: "??",
thread: "??",
badge: 123,
// userInfo: { },
identifier: "??",
fireDate: tDate.setMinutes(tDate.getMinutes() + 1),
});
}
}}
title="로컬 푸쉬 알림"
/>