我有问题!对不起,我是编程新手,我不知道该怎么做。我实现了一些代码来自定义我的 ActivitiViewController。我创建了一个新类,并将其链接到我的代码:
- (IBAction)share:(id)sender
{
Class avcClass = NSClassFromString(@"UIActivityViewController");
if (avcClass) {
APActivityProvider *ActivityProvider = [[APActivityProvider alloc] init];
UIImage *ImageAtt = [UIImage imageNamed:@"MyApp Icon 512x512.png"];
NSArray *Items = @[ActivityProvider, ImageAtt];
APActivityIcon *ca = [[APActivityIcon alloc] init];
NSArray *Acts = @[ca];
UIActivityViewController *ActivityView = [[UIActivityViewController alloc]
initWithActivityItems:Items
applicationActivities:Acts];
[ActivityView setExcludedActivityTypes:
@[UIActivityTypeAssignToContact,
UIActivityTypeCopyToPasteboard,
UIActivityTypePrint,
UIActivityTypeSaveToCameraRoll,
UIActivityTypePostToWeibo]];
[self presentViewController:ActivityView animated:YES completion:nil];
[ActivityView setCompletionHandler:^(NSString *act, BOOL done)
{
NSString *ServiceMsg = nil;
if ( [act isEqualToString:UIActivityTypeMail] ) ServiceMsg = @"Mail sended!";
if ( [act isEqualToString:UIActivityTypePostToTwitter] ) ServiceMsg = @"Post on twitter, ok!";
if ( [act isEqualToString:UIActivityTypePostToFacebook] ) ServiceMsg = @"Post on facebook, ok!";
if ( [act isEqualToString:UIActivityTypeMessage] ) ServiceMsg = @"SMS sended!";
if ( done )
{
UIAlertView *Alert = [[UIAlertView alloc] initWithTitle:ServiceMsg message:@"" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil];
[Alert show];
}}];
.........但是,我运行代码,但仍然出现错误!我创建的两个文件名为 APActivityProvider。所以现在我得到了那个错误,不知道如何处理这个。我的架构有什么错误?
任何提示、建议或解决方案?
谢谢