-(void)shareInfor{
NSString *textToShare = @"IELTS Vocabularies, Sentences and Tests Application, Support 4 English voice. Easy to operate:";
NSString * strUrl=@"https://itunes.apple.com/ca/app/雅思单词宝/id1209567759?mt=8";
strUrl = [strUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; //对字符串进行编码,保证链接中的汉字能够正确识别
NSURL *url = [NSURL URLWithString:strUrl];
//https://itunes.apple.com/ca/app/雅思单词宝/id1209567759?mt=8
NSArray *objectsToShare = @[textToShare, url];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];
//不需要的功能可以写在如下数组屏蔽
NSArray *excludeActivities = @[UIActivityTypeAirDrop,
UIActivityTypePrint,
UIActivityTypeCopyToPasteboard,
UIActivityTypeAssignToContact,
UIActivityTypeSaveToCameraRoll,
UIActivityTypeAddToReadingList,
UIActivityTypePostToFlickr,
UIActivityTypePostToVimeo
];
activityVC.excludedActivityTypes = excludeActivities;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{ //if iPhone
[self presentViewController:activityVC animated:YES completion:nil];
}
else //if iPad
{
// Change Rect to position Popover
UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activityVC];
NSLog(@"%f",self.view.frame.size.width/2);
[popup presentPopoverFromRect:CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/4, 0, 0)inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
//stateData.score=stateData.score+1;//分享后积分,该部分代码使用者根据自身添加
//[self writeStateFile];//积分写入文件
}