0%

平时开发中,大部分使用NSDictionaryNSMutableDictionary。下面介绍个特殊的。

  • NSMapTable
  • NXMapTable(objc源码)
阅读全文 »

在OC中,因其动态性我们经常会用到Runtime相关的API,探索一下Runtime在Swift中的注意点

阅读全文 »

最近在网上经常能看到源码编译的文章,整理一下关于源码编译的问题。

阅读全文 »

字典这种数据结构在现代的开发语言中比较常见(PHP叫关联数组)
探索一下其底层原理。

阅读全文 »

代码检测

1
2
3
4
5
6
7
8
9
10
11
12
# 生成用于后续代码检测的解析文件
#!/bin/sh
set +e

source ~/.bash_profile

cd MCShow
export LANG=en_US.UTF-8

swiftlint lint --path MCShow > MCShow-swiftlint.txt

echo $?

环境配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
cd MCShow
export LANG=en_US.UTF-8

# 操作Jenkins打包环境配置

if [ "$Environment" == "ONLINE" ];then
echo "0" > ./domain_config
elif [ "$Environment" == "RELEASE" ];then
echo "1" > ./domain_config
elif [ "$Environment" == "TEST" ];then
echo "2" > ./domain_config
elif [ "$Environment" == "DEV" ];then
echo "3" > ./domain_config
fi

拷贝依赖

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
startInfo="开始引入依赖库"
endInfo="依赖库引入完成"
source ~/.bash_profile
cd MCShow
export LANG=en_US.UTF-8
export https_proxy=http://10.0.72.225:7890 http_proxy=http://10.0.72.225:7890 all_proxy=socks5://10.0.72.225:7890

echo $startInfo
pod install
echo $endInfo
# 拷贝资源库
# targetUmdevicePath="./Pods/UMDevice/UMDevice_1.1.0/UMDevice.framework/"
# srcUmdevicePath="../Resource/libs/UMDevice.framework/"
# rm -rf $targetUmdevicePath
# cp -r $srcUmdevicePath $targetUmdevicePath

# 拷贝融云资源
targetRongcloudPath="./Pods/RongCloudIM/RongCloudIM/RongCloud.bundle/"
srcRongcloudPath="../Resource/RongCloud.bundle/"
rm -rf $targetRongcloudPath
cp -r $srcRongcloudPath $targetRongcloudPath

分发

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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
offical="Fir.im-Official"
standby="Fir.im-Standby"
testflight="TestFlight"
source ~/.bash_profile
cd MCShow
export LANG=en_US.UTF-8

echo "授权钥匙串访问权限"
security unlock-keychain -p 111111 $HOME/Library/Keychains/login.keychain

echo "开始打包"

checkIpa(){
fileName="MCShow.ipa"
filePath="app/$fileName"
fileCreateTimeInterval=`date -r "$filePath" +%s`
nowTimeInterval=`date +%s`
diff=$(($fileCreateTimeInterval-$nowTimeInterval))
if [ 0 -gt $diff ];then
let diff=0-$diff
fi
limitTimeInterval=1800
if [ $diff -gt $limitTimeInterval ];then
echo "安装包检测有问题";
exit 2005
fi
}

firPublish(){
fir publish app/MCShow.ipa --token=$1 --specify-icon-file=fastlane/logo.jpg --changelog=$ReleaseNotes
}


if [ "$ShowPlatform" == "$offical" ];then
echo $offical;
fastlane archive;
echo "打包结束"
checkIpa;
firPublish 9e878f3339b1c1efb036ccf17ca96072;
elif [ "$ShowPlatform" == "$standby" ];then
echo $standby;
fastlane archive;
echo "打包结束"
checkIpa;
firPublish 909f3f4743198a622a0540c0685beab7;
elif [ "$ShowPlatform" == "$testflight" ];then
echo $testflight;
fastlane beta;
echo "打包结束"
fi

通知

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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
cd MCShow
export LANG=en_US.UTF-8
source ~/.bash_profile
appName=""
appVersion=""
appBuild=""
appBundleId=""
platform="iOS"

getAppInfo(){
basePath=`pwd`
ipaFilePath="$basePath/app/MCShow.ipa"
if [ ! -f "$ipaFilePath" ]; then
echo "未找到ipa包 $ipaFilePath"
exit 2002
fi

temIpaDirName="TempPayload"
temIpaDirPath="${basePath}/${temIpaDirName}"

if [ -d "$temIpaDirPath" ]; then
rm -rf "${temIpaDirPath}"
fi

if [[ -f "$ipaFilePath" ]]; then
unzip "$ipaFilePath" -d "$temIpaDirPath"
fi

appDir="$temIpaDirPath/Payload/`ls "$temIpaDirPath/"Payload`"
lcmInfoPlist="${appDir}/Info.plist"

appName=`/usr/libexec/PlistBuddy -c "Print :CFBundleDisplayName" $lcmInfoPlist`
appVersion=`/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" $lcmInfoPlist`
appBuild=`/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" $lcmInfoPlist`
appBundleId=`/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" $lcmInfoPlist`

if [ -d "$temIpaDirPath" ]; then
rm -rf "${temIpaDirPath}"
fi
}

getAppInfo


offical="Fir.im-Official"
standby="Fir.im-Standby"
testflight="TestFlight"

if [ "$ShowPlatform" == "$testflight" ];then
exit 2001
fi

#钉钉通知
accessToken="c50924ce66e3f842e454089c2f6e75222892d56e9e7f143ef8c235539a66f984"
iconUrl="https://tva1.sinaimg.cn/large/008eGmZEly1gomwuhsuu7j305k05k748.jpg"
downloadUrl="http://fir.renchengqi.com/showios"

if [ "$ShowPlatform" == "$offical" ];then
downloadUrl="http://fir.hulai.com/shai"
accessToken="c50924ce66e3f842e454089c2f6e75222892d56e9e7f143ef8c235539a66f984"
fi

url="https://oapi.dingtalk.com/robot/send?access_token=$accessToken"
header="Content-Type: application/json"

title="$appName($platform)更新"
text="[$appName($platform)更新]($downloadUrl)\n\n \
![$appName]($iconUrl)\n\n \
链接:[$downloadUrl]($downloadUrl)\n\n \
版本: $appVersion (Build: $appBuild)\n\n \
更新内容: $ReleaseNotes\n\n \
Git记录: [https://jenkins.hulai.com/view/shai/job/shai-ios/${BUILD_NUMBER}/changes](https://jenkins.hulai.com/view/shai/job/shai-ios/${BUILD_NUMBER}/changes)\n"

rawData="{ \"msgtype\":\"actionCard\", \
\"actionCard\": { \
\"title\": \"$title\", \
\"text\": \"$text\", \
\"hideAvatar\": \"0\", \
\"btnOrientation\": \"0\", \
\"singleTitle\": \"\" \
} \
}"

curl --request POST "$url" -H "$header" --data-raw "$rawData"

在使用C/C++/OC语言中,经常会用到指针的语法,也理解指针的意义。
在Swift中,将指针包装成不安全指针类型

阅读全文 »

内存访问冲突产生条件

  • 至少一个是写入操作
  • 它们访问的是同一块内存
  • 它们的访问时间重叠(比如在同一个函数内)
阅读全文 »

TODO:

功能点:

  • 媒体(图片/视频/音频)捕捉功能(采集)
  • 截屏(只支持MacOS)

捕捉会话:AVCaptureSession
捕捉设备:AVCaptureDevice
捕捉设备输入:AVCaptureDeviceInput
捕捉设备输入:AVCaptureOutput(抽象类)
AVCaptureStillImageOutput
AVCaptureMovieFileOutput
AVCaptureAudioDataOutput
AVCaptureVideoDataOutput
捕捉连接:AVCaptureConnection
捕捉预览:AVCaptureVideoPreviewLayer