Apple Mach-O Linker error (APActivityIcon)

2019-08-31 05:30发布

I've a problem! Sorry I'm new to programming and I dont know what to do. I implemented some code, to customize my ActivitiViewController. I created a new class, which I linked to my code:

  - (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];


          }}];

.........However, I run the code, but I still get an error! My two files I created are named APActivityProvider. So now I get that error and dont know how to treat this. Whats the error of my architecture?

enter image description here

Any tipps, suggestions or solutions?

Thanks

4条回答
成全新的幸福
2楼-- · 2019-08-31 06:04

Simple 4 Steps to follow :)

Step 1: Click on Project's name

enter image description here

Step 2: Click on Projects Name under Targets and select Build Phases Tab

enter image description here

Step 3: Check the compile source files list and add the missing files name by pressing the + button at the bottom

enter image description here

Step 4: Enter the file name and it will show the file in the search list, just Add it and you are done :)

enter image description here**

Hope this will help :) Happy Coding

查看更多
We Are One
3楼-- · 2019-08-31 06:09

If it is the problem with your architecture you can solve it by check on settings BuildActiveArchitectureOnly in your project as well as target build settings.

Refer this. Hope this helps. Happy Coding :)

查看更多
小情绪 Triste *
4楼-- · 2019-08-31 06:24

You need to check if target architectures in linked libraries project details have every architecture of main target.

In other words, go to your project build settings, check Architectures line (by default you'll have armv7 and arv7s now) then iterate through every project of included libraries and check if they have the same.

查看更多
干净又极端
5楼-- · 2019-08-31 06:26

APActivityIcon.m is probably not being compiled with your app, when it probably should be.

If it's part of a library, then you will have to configure that library as a dependency in Xcode, then link your app to that static library.

查看更多
登录 后发表回答