gpt4 book ai didi

ios - 将 Pinterest 与我的 iOS 应用程序集成

转载 作者:可可西里 更新时间:2023-11-01 04:40:14 25 4
gpt4 key购买 nike

<分区>

我想从我的 iPhone 应用程序将图像发布到 pinterest 帐户,pinterest 没有任何 API 版本,这就是为什么我试图将它与 URL Scheme 集成但没有成功。这是它的代码,

- (void)pinThroughURLScheme {
NSString *urlString = PinterestURLMake(self.image, nil, @"alt", @"image.jpeg", NO);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
}

NSString *PinterestURLMake(UIImage *image, NSString *urlString, NSString *alt, NSString *title, BOOL isVideo) {
NSString *base64ImageString = [NSString stringWithFormat:@"data:image/png;base64,%@", NSStringFromUIImage(image)];
NSString *encodedBase64ImageString = [base64ImageString urlEncodeUsingEncoding:NSUTF8StringEncoding];
NSString *encodedURLValue = [urlString urlEncodeUsingEncoding:NSUTF8StringEncoding];
NSString *encodedAltValue = [alt urlEncodeUsingEncoding:NSUTF8StringEncoding];
NSString *encodedTitleValue = [[NSString stringWithFormat:@"%@ %.0fx%.0f pixels", title, image.size.width, image.size.height] urlEncodeUsingEncoding:NSUTF8StringEncoding];
NSString *videoValue = isVideo ? @"true" : @"false";
return [NSString stringWithFormat:@"pinterest://pin/create/bookmarklet/?url=URL-OF-THE-PAGE-TO-PIN&media=URL-OF-THE-IMAGE-TO-PIN&description=ENTER-YOUR-DESCRIPTION-FOR-THE-PIN",
encodedBase64ImageString,
urlString ? [NSString stringWithFormat:@"&url=%@", encodedURLValue] : @"",
alt ? [NSString stringWithFormat:@"&alt=%@", encodedAltValue] : @"",
title ? [NSString stringWithFormat:@"&title=%@", encodedTitleValue] : @"",
videoValue];
}

运行此代码后,我的 iPhone 设备没有任何响应。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com