iT邦幫忙

2019 iT 邦幫忙鐵人賽

DAY 28
0
Software Development

iOS 從 Objective-c 進化為 Swift 的 30天之旅系列 第 28

[Day 28] Xcode7.2後 Build Settings 默認沒有 Other Linker Flags解決方案

  • 分享至 

  • xImage
  •  

前言

今天第一天上班
在安裝環境SDK時
發現Xcode 突然找不到 Other Linker Flags
上網查才知道7.2以後Build Settings 默認是沒有
那今天我們就來使用code來新增Other Linker Flags

修改project.pbxproj

到你的專案*.xcodeproj
右鍵顯示套件,打開project.pbxproj

收尋buildSettings
加入如下内容:

OTHER_LDFLAGS = (
"-ObjC",
);

加進去以前

046C7718218AC8DE0013C81B /* Debug */ = {
    isa = XCBuildConfiguration;
    buildSettings = {
        ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
        CODE_SIGN_STYLE = Automatic;
        DEVELOPMENT_TEAM = 28Q4D37JZZ;
        ENABLE_BITCODE = NO;
        FRAMEWORK_SEARCH_PATHS = (
            "$(inherited)",
            "$(PROJECT_DIR)/ShortVideo/Resources/TuSDK",
            "$(PROJECT_DIR)/Resources/TuSDK",
        );
        INFOPLIST_FILE = ShortVideo/Info.plist;
        IPHONEOS_DEPLOYMENT_TARGET = 9.0;
        LD_RUNPATH_SEARCH_PATHS = (
            "$(inherited)",
            "@executable_path/Frameworks",
        );
        PRODUCT_BUNDLE_IDENTIFIER = com.upyun.UPYUNShortVideo;
        PRODUCT_NAME = "$(TARGET_NAME)";
        TARGETED_DEVICE_FAMILY = 1;
    };
    name = Debug;
};
046C7719218AC8DE0013C81B /* Release */ = {
    isa = XCBuildConfiguration;
    buildSettings = {
        ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
        CODE_SIGN_STYLE = Automatic;
        DEVELOPMENT_TEAM = 28Q4D37JZZ;
        ENABLE_BITCODE = NO;
        FRAMEWORK_SEARCH_PATHS = (
            "$(inherited)",
            "$(PROJECT_DIR)/ShortVideo/Resources/TuSDK",
            "$(PROJECT_DIR)/Resources/TuSDK",
        );
        INFOPLIST_FILE = ShortVideo/Info.plist;
        IPHONEOS_DEPLOYMENT_TARGET = 9.0;
        LD_RUNPATH_SEARCH_PATHS = (
            "$(inherited)",
            "@executable_path/Frameworks",
        );
        PRODUCT_BUNDLE_IDENTIFIER = com.upyun.UPYUNShortVideo;
        PRODUCT_NAME = "$(TARGET_NAME)";
        TARGETED_DEVICE_FAMILY = 1;
    };
    name = Release;
};

加入以後

046C7718218AC8DE0013C81B /* Debug */ = {
    isa = XCBuildConfiguration;
    buildSettings = {
        ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
        CODE_SIGN_STYLE = Automatic;
        DEVELOPMENT_TEAM = 28Q4D37JZZ;
        ENABLE_BITCODE = NO;
        FRAMEWORK_SEARCH_PATHS = (
            "$(inherited)",
            "$(PROJECT_DIR)/ShortVideo/Resources/TuSDK",
            "$(PROJECT_DIR)/Resources/TuSDK",
        );
        INFOPLIST_FILE = ShortVideo/Info.plist;
        IPHONEOS_DEPLOYMENT_TARGET = 9.0;
        LD_RUNPATH_SEARCH_PATHS = (
            "$(inherited)",
            "@executable_path/Frameworks",
        );
        OTHER_LDFLAGS = "-ObjC";
        PRODUCT_BUNDLE_IDENTIFIER = com.upyun.UPYUNShortVideo;
        PRODUCT_NAME = "$(TARGET_NAME)";
        TARGETED_DEVICE_FAMILY = 1;
    };
    name = Debug;
};
046C7719218AC8DE0013C81B /* Release */ = {
    isa = XCBuildConfiguration;
    buildSettings = {
        ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
        CODE_SIGN_STYLE = Automatic;
        DEVELOPMENT_TEAM = 28Q4D37JZZ;
        ENABLE_BITCODE = NO;
        FRAMEWORK_SEARCH_PATHS = (
            "$(inherited)",
            "$(PROJECT_DIR)/ShortVideo/Resources/TuSDK",
            "$(PROJECT_DIR)/Resources/TuSDK",
        );
        INFOPLIST_FILE = ShortVideo/Info.plist;
        IPHONEOS_DEPLOYMENT_TARGET = 9.0;
        LD_RUNPATH_SEARCH_PATHS = (
            "$(inherited)",
            "@executable_path/Frameworks",
        );
        OTHER_LDFLAGS = "-ObjC";
        PRODUCT_BUNDLE_IDENTIFIER = com.upyun.UPYUNShortVideo;
        PRODUCT_NAME = "$(TARGET_NAME)";
        TARGETED_DEVICE_FAMILY = 1;
    };
    name = Release;
};

老實說我後面發現


選ALL就可以搜尋到
真的是太久沒設定
沒關係就當學了一課


上一篇
[Day 27] Swift Timer 簡易使用介紹
下一篇
[Day 29] Swift 影片MOV轉MP4
系列文
iOS 從 Objective-c 進化為 Swift 的 30天之旅30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言