如何从跨平台 PCL 使用 iOS AppTrackingTransparency.ATTrackingManager?

编程入门 行业动态 更新时间:2024-10-17 21:22:58
本文介绍了如何从跨平台 PCL 使用 iOS AppTrackingTransparency.ATTrackingManager?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

所以昨天这一行:

          ATTrackingManager.RequestTrackingAuthorization((status) => {
                     if (status == ATTrackingManagerAuthorizationStatus.Authorized)
                     {
                     }

是工作代码(在我的跨平台 Xamarin.Forms PCL 中).今天 xamarin.ios 收到了更新.

was working code (in my cross-platform Xamarin.Forms PCL). Today xamarin.ios received an update.

在 PCL 项目中,不再找到跟踪管​​理器.Intellisense 不知道它是什么,我无法调试应用程序.

In the PCL project, the tracking manager is not found anymore. Intellisense doesnt know what it is anymore and I cannot debug the app.

它在 xamarin.ios 项目中被识别,但我需要从我的 PCL 访问它.

It is recognized in the xamarin.ios project, but I need to access it from my PCL.

有人遇到同样的问题和/或已经找到了解决方案吗?

Anyone having the same issue and / or has already found a solution?

如何在今天收到之前回滚到 xamarin.ios?

How can I rollback to xamarin.ios before the one I received today?

推荐答案

不需要回滚.作为测试,我更新了

Don't need to rollback. As a test, I updated

Visual Studio(也更新了 Xamarin.iOS).XCode 到 14.5.1.

然后,我向现有的 Xamarin Forms 解决方案添加了一行代码,引用了 AppTrackingTransparency.ATTrackingManager.这被识别为有效代码.我还尝试了 ATTrackingManager,Intellisense 正确地告诉我我需要 using AppTrackingTransparency.

Then I added a line of code to an existing Xamarin Forms solution, that referenced AppTrackingTransparency.ATTrackingManager. This was recognized as valid code. I Also tried just ATTrackingManager, and Intellisense correctly told me I needed using AppTrackingTransparency.

现在就在那里.

该命名空间+类名是特定于 iOS 的,因此必须从特定于 iOS 的项目中引用.(如果它之前在 PCL 中是可引用的,那么这可能是一个错误,后来被更正了;这样的代码在任何其他平台上都会中断.)

That namespace+classname is specific to iOS, so must be referenced from the iOS-specific project. (If it previously was referenceable in the PCL, that was probably a bug that has since been corrected; such code would break on any other platform.)

第一步:

在您的 iOS 项目中,编写引用该类的代码.

In your iOS project, write code that references that class.

第二步:

您需要了解如何使用来自跨平台 Xamarin Forms PCL 的自定义 iOS 代码.

You need to know how to use your custom iOS code from the cross-platform Xamarin Forms PCL.

我不会在这里重复 - 关于该主题有多个问答.
谷歌stackoverflow xamarin 表单调用平台特定代码".

I won't repeat that here - there are multiple Q&As on that topic.
google "stackoverflow xamarin forms call platform specific code".

这篇关于如何从跨平台 PCL 使用 iOS AppTrackingTransparency.ATTrackingManager?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-24 17:44:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1068478.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:平台   PCL   iOS   AppTrackingTransparency   ATTrackingManager

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!