在iOS中使用pinterest登录 [英] Login with pinterest in iOS
问题描述
Pinterest for developers 中的图钉有解释。
但我仍然有以下两个问题:
But I still have got the two following questions:
- 如何登录?
- 登录后如何从服务器获取登录用户的响应?
我已经完成了google&堆栈溢出,所有这些都是使用 Web视图解释的。但是使用网页视图,我们无法得到登录用户的响应,在一些演示中,他们只解释了如何固定它?
I have gone through towards all demo available on google & stack overflow ,all they explain by using web view. but using web view, we can't get response of logged in user and in some Demo they have explained just how to pin it ?
在我的应用程序中,我希望以pinterest登录。
In my app, I want login with pinterest.
任何有关这些问题的帮助将不胜感激。
Any help with the questions would be greatly appreciated.
推荐答案
按照此处中的步骤1至4进行操作
Follow the steps 1 to 4 from here
将以下内容放入Appdelgate.swift
Put following in Appdelgate.swift
import PinterestSDK
在appdelegate的didFinishLaunchingWithOptions方法中添加以下行
Add following line in didFinishLaunchingWithOptions method of appdelegate
PDKClient.configureSharedInstanceWithAppId("your-app-id")
add在你的登录视图控制器上跟随
add following on your login view controller
import PinterestSDK
func PinterestLogin() {
PDKClient.sharedInstance().authenticateWithPermissions([PDKClientReadPrivatePermissions,PDKClientReadPublicPermissions,PDKClientReadRelationshipsPermissions,PDKClientWritePublicPermissions,PDKClientWritePrivatePermissions,PDKClientWriteRelationshipsPermissions], withSuccess: { (success :PDKResponseObject!) -> Void in
let user = success.user()
print(user.identifier)
print(user.image?.url)
print(user.username);
print(user.firstName);
print(user.lastName);
print(user.biography);
print(user.largestImage().url)
print(user.smallestImage().url)
}) { (error: NSError!) -> Void in
print(error.description)
}
}
func PinterestLogout() {
PDKClient.clearAuthorizedUser()
}
这篇关于在iOS中使用pinterest登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!