我遇到問題了!對不起,我是編程新手,我不知道該怎麼做。我實現了一些代碼,來定製我的ActivitiViewController。我創建了一個新類,它鏈接到我的代碼:Apple Mach-O鏈接器錯誤(APActivityIcon)
- (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。所以現在我得到這個錯誤,不知道如何處理這個。我的架構有什麼錯誤?
任何的竅門,建議或解決方案?
感謝
你有進口APActivityIcon.h?活動圖標是否是正確目標的一部分? (檢查左側的文件檢查器,應該有用於目標的複選框。選擇您的APActivityIcon.m,並檢查文件檢查器的目標)。該錯誤似乎表明它找不到它。 – WDUK
是還輸入!? – MasterRazer