본문 바로가기

IOS (아이폰)/iOS

iOS PushWoosh 적용 (2) - SDK 적용

안녕하세요.

이번 포스팅은 (1) PushWoosh 웹 설정에 이어

프로젝트에 SDK를 적용하는법 입니다.


푸시우시 사이트 좌측 메뉴에 있는 Documentation 를 클릭해서 doc 페이지로 이동합니다.

그리고 iOS를 클릭해주세요



그리고 다운로드 SDK 를 클릭해서

PushWoosh iOS SDK Git 사이트로 이동 후

파일을 다운로드 받습니다.



https://github.com/Pushwoosh/pushwoosh-ios-sdk


다운받은 파일을 압축해제 하고

Pushwoosh.framework 파일을

프로젝트 안으로 드래그 해주세요.


프로젝트 파일 -> General 메뉴를 눌러

Linked Frameworks and Libraries를 확인해보면

Pushwoosh.framework 파일이 추가된것을 확인 할 수 있습니다.


PushWoosh를 사용하기 위해서는

libz.tbd 와 libstdc++.tdb가 필요합니다.

Linked Frameworks and Libraries 아래 + 버튼을 눌러

Search에 libz.tbd와 libstdc++.tdb 를 써서

하나씩 추가해줍니다.


작게 보이면 클릭해주세요

0



프로젝트를 열고 info.plist 파일에

PushWoosh_APPID 를 추가해주세요.


APPID는 푸시우시 사이트에서 만들었던

Application의 Code 값입니다. 



프로젝트의 Push 설정을 해주기 위해

프로젝트 파일 -> Capabilities 을 클릭합니다.


Push Notifications & Background Modes 를

Off에서 On으로 변경해줍니다.

Background Modes Remote Notifcations를 체크해주세요.



AppDelegate.m 파일에

Push와 PushWoosh 코드를 추가하겠습니다.


앱 실행 시 PushWoosh 를 등록해주는 코드와

Push 관련된 코드를 추가하겠습니다.

#import "AppDelegate.h"
#import 

@implementation AppDelegate

#pragma mark - init

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    PushNotificationManager *pushManager = [PushNotificationManager pushManager];
    [pushManager sendAppOpen];
    [pushManager registerForPushNotifications];
    
    return YES;
}

#pragma mark - Push

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    [[PushNotificationManager pushManager] handlePushRegistration:deviceToken];
}

@end


이제 다시 웹 사이트로 이동해서

Send Push 에서 메세지 내용을 적고 푸시를 발송해보겠습니다.



잠시 기다리면

푸시 수신!


0


이상으로 PushWoosh SDK 적용 포스팅을 마치겠습니다.

감사합니다.