preface

Disclaimer: This article is for recording configuration notes only!!

Configure Carthage

1. Add it in the project directoryCartfilefile

CD to the project root directory
mxgx:~ mxgx$ cd /Users/mxgx/Documents/GitHub/MyGitHub/JJCListeningBook 
## Create and edit the Cartfile file
mxgx:JJCListeningBook mxgx$ vim Cartfile
Copy the code

2, edit,Cartfilefile

After opening the Cartfile file with the vim Cartfile command:

  • Click on theiKey to enable the editing function, pressescButton to close editing function;
  • Click on theShift + :Press and enterwqPress Enter to exit the editing screen.
## Cartfile file contents, format: github "library author name/library name"
github "Alamofire/Alamofire"
github "SwiftyJSON/SwiftyJSON"
github "ReactiveX/RxSwift"
github "onevcat/Kingfisher"
github "SnapKit/SnapKit"
github "pkluz/PKHUD"
github "mac-cain13/R.swift.Library"
github "hackiftekhar/IQKeyboardManager"
github "scinfu/SwiftSoup"
Copy the code

3,cloneAnd compileframeworkfile

mxgx:JJCListeningBook mxgx$ carthage update --platform ios
*** Fetching SwiftyJSON
*** Fetching IQKeyboardManager
*** Fetching RxSwift
*** Fetching SnapKit
*** Fetching R.swift.Library
*** Fetching Kingfisher
*** Fetching Alamofire
*** Fetching SwiftSoup
*** Fetching PKHUD
*** Checking out PKHUD at "5.3.0"
*** Checking out SwiftSoup at "2.3.0"
*** Checking out Alamofire at "5.0.4"
*** Checking out Kingfisher at "5.13.2"
*** Checking out R.swift.Library at "v5.1.0"
*** Checking out SnapKit at "5.0.1"
*** Checking out RxSwift at "5.1.0"
*** Checking out IQKeyboardManager at "v6.5.5"
*** Checking out SwiftyJSON at "5.0.0"
*** xcodebuild output can be found in /var/folders/21/dw30m9y11l3gnc9v7n2qbcd80000gn/T/carthage-xcodebuild.KkAW9u.log
*** Downloading Kingfisher.framework binary at "5.13.2 - KFImage" Orientation"
*** Downloading RxSwift.framework binary at "Catalyst"
*** Building scheme "Alamofire iOS" in Alamofire.xcworkspace
*** Building scheme "IQKeyboardManager" in IQKeyboardManager.xcodeproj
*** Building scheme "IQKeyboardManagerSwift" in IQKeyboardManager.xcodeproj
*** Building scheme "KingfisherSwiftUI" in Kingfisher.xcworkspace
*** Building scheme "Kingfisher" in Kingfisher.xcworkspace
*** Building scheme "PKHUD" in PKHUD.xcodeproj
*** Building scheme "Rswift-iOS" in R.swift.Library.xcodeproj
*** Building scheme "SnapKit" in SnapKit.xcworkspace
*** Building scheme "SwiftSoup-iOS" in SwiftSoup.xcodeproj
*** Building scheme "SwiftyJSON iOS" in SwiftyJSON.xcworkspace
Copy the code

Configure the r.swift library in Xcode

1. Link static libraries

2, configuration,Run Script

Fifth: / usr/local/bin/Carthage copy – frameworks at 6: $(SRCROOT)/Carthage/Build/iOS/Rswift framework

3. Exclusive configurationR.SwiftThe libraryRun Script

Run the compilation and make sure that function R is defined

R.swift – Rswift resource file link

## r.swift configures the runtime script parameters:
$SRCROOT/rswift is the rswift file path
"$SRCROOT/rswift" generate "$SRCROOT/R.generated.swift"

$TEMP_DIR/rswift-lastrun
$SRCROOT/R.generated.swift
Copy the code

4,Command + Bcompile

After compiling, an r.enerated. swift file will be generated in the root directory of the project. Drag the file into the project and run it again.

Three, error solutions

Error: Couldn’t IRGen expression, no Additional error.

Error content

(lldb) po self
error: Couldn't IRGen expression, no additional error
Copy the code

The reason for the error

This problem is mainly caused by the direct use of the binary Framework downloaded from the official website by Carthage. For example, WHEN I use RxSwift, I do not use the compiled RxSwift, but use the default Settings of Carthage to use the official downloaded RxSwift. So there’s this problem.

The solution

## Use this parameter to update, i.e. do not use existing binary packages:
carthage update --platform iOS --no-use-binaries
Copy the code

Refer to the link

  • Rural Network – Resolve the “Couldn’t IRGen expression” problem in LLDB

Refer to the link

  • GitHub – mac-cain13 – R.swift
  • GitHub – mac-cain13 – R.swift.Library
  • Jane book – the Cherry Tree in front of the door – use and installation of R. Swift
  • Jane Book – Matchmaker clown – install R.swift using Carthage
  • ———-
  • Rural Network – Resolve the “Couldn’t IRGen expression” problem in LLDB