美文网首页
组件化项目-Carthage管理工具

组件化项目-Carthage管理工具

作者: 架构师的一小步 | 来源:发表于2019-06-19 11:25 被阅读0次

    一、Carthage项目管理工具使用?
    第一步:安装/更新Homebrew工具
    1、/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    2、brew install carthage
    如果抱警告:Warning: carthage 0.30.1 is already installed, it's just not linked You can use brew link carthage to link this version.
    3、brew link carthage
    4、brew install carthage
    如果还是报警告:Warning: carthage 0.30.1 is already installed and up-to-date To reinstall 0.30.1, run brew reinstall carthage
    5、brew reinstall carthage
    成功了
    第二步:源码方式->项目安装carthage
    1、在项目根目录新建carthage文件
    命令:touch Cartfile
    2、打开Cartfile文件添加第三方库
    例如:github "rs/SDWebImage"
    3、安装
    carthage update
    可能会静态库编译不过报错,错误信息如下:
    *** Fetching SDWebImage
    *** Checking out SDWebImage at "4.4.2"
    *** xcodebuild output can be found in /var/folders/7w/4gr2dxc57v3656mjgqmv9mkm0000gn/T/carthage-xcodebuild.XWTgwJ.log
    A shell task (/usr/bin/xcrun xcodebuild -workspace /Users/yangshaohong/Desktop/Course/iOS/framework/project/Dream_20180902_TZVideo_02/Carthage/Checkouts/SDWebImage/SDWebImage.xcworkspace CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES -list) failed with exit code 72:
    xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH

            解决方案:为Carthage是先将第三方框架编译成动态库(.framework的二进制文件),所以需要先指定一个编译工具。在Xcode > Preferences > Locations中的下拉菜单里选择命令行工具
    

    一、Carthage项目管理工具使用?
    第一步:安装/更新Homebrew工具
    1、/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    2、brew install carthage
    如果抱警告:Warning: carthage 0.30.1 is already installed, it's just not linked You can use brew link carthage to link this version.
    3、brew link carthage
    4、brew install carthage
    如果还是报警告:Warning: carthage 0.30.1 is already installed and up-to-date To reinstall 0.30.1, run brew reinstall carthage
    5、brew reinstall carthage
    成功了
    第二步:源码方式->项目安装carthage
    1、在项目根目录新建carthage文件
    命令:touch Cartfile
    2、打开Cartfile文件添加第三方库
    例如:github "rs/SDWebImage"
    3、安装
    carthage update
    可能会静态库编译不过报错,错误信息如下:
    *** Fetching SDWebImage
    *** Checking out SDWebImage at "4.4.2"
    *** xcodebuild output can be found in /var/folders/7w/4gr2dxc57v3656mjgqmv9mkm0000gn/T/carthage-xcodebuild.XWTgwJ.log
    A shell task (/usr/bin/xcrun xcodebuild -workspace /Users/yangshaohong/Desktop/Course/iOS/framework/project/Dream_20180902_TZVideo_02/Carthage/Checkouts/SDWebImage/SDWebImage.xcworkspace CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES -list) failed with exit code 72:
    xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH

            解决方案:为Carthage是先将第三方框架编译成动态库(.framework的二进制文件),所以需要先指定一个编译工具。在Xcode > Preferences > Locations中的下拉菜单里选择命令行工具
            
    
    
    
    
    
    
    
    
    
        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        4、继续安装
            carthage update
            安装成功提示如下:
    
    
        5、将Carthage文件导入项目中
            
    
    
    
    
    
        
    
    
    
    
        
        
        6、查看帮助文档,去掉不需要的平台
            命令:carthage help update
            执行结果如下:
    
            
    
        7、按照指定命令选择指定平台
            命令:carthage update --platform iOS
            可选平台如下:macOS、iOS、watchOS、tvOS
            安装成功如下:
    
        8、查看文件夹有没有删除其他平台
            结果如下:
        
            
        9、手动删除
            
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        10、重新更新
            命令:carthage update --platform iOS
            执行成功如下
        11、再看一下文件夹
            目录:Carthage->Build
            结果如下
        12、删除原来引用的Carthage目录,重新导入Carthage目录至项目
    
            
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        13、删除SDWebImage多余文件
    原始目录结构如下                    新的目录结构  
        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
            
    
    
    
    
    
    
    
    
    
    
    第二步:静态库方式(.framework方式)->项目安装carthage
        注意:如果无法导入,配置target
    
        注意:如果运行还是依然报错,报错信息如下
    
    
    
    
    
        解决方案如下:配置成功之后就好了
    
    
    
    
    
    
        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        4、继续安装
            carthage update
            安装成功提示如下:
    
    
        5、将Carthage文件导入项目中
            
    
    
    
    
    
        
    
    
    
    
        
        
        6、查看帮助文档,去掉不需要的平台
            命令:carthage help update
            执行结果如下:
    
            
    
        7、按照指定命令选择指定平台
            命令:carthage update --platform iOS
            可选平台如下:macOS、iOS、watchOS、tvOS
            安装成功如下:
    
        8、查看文件夹有没有删除其他平台
            结果如下:
        
            
        9、手动删除
            
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        10、重新更新
            命令:carthage update --platform iOS
            执行成功如下
        11、再看一下文件夹
            目录:Carthage->Build
            结果如下
        12、删除原来引用的Carthage目录,重新导入Carthage目录至项目
    
            
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        13、删除SDWebImage多余文件
    原始目录结构如下                    新的目录结构  
        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
            
    
    
    
    
    
    
    
    
    
    
    第二步:静态库方式(.framework方式)->项目安装carthage
        注意:如果无法导入,配置target
    
        注意:如果运行还是依然报错,报错信息如下
    
    
    
    
    
        解决方案如下:配置成功之后就好了

    相关文章

      网友评论

          本文标题:组件化项目-Carthage管理工具

          本文链接:https://www.haomeiwen.com/subject/wcfwiqtx.html