Skip to content

Commit

Permalink
同步旧博客
Browse files Browse the repository at this point in the history
  • Loading branch information
dsencheng committed Jul 13, 2023
1 parent 306e98a commit 80a43f8
Show file tree
Hide file tree
Showing 33 changed files with 2,725 additions and 1,786 deletions.
2 changes: 1 addition & 1 deletion archetypes/default.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
draft: false
tags: []
categories: []
---
Expand Down
Binary file added content/images/15960888405946.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/images/15960900655226.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/images/15960902123521.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/images/15960903221998.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/images/15960917465536.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions content/posts/cocoapods/cocoapods-pod-command.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: "Cocoapods之pod命令"
date: 2019-11-26T16:24:10+08:00
draft: false
tags: ["Cocoapods"]
categories: ["Cocoapods"]
---

`pod init`
初始化

`pod install`
安装/更新库

`pod lib lint`
验证lib合法性

`pod lib lint --verbose --use-libraries --allow-warnings -- sources='私有仓库repo地址,https://github.com/CocoaPods/Specs'`
验证多仓库lib

`pod spec lint`
验证spec合法性

`pod spec lint --verbose --use-libraries --allow-warnings -- sources='私有仓库repo地址,https://github.com/CocoaPods/Specs'`
验证多仓库spec

`pod repo push DCSpecs name.podspec --use-libraries --allow-warnings`
向DCSpecs推送DCServices库

`pod repo push MCLib MCAppKit.podspec --verbose --use-libraries --allow-warnings`
强制推送

以上命令均可选参数,
`--use-libraries`使用静态库
`--allow-warnings`允许警告
62 changes: 62 additions & 0 deletions content/posts/cocoapods/cocoapods-podspec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: "Cocoapods之podspec文件"
date: 2019-07-17T16:21:07+08:00
draft: false
tags: ["Cocoapods"]
categories: ["Cocoapods"]
---


```text
#名字
s.name = 'Chat2Love'
#版本号,更新发布内容最好更新版本号
s.version = '0.1.0'
#简介说明
s.summary = 'A short description of Chat2Love.'
#详细说明
s.description = ''
#主页,通常是github项目地址
s.homepage = 'https://github.com/dsencheng/Chat2Love'
#屏幕快照链接
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
#协议
s.license = { :type => 'MIT', :file => 'LICENSE' }
#作者
s.author = { 'dsencheng' => 'dsencheng@gmail.com' }
#源码地址
s.source = { :git => 'https://github.com/dsencheng/Chat2Love.git', :tag => s.version.to_s }
#社交信息
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
#开发版本
s.ios.deployment_target = '8.0'
#暴露的文件,举例:`/*.h` 仅暴露.h文件。 `/*.{h,m} ` 仅暴露.h和.m文件
s.source_files = 'Chat2Love/Classes/**/*'
#资源文件
# s.resource_bundles = {
# 'Chat2Love' => ['Chat2Love/Assets/*.png']
# }
#暂未用到
# s.public_header_files = 'Pod/Classes/**/*.h'
#需要使用到的系统库
# s.frameworks = 'UIKit', 'MapKit'
# 需要依赖的三方库,支持指定版本,不支持指定地址。可在podfile文件中指定地址。
# s.dependency 'AFNetworking', '~> 2.3'
#静态库
#s.static_framework = true
# 依赖的系统静态库
#s.library = 'c++', 'resolv'
# build setting中的配置
#s.ios.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-lObjC', 'ENABLE_BITCODE' => false, }
# 子库,会有不同的文件夹
# s.subspec 'Sub' do | b |
# b.source_files = 'Chat2Love/Classes/**/*'
# end
# 引用其他的库,不建议样写,pod中引用framework文件会报错。
# s.ios.vendored_frameworks = 'Ali/Classes/AliRTCSdk.framework','Ali/Classes/UTDID.framework'
# 引用其他的库,建议写法
# s.subspec 'AliRTC' do | sub_rtc |
# sub_rtc.ios.vendored_frameworks = 'Ali/Classes/AliRTCSdk.framework','Ali/Classes/UTDID.framework'
# end
```
135 changes: 135 additions & 0 deletions content/posts/cocoapods/cocoapods-private.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---
title: "Cocoapods之创建私有库"
date: 2019-07-06T15:49:41+08:00
draft: false
tags: ["Cocoapods"]
categories: ["Cocoapods"]
---


**本文以创建名为"DCServices"的私有库为例。**


1. 打开任意终端工具,进入你的工作目录,输入命令 `pod lib create DCServices`,按照提示回答问题,即可完成lib项目的创建工作。

```
~ pod lib create DCServices
Cloning `https://github.com/CocoaPods/pod-template.git` into `DCServices`.
Configuring DCServices template.
------------------------------
To get you started we need to ask a few questions, this should only take a minute.
If this is your first time we recommend running through with the guide:
- https://guides.cocoapods.org/making/using-pod-lib-create.html
( hold cmd and click links to open in a browser. )
What platform do you want to use?? [ iOS / macOS ]
ios
What language do you want to use?? [ Swift / ObjC ]
objc
Would you like to include a demo application with your library? [ Yes / No ]
yes
Which testing frameworks will you use? [ Specta / Kiwi / None ]
none
Would you like to do view based testing? [ Yes / No ]
no
What is your class prefix?
DC
Running pod install on your new library.
Analyzing dependencies
Downloading dependencies
Installing DCServices (0.1.0)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `DCServices.xcworkspace` for this project from now on.
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
Ace! you're ready to go!
We will start you off by opening your project in Xcode
open 'DCServices/Example/DCServices.xcworkspace'
To learn more about the template see `https://github.com/CocoaPods/pod-template.git`.
To learn more about creating a new pod, see `https://guides.cocoapods.org/making/making-a-cocoapod`.
```

2. 创建完成后会自动打开Xcode工程,依次展开左侧列表 `Pods > Development Pods > DCServices` ,找到 `ReplaceMe.m` 文件后删除它。

3.`DCServices` 中创建名为 `DCTest``.h``.m` 文件,存放路径选择 `...\DCServices\Classes\` ,完成后添加测试方法。



**DCTest.h**

```
@interface DCTest : NSObject
- (void)test;
@end
```

**DCTest.m**

``````
@implementation DCTest
-(void)test {
NSLog(@"test");
}
@end
``````

4. 回到终端,进入 `DCServices/Example` , 执行 `pod install`

``````
~/GitHub cd DCServices/Example
~/GitHub/DCServices/Example pod install
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
``````

5. 打开 `Example for DCServices` 中的 `DCViewController.m` 文件,导入DCTest.h,并使用测试方法。

``````
#import "DCViewController.h"
#import "DCTest.h";
@interface DCViewController ()
@end
@implementation DCViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
DCTest *obj = [DCTest new];
[obj test];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
``````
@end

6. 选择模拟器或真机运行,Console窗口中输出 'test',到此项目创建完成。
50 changes: 50 additions & 0 deletions content/posts/cocoapods/cocoapods-publish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: "Cocoapods之私有库发布及使用"
date: 2010-07-13T16:18:22+08:00
draft: false
tags: ["Cocoapods"]
categories: ["Cocoapods"]
---

本文以github为例
1、打开你的github主页,选择 `New repository` .

> a. `Repository name` 填写 `DCSpecs`
> b. `Description` 可以不填写。
> c. 选择 `Private``Public`
> d. 勾选 `Initialize this repository with a README`
> e. 点击 `Create repository` 按钮。
2、打开终端,进入目录,执行命令

```text
pod repo add DCSpecs https://github.com/dsencheng/DCSpecs.git
```

3、执行成功后,可以进入目录查看 `~/.cocoapods/repos/` ,是否有`DCSpecs`文件夹。

4、在`DCServices.podspec`文件目录,推送私有库。

```text
pod repo push DCSpecs DCServices.podspec
```

> `DCServices``code`
> `DCSpecs` 是管理和记录。它会记录`DCServices``0.1.0``0.1.1` ... `1.5.3`
> 写命令时,注意区分`DCServices``DCSpecs`
5、在项目中引入私有库。打开你开发的项目,如果没有`Podfile`,请先初始化。添加内容

```text
source 'https://cdn.cocoapods.org/'
source 'https://github.com/dsencheng/DCSpecs.git'
platform :ios, ‘9.0’
target “your_target_name”
do
pod 'DCServices'
end
```

打开终端在当前项目目录执行`pod install`完成!

0 comments on commit 80a43f8

Please sign in to comment.