Post

Cocoapods 第三方库报mas_makeConstraints:]: unrecognized selector

由于没用use_frameworks!导致pods创建的是静态库,不是framework导致的问题 修改前的的Podfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'MainSubControllerDemo' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for MainSubControllerDemo

  target 'MainSubControllerDemoTests' do
      inherit! :search_paths
    # 返回侧滑适配有导航栏和没导航栏的切换
    pod 'FDFullscreenPopGesture', '~> 1.1'
    pod 'ZJScrollPageView'
    pod 'YYModel'
    pod 'Aspects'
    pod 'Masonry', '~> 1.1.0'
    pod 'MJRefresh', '~> 3.1.13'
  end

  target 'MainSubControllerDemoUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

image

问题1: -[UITableView mas_makeConstraints:]: unrecognized selector sent to instance 0x7f9ee6855000

问题2: Undefined symbols for architecture x86_64: “OBJC_CLASS$_MJRefreshHeader”, referenced from: objc-class-ref in HomeViewController.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

修改成如下的格式后的Podfile就ok了,原因是之前的pod引用的是静态类库,后面这种引用的Library的格式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '9.0'
use_frameworks!

inhibit_all_warnings!
def m_pods

    # 返回侧滑适配有导航栏和没导航栏的切换
    pod 'FDFullscreenPopGesture', '~> 1.1'
    pod 'ZJScrollPageView'
    pod 'YYModel'
    pod 'Aspects'
    pod 'Masonry', '~> 1.1.0'
    pod 'MJRefresh', '~> 3.1.13'
end

target 'MainSubControllerDemo' do
    m_pods
end

image

This post is licensed under CC BY 4.0 by the author.