0
votes

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
Have you imported APActivityIcon.h? Is activity icon part of the correct target? (Check the file inspector on the left hand side, there should be checkboxes for your targets. Select your APActivityIcon.m, and check in the file inspector its targets). The error seems to suggest it cannot find it.WDUK

4 Answers

3
votes

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

1
votes

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.

0
votes

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.

0
votes

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 :)