-
ios - fcm 메세지 전송시 400 erroriOS 2020. 12. 30. 11:08
fcm 서버 구축 -> spring boot
controller에서 message 전송시 에러 발생
java.io.IOException: Server returned HTTP response code: 400 for URL: https://fcm.googleapis.com/v1/projects/crewgym-e735d/messages:send
@PostMapping("/fcm/sendMessage") @ResponseBody public Result fcmTest(String deviceToken, String title, String content) { // log.info("tokenId:" + param.getToken() + " / title:" + param.getTitle() + " / " + "content:" // + param.getContent()); FcmAndroidService fcmAndroid = new FcmAndroidService(); FcmService fcmIos = new FcmService(); try { fcmIos.sendFcmMessage(param.getToken(), param.getTitle(), param.getContent()); } catch (IOException e) { e.printStackTrace(); } log.info("FCM_test 실행!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); return new Result("1", "fcm테스트"); }
이렇게 고침
@PostMapping("/fcm/sendMessage") @ResponseBody public Result fcmTest(@RequestBody FcmMsgModel param) { // log.info("tokenId:" + param.getToken() + " / title:" + param.getTitle() + " / " + "content:" // + param.getContent()); FcmAndroidService fcmAndroid = new FcmAndroidService(); FcmService fcmIos = new FcmService(); try { fcmIos.sendFcmMessage(param.getToken(), param.getTitle(), param.getContent()); } catch (IOException e) { e.printStackTrace(); } log.info("FCM_test 실행!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); return new Result("1", "fcm테스트"); }
'iOS' 카테고리의 다른 글
ios - AppDelegate (0) 2021.01.26 ios - fcm 설정 #1 (cocoa pod 설정) (0) 2021.01.20 iOS - push 기능 설정 (0) 2020.12.23 iOS - memo 앱 만들기 # 11 DB구현2 (0) 2020.12.16 iOS - memo 앱 만들기 #10 DB 구현 1 (0) 2020.12.15