Discuss hardware-specific topics related to iPad.

Posts under iPad tag

127 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Wired data transfer between an app on two iOS/iPadOS devices--Possible or pipe dream?
If two iOS/iPadOS devices have your app opened, is it possible to have the apps send data to each other over a wired connection? E.g. If two iPhone 15s are connected by USB-C, can I get my app in iPhone A to send data to iPhone B and vice-versa? I've been looking around for quite a while now and at this point I just want to know if it's technically feasible.
5
0
827
Feb ’24
NetworkExtension - NEIPC: SIGNAL 5 Trace/BPT trap, Help!!
Hello, Sometimes I need to send a message via sendMessageToProvider to tell the proxy service in NetworkExtension that it should be restarted It looks like this: self.sendMessageToProvider("restart"...) { resp if resp != "ok" { // stopVPNTunnel()... } } Then accept the request in NetworkExtension, which looks like: open override func handleAppMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)?) { reasserting = true setTunnelNetworkSettings(nil) { error in startTunnel() { reasserting = false completionHandler("ok"...) } } } But NetworkExtension crashes occasionally and I spent a long time looking for the cause but found nothing. Where should I start? Date/Time: 2023-06-17 08:01:38.2104 +0800 Launch Time: 2023-06-17 08:01:06.5706 +0800 OS Version: iPhone OS 16.5 (20F66) Release Type: User Baseband Version: 3.70.01 Report Version: 104 Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x000000022a76b2d0 Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [38097] Triggered by Thread: 0 Thread 0 name: Thread 0 Crashed: 0 libxpc.dylib 0x000000022a76b2d0 _xpc_api_misuse + 80 (debug.c:71) 1 libxpc.dylib 0x000000022a75c918 xpc_dictionary_set_value + 128 (dictionary.c:1849) 2 libxpc.dylib 0x000000022a75d888 xpc_dictionary_set_data + 60 (dictionary.c:1983) 3 NetworkExtension 0x00000001e1d69978 __35-[NEIPC handleMessage:withHandler:]_block_invoke + 112 (NEIPC.m:47) 4 PacketTunnel 0x0000000104f5be7c thunk for @escaping @callee_unowned @convention(block) (@unowned NSData?) -> () + 60 (<compiler-generated>:0) 5 PacketTunnel 0x0000000104f5bd4c MyPacketTunnelProvider.responseMessage(msg:completionHandler:) + 96 (MyPacketTunnelProvider.swift:188) 6 PacketTunnel 0x0000000104f5bd4c closure #1 in closure #1 in MyPacketTunnelProvider.handleAppMessage(_:completionHandler:) + 244 (MyPacketTunnelProvider.swift:178) 7 PacketTunnel 0x0000000104f5d808 closure #1 in closure #1 in closure #1 in MyPacketTunnelProvider.startTunnel(config:completionHandler:) + 12 (MyPacketTunnelProvider.swift:54) 8 PacketTunnel 0x0000000104f5d808 partial apply for closure #1 in closure #1 in closure #1 in MyPacketTunnelProvider.startTunnel(config:completionHandler:) + 32 (<compiler-generated>:0) 9 PacketTunnel 0x0000000104f5f720 closure #1 in closure #1 in xxxx.start(config:packetFlow:startCompletion:stoppedCompletion:) + 188 (xxxx.swift:140) 10 PacketTunnel 0x0000000104f5b4f0 thunk for @escaping @callee_guaranteed () -> () + 28 (<compiler-generated>:0) 11 libdispatch.dylib 0x00000001d1e21320 _dispatch_call_block_and_release + 32 (init.c:1518) 12 libdispatch.dylib 0x00000001d1e22eac _dispatch_client_callout + 20 (object.m:560) 13 libdispatch.dylib 0x00000001d1e316a4 _dispatch_main_queue_drain + 928 (queue.c:7794) 14 libdispatch.dylib 0x00000001d1e312f4 _dispatch_main_queue_callback_4CF + 44 (queue.c:7954) 15 CoreFoundation 0x00000001ca9ebc28 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1780) 16 CoreFoundation 0x00000001ca9cd560 __CFRunLoopRun + 1992 (CFRunLoop.c:3147) 17 CoreFoundation 0x00000001ca9d23ec CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418) 18 Foundation 0x00000001c4c52fd4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373) 19 Foundation 0x00000001c4c52e68 -[NSRunLoop(NSRunLoop) run] + 64 (NSRunLoop.m:398) 20 libxpc.dylib 0x000000022a761678 _xpc_objc_main + 496 (main.m:246) 21 libxpc.dylib 0x000000022a763924 xpc_main + 156 (init.c:1258) 22 Foundation 0x00000001c4c9a930 -[NSXPCListener resume] + 312 (NSXPCListener.m:460) 23 PlugInKit 0x00000001f1177e90 -[PKService run] + 356 (PKService.m:197) 24 PlugInKit 0x00000001f1164628 +[PKService main] + 536 (PKService.m:119) 25 PlugInKit 0x00000001f116393c +[PKService _defaultRun:arguments:] + 16 (PKService.m:244) 26 ExtensionFoundation 0x00000001d7fa5540 EXExtensionMain + 252 (EXExtensionMain.m:34) 27 Foundation 0x00000001c4cdee00 NSExtensionMain + 204 (NSExtensionMain.m:21) 28 dyld 0x00000001e9ed2dec start + 2220 (dyldMain.cpp:1165)
5
0
735
Jan ’24
iOS 16: NavigationPath is cleared upon backgrounding of app
On iOS 16 (16.4 specifically) and not iOS 17, I am running into an issue where navigationPath in MyNavigationViewModel is cleared when my app is backgrounded. I seemingly couldn't find much discussion around this happening. I'm hoping there is a work around and this is not intended, as the larger project I am working on depends on the state of navigationPath persisting despite being backgrounded. Note: Since I am working on a larger project, so I'm trying to mimic it's structure, which is why I am doing things like passing my view model as an environment object, and having a button in the side bar to push the initial view on to the navigation destination. To reproduce and observe the issue using the sample code below: Swipe from the left edge of the screen to open the side bar (not sure why applying the .balanced style is not having the sidebar displace the detail view, but that's a separate issue I'm not concerned about...) Click the button "Present Detail View" Background the app Wait some time (you will be able to see the print statement in the didSet print out a count of 0 for navigationPath) Reopen the app Observe the Base detail view is displayed, as opposed to the view that was pushed by pressing the side bar button. The navigation path was cleared. Any advice on how to deal with this issue? public class MyNavigationViewModel: ObservableObject { @Published var navigationPath: [MyType] = [] { didSet { print("Count: \(self.navigationPath.count)") } } } public struct MyType: Hashable { public var string: String } public struct MyDestination: View { @EnvironmentObject var viewModel: MyNavigationViewModel var text: String let onBackPressed: ()->() let onNextPressed: ()->() public var body: some View { VStack { HStack { Button(action: { self.onBackPressed() }, label: {Text("Back")}) Button(action: { self.onNextPressed() }, label: {Text("Next")}) } Text("String: \(self.text).") } } } @available(iOS 16.0, *) public struct MyNavigationView: View { @EnvironmentObject var viewModel: MyNavigationViewModel public var body: some View { NavigationSplitView( sidebar: { VStack { Button( action: { self.$viewModel.navigationPath.wrappedValue.append(MyType(string: "Hello")) }, label: { Text("Present Detail View") } ) } }, detail: { NavigationStack(path: self.$viewModel.navigationPath) { Group { Text("This is the detail base view.") } .navigationDestination(for: MyType.self) { data in MyDestination ( text: data.string, onBackPressed: { if(self.$viewModel.navigationPath.wrappedValue.count > 0) { self.$viewModel.navigationPath.wrappedValue.removeLast() } }, onNextPressed: { self.$viewModel.navigationPath.wrappedValue.append(MyType(string: "This is the next thing")) } ) } } } ) .navigationSplitViewStyle(.balanced) .environmentObject(self.viewModel) } } @available(iOS 16.0, *) struct ContentView: View { var body: some View { MyNavigationView().environmentObject(MyNavigationViewModel()) } } @available(iOS 16.0, *) struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
1
0
494
Dec ’23
Problems with csv-Import
I want to import a csv-file to my app. It works when I use the Simulator but when I try to import the same file on my iPad, the follwowing message occurs: UserInfo={NSFilePath=/private/var/mobile/Containers/Shared/AppGroup/4C49BACA-5490-45A4-A8DF-6D47711CFC34/File Provider Storage/LUSD 3.csv, NSUnderlyingError=0x2812068e0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}. Where do I find the right settings to enable the import of this csv-file?
2
0
571
Dec ’23
Guideline 2.1 - Performance - App Completeness
We were still unable to review your app as it crashed on launch. We have attached detailed crash logs to help troubleshoot this issue. While we appreciate that your app is intended primarily for use on iPhone, in order to bring your app into compliance with App Store guidelines, all apps designed for use on iPhone must still be formatted correctly and behave properly when run on iPad. Review device details: Device type: iPad OS version: iOS 17.2 crashlog-82A3D8C6-0136-4C68-A006-6A4AE49B1D1C.txt crashlog-DBA3D1B0-5760-4B47-8FE7-DE44C570271A.txt crashlog-C30814D5-13BC-40FE-92EC-89E736FA7F1B.txt my app crashed only on iPad mini 6th generation its run fine on all other iPad's
1
0
742
Apr ’24
Launch Issue - Blank Screen - Specifically, your app landed on a blank screen. No content was loading.
** I am having this issue when publishing my app in appstore and this issue does not appear in any simulator or on a real device when doing internal testing with test flight. But when testing with public link some times it shows the blank screen and after kill and re open the app for few times it works. Do any one have solution for this? I tried so many options but not worked. ** Guideline 2.1 - Performance - App Completeness We discovered one or more bugs in your app. Specifically, your app landed on a blank screen. No content was loading. Please review the details below and complete the next steps. Steps to reproduce: Launch Review device details: Device type: iPad OS version: iOS 17.1.2 Next Steps Please run your app on a device to reproduce the issues, then revise and submit your app for review. If at first you're unable to reproduce the issue, try the following: For new apps, uninstall all previous versions of your app from a device, then install and follow the steps to reproduce. For app updates, install the new version as an update to the previous version, then follow the steps to reproduce. If we misunderstood the intended behavior of your app, please reply to this message in App Store Connect to provide information on how these features were intended to work. Resources For information about testing apps and preparing them for review, see Testing a Release Build. To learn about troubleshooting networking issues, see About Networking. Watch a video from App Store Review with tips for preventing common rejections. Please see attached screenshot for details.
1
0
582
Dec ’23
UIImagePickerController crashes on M2 Mac
if UIImagePickerController.isSourceTypeAvailable(.camera) { let imagePicker = UIImagePickerController() imagePicker.delegate = self imagePicker.allowsEditing = false imagePicker.sourceType = .camera self.present(imagePicker, animated: true, completion: nil) } this code crashes on M2 Mac (Designed for iPad) with the following exception <<<< FigCaptureCameraParameters >>>> Fig assert: "success" at bail (FigCaptureCameraParameters.m:249) - (err=0) An uncaught exception was raised *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0] ( 0 CoreFoundation 0x0000000180b02800 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x00000001805f9eb4 objc_exception_throw + 60 2 CoreFoundation 0x0000000180a1a724 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 728 3 CoreFoundation 0x0000000180a1a420 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 52 4 AVFCapture 0x000000019de90374 -[AVCaptureFigVideoDevice _cameraInfo] + 200 5 AVFCapture 0x000000019de90278 -[AVCaptureFigVideoDevice updateStreamingDeviceHistory] + 36 6 AVFCapture 0x000000019deec8c0 -[AVCaptureSession _startFigCaptureSession] + 464 7 AVFCapture 0x000000019def0980 -[AVCaptureSession _buildAndRunGraph:] + 1936 8 AVFCapture 0x000000019deecc00 -[AVCaptureSession _setRunning:] + 120 9 AVFCapture 0x000000019deec46c -[AVCaptureSession startRunning] + 452 10 libRPAC.dylib 0x00000001051c9024 _replacement_AVCaptureSession_startRunning + 104 11 libdispatch.dylib 0x000000010509cf14 _dispatch_call_block_and_release + 32 12 libdispatch.dylib 0x000000010509eb4c _dispatch_client_callout + 20 13 libdispatch.dylib 0x00000001050a7cd8 _dispatch_lane_serial_drain + 864 14 libdispatch.dylib 0x00000001050a8dcc _dispatch_lane_invoke + 416 15 libdispatch.dylib 0x00000001050b877c _dispatch_root_queue_drain_deferred_wlh + 652 16 libdispatch.dylib 0x00000001050b7a54 _dispatch_workloop_worker_thread + 444 17 libsystem_pthread.dylib 0x0000000105147d9c _pthread_wqthread + 288 18 libsystem_pthread.dylib 0x000000010514fab4 start_wqthread + 8 )
2
2
687
Jan ’24
React Native iOS App Perfectly Runs on Simulator and Physical Devices but Crashes on App Store Release - RCTFormatError on iPad with iOS 17.1.2
Symbolicating Error Log : RCTFormatError (in MyApp) (RCTAssert.m:167) -[RCTExceptionsManager reportFatal:stack:exceptionId:extraDataAsJSON:] (in MyApp) (RCTExceptionsManager.mm:82) -[RCTExceptionsManager reportException:] (in MyApp) (RCTExceptionsManager.mm:154) -[RCTModuleMethod invokeWithBridge:module:arguments:] (in MyApp) (RCTModuleMethod.mm:587) facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&, int, (anonymous namespace)::SchedulingContext) (in MyApp) (RCTNativeModule.mm:197) invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int) (in MyApp) (RCTNativeModule.mm:105) main (in MyApp) (main.m:8) FIRCLSTerminateHandler() (in MyApp) (FIRCLSException.mm:0) FIRCLSMachExceptionServer (in MyApp) (FIRCLSMachException.c:168) +[RCTCxxBridge runRunLoop] (in MyApp) (RCTCxxBridge.mm:0) facebook::hermes::inspector::detail::SerialExecutor::runLoop() (in MyApp) (SerialExecutor.cpp:41) void* std::__1::__thread_proxy[abi:v160006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct>, void ()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, std::__1::function<void ()>>>(void) (in MyApp) (thread:299) facebook::hermes::inspector::detail::SerialExecutor::runLoop() (in MyApp) (SerialExecutor.cpp:41) void* std::__1::__thread_proxy[abi:v160006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct>, void ()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, std::__1::function<void ()>>>(void) (in MyApp) (thread:299) facebook::hermes::inspector::detail::SerialExecutor::runLoop() (in MyApp) (SerialExecutor.cpp:41) void* std::__1::__thread_proxy[abi:v160006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct>, void ()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, std::__1::function<void ()>>>(void) (in MyApp) (thread:299) facebook::hermes::inspector::detail::SerialExecutor::runLoop() (in MyApp) (SerialExecutor.cpp:41) void* std::__1::__thread_proxy[abi:v160006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct>, void ()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, std::__1::function<void ()>>>(void) (in MyApp) (thread:299) STDERR: Replacing matches in sample/spindump report: 2 MyApp 0x10531419c 0x104f54000 + 3932572 Replacing matches in sample/spindump report: 3 MyApp 0x104f6bcd4 0x104f54000 + 97492 Replacing matches in sample/spindump report: 4 MyApp 0x104f6c4e8 0x104f54000 + 99560 Replacing matches in sample/spindump report: 8 MyApp 0x105343b3c 0x104f54000 + 4127548 Replacing matches in sample/spindump report: 9 MyApp 0x105345b8c 0x104f54000 + 4135820 Replacing matches in sample/spindump report: 10 MyApp 0x1053457dc 0x104f54000 + 4134876 Replacing matches in sample/spindump report: 10 MyApp 0x104f5a8bc 0x104f54000 + 26812 Replacing matches in sample/spindump report: 7 MyApp 0x104fd6820 0x104f54000 + 534560 Replacing matches in sample/spindump report: 4 MyApp 0x104fdf198 0x104f54000 + 569752 Replacing matches in sample/spindump report: 7 MyApp 0x105326414 0x104f54000 + 4006932 Replacing matches in sample/spindump report: 3 MyApp 0x1057c64d8 0x104f54000 + 8856792 Replacing matches in sample/spindump report: 4 MyApp 0x105787e08 0x104f54000 + 8601096 Replacing matches in sample/spindump report: 3 MyApp 0x1057c64d8 0x104f54000 + 8856792 Replacing matches in sample/spindump report: 4 MyApp 0x105787e08 0x104f54000 + 8601096 Replacing matches in sample/spindump report: 3 MyApp 0x1057c64d8 0x104f54000 + 8856792 Replacing matches in sample/spindump report: 4 MyApp 0x105787e08 0x104f54000 + 8601096 Replacing matches in sample/spindump report: 3 MyApp 0x1057c64d8 0x104f54000 + 8856792 Replacing matches in sample/spindump report: 4 MyApp **Please advise. thank you have a good day.**
1
0
554
Dec ’23
Automation Overlay | Appium Testing
Hi , I am doing mobile automation using iOS 15 + devices and I can see Automation Overlay screen which impacts my testing. I use camera to capture video stream of iOS device ,So i get this over lay also recorded.So some of my QoE KPI like Video Startup time ,Buffer time of Some OTT getting failed.So any way to disable overlay .This is purly for development purpose .So by updating any Webdriver agent parameter or by installing any Applications.Please help me on the same.
0
0
328
Dec ’23
.draggable and .dropDestination not working
I've put together a somewhat simple app to demonstrate drag and drop using .draggable and .dropDestination. I'm using a simple custom object with two strings and two enums as properties. I have followed all the steps for UTType and implementing Transferrable. I have two views displayed from the ContentView. The left side is a List with four of my custom objects (a user). The user is a "card" I implemented in a separate imbedded view. The right side is a drop area which is a ZStack with a List inside which displays an array of users dropped onto the ZStack. The draggable seems to be working fine. I can drag a user "card" around. The drop doesn't work. I have the .dropDestination on the ZStack and the initial closure on the .dropDestination doesn't seem to fire. I placed a print() in both closures and the print() in the first closure never prints. The "isTargeted:" closure does fire (a little unreliably) on the iPhone simulator and (less reliably) on the iPad.
4
0
605
Nov ’23
Software Update Problem iPadOS 17.1.1
I updated my iPad to the 17.1.1 update and there is a problem with my Files. I have pdfs that I read there and every time I open a pdf and want to make notes, the Files app crashes. I have restarted the device numerous times and still the same. None of my notes are saved on the pdf and then the Files crashes again and again and again. Why is this happening? I'm doing important work on the Files and I can't now with this update. Also before the update I had the opportunity to move the pdf to another folder while reading it and move to other pdfs left and right but with the new update this possibilities are gone. I have to close the pdf file and move it to another folder or close the file and scroll through the folder to find other files that I want. How can I fix this? This didn't happen before the update.
1
0
289
Nov ’23
Accessing iOS Device Serial Number to Comply with German KassenSichV
Hey there, in order to comply with the German law, especially the KassenSichV for cash register systems it is necessary to access the "manufacturer issued unique device serial number" and log it in the sales history, as well as print it on the receipt for the customer. Is there any way to access the device serial number through .NET Maui, or even Swift? Thank you in advance!
1
0
391
Nov ’23
Error with Download Container on iPadOS17 and Xcode15
From Xcode15, when Download Container in Window > Devices and Simulators for iPadOS17, an error occurs. The specified file could not be transferred. Domain: com.apple.dt.CoreDeviceError Code: 7000 User Info: { DVTErrorCreationDateKey = "2023-11-21 05:52:37 +0000"; NSURL = "file:///Users/administrator/Desktop/<bundle identifer>%202023-11-21%2014:52.14.006.xcappdata/AppData/Library/WebKit/WebsiteData/IndexedDB/v0"; } -- Performing a file system operation failed: Failed to open Library/WebKit/WebsiteData/IndexedDB/v0 for reading, openat(2) returned POSIX error code 62 (parentParam = 51) Domain: com.apple.dt.remoteservices.error Code: 11001 -- Failed to open Library/WebKit/WebsiteData/IndexedDB/v0 for reading, openat(2) returned POSIX error code 62 (parentParam = 51) Domain: NSPOSIXErrorDomain Code: 62 Failure Reason: Too many levels of symbolic links -- System Information macOS Version 14.0 (Build 23A344) Xcode 15.0.1 (22266) (Build 15A507) indexedDB is not used in the app. I was able to download successfully with Xcode15 and iPadOS16. I was able to download successfully with Xcode14 and iPadOS17. Why do I get an error with Xcode15 and iPadOS17?How should I fix it? That you.
9
2
1.9k
Apr ’24
Dual Experience App (Full Function on iPad, Waitlist on Mobile)
Hi apple developer community, My current live app is iPad-only, and I'm considering a mobile version that acts as a waitlist, informing users about our progress and directing them to more information about our iPad version as we work to continue building out mobile. Questions: Could this approach conflict with App Store guidelines? Are there technical challenges or recommendations for such a setup? Are there any examples of apps that download as a fully functioning expereince from the iPad store, and a waitlist/beta mobile version when downloaded from mobile App Store? Thanks so much in advance!
0
0
509
Nov ’23
AdMob inline adaptive banner in NavigationSplitView sidebar
TL;DR How to implement AdMob inline adaptive banner ad in NavigationSplitView's sidebar on iPad with SwiftUI, so it takes the entire width of its parent and the view's height adjusts to the ad's height? Details I'm trying to insert an AdMob inline adaptive banner ad in the sidebar of a NavigationSplitView on iPad. As I'm using SwiftUI, I tried to replicate the implementation from this Google example. One problem is that the example is for an adaptive anchor banner ad—not what I'm looking for. I've made a few attempts over the past few days, with varying results. I can't seem to make it truly adaptive. Two attempts that display the ad but with fixed size are presented below. Attempt 1 struct InlineAdaptiveBannerAdView: UIViewControllerRepresentable { func makeUIViewController(context: Context) -> some UIViewController { let viewController = UIViewController() let adSize = GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight(280, 150) let bannerView = GADBannerView(adSize: adSize) bannerView.adUnitID = "ca-app-pub-3940256099942544/2934735716" bannerView.rootViewController = viewController let request = GADRequest() request.scene = UIApplication.shared.connectedScenes.first as? UIWindowScene bannerView.load(request) viewController.view.addSubview(bannerView) return viewController } func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) {} } I didn't know how to get the width of the sidebar programmatically, so I set it to 320 with .navigationSplitViewColumnWidth() and set the ad width to 280 (adjusted for padding). This code displays the ad nicely (at least along X-axis), but the size is fixed. Attempt 2 struct InlineAdaptiveBannerAdView: UIViewControllerRepresentable { // viewWidth is set to .zero in the Google sample @State private var viewWidth: CGFloat = CGFloat(280.0) private let bannerView = GADBannerView() private let adUnitID = "ca-app-pub-3940256099942544/2934735716" func makeUIViewController(context: Context) -> some UIViewController { let bannerViewController = BannerViewController() bannerView.adUnitID = adUnitID bannerView.rootViewController = bannerViewController bannerView.delegate = context.coordinator bannerView.translatesAutoresizingMaskIntoConstraints = false // Removed the constraints from the sample bannerViewController.view.addSubview(bannerView) bannerViewController.delegate = context.coordinator return bannerViewController } func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) { guard viewWidth != .zero else { return } bannerView.adSize = GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight(viewWidth, 150) let request = GADRequest() request.scene = UIApplication.shared.connectedScenes.first as? UIWindowScene bannerView.load(request) print("View height: \(uiViewController.view.frame.height)") } func makeCoordinator() -> Coordinator { Coordinator(self) } class Coordinator: NSObject, BannerViewControllerWidthDelegate, GADBannerViewDelegate { let parent: InlineAdaptiveBannerAdView init(_ parent: InlineAdaptiveBannerAdView) { self.parent = parent } // MARK: BannerViewControllerWidthDelegate methods func bannerViewController(_ bannerViewController: BannerViewController, didUpdate width: CGFloat) { parent.viewWidth = width } // MARK: GADBannerViewDelegate methods func bannerViewDidReceiveAd(_ bannerView: GADBannerView) { print("Did receive ad") print("Ad height: \(bannerView.adSize.size.height)") } func bannerView(_ bannerView: GADBannerView, didFailToReceiveAdWithError error: Error) { print("Did not receive ad: \(error.localizedDescription)") } } } protocol BannerViewControllerWidthDelegate: AnyObject { func bannerViewController(_ bannerViewController: BannerViewController, didUpdate width: CGFloat) } class BannerViewController: UIViewController { weak var delegate: BannerViewControllerWidthDelegate? override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) delegate?.bannerViewController(self, didUpdate: view.frame.inset(by: view.safeAreaInsets).size.width) } override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { coordinator.animate { _ in // Do nothing } completion: { _ in self.delegate?.bannerViewController(self, didUpdate: self.view.frame.inset(by: self.view.safeAreaInsets).size.width) } } } If I leave the default .zero for viewWidth, the whole process doesn't get through guard viewWidth != .zero else { return }. With viewWidth set to 280, the ad shows, but the size is never updated. Both viewDidAppear(_:) and viewWillTransition(to:with:) never get called, even if the ad gets displayed, so the width is never updated. As for height, according to Google developer's guide (which I can't link to on this forum): The height is either zero or maxHeight, depending on which API you're using. The actual height of the ad is made available when it's returned. So, I can read the ad's height when it is presented, but I still don't know how to really update the view's size. My brain is fried. Am I missing something very simple and obvious here?
1
0
513
Nov ’23
Allow Display Mode Changes
When you connect an external display via USB-C to an iPad, that displays shows in iPadOS via Settings -> Display and Brightness -> Name of Display. There is an option called 'Allow Display Mode Changes' for an external display which is described as follows: When this is on, the display mode will change to match the dynamic range and frame rate of the content you're viewing. This may result in flickering or long periods of black whenever content changes. Does anyone know how this functionality works and how to support it for an iPadOS App? In my tests the iPad always outputs at a frame rate of 60fps or sometimes 59.94fps. If the video I am playing back from an AVPlayer is at 25fps the external display stays at 60fps both with 'Allow Display Mode Changes' toggled on/off. Given that it's meant to 'match frame rate of content' I would expect the external display to change from 60fps -> 25fps. I can not find any documentation about this feature and what AV Frameworks it talks to or gets it's frame rate information from. If anyone has any idea or has experimented with it and learnt something that would be much appreciated.
0
0
615
Nov ’23
Wrong Video Aspect Ratio
Hello. I'm having problems with a narrow video aspect ratio displayed on an iPad Air. In an outlet labeled ImagePreviewOutlet I want to display a video feed from the iPad camera facing the user. So basically the user will see their own face. I did all the necessary moves in the Story Board and in the code and I got what I wanted. Except it is in the wrong Aspect Ratio. The image doesn't fill the screen of the iPad even though the dimensions of the ImagePreviewOutlet does. It's narrow, showing white space on either side of the video. I want a wider aspect ratio. I understand that the iPad has 2 ratios : 4:3 and 16:9. Can anybody help me? I can supply the code that I'm using but I don't want my first post to be overwhelming. Thank you for your time. JR
1
0
441
Nov ’23