Search code examples
iosobjective-cxcodetvoslibvlc

Can't build project with MobileVLCKit (XCode)


I'm trying to make a single view application for iOS and tvOS with MobileVLCKit.

  1. I downloaded files from git.
  2. I ran ./buildMobileVLCKit.sh with -f key and got a framework ("MobileVLCKit.framework" folder containing MobileVLCKit binaty and Headers subfolder).
  3. I temporary put the framework into ~/Desktop/FrameworkFolder/
  4. I created new project in XCode, chose "File->Add files" and located the framework.
  5. Added Framework Search Path in Project Options (~/Desktop/FrameworkFolder/, recursive).
  6. Added #import into ViewController.h file.
  7. Added VLCMediaPlayer *vPlayer = [[VLCMediaPlayer alloc] init]; into ViewController.m -> viewDidLoad method.

This is my binary:

imac:~ vlad$ file ~/Desktop/FrameworkFolder/MobileVLCKit.framework/MobileVLCKit 
/Users/vlad/Desktop/FrameworkFolder/MobileVLCKit.framework/MobileVLCKit: Mach-O universal binary with 5 architectures
/Users/vlad/Desktop/FrameworkFolder/MobileVLCKit.framework/MobileVLCKit (for architecture armv7):   current ar archive random library
/Users/vlad/Desktop/FrameworkFolder/MobileVLCKit.framework/MobileVLCKit (for architecture armv7s):  current ar archive random library
/Users/vlad/Desktop/FrameworkFolder/MobileVLCKit.framework/MobileVLCKit (for architecture i386):    current ar archive random library
/Users/vlad/Desktop/FrameworkFolder/MobileVLCKit.framework/MobileVLCKit (for architecture x86_64):  current ar archive random library
/Users/vlad/Desktop/FrameworkFolder/MobileVLCKit.framework/MobileVLCKit (for architecture arm64):   current ar archive random library

When I try to build and run the project I'm getting two types of errors:

  1. If I'm working with AppleTV project:

    ld: in /Users/vlad/Desktop/FrameworkFolder/MobileVLCKit.framework/MobileVLCKit(VLCMediaPlayer.o), building for tvOS, but linking in object file built for iOS, for architecture arm64

    clang: error: linker command failed with exit code 1 (use -v to see invocation)

  2. If I'm working with iOS project:

Undefined symbols for architecture x86_64:
  "_AVAudioSessionCategoryPlayback", referenced from:
      _Start in MobileVLCKit(audiounit_ios.o)
      _Pause in MobileVLCKit(audiounit_ios.o)
  "_AVAudioSessionModeMoviePlayback", referenced from:
      _Start in MobileVLCKit(audiounit_ios.o)
      _Pause in MobileVLCKit(audiounit_ios.o)
  "_AudioComponentFindNext", referenced from:
      _Start in MobileVLCKit(audiounit_ios.o)
  "_AudioComponentInstanceDispose", referenced from:
      _Stop in MobileVLCKit(audiounit_ios.o)

— at the begining, and:

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)
Showing first 200 notices only

— at the end of output. And 155 critical errors between.

I have tried to use precompilled framework as well, same result.

The questions are:

  1. What am I doing wrong?
  2. How can I solve this issue and successfully build and run the project(s)?

Thank you for any help!


Solution

    1. The reason of ld and clang errors was that the Framework and the Library has been built wrong.
    2. The reason of multiple errors during working with iOS project is that required system frameworks has not been included.

    I built the static library using XCode and the issue has been solved!