본문으로 건너뛰기

애플 (apple) - 레퍼런스

Thumbnail Image

🚀 추가된 버전 : SDKSDKv1.4.0 iOSiOSv1.4.0
🔔 최신화 일자: 2026-03-25

iOS-Only

참고

이 네임스페이스는 현재 iOS에서만 지원됩니다.

연동을 마치셨나요?

SDK 메서드를 사용하기 위해선 필수 선행 작업으로 연동하기를 마쳐야합니다.

개요

apple 네임스페이스는 Apple 로그인사용자 정보 조회디바이스의 Apple 네이티브 기능을 활용할 수 있도록 지원합니다.


타입 정의

AppleResult

Apple 로그인 요청의 결과 상태를 나타내는 객체 타입입니다.

export declare type AppleSuccessResult = {
status: 'success';
};
export declare type AppleErrorResult = {
status: 'error';
errorCode: string;
message: string;
};
export declare type AppleResult = AppleSuccessResult | AppleErrorResult;
필드타입설명
statusstring요청 결과 상태 (success / error)
errorCode (optional)string오류 코드
message (optional)string오류 메시지

ApplePermissionTypes

Apple 로그인 요청 시 요구할 수 있는 권한 목록입니다.

export declare type ApplePermissionTypes = ['email', 'fullName'];
export declare type ApplePermissions = (typeof ApplePermissionTypes)[string][];
설명
email사용자 이메일 정보
fullName사용자 전체 이름 정보

AppleUserData

Apple 로그인 성공 시 반환되는 사용자 정보 객체입니다.

주의

사용자의 이메일 및 이름 정보는 최초 로그인 시에만 제공될 수 있으며, 이후 재로그인 시 반환되지 않을 수 있습니다. 또한, 사용자가 제공하는 것을 거부하거나 요청할 때 권한에서 누락된다면 반환 데이터에서도 생략되게 되니 사용에 주의하시기 바랍니다.

export declare type AppleUserData = {
identifier: string;
token: string;
authorizationCode: string;
email?: string;
name?: {
givenName: string;
familyName: string;
};
[fields: string]: any;
};
필드타입설명
identifierstringApple 사용자 고유 식별자
tokenstring사용자 토큰
authorizationCodestringApple 인증 코드
email (optional)string사용자 이메일
name.familyName (optional)string사용자 성
name.givenName (optional)string사용자 이름
[fields: string]any기타 사용자 데이터

메서드 목록

메서드설명추가된 버전
login(permissions, callback)Apple 네이티브 소셜 로그인을 수행합니다.SDKSDKv1.4.0
iOSiOSv1.4.0
isLoggedIn(identifier, callback)Apple 로그인 상태를 확인합니다.SDKSDKv1.4.0
iOSiOSv1.4.0
getUserIdentifier(callback)Apple 사용자 고유 식별자를 반환합니다.SDKSDKv1.4.0
iOSiOSv1.4.0

메서드 상세

login(permissions, callback)

주의

연동하기가 완료되어야 사용할 수 있습니다.

타입 정의

function login(
permissions: ApplePermissions,
callback: (result: AppleResult, userData?: AppleUserData) => void
): void;

설명

Apple 네이티브 소셜 로그인을 수행하고 사용자 정보를 반환합니다.

사용자 정보 활용 시 주의사항

사용자의 이메일 및 이름 정보는 최초 로그인 시에만 제공될 수 있으며, 이후 재로그인 시 반환되지 않을 수 있습니다.
또한, 사용자가 제공하는 것을 거부하거나 요청할 때 권한에서 누락된다면 반환 데이터에서도 생략되게 되니 사용에 주의하시기 바랍니다.

매개변수

이름타입필수 여부설명
permissionsApplePermissions로그인 요청 시 요구할 권한 목록
callback(result: AppleResult, userData?: AppleUserData) => void요청 결과와 사용자 정보를 반환하는 함수

반환 값

해당 메서드는 반환 값을 가지지 않으며, 결과는 callback을 통해 비동기적으로 제공됩니다.

사용 예제

// Apple 로그인 요청
Nachocode.apple.login(['email', 'fullName'], (result, userData) => {
if (result.status === 'success') {
console.log('Apple 로그인 성공:', userData);
console.log('토큰:', userData.token);
console.log('인가코드:', userData.authorizationCode);
console.log('이메일:', userData.email);
console.log('성:', userData.name?.familyName);
console.log('이름:', userData.name?.givenName);
} else {
console.error(`Apple 로그인 실패: ${result.message}`);
}
});

isLoggedIn(identifier, callback)

주의

연동하기가 완료되어야 사용할 수 있습니다.

타입 정의

function isLoggedIn(
identifier: string,
callback: (result: AppleResult, isLoggedIn: boolean) => void
): void;

설명

Apple 사용자 고유 식별자(identifier)를 기반으로 현재 사용자가 로그인 상태인지 확인합니다.

매개변수

이름타입필수 여부설명
identifierstringApple 사용자 고유 식별자
callback(result: AppleResult, isLoggedIn: boolean) => void로그인 여부를 반환하는 함수

반환 값

해당 메서드는 반환 값을 가지지 않으며, 결과는 callback을 통해 비동기적으로 제공됩니다.

사용 예제

// Apple 로그인 상태 확인
Nachocode.apple.isLoggedIn('user_identifier_here', (result, isLoggedIn) => {
console.log('조회 성공 여부:', result.status);
if (isLoggedIn) {
console.log('사용자는 현재 Apple에 로그인되어 있습니다.');
} else {
console.log('Apple 로그인이 되어 있지 않습니다.');
}
});

getUserIdentifier(callback)

주의

연동하기가 완료되어야 사용할 수 있습니다.

타입 정의

function getUserIdentifier(
callback: (result: AppleResult, userIdentifier?: string) => void
): void;

설명

Apple 사용자 고유 식별자를 반환합니다.

매개변수

이름타입필수 여부설명
callback(result: AppleResult, userIdentifier?: string) => voidApple 사용자 식별자를 반환하는 함수

반환 값

해당 메서드는 반환 값을 가지지 않으며, 결과는 callback을 통해 비동기적으로 제공됩니다.

사용 예제

// Apple 사용자 고유 식별자 조회
Nachocode.apple.getUserIdentifier((result, userIdentifier) => {
if (result.status === 'success') {
console.log(`사용자 식별자: ${userIdentifier}`);
} else {
console.error(`사용자 식별자 조회 실패: ${result.message}`);
}
});

추가 정보
  • Apple 네임스페이스는 현재 iOS에서만 동작합니다. Android 및 기타 환경에서는 추후 지원될 예정입니다.
  • 사용자의 이메일 및 이름 정보는 최초 로그인 시에만 제공될 수 있으며, 이후 재로그인 시 반환되지 않을 수 있습니다.