This document describes how to integrate Kakao Talk Social APIs into your service with the Kakao SDK for iOS ("iOS SDK").
Reference | App setting |
---|---|
[SDK, RxSDK] profile() [SDK] TalkProfile |
Install Import modules Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms Activate Kakao Login Manage consent items |
Required | Required: Profile Info(nickname/profile image) Nickname Profile image |
Retrieves the Kakao Talk profile of the user currently logged in.
Call profile()
.
profile()
returns the TalkProfile
object which contains the user's Kakao Talk profile information.
The Kakao Talk profile obatained though profile()
is different from the profile of Kakao Account. Refer to Concepts.
TalkApi.shared.profile {(profile, error) in
if let error = error {
print(error)
else {
print("profile() success.")
// Implement service logics
_ = profile
}
}
// Class member property
let disposeBag = DisposeBag()
TalkApi.shared.rx.profile()
.retry(when: Auth.shared.rx.incrementalAuthorizationRequired())
.subscribe (onSuccess:{ (profile) in
print("success.")
// Implement service logics
_ = profile
}, onFailure: {error in
print(error)
})
.disposed(by: disposeBag)
Reference | App setting |
---|---|
[SDK, RxSDK] selectFriend() [SDK, RxSDK] selectFriends() [SDK, RxSDK] selectFriendPopup() [SDK, RxSDK] selectFriendsPopup() [SDK] SelectedUsers |
Install Import modules Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
Required | Register platforms Activate Kakao Login Manage consent items |
Required | Required: Friends List in Kakao Service(Including profile image, nickname, and favorites) |
This API displays the Friend picker and provides the information of the Kakao Talk friends that a user selects through the picker.
Depending on the selection type and display format of the Friend picker, you need to use a different method.
Display format | Selection type | Method to use |
---|---|---|
Full screen | Single picker | selectFriend() |
Full screen | Multi-picker | selectFriends() |
Popup screen | Single picker | selectFriendPopup() |
Popup screen | Multi-picker | selectFriendsPopup() |
The components can be set by parameters.
If the request is successful, the information of the friends that a user selects from the Friend picker is returned through SelectedUsers
. If you encounter errors, refer to Troubleshooting.
let openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title: "Single picker", // Name of the picker
viewAppearance: .auto, // Display type
orientation: .auto, // Orientation of the picker
enableSearch: true, // Enables the search function
enableIndex: true, // Enables the index view
showFavorite: true // Marks on favorite friends
)
PickerApi.shared.selectFriend(params: openPickerFriendRequestParams) { selectedUsers, error in
if let error = error {
print(error)
}
else {
print("selectFriend(params:) success.")
//do something
_ = selectedUsers
}
}
let openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title: "Multi-picker", // Name of the picker
viewAppearance: .auto, // Display type
orientation: .auto, // Orientation of the picker
enableSearch: true, // Enables the search function
enableIndex: true, // Enables the index view
showFavorite: true, // Marks on favorite friends
showPickedFriend: true, // Displays selected friends for multi-picker
maxPickableCount: 5, // Maximum pickable count
minPickableCount: 1 // Minimum pickable count
)
PickerApi.shared.selectFriends(params: openPickerFriendRequestParams) { selectedUsers, error in
if let error = error {
print(error)
}
else {
print("selectFriends(params:) success.")
//do something
_ = selectedUsers
}
}
// Class member property
let disposeBag = DisposeBag()
let openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title: "Single picker", // Name of the picker
viewAppearance: .auto, // Display type
orientation: .auto, // Orientation of the picker
enableSearch: true, // Enables the search function
enableIndex: true, // Enables the index view
showFavorite: true // Marks on favorite friends
)
PickerApi.shared.rx.selectFriend(params:openPickerFriendRequestParams)
.subscribe (onNext:{ (selectedUsers) in
print("selectFriend(params:) success.")
//do something
_ = selectedUsers
}, onError: {error in
print(error)
})
.disposed(by: disposeBag)
// Class member property
let disposeBag = DisposeBag()
let openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title: "Multi-picker", // Name of the picker
viewAppearance: .auto, // Display type
orientation: .auto, // Orientation of the picker
enableSearch: true, // Enables the search function
enableIndex: true, // Enables the index view
showFavorite: true, // Marks on favorite friends
showPickedFriend: true, // Displays selected friends for multi-picker
maxPickableCount: 5, // Maximum pickable count
minPickableCount: 1 // Minimum pickable count
)
PickerApi.shared.rx.selectFriends(params:openPickerFriendRequestParams)
.subscribe (onNext:{ (selectedUsers) in
print("selectFriends(params:) success.")
//do something
_ = selectedUsers
}, onError: {error in
print(error)
})
.disposed(by: disposeBag)
let openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title: "Single picker", // Name of the picker
viewAppearance: .auto, // Display type
orientation: .auto, // Orientation of the picker
enableSearch: true, // Enables the search function
enableIndex: true, // Enables the index view
showFavorite: true // Marks on favorite friends
)
PickerApi.shared.selectFriendPopup(params: openPickerFriendRequestParams) { selectedUsers, error in
if let error = error {
print(error)
}
else {
print("selectFriendPopup(params:) success.")
//do something
_ = selectedUsers
}
}
let openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title: "Multi-picker", // Name of the picker
viewAppearance: .auto, // Display type
orientation: .auto, // Orientation of the picker
enableSearch: true, // Enables the search function
enableIndex: true, // Enables the index view
showFavorite: true, // Marks on favorite friends
showPickedFriend: true, // Displays selected friends for multi-picker
maxPickableCount: 5, // Maximum pickable count
minPickableCount: 1 // Minimum pickable count
)
PickerApi.shared.selectFriendsPopup(params: openPickerFriendRequestParams) { selectedUsers, error in
if let error = error {
print(error)
}
else {
print("selectFriendsPopup(params:) success.")
//do something
_ = selectedUsers
}
}
// Class member property
let disposeBag = DisposeBag()
let openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title: "Single picker", // Name of the picker
viewAppearance: .auto, // Display type
orientation: .auto, // Orientation of the picker
enableSearch: true, // Enables the search function
enableIndex: true, // Enables the index view
showFavorite: true // Marks on favorite friends
)
PickerApi.shared.rx.selectFriendPopup(params:openPickerFriendRequestParams)
.subscribe (onNext:{ (selectedUsers) in
print("selectFriendPopup(params:) success.")
//do something
_ = selectedUsers
}, onError: {error in
print(error)
})
.disposed(by: disposeBag)
// Class member property
let disposeBag = DisposeBag()
let openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title: "Multi-picker", // Name of the picker
viewAppearance: .auto, // Display type
orientation: .auto, // Orientation of the picker
enableSearch: true, // Enables the search function
enableIndex: true, // Enables the index view
showFavorite: true, // Marks on favorite friends
showPickedFriend: true, // Displays selected friends for multi-picker
maxPickableCount: 5, // Maximum pickable count
minPickableCount: 1 // Minimum pickable count
)
PickerApi.shared.rx.selectFriendsPopup(params:openPickerFriendRequestParams)
.subscribe (onNext:{ (selectedUsers) in
print("selectFriendsPopup(params:) success.")
//do something
_ = selectedUsers
}, onError: {error in
self.errorHandler(error: error)
})
.disposed(by: disposeBag)
Reference | App setting |
---|---|
[SDK, RxSDK] friends() [SDK] Friends |
Install Import modules Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
Required | Register platforms Activate Kakao Login Manage consent items |
Required | Required: Friends List in Kakao Service (Including profile image, nickname, and favorites) |
This API enables you to get the list of Kakao Talk friends of the user currently logged in. Note that Kakao Talk profiles may be different from Kakao Account profiles. Refer to Concepts.
To get the list of Kakao Talk friends of the user currently logged in, call the friends()
method in the TalkApi
class. You can also pass optional parameters through arguments. If you make a request without any parameters, the default settings are applied.
friends()
returns Friends
which contains a list of the user's Kakao Talk friends.
If the request fails because the user has not agreed to provide the Friends list, proceed the followings:
TalkApi.shared.friends {(friends, error) in
if let error = error {
print(error)
}
else {
// Implement service logics
_ = friends
}
}
// Class member property
let disposeBag = DisposeBag()
TalkApi.shared.rx.friends()
.retry(when: Auth.shared.rx.incrementalAuthorizationRequired())
.subscribe (onSuccess:{ (friends) in
// Implement service logics
_ = friends
}, onFailure: {error in
print(error)
})
.disposed(by: disposeBag)
To retrieve the response in the page format, use FriendsContext
. FriendsContext
includes same paramaeters. When the number of Kakao Talk friends is more than the specified value or default value(100), the response will be returned in the page format. After the first page, use FriendsContext
to retrieve the second page.