在 iOS 14 中,当应用程序在 SwiftUI 中启动时,它可以显示 ATT(应用程序跟踪透明度)对话框,如下所示。
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in
// loadAd()
})
} else {
// loadAd()
}
return true
}
Run Code Online (Sandbox Code Playgroud)
但是,在 iOS 15.0 中,它不起作用。苹果文档描述如下。
仅当应用程序状态为:UIApplicationStateActive 时才会提示调用 API。通过应用扩展调用 API 不会提示。 https://developer.apple.com/documentation/apptrackingtransparency/attrackingmanager/3547037-requesttrackingauthorization
如何在 iOS 15 中应用程序启动时显示 ATT 对话框?
2021/9/28更新 我解决如下。
struct HomeView: View {
var body: some View {
VStack {
Text("Hello!")
}.onReceive(NotificationCenter.default.publisher(for: UIApplication.didBecomeActiveNotification)) { …Run Code Online (Sandbox Code Playgroud) 在 React Native 中,可以通过多种方式从 Android 和 iOS 引入本机功能。我一直认为所有可能的方式都受到 Java/Kotlin 和 Objective-C/Swift 等平台相关语言的限制。然而,我注意到即使从 C++ 中仍然可以桥接本机功能(不使用 JSI)。具体来说,我注意到从react-native-builder-bob可以轻松启动一个使用C++ 桥接本机模块的包。
此时我想知道,如果已经可以将 JS 与 C++ 集成,那么 JSI 会引入什么新内容呢?为什么它应该比当前解决方案带来性能改进?
我提前为我的知识匮乏表示歉意,但我真的找不到答案。
我在 ionic 3(旧版)中有一个应用程序,在构建它时,我在文件“GtalkExtensions.pbobjc”的这一部分的 Firebase Messaging 库中收到错误
if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {
[worker release];
}
Run Code Online (Sandbox Code Playgroud)
“OSAtomicCompareAndSwapPtrBarrier”的冲突类型
在需要之前,必须从模块“Darwin.libkern.OSAtomic”导入“OSAtomicCompareAndSwapPtrBarrier”声明
函数“OSAtomicCompareAndSwapPtrBarrier”的隐式声明在 C99 中无效
如何解决这个问题我已经完全删除了cocoapods并测试了几个版本,但没有帮助。
Mac Mini M1 Mac 操作系统 Ventura XCode 14.2
我已经开始在 XCode 12 上使用 AppTrackingTransparency 框架,我的应用程序在 iOS 14 上运行良好,但是当我在 iOS 13 上启动我的应用程序时,出现下一个错误:
dyld: Library not loaded: /System/Library/Frameworks/AppTrackingTransparency.framework/AppTrackingTransparency
Run Code Online (Sandbox Code Playgroud)
我认为是因为以前的 iOS 版本没有这个框架,但它链接到我的应用程序,所以如何仅在 iOS 14 及更高版本上链接这个框架?
我们有一个正在生产的应用程序,报告 ios 15 预热的交互时间(tti)非常长。
TTI = ViewController 加载时间 - mainStartTime
mainStart 时间是在 AppDelegate.swift 的 willFinishLaunchingWithOptions 方法中测量的,如下所示
mainStartTime = Date()
Run Code Online (Sandbox Code Playgroud)
当第一个视图控制器加载时,我们将 tti 测量为
tti = -(mainStartTime.timeIntervalSinceNow)
Run Code Online (Sandbox Code Playgroud)
我们观察到,对于预热场景,mainStartTime 来得非常早(大约在用户启动应用程序之前 2 小时)。
我上网查了一下,但没有找到任何文档。只是想知道预热应用程序时是否可能会调用 willFinishLaunchingWithOptions 方法。
我是反应新手,正在研究反应桥接模块。我只是想知道 RCTConvert 有什么用处以及如何使用它。我正在关注这个网站 链接
请任何人帮助我了解这些东西。
我当前版本的 Fastlane 2.173.0 可以与 XCode 13 配合使用,并构建我的 iOS RN/Native 项目并将其发布到 TestFlight。但是在迁移到 XCode 14 后,我在开始构建时遇到了下一个错误 ( gym)。
[16:56:49]: $ set -o pipefail && xcodebuild -workspace MyProject.xcworkspace -scheme MyProject -configuration Release -destination \'generic/platform=iOS\' -archivePath /Users/vagrant/Library/Developer/Xcode/Archives/2022-10-31/MyProject\\ 2022-10-31\\ 16.56.49.xcarchive archive | tee /var/folders/9l/1ysg9vq51p37q0lgksxhdb9r0000gn/T/fastlane_logs3640665801/gym/MyProject-MyProject.log | xcbeautify\n[16:56:52]: \xe2\x96\xb8 Resolve Package Graph\n[16:56:54]: \xe2\x96\xb8 Resolved source packages\n[16:56:54]: \xe2\x96\xb8 DLog - https://github.com/ikhvorost/DLog @ 1.4.0\n[16:56:54]: \xe2\x96\xb8 PromiseQ - https://github.com/ikhvorost/PromiseQ.git @ 1.7.0\n[16:56:54]: \xe2\x96\xb8 Realm - https://github.com/realm/realm-cocoa.git @ 10.15.1\n[16:56:54]: \xe2\x96\xb8 RealmDatabase - https://github.com/realm/realm-core @ 11.4.1\n[16:57:10]: \xe2\x96\xb8 \xe2\x9a\xa0\xef\xb8\x8f Run script build …Run Code Online (Sandbox Code Playgroud) 我有一个UIView以编程方式创建的子类。
我的应用程序中有纵向和横向模式,使用自动布局。
最初UIView使用 设定框架initWithFrame,但当方向更改为横向时, 的CGRect则UIView停留在纵向模式。
如何提醒子UIView类更改CGRect设备方向?
这是我的初始框架设置代码UIView:
- (id)initWithFrame:(CGRect)frame videoUrl:(NSURL *)videoUrl{
self = [super initWithFrame:frame];
if (self) {
_frame_width = frame.size.width;
int thumbWidth = ceil(frame.size.width*0.05);
_bgView = [[UIControl alloc] initWithFrame:CGRectMake(thumbWidth-BG_VIEW_BORDERS_SIZE, 0, frame.size.width-(thumbWidth*2)+BG_VIEW_BORDERS_SIZE*2, frame.size.height)];
_bgView.layer.borderColor = [UIColor grayColor].CGColor;
_bgView.layer.borderWidth = BG_VIEW_BORDERS_SIZE;
[self addSubview:_bgView];
}
}
Run Code Online (Sandbox Code Playgroud) 我想为我的 iOS React Native 项目启用 Hermes,但出现下一个错误:
In file included from ../ios/Pods/RCT-Folly/folly/Singleton.cpp:35:
../ios/Pods/RCT-Folly/folly/portability/FmtCompile.h:19:10: fatal error: 'fmt/compile.h' file not found
#include <fmt/compile.h>
^~~~~~~~~~~~~~~
Run Code Online (Sandbox Code Playgroud)
我的配置:
System:
OS: macOS 11.6.1
Binaries:
Node: 12.22.7 - /usr/local/bin/node
npm: 6.14.15 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: ^0.66.3 => 0.66.3
Run Code Online (Sandbox Code Playgroud)
我的 Pod 文件:
In file included from ../ios/Pods/RCT-Folly/folly/Singleton.cpp:35:
../ios/Pods/RCT-Folly/folly/portability/FmtCompile.h:19:10: fatal …Run Code Online (Sandbox Code Playgroud)