前端 - 官方的ios sdk Demo里的Token是怎么来的?
迷茫
迷茫 2017-04-22 09:00:36
0
2
366

想开发一个个人的app,用七牛主要是存储图片而已

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
伊谢尔伦

Since generating upload and download credentials requires the secretKey of the account, due to security considerations, the sk will not be stored in the client, so there is no function to generate tokens in the ios and android SDKs. The tokens on the client are all for your business. The server requests a token and the server returns it to the client.

阿神
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // 需要告诉苹果的服务器,当前应用程序需要接收远程通知
    [application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound];

    return YES;
}

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    // 第一次运行获取到DeviceToken时间会比较长!
    NSLog(@"%@", deviceToken);

    // 将deviceToken转换成字符串,以便后续使用
    NSString *token = [deviceToken description];
    NSLog(@"description %@", token);
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template