【问题标题】:Expressplay.framework is giving linking error - xcode - iosExpressplay.framework 给出链接错误 - xcode - ios
【发布时间】:2019-01-01 09:26:48
【问题描述】:

我正在使用 Expressplay SDK 播放 DRM 内容。我已将 Expressplay.framework 链接到我的 iOS 项目。但是在构建它的给链接错误时

.h 和 .mm 文件以下

iosdrm.h 文件

#import <ExpressPlay/ExpressPlay.h>
// import RCTBridgeModule
#import <UIKit/UIKit.h>
#if __has_include(<React/RCTBridgeModule.h>)
#import <React/RCTBridgeModule.h>
#elif __has_include(“RCTBridgeModule.h”)
#import “RCTBridgeModule.h”
#else
#import “React/RCTBridgeModule.h” // Required when used as a Pod in a Swift project
#endif

#define EXP_INIT_ASYNC  1

typedef enum {
  DRMCommandStatus_NO_RESULT = 0,
  DRMCommandStatus_OK,
  DRMCommandStatus_CLASS_NOT_FOUND_EXCEPTION,
  DRMCommandStatus_ILLEGAL_ACCESS_EXCEPTION,
  DRMCommandStatus_INSTANTIATION_EXCEPTION,
  DRMCommandStatus_MALFORMED_URL_EXCEPTION,
  DRMCommandStatus_IO_EXCEPTION,
  DRMCommandStatus_INVALID_ACTION,
  DRMCommandStatus_JSON_EXCEPTION,
  DRMCommandStatus_ERROR
} DRMCommandStatus;

@interface iosdrm : NSObject <RCTBridgeModule>
{
  UIAlertView* alertView;
  NSMutableData *receivedData;
  long responseCode;
  NSMutableArray* proxies;
  NSDictionary * cdvCommand;
}
// @property(nonatomic, readonly) WSB_PlaylistProxy* proxy;
@end

#pragma mark - 私有方法

 WSB_Result EXP_Initialize(void (^callback)(WSB_Result initialization_result))
 {
     // initialize the Wasabi runtime
     WSB_Result result = WSB_Runtime_Initialize();
     if (result != WSB_SUCCESS) {
         NSLog(@"Failed to initialize Wasabi Runtime: %d", result);
         return result;
     }

     // check if we're already personalized, without blocking
     if (WSB_Runtime_IsPersonalized()) return WSB_SUCCESS;

     // personalize in a separate thread
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         // personalize and block until we're done
         WSB_Result result = WSB_Runtime_Personalize(nil, 0);
         NSLog(@"Wasabi Personalization result: %d", result);
         dispatch_async(dispatch_get_main_queue(), ^{ callback(result); });
     });

     return EXP_INIT_ASYNC;
 }

iosdrmManager.mm

#import "iosdrm.h"
#import <Foundation/Foundation.h>
#import <React/RCTLog.h>
// import RCTBridge
#import <React/RCTUtils.h>
#if __has_include(<React/RCTBridge.h>)
#import <React/RCTBridge.h>
#elif __has_include(“RCTBridge.h”)
#import "RCTBridge.h"
#else
#import "React/RCTBridge.h" // Required when used as a Pod in a Swift project
#endif

// import RCTEventDispatcher
#if __has_include(<React/RCTEventDispatcher.h>)
#import <React/RCTEventDispatcher.h>
#elif __has_include(“RCTEventDispatcher.h”)
#import "RCTEventDispatcher.h"
#else
#import "React/RCTEventDispatcher.h" // Required when used as a Pod in a Swift project
#endif

struct Node
{
  WSB_PlaylistProxy* proxy;
};

static void EXP_OnPlaylistProxyEvent(void* instance, const WSB_PlaylistProxy_Event* event)
{
  // instance not used in this example
  switch (event->type) {
    case WSB_PPET_ERROR_NOTIFICATION:
      WSB_PlaylistProxy_ErrorNotificationEvent* e;
      e = (WSB_PlaylistProxy_ErrorNotificationEvent*)event;
      NSLog(@"Error notification from Playlist Proxy: %d, %s",
            e->result, e->error_string);
      break;

    default:
      break;
  }
}

static dispatch_queue_t RCTGetMethodQueueDRM()
{
  // We want all instances to share the same queue since they will be reading/writing the same database.
  static dispatch_queue_t queue;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    queue = dispatch_queue_create("drmQueue", DISPATCH_QUEUE_SERIAL);
  });
  return queue;
}

@implementation iosdrm
@synthesize bridge = _bridge;

// Export a native module
// https://facebook.github.io/react-native/docs/native-modules-ios.html
RCT_EXPORT_MODULE(lstdrm);

- (dispatch_queue_t)methodQueue
{
  return RCTGetMethodQueueDRM();
}

// Export constants
// https://facebook.github.io/react-native/releases/next/docs/native-modules-ios.html#exporting-constants
- (NSDictionary *)constantsToExport
{
  return @{
           @"EXAMPLE": @"example"
         };
}

// Return the native view that represents your React component
- (UIView *)view
{
  return [[UIView alloc] init];
}

 #pragma mark - Private methods

 WSB_Result EXP_Initialize(void (^callback)(WSB_Result initialization_result))
 {
     // initialize the Wasabi runtime
     WSB_Result result = WSB_Runtime_Initialize();
     if (result != WSB_SUCCESS) {
         NSLog(@"Failed to initialize Wasabi Runtime: %d", result);
         return result;
     }

     // check if we're already personalized, without blocking
     if (WSB_Runtime_IsPersonalized()) return WSB_SUCCESS;

     // personalize in a separate thread
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         // personalize and block until we're done
         WSB_Result result = WSB_Runtime_Personalize(nil, 0);
         NSLog(@"Wasabi Personalization result: %d", result);
         dispatch_async(dispatch_get_main_queue(), ^{ callback(result); });
     });

     return EXP_INIT_ASYNC;
 }

在构建时出现以下错误

Undefined symbols for architecture x86_64:
  "_WSB_Runtime_Initialize", referenced from:
      EXP_Initialize(void (int) block_pointer) in iosdrmManager.o
  "_WSB_Runtime_IsPersonalized", referenced from:
      EXP_Initialize(void (int) block_pointer) in iosdrmManager.o
  "_WSB_Runtime_Personalize", referenced from:
      ____Z14EXP_InitializeU13block_pointerFviE_block_invoke in iosdrmManager.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

【问题讨论】:

    标签: ios xcode drm


    【解决方案1】:
    Undefined symbols for architecture x86_64:
    

    似乎建议您为模拟器构建,而不是为实际设备构建。该库可能无法在模拟器上运行(FairPlay 或我知道的任何其他 DRM 库也不行)。确保您正在为实际的 iOS 设备构建(应该有一些 arm 架构的变体)。

    【讨论】:

    • 我正在为实际设备构建,请帮我解决这个问题
    • @OK200 那么您可以尝试启用此功能:samwize.com/2015/01/14/what-is-build-active-architecture-only
    • @OK200 那么你肯定是出于某种原因在为模拟器构建。你能贴一张你的 XCode 顶部栏的截图吗?
    • @OK200 我想你是按播放键来运行它的?是的,它会在删除代码后运行,因为通常你可以很容易地在模拟器上构建,但是 DRM 库是不同的。您是否检查过架构下的构建设置?这是什么设置?
    • 是的,我对此一无所知,直到几周前它还运行良好。
    猜你喜欢
    • 2013-06-29
    • 1970-01-01
    • 1970-01-01
    • 2013-01-20
    • 2013-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多