Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

This article also participated in the “Digitalstar Project” to win a creative gift package and creative incentive money

The introduction

For better collaborative project management, I’m going to share the third-party library management specification with Cocoapods as an example.

  1. Assign a version number to your PodfilePodfile.lockView basic information about third-party libraries used by the project).
  2. Readme file description for the projectpod update Things that need to be changed later, such as some libraries that are not adapted to the latest system, need to be changed.
  3. If a third-party library cannot be pulled or not maintained for special reasons, it can be placed in a local directory as a local library.

I. Third-party library management specifications

1.1 Modification. Gitignore ignores the Pods directory

There are many reasons to ignore the Pods directory, but here are just a few

  1. MAC pod version is not the same causing the code pod to drop path problem
  2. Reduce warehouse size
  3. Because the SDK static library file libgdtmobsdk. a>110M, the submission to git repository may fail due to the file size limitation, so it is recommended to use. Gitignore to ignore the Pods directory. Pod install –verbose –no-repo-update only installs the newly added libraries and ignores the updated ones. Or update the specified library, other libraries ignore the POD update library name –verbose –no-repo-update
 Pods/

Copy the code

.gitignore can only be ignored for files that have not been traced before, or modified if some files have been versioned. Gitignore is invalid. The solution is to delete the local cache (change it to an untracked state) and commit it so that no files are ignored.

Git rm -r –cached

git init
git rm -r --cached .
git add .
git commit -m "first commit"
git remote add origin The $1
git push -u origin main

Copy the code

Git Merge Code branch management tutorial

Kunnan.blog.csdn.net/article/det…

1.2 Assign a version number to your Podfile

Assign a version number to your Podfile by viewing podfile. lock

II Packing matters needing attention

2.1 pod update What needs to be modified later

QMUIKit

pod 'QMUIKit' ,'4.1.3'

Copy the code

QMUIKit evokes the keyboard stuck main thread for the first time in iOS14

Solution: Since you’re not using QMUITheme, just comment out the following code. Search #import “UITraitCollection+ qmui.h “and return in load

@implementation UIWindow (QMUIUserInterfaceStyleWillChangeNotification)

#ifdef IOS13_SDK_ALLOWED
+ (void)load {
    
    return ;
}

Copy the code

Kunnan.blog.csdn.net/article/det…

Solution: If you don’t use QMUITheme, just comment out the code.

2.2 Includes considerations for extended projects

  1. The version and build of the extension are the same as the main app
  2. Bundle ID and the prefix one of the main app
  3. The extended signature certificate is the same as the signature certificate of the main app. Automatic management is recommended

Common mistakes:

2.3 Configuring Sign

Automatic management certificates are recommended

  1. Profiles is only for real machine debugging, that is, development kits and Ad Hoc.
  2. Directly upload the appStoreConnect backend package,

Compiling first is a good habit. But in fact you just need to clean, archive directly, then choose automatic management certificate on the line.

Certificates can also be automatically managed when you add a production package. The configuration is as follows:

  1. Don’t select a specific certificate for your keystring, choose iOS DIs or iOS Dev

  1. Certificate Description File Provisioning Profile Selects Automatic
  2. Code Signing Identity Select Automatic
  3. Development Team select the Development account you logged in to
 CODE_SIGN_IDENTITY = "iPhone Developer";
 CODE_SIGN_STYLE = Automatic;

Copy the code

IOS developers add a new UDID in the background. How do THEY update the Provisioning Profiles that automatically manage signing certificates?

Kunnan.blog.csdn.net/article/det…

2.4 Use TestFlight tests before launching to ensure that the package is tested.

If you develop and launch packages for different people, the use of TestFlighty becomes a must-have skill for your testing colleagues.

  1. IOS developer account administrator creates a group

  1. IOS developer account administrator adds testers

Select up to 100 testers who will be invited to test all available builds in the TestFlight App. They are also notified when a new build is added. If you don’t see the tester you want to add, go toUsers and FunctionsAdd.

  1. The tester logs in to the mailbox to obtain the invitation code

www.icloud.com/mail/3.2 Open TestFlight and Choose Redeem. 3.3 Enter code and start testing.

III. Examples of integrating third-party libraries as local libraries into a project

3.1 Rich text library

Convert ChainAttributedString to a local library. If you are interested in this library, follow the public id: iOS Reverse

Copy the ChainAttributedString code to the local directory, annotate the ChainAttributedString in the Podfile, and run pod install –verbose –no-repo-update

#pod 'ChainAttributedString' # convert to local library

Copy the code

Modification of header file references

//#import <ChainAttributedString/NSMutableAttributedString+Chain.h>

#import "NSMutableAttributedString+Chain.h"

Copy the code

3.2 Lightweight chart library

Only Line

pod 'ORCharts/Line' 
# change the internal _or_initailizeUI method:
#pod update JPush --verbose --repo-update
Copy the code

IV Related auxiliary scripts

4.1 POD auxiliary scripts

➜ Housekeeper git:(develop) qualify cat ~/bin/knpod#! /bin/sh

This command only installs newly added libraries, ignoring updated libraries

pod install --verbose --no-repo-update
# this command updates only the specified libraries, ignoring other libraries
#pod update library name --verbose --no-repo-update

exit5. 0% ➜ fixtures git:(develop) qualifyCopy the code

4.2 Git Auxiliary Scripts

➜ git: (master) cat ~ / bin/kngit#! /bin/sh
git pull
git status
git add .
The difference between # $1 and $1 is that $1 returns a char array, while $1 returns a string
git commit -m "The $1"
git push
exit 0%                                                                                                                           ➜   git:(master) cat ~/bin/kngitinit
#! /bin/sh
# dirname $0, get the parent directory of the currently executing script file
# CD 'dirname $0', go to this directory (switch current working directory)

# cd `dirname $0` 
#alias gitadd='cd `dirname $0` && git add . && git commit -m /! * && git push'
#! /bin/bash
#
# NOTE: You need to `brew install git` on Mac
# 
# by @kunnan
# https://github.com/zhangkn/KNAlipayWalletTweakDemo
Create a Git repository in your existing project and upload it to the remote repository address
#
# usage: kngitinit SSHURL [email protected]:zhangkn/KNAlipayWalletTweakDemo.git


usage() {
  echo "Create a Git repository in an existing project and upload it to the remote repository address"
  echo
  echo "Usage: $0 {SSHURL}"
}

if [ ! -n "The $1"];then
  echo "Invalid url The $1"
  usage
  exit 1
fi

Delete remote libraries from local directories. Often used to create new project scenarios based on copyxx projects
git remote remove origin

No Spaces for variable assignments
var=The $1
# # * / said to delete the last from the left (the right) a/number and all characters on the left Or delete [email protected]: zhangkn/result is KNAlipayWalletTweakDemo git
var=${var##*/}
#%/* deletes the first/sign and the character on the right, starting from the right
var=${var%.*}
echo "# [$var](https://kunnan.blog.csdn.net/)" >> README.md
#echo "# " >> README.md
git init
git rm -r --cached .
git add .
git commit -m "first commit"
git remote add origin The $1
git push -u origin main
exit0% ➜ Housekeeper git: (master)Copy the code

see also

For more, check out # Applets: iOS Reverse, which presents valuable information only for you, focusing on the mobile technology research field.