当我使用UIActivityViewController分享视频时,ActivityView显示facebook insThumb Tumblr等但是没有youtube所以我想编写一个自定义UIActivity来在youtube上分享视频但是我的英语太差了,无法理解YouTube API文档。 ..
这是我的代码
@interface RFCustomYoutubeActivity : UIActivity
@end
#import "RFCustomYoutubeActivity.h"
@interface RFCustomYoutubeActivity ()
@property (nonatomic,strong)NSArray *activityItems;
@end
@implementation RFCustomYoutubeActivity
+ (UIActivityCategory)activityCategory {
return UIActivityCategoryShare;
}
- (NSString *)activityType{
NSString *bundeID = [NSBundle mainBundle].bundleIdentifier;
NSString *typeStr =[bundeID stringByAppendingString:NSStringFromClass([RFCustomYoutubeActivity class])];
return typeStr;
}
- (NSString *)activityTitle {
return @"Youtube";
}
- (UIImage *)activityImage {
return [UIImage imageNamed:@"youtube.png"];
}
- (BOOL)canPerformWithActivityItems:(NSArray *)activityItems{
for (NSObject *obj in activityItems) {
if ([obj isKindOfClass:[NSURL class]] ) {
return YES;
}
}
return NO;
}
- (void)prepareWithActivityItems:(NSArray *)activityItems{
NSMutableArray *mutableArray=[NSMutableArray array];
for (NSObject *obj in activityItems) {
if ([obj isKindOfClass:[NSURL class]]) {
[mutableArray addObject:obj];
}
}
self.activityItems=[NSArray arrayWithArray:mutableArray];
}
- (void)performActivity{
//self.activityItems[0] is a video urlPath.
//here i don't konw how to open youtube(app) or share video to youtube
//or how to open youtube album
}
- (void)activityDidFinish:(BOOL)completed{
NSLog(@"end");
}