


Let's talk about how the uniAPP native plug-in on iOS is packaged? (Packaging process sharing)
How is the uniAPP native plug-in packaged on iOS? The following article will talk to you about the uniAPP native plug-in packaging process on iOS. I hope it will be helpful to you!
The beginning of nonsense: uniAPP is packaged using cloud compilation, that is to say, app NextiOS The native part of the code needs to be submitted to the background of uni for compilation. It can be understood that there is a Xcode running environment on the uni server. Of course, the cloud should be completed using the Xcode command. When HBuilderX performs cloud compilation, all local native libraries will be compressed and packaged to the cloud. Finally, the compiled ipa Download the package locally so it can be installed.
1. Static library settings
You can simply familiarize yourself with the project structure based on the Demo downloaded from the uni official website.
1. HBuilder-uniPlugin main project
It can actually be roughly understood as the cloud compilation time All compilation environments of Xcode, why do you say that? You can take a look at all the dependencies of this project.
The number of purely local dependencies is as many as 120, because uni considers the cost of cloud compilation. If all Libraries are uploaded by developers, so the compilation resources will be heavily occupied, so the remote third-party library reserve method is adopted, which can also be learned from the uni background.
The version description of the third-party library that iOS depends on
https://nativesupport.dcloud.net.cn/AppDocs/usemodule/iOSModuleConfig/dependentLibrary
Therefore, when developing uni native plug-ins, you can first refer to whether there is a supported third party on the remote end to avoid compilation symbol conflicts caused by repeated imports. .
Example: For example, the plug-in requires the IJKMediaFramework library of site B (about 160M, which is really large). Then, first check whether the cloud compilation has this library,
It is found that it already exists. Then, at this time, there is no need to submit the local IJKMediaFramework library. You only need to submit the manifest.json of HBuilderX Just check VideoPlayer under configuration.
In this way, the configuration of manifest.json of HBuilderX will tell the cloud compiler to add IJKMediaFramework Come to the project.
2. DCTestUniPlugin static library project
When making a static library, you need to set up support for the static library architecture.
Set under Build Setting -> Architectures
Any iOS Device
What should I do if the static library requires a third-party library?
During development, you will definitely encounter situations that require third-party library support, such as:AFNetWorking, here first check uni Far Whether the client supports it and it is found that the corresponding static library has not been improved, then it needs to be uploaded locally.
Because the self-made static library will eventually be loaded into the environment ofAPP, so the strategy for self-made static libraries to rely on third parties is to add the third-party library .a file Add it to the HBuilder-uniPlugin main project, because the self-made static library needs to import the header file, then add it to Heard Search Paths under the DCTestUniPlugin static library project. Introduction of header files.
HBuilder-uniPlugin Main project
Static library projectHeard Search Paths All functions have been developed, the next step islocal plug-in package Configuration For specific packaging steps, please refer to the link above. The final file directory structure is as follows: 1, WSLUniPlugin is the overall file, which can contain android and ios (it is marked ios instead of iOS on the official website) 2. The ios file contains all required third-party libraries and self-made static libraries. 3 and package.json are related configurations. The internal information of package.json will tell the remote compilation which libraries to load and the folder locations of the libraries. Of course It also includes some configurations, such as which dynamic libraries need to be signed (although you can make your own dynamic libraries, they need to be signed). The above is the basic configuration settings. Because the number of uni cloud compilations per day is limited (about 10 times), and the package size must be less than 40M, the excess number is 2 yuan per time, and the excess volume is 10 yuan per 100M. Is there a little pitfall? In this way, the cost of daily trial and error is extremely high, so I will record it here. Recommended: "uniapp tutorial"2. Configure iOS native plug-inpackage.json
3. package.json directory
{
"name": "WSLUniPlugin",//插件名称
"id": "WSLUniPlugin",//插件ID
"version": "1.0",
"description": "功能描述",//功能描述这里进行功能描述,添加后会在HBuilder下展示
"_dp_type":"nativeplugin",//原生组件类型
"_dp_nativeplugin":{
"ios": {
"plugins": [
{
"type": "component",//插件类型,是功能组件(module)还是视图组件(component)
"name": "wsl-component",//在nvue文件内的标签tag
"class": "WSLComponent" //iOS 原生对象class,继承自 DCUniComponent
},
],
"integrateType": "framework",//自制库类型
"hooksClass": "",这里声明 app 生命周期勾子对象,它会同时响应appDelegate 事件
"frameworks": [
"libAFNetworking.a",//uni远端非储备库,需要标注声明
"Masonry.framework",//Masonry 为uni远端储备库,ios 文件夹里不需要再添加,否则编译出现符号重复错误
],
"embedFrameworks": [
"IDLFaceSDK.framework",//动态库
],
"capabilities": {
"entitlements": {
},
"plists": {
}
},
"plists": {
},
"assets": [
"WSLUniPlugin.xcassets"//图片资源文件,这里填写的是与 ios 文件夹的相对路径,因为 WSLUniPlugin.xcassets 就在 ios 文件里,所以直接写。
],
"privacies": [
],
"embedSwift": false,
"deploymentTarget": "8.0",//支持iOS版本
"validArchitectures": [
"arm64"//架构
],
"parameters": {
},
"resources": [
"WSLUniPlugin.bundle",//这里是一些资源文件,比如 bundle,这里填写的是与 ios 文件夹的相对路径,因为 WSLUniPlugin.bundle 就在 ios 文件里,所以直接写。
]
}
}
}
The above is the detailed content of Let's talk about how the uniAPP native plug-in on iOS is packaged? (Packaging process sharing). For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The annual WWDC has ended, and iOS18 is undoubtedly the focus of everyone's attention. Currently, many iPhone users are rushing to upgrade to iOS18, but various system bugs are making people uncomfortable. Some bloggers said that you should be cautious when upgrading to iOS18 because "there are so many bugs." The blogger said that if your iPhone is your main machine, it is recommended not to upgrade to iOS18 because the first version has many bugs. He also summarized several system bugs currently encountered: 1. Switching icon style is stuck, causing the icon not to be displayed. 2. Flashlight width animation is often lost. 3. Douyin App cannot upload videos. 4. WeChat message push is delayed by about 10 seconds. 5 . Occasionally, the phone cannot be made and the screen is black. 6. Severe fever.

Thanks to netizens Ji Yinkesi, xxx_x, fried tomatoes, Terrence, and spicy chicken drumsticks for submitting clues! According to news on July 27, Apple today re-released the iOS/iPadOS 18 Beta 4 update for developers. The internal version number was upgraded from 22A5316j to 22A5316k. It is currently unclear the difference between the two Beta 4 version updates. Registered developers can open the "Settings" app, enter the "Software Update" section, click the "Beta Update" option, and then toggle the iOS18/iPadOS18 Developer Beta settings to select the beta version. Downloading and installing the beta version requires an Apple ID associated with a developer account. Reported on July 24, iO

Update: Saunders Tech has uploaded a tutorial to his YouTube channel (video embedded below) explaining how to install Fortnite and the Epic Games Store on an iPad outside the EU. However, not only does the process require specific beta versions of iO

According to news on July 31, Apple issued a press release yesterday (July 30), announcing the launch of a new open source Swift package (swift-homomorphic-encryption) for enabling homomorphic encryption in the Swift programming language. Note: Homomorphic Encryption (HE) refers to an encryption algorithm that satisfies the homomorphic operation properties of ciphertext. That is, after the data is homomorphically encrypted, specific calculations are performed on the ciphertext, and the obtained ciphertext calculation results are processed at the same time. The plaintext after state decryption is equivalent to directly performing the same calculation on the plaintext data, achieving the "invisibility" of the data. Homomorphic encryption technology can calculate encrypted data without leaking the underlying unencrypted data to the operation process.

According to news on June 1, technology media AppleInsider published a blog post today, stating that Apple will launch a new navigation function of "Scenes" for the "Freeform" application extension in the iOS18 system, and add new options for object alignment. Introduction to the "Wubianji" application First, let's briefly introduce the "Wubianji" application. The application will be launched in 2022 and has currently launched iOS, iPadOS, macOS15 and visionOS versions. Apple’s official introduction is as follows: “Boundless Notes” is an excellent tool for turning inspiration into reality. Sketch projects, design mood boards, or start brainstorming on a flexible canvas that supports nearly any file type. With iCloud, all your boards

[Click here to go directly to the upgrade tutorial] According to news on May 8, Apple pushed the iOS17.5RC update (internal version number: 21F79) to iPhone users today. This update is 70 days away from the last release. How to upgrade iOS/iPadOS/watchOS/macOS development version and public beta version? To upgrade the iOS/iPadOS17 developer preview version and public beta version, you can refer to the experience shared by friends: Experience Post 1||Experience Post 2||Experience Post 3||Experience Post 4. Starting from the iOS/iPadOS 16.4 Developer Preview Beta 1, you need to register for the Apple Developer Program. After registration, open the system [Settings] [Software Update] to see the upgrade option. Please note that your iPhone or IP

Thanks to netizens Spicy Chicken Leg Burger, Soft Media New Friends 2092483, Handwritten Past, DingHao, Xiaoxing_14, Wowotou Eat Big Kou, Feiying Q, Soft Media New Friends 2168428, Slades, Aaron212, Happy Little Hedgehog, Little Earl, Clues for the little milk cat that eats fish! [Click here to go directly to the upgrade tutorial] According to news on July 24, Apple today pushed the iOS/iPadOS18 developer preview version Beta4 update (internal version number: 22A5316j) to iPhone and iPad users. This update is 15 days after the last release. . Carplay Wallpaper Apple has added wallpapers to CarPlay, covering light and dark modes. Its wallpaper style is similar to iPhone

In the just-concluded European Cup final, did you cheer crazily for the team you supported? In the upcoming Paris Olympics, are you also looking forward to perfectly capturing the highlight moments of each event? Among them, having a high-quality viewing equipment is crucial. The Haqu K2 projector is well-deserved to be a good choice for watching games due to its high cost performance and excellent performance. It not only has high brightness and clear picture quality, but also provides an immersive viewing experience, making every exciting moment of the game feel as if it is close at hand. Are you already attracted by such a device? It will definitely allow you to enjoy the passion and dreams of the Olympic Games at home. The most intimate highlight of Haqu K2 is its 210° super angle adjustment, which makes it convenient to watch movies whether on the ceiling or on the wall.
