Since I implemented the LINE login function when creating a personal application, We will share the command after the memorandum.
Please take a look at the code on GitHub. -> https://github.com/onishi-app/LINELogin
environment ・ Apple Swift version 5.3 ・ XCode version 12.3 ・ LINE Developers 5.2
I will explain the mounting method from 1.
We have implemented the functions by referring to the following site, so we hope that you will also refer to them. -> Reference site
Basically, you can create it by referring to here.
The flow when I created it is also described below.
(Flow of adding channels to Developer, handling of errors, etc.)
LINE Developers
First of all, go to LINE Developer.
Log in to your LINE account from the login on the upper right.
Scroll down and create a new provider.
Create a provider because you can use any name you like.
Then the provider will be created, so
Create a LINE login channel from the created provider.
Fill in the required fields and create a channel.
When created, the channel ID is defined.
Since you need to enter the bundle ID of the app after creating the channel, Create an app that implements the LINE login function.
For bundle ID, the bundle identifier in the image below is the bundle ID.
If you switch the channel tab to LINE login, there is a place to enter the iOS bundle ID, so
Enter the bundle ID of the app you just created there.
This is the end of LINE Developer.
Then open a terminal. ** * CocoaPods and Homebrew must be installed Please install it in advance. ** **
CocoaPods
Move the directory.
cd /**/**/**/App folder
If you don't know how to operate the terminal If you drag and drop the app folder from Finder after cd, it will be entered automatically.
Create a podfile.
$ pod init
Add the following contents to the Podfile. (It doesn't matter whether you use the Finder or the vi command.)
pod 'LineSDKSwift', '~> 5.0'
Install the pod.
pod install
Carthage
Create and edit a Cartfile. (It doesn't matter whether you use the Finder or the vi command. This time I will describe the operation from vi. )
$ vi Cartfile
Press "i" to enter edit mode. After entering the following command, press "esc"-> ": wq". (** vi command ** You can find the operation method by searching.)
github "line/line-sdk-ios-swift" ~> 5.0
Update when the screen returns.
$ carthage update line-sdk-ios-swift
At this time, if the following error is output, please refer to the article ** here **.
A shell task (/usr/bin/xcrun xcodebuild -workspace /Users/ryosuke/Desktop/project/LINELogin/Carthage/Checkouts/line-sdk-ios-swift/LineSDK.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
Please update again after dealing with the error.
In my case I went a little further, but I got more errors. If you get the following error, please refer to the article ** here **! If you do the part below from "How to make it work" in the article, it will work.
Build Failed
Task failed with exit code 1:
/usr/bin/xcrun lipo -create /Users/ryosuke/Library/Caches/org.carthage.CarthageKit/DerivedData/12.3_12C33/line-sdk-ios-swift/5.7.0/Build/Intermediates.noindex/ArchiveIntermediates/LineSDK/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/LineSDK.framework/LineSDK /Users/ryosuke/Library/Caches/org.carthage.CarthageKit/DerivedData/12.3_12C33/line-sdk-ios-swift/5.7.0/Build/Products/Release-iphonesimulator/LineSDK.framework/LineSDK -output /Users/ryosuke/Desktop/project/LINELogin/Carthage/Build/iOS/LineSDK.framework/LineSDK
This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/4s/408j5zx12f1b7my_mjvm6xw80000gn/T/carthage-xcodebuild.FJHOKm.log
If all goes well, the following log will be output.
MacBook-Pro:LINELogin username$ carthage.sh bootstrap --platform iOS --cache-builds
*** Checking out line-sdk-ios-swift at "5.7.0"
*** No cache found for line-sdk-ios-swift, building with all downstream dependencies
*** xcodebuild output can be found in /var/folders/4s/408j5zx12f1b7my_mjvm6xw80000gn/T/carthage-xcodebuild.YksYHO.log
*** Downloading line-sdk-ios-swift.framework binary at "5.7.0"
*** Building scheme "LineSDKObjCBinary" in LineSDK.xcworkspace
*** Building scheme "LineSDKObjC" in LineSDK.xcworkspace
*** Building scheme "LineSDK" in LineSDK.xcworkspace
MacBook-Pro:LINELogin username$
If you check the directory, you will see that some files have been created. I think that Cartfile and Podfile have been created.
LINELogin is the name of the app I created this time.
$ ls -al
total 48
drwxr-xr-x 14 ******* staff 448 1 11 09:45 .
drwxr-xr-x@ 8 ******* staff 256 1 11 09:04 ..
-rw-r--r--@ 1 ******* staff 6148 1 11 09:32 .DS_Store
drwxr-xr-x 12 ******* staff 384 1 11 09:11 .git
-rw-r--r-- 1 ******* staff 0 1 11 09:19 5.0
-rw-r--r-- 1 ******* staff 40 1 11 09:44 Cartfile
-rw-r--r--@ 1 ******* staff 41 1 11 09:45 Cartfile.resolved
drwxr-xr-x 3 ******* staff 96 1 11 09:45 Carthage
drwxr-xr-x 8 ******* staff 256 1 11 09:04 LINELogin
drwxr-xr-x@ 5 ******* staff 160 1 11 09:10 LINELogin.xcodeproj
drwxr-xr-x@ 5 ******* staff 160 1 11 09:10 LINELogin.xcworkspace
-rw-r--r--@ 1 ******* staff 265 1 11 09:09 Podfile
-rw-r--r--@ 1 ******* staff 330 1 11 09:10 Podfile.lock
drwxr-xr-x 8 ******* staff 256 1 11 09:10 Pods
That's it for using the terminal! thank you for your hard work.
If all goes well, ** LineSDK.framework ** will be created in the following hierarchy.
Project> Carthage> Build> iOS> LineSDK.framework
Put it in XCode> project name> General> Frameworks, Libraries, and ...
Drag and drop.
I chose General earlier,
Select Build Phases and select ** New Run Script Phase ** from +
.
Add the following three to the created Run Script.
· / usr/local/bin/carthage copy-frameworks
・ $ (SRCROOT) /Carthage/Build/iOS/LineSDK.framework
・ $ (BUILT_PRODUCTS_DIR)/$ (FRAMEWORKS_FOLDER_PATH) /LineSDK.framework
Please refer to the image below for the place to add.
Info.plist
The Info.plist file should have been created in the app, so
Control-click> Open As> Source Code.
Insert the following snippet just before the last tag.
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<!--Added URL schema to use when returning to the app from LINE-->
<string>line3rdp.$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<!--Added URL schema to be used when launching LINE from the app-->
<string>lineauth2</string>
</array>
When added, it looks like this.
Now that the installation has been completed, the next step is to install it. The article I referred to is ** here **.
Since I only write the code, I can only write the same content as the reference site, so I will omit it.
It was a difficult process, but I managed to log in.
I've mentioned some of the errors I've encountered, You may get an error other than this article.
Instead of giving up because of an error Please search for the error text! It comes out unexpectedly! (Lol)
Thank you for watching until the end.
-Installation method -Installation error: Utility unknown -Installation error: Architecture duplication workaround -Embedded -Multiple commands produce Compile error workaround Corrective action for errors that occur after implementation -> The file "XXX.entitlements" was not opened.
Recommended Posts