【iOS打包报错】Extension打包报错armv7

/Users/tong/Desktop/wanshifu/Innovative/wanshifu-app-iOS/App.xcodeproj The linked framework 'Pods_GIONotificationServiceExtension.framework' is missing one or more architectures required by this target: armv7.
在 TARGETS ——> Build Settings-Excluded Architectures 中添加:
image.png


Extension——带图片推送步骤(前提:extension target证书一定要配置正确)

1、打adhoc包上传到蒲公英
2、xcode运行项目到iPhone手机,获取devicetoken,记录devicetoken。
3、扫码蒲公英下覆盖安装包
4、使用Knuff —— 推送工具,配置推送消息
image.png
{
         "aps": {
             "alert": {
                 "title": "最新资讯",
                 "body": "2017全国文明城市公布"
             },
             "sound": "default",
             "badge": 1,
             "mutable-content": 1
         },
         "image": "https://img1.gtimg.com/ninja/2/2017/05/ninja149447456097353.jpg"
     }
5、收到推送消息,不能打开app,否则又需要重复2、3步骤
image.png
6、相关代码

@interface NotificationService ()

@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
@property (nonatomic, strong) NSURLSession * session;

@end

@implementation NotificationService

- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
    
    self.contentHandler = contentHandler;
    self.bestAttemptContent = [request.content mutableCopy];
    
    // 下载并关联附件
    NSString * urlString = self.bestAttemptContent.userInfo[@"image"];
    [self loadAttachmentForUrlString:urlString
                   completionHandler: ^(UNNotificationAttachment *attachment) {
                       self.bestAttemptContent.attachments = [NSArray arrayWithObjects:attachment, nil];
                       [self contentComplete];
                   }];
}

- (void)serviceExtensionTimeWillExpire {
    //这里进行操作超时后的补救···例如将图片替换成默认图片等等
    self.bestAttemptContent.title = @"超时";
    [self contentComplete];
}

- (void)contentComplete
{
    [self.session invalidateAndCancel];
    self.contentHandler(self.bestAttemptContent);
}

- (void)loadAttachmentForUrlString:(NSString *)urlString
                 completionHandler:(void (^)(UNNotificationAttachment *))completionHandler {
    __block UNNotificationAttachment *attachment = nil;
    __block NSURL *attachmentURL = [NSURL URLWithString:urlString];
    //NSString *fileExt = [@"." stringByAppendingString:[urlString pathExtension]];
    NSString *fileExt = [self fileExtensionForMediaType:@"image"];
    if ([urlString containsString:@".jpg"] || [urlString containsString:@".png"]) {
        fileExt = [@"." stringByAppendingString:[urlString pathExtension]];
    }
    
    //下载附件
    _session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
    NSURLSessionDownloadTask *task;
    task = [_session downloadTaskWithURL:attachmentURL
                       completionHandler: ^(NSURL *temporaryFileLocation, NSURLResponse *response, NSError *error) {
                          
                           if (error != nil) {
                               NSLog(@"%@", error.localizedDescription);
                           } else {
                               NSFileManager *fileManager = [NSFileManager defaultManager];
                               NSURL *localURL = [NSURL fileURLWithPath:[temporaryFileLocation.path
                                                     stringByAppendingString:fileExt]];
                               [fileManager moveItemAtURL:temporaryFileLocation
                                                    toURL:localURL
                                                   error:&error];
                               NSError *attachmentError = nil;
                               NSString * uuidString = [[NSUUID UUID] UUIDString];
                               //将附件信息进行打包
                               attachment = [UNNotificationAttachment attachmentWithIdentifier:uuidString
                                                                                           URL:localURL
                                                                                       options:nil
                                                                                         error:&attachmentError];
                               if (attachmentError) {
                                   NSLog(@"%@", attachmentError.localizedDescription);
                               }
                           }
                           
                           completionHandler(attachment);
                       }];
    [task resume];
}

- (NSString *)fileExtensionForMediaType:(NSString *)type {
    NSString *ext = type;
    if ([type isEqualToString:@"image"]) {
        ext = @"jpg";
    }
    if ([type isEqualToString:@"video"]) {
        ext = @"mp4";
    }
    if ([type isEqualToString:@"audio"]) {
        ext = @"mp3";
    }
    return [@"." stringByAppendingString:ext];
}

@end


RJNotificationDemo_iOS10

NotificationServiceExtension 与 NotificationContentExtension 的使用Demo【需要自己配置证书 】

仅做代码展示,需要自己配置相关证书才能运行。
相关文章地址

Demo
[图片上传失败...(image-56ed6f-1630058998315)]

你可能感兴趣的:(【iOS打包报错】Extension打包报错armv7)