ios视频剪辑_iOS 14中的应用剪辑

ios视频剪辑

Apple has announced a new feature for iOS 14 called “App Clips,” which surfaces information from relevant apps throughout the ‌iOS 14‌ interface, without needing to download an entire app. Apple described App Clips as a “small part” of an app designed to be discovered the moment it is needed.

苹果公司宣布了iOS 14的一项新功能,称为“应用剪辑”,该功能可在整个“ iOS 14”界面中显示来自相关应用的信息,而无需下载整个应用。 苹果将​​App Clips描述为旨在在需要时发现的应用程序的“一小部分”。

An App Clip launches instantly and offers some of its associated app’s functionality to users who don’t have the full app installed. It is a lightweight version of your app that offers some of its functionality where and when people need it. They can be used by multiple businesses.

一个应用程序剪辑会立即启动,并向未安装完整应用程序的用户提供其某些相关应用程序的功能。 它是应用程序的轻量级版本,可在人们需要的地方和时间提供某些功能。 它们可以被多个企业使用。

Image for post

Basically, it provides a generic interface for a quick and seamless transition of apps into useful on-the-spot utilities. It’s a way to use a special part of an app on demand. Through a special app clip code, NFC, or a QR code, an App Clip can be summoned. As per an example given in WWDC, let’s say that you’re parking your car at a meter. Using NFC, only the part of a particular app that you need to pay for the parking spot will show up in a box on the bottom of your iPhone. There is support for Apple Pay so you can have your spot paid for in the blink of an eye without tapping in a credit card number, and using “Sign in with Apple,” there is no need to type in an account number.

基本上,它提供了通用界面,可将应用程序快速无缝地转换为有用的现场实用程序。 这是按需使用应用程序特殊部分的一种方式。 通过特殊的应用程序剪辑代码,NFC或QR码,可以调用应用程序剪辑。 根据WWDC中提供的示例,假设您要将汽车停在仪表处。 使用NFC,只有您需要为停车位付费的特定应用程序部分才会显示在iPhone底部的框中​​。 它支持Apple Pay,因此您无需眨眼就可以付款,而无需输入信用卡号,而使用“使用Apple登录”,则无需输入帐号。

Image for post

创建一个应用剪辑 (Creating an App Clip)

With Xcode, you can add an app clip target to your app’s Xcode project and share code and assets between the app clip and app. Like you do with other targets in your project, you use Xcode to build, run, and debug your app clip in a simulator or on a device. In addition, you must configure your web server to enable the system to verify your app clip’s authenticity.

使用Xcode,您可以将应用程序剪辑目标添加到应用程序的Xcode项目中,并在应用程序剪辑和应用程序之间共享代码和资产。 就像处理项目中的其他目标一样,您可以使用Xcode在模拟器或设备上构建,运行和调试应用程序剪辑。 另外,您必须配置Web服务器以使系统能够验证您的应用剪辑的真实性。

Dimensions of an App Clip are -

应用程序剪辑的尺寸为-

Image for post

添加应用剪辑目标 (Add an App Clip Target)

App clips require a corresponding app that offers at least the same functionality as the app clip, and you typically use the same Xcode project for both your full app and your app clip. If you’re starting a new app project, first create a new iOS project with Xcode. If you want to add an app clip to your existing app, open its Xcode project. Then, add an app clip target to the Xcode project:

应用程序剪辑需要一个相应的应用程序,该应用程序至少应提供与该应用程序剪辑相同的功能,并且您通常会对完整应用程序和应用程序剪辑使用相同的Xcode项目。 如果要启动新的应用程序项目,请首先使用Xcode创建一个新的iOS项目。 如果要将应用剪辑添加到现有应用中,请打开其Xcode项目。 然后,将应用剪辑目标添加到Xcode项目:

  1. Add a new target using the App Clip template.

    使用应用剪辑模板添加新目标。
  2. Choose a product name, select applicable options for your app clip, and click Finish.

    选择一个产品名称,为您的应用程序剪辑选择适用的选项,然后单击“完成”。
Image for post

Xcode creates all required files for the options you choose, and adds a target for your app clip with:

Xcode为您选择的选项创建所有必需的文件,并使用以下代码为您的应用剪辑添加目标:

  • A scheme to build and run your app clip and its tests. To build and run your full app, continue using your existing schemes.

    一种构建和运行您的应用程序剪辑及其测试的方案。 要构建和运行完整的应用程序,请继续使用现有方案。
  • A new capability named On Demand Install Capable.

    一种名为“按需安装功能”的新功能。
  • The Parent Application Identifiers Entitlement.

    Parent Application Identifiers Entitlement

  • An app identifier for the app clip, using the full app’s app identifier as its prefix, followed by a string. For example, if your full app’s app identifier is $(AppIdentifierPrefix)com.example.MyApp, the app clip’s app identifier would be $(AppIdentifierPrefix)com.example.MyApp.Clip.

    应用剪辑的应用标识符,使用完整应用的应用标识符作为其前缀,后跟一个字符串。 例如,如果您完整的应用程序的应用程序标识符为$(AppIdentifierPrefix)com.example.MyApp ,则应用程序剪辑的应用程序标识符将为$(AppIdentifierPrefix)com.example.MyApp.Clip

  • The _XCAppClipURL environment variable as part of the app clip’s scheme that allows you to test invocations.

    _XCAppClipURL环境变量是应用程序剪辑方案的一部分,允许您测试调用。

  • Support for the same devices as the full app, not including macOS.

    支持与完整应用程序相同的设备,不包括macOS。

In addition, Xcode creates a new build phase for the app target that embeds the app clip in the app.

此外,Xcode为应用程序目标创建了一个新的构建阶段,该阶段将应用程序剪辑嵌入到应用程序中。

Before you add your own code to the app clip target, run the app clip in the simulator or on a device. At this point, the app clip shows an empty white screen because you haven’t added any code and assets yet.

在将自己的代码添加到应用剪辑目标之前,请在模拟器或设备上运行应用剪辑。 此时,由于您尚未添加任何代码和资产,因此该应用程序剪辑显示空白屏幕。

添加关联的域权利 (Add the Associated Domains Entitlement)

Users launch app clips from invocations that pass an invocation URL to the app clip or, if the user installs the app to replace the app clip, to the full app. No matter which invocations you choose to support, you must add the Associated Domains Entitlement to the app and the app clip targets:

用户从将调用URL传递给应用程序剪辑的调用中启动应用程序剪辑,或者如果用户安装了应用程序以替换应用程序剪辑,则将其传递给完整的应用程序。 无论您选择支持哪种调用,都必须将“ Associated Domains Entitlement添加到应用程序和应用程序剪辑目标中:

  1. Open your project in Xcode; then, in your project settings, enable the Associated Domains capability to add the Associated Domains Entitlement.

    在Xcode中打开您的项目; 然后,在项目设置中,启用“关联域”功能以添加“ Associated Domains Entitlement

  2. For each URL that launches your app clip or full app, add its domain to the Associated Domains capability using this pattern: appclips:<fully qualified domain>. For example, add appclips:example.com.

    对于每个启动您的应用程序片段或完整应用程序的URL,使用以下模式将其域添加到“关联的域”功能中: appclips:<fully qualified domain> 。 例如,添加appclips:example.com

In addition to adding the Associated Domains Entitlement, you must make changes to your server to allow the system to validate your app clip before launch. For more information, see Configuring Your App Clip’s Launch Experience.

除了添加“ Associated Domains Entitlement ,您还必须对服务器进行更改,以允许系统在启动之前验证您的应用剪辑。 有关更多信息,请参见“ 配置App Clip的启动体验”

添加代码和资产 (Add Code and Assets)

App clips make use of the same frameworks as full apps, and adding code or assets to an app clip’s target works just like it does for any other target. Create new source files and assets, or use existing source files and assets as members of the app clip’s target. To ensure the project’s maintainability, both the full app and the app clip should share as much code as possible:

应用程序剪辑与完整应用程序使用相同的框架,并且向应用程序剪辑的目标添加代码或资产的工作方式与对其他任何目标一样。 创建新的源文件和资产,或使用现有的源文件和资产作为应用程序剪辑目标的成员。 为了确保项目的可维护性,完整的应用程序和应用程序剪辑应共享尽可能多的代码:

  • If you create a new app, build it with creating an app clip in mind, and follow best practices that promote a modular code base. For example, create reusable components, bundle them as Swift Packages, and use the packages in both the full app and the app clip.

    如果您创建一个新应用程序,请在创建该应用程序时牢记创建一个应用程序剪辑,并遵循促进模块化代码库的最佳实践。 例如,创建可重复使用的组件,将它们捆绑为Swift软件包,然后在完整应用程序和应用程序剪辑中使用这些软件包。
  • If you add an app clip to an existing app, set aside time to refactor its code base to be modular and share code between the app clip and the full app to avoid duplicating code.

    如果将应用程序剪辑添加到现有应用程序,请预留时间将其代码库重构为模块化,并在应用程序剪辑和完整应用程序之间共享代码,以避免重复代码。
  • Add shared assets to a new asset catalog, and use the catalog in both the full app and the app clip.

    将共享资产添加到新的资产目录,然后在完整应用程序和应用程序剪辑中使用该目录。

使用主动编译条件 (Use Active Compilation Conditions)

When you share code between the app clip and the full app, you may encounter cases where you can’t use some of your app’s code in the app clip. In these cases, take advantage of the Active Compilation Conditions build setting, where you can declare a condition to exclude code.

当您在应用剪辑和完整应用之间共享代码时,您可能会遇到无法在应用剪辑中使用某些应用代码的情况。 在这些情况下,请利用“活动编译条件”构建设置,在其中可以声明排除代码的条件。

Image for post

Start by navigating to your app clip target’s build settings and creating a new value for the Active Compilation Condition build setting; for example, APPCLIP. Then add a check in your shared code, where needed, to exclude code you don’t want to use in your app clip.

首先,导航到您的应用剪辑目标的构建设置,然后为“活动编译条件”构建设置创建一个新值; 例如APPCLIP 。 然后在需要的地方在共享代码中添加一个检查,以排除您不想在应用程序剪辑中使用的代码。

The following code checks for the APPCLIP value you added to the Active Compilation Conditions build setting.

以下代码检查您添加到“活动编译条件”构建设置中的APPCLIP值。

#if !APPCLIP// Code you don't want to use in your app clip.#else// Code your app clip may access.#endif

#if !APPCLIP// Code you don't want to use in your app clip.#else// Code your app clip may access.#endif

Now build, run, and debug your app clip in the simulator or on a device.

现在,在模拟器或设备上构建,运行和调试您的应用剪辑。

对您的服务器和Xcode项目进行更改 (Make Changes to Your Server and Your Xcode Project)

Before the system presents the app clip card or allows the invocation of an app clip, it verifies the app clip’s configuration and the invocation URL. If it’s unable to perform the verification, it doesn’t show the app clip card and the app clip doesn’t launch. To enable the system to verify your app clip, you need to make changes to your web server and your Xcode project.

在系统出示应用程序剪辑卡或允许应用程序剪辑调用之前,系统会验证应用程序剪辑的配置和调用URL。 如果无法执行验证,则不会显示应用剪辑卡,也不会启动应用剪辑。 为了使系统能够验证您的应用剪辑,您需要对Web服务器和Xcode项目进行更改。

First, add an Apple App Site Association file to your server as described in Supporting Associated Domains in Your App. Next, include an entry for the app clip with the appclips key. If you previously added an Apple App Site Association file to your server, add the entry for the appclips key to your existing file.

首先,按照在您的应用程序支持关联域所述,将Apple App Site Association文件添加到您的服务器。 接下来,使用appclips键为应用程序剪辑添加一个条目。 如果您先前已将Apple App Site Association文件添加到服务器,则将appclips项的条目添加到现有文件中。

The following code shows the content to add. Note how the value for the apps key is an array with just one entry—the app clip’s app identifier.

以下代码显示了要添加的内容。 请注意, apps键的值如何是一个只有一个条目(应用剪辑的应用程序标识符)的数组。

{ "appclips": { "apps": ["ABCED12345.com.example.MyApp.Clip"] } ...}

{ "appclips": { "apps": ["ABCED12345.com.example.MyApp.Clip"] } ...}

Finally, in Xcode, add your website’s domain to the Associated Domains Entitlement of both app and app clip.

最后,在Xcode中,将您网站的域添加到应用程序和应用程序剪辑的“ Associated Domains Entitlement中。

配置并响应调用 (Configure and Respond to Invocations)

The system uses URLs you configure in App Store Connect to launch your app clip. Therefore, identifying URLs that launch your app clip, responding to them on launch, and registering them in App Store Connect is essential to creating an app clip. For more information, see Configuring Your App Clip’s Launch Experience and Responding to Invocations.

系统使用您在App Store Connect中配置的URL来启动您的应用程序剪辑。 因此,识别启动应用程序剪辑的URL,在启动时对其进行响应并在App Store Connect中注册它们对于创建应用程序剪辑至关重要。 有关更多信息,请参见配置App Clip的启动体验响应调用

发布您的应用程序剪辑 (Publish Your App Clip)

App clips require a corresponding app. When you’re ready to publish your app clip, submit it as part of your app’s archive. Note that your app clip must pass the App Store review process after you submit it for review.

应用片段需要相应的应用。 准备发布应用剪辑时,请将其作为应用存档的一部分提交。 请注意,您的应用剪辑在提交进行审查后必须通过App Store审查过程。

For details you can refer to a the Sample App Clip code .

有关详细信息,请参阅示例应用剪辑代码

Thanks for going through the article !

感谢您浏览本文!

翻译自: https://medium.com/swlh/ios-14-app-clips-95bfaf2b159c

ios视频剪辑

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值