简体   繁体   English

Apple Mach-O链接器错误(APActivityIcon)

[英]Apple Mach-O Linker error (APActivityIcon)

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. 我实现了一些代码,以自定义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. 我创建的两个文件名为APActivityProvider。 So now I get that error and dont know how to treat this. 因此,现在我收到了该错误,并且不知道该如何处理。 Whats the error of my architecture? 我的架构有什么错误?

在此处输入图片说明

Any tipps, suggestions or solutions? 有什么建议,建议或解决方案吗?

Thanks 谢谢

Simple 4 Steps to follow :) 简单的4个步骤:)

Step 1: Click on Project's name 步骤1: 按一下专案名称

在此处输入图片说明

Step 2: Click on Projects Name under Targets and select Build Phases Tab 第2步: 在“目标”下单击“项目名称”,然后选择“构建阶段”选项卡

在此处输入图片说明

Step 3: Check the compile source files list and add the missing files name by pressing the + button at the bottom 第3步: 检查编译源文件列表,并按底部的+按钮添加缺少的文件名

在此处输入图片说明

Step 4: Enter the file name and it will show the file in the search list, just Add it and you are done :) 第4步: 输入文件名,它将在搜索列表中显示该文件,只需将其添加即可:)

在此处输入图片说明 ** **

Hope this will help :) Happy Coding 希望这会有所帮助:)快乐编码

APActivityIcon.m is probably not being compiled with your app, when it probably should be. APActivityIcon.m可能不应该与您的应用一起编译。

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. 如果它是库的一部分,那么您将必须将该库配置为Xcode中的依赖项,然后将您的应用程序链接到该静态库。

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. 换句话说,转到您的项目构建设置,检查“体系结构”行(默认情况下现在将拥有armv7和arv7s),然后遍历包含库的每个项目,并检查它们是否相同。

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. 如果您的体系结构存在问题,则可以通过检查项目中的BuildActiveArchitectureOnly设置以及目标构建设置来解决。

Refer this . 请参考 Hope this helps. 希望这可以帮助。 Happy Coding :) 快乐编码:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM