What are the specific characteristics that trigger Game Mode in an iOS game? I have several casual SpriteKit games in the App Store but only one of them triggers Game Mode.
What does GCSupportsGameMode do when set to true? Will it trigger Game Mode or will the OS still decide by itself?
Delve into the world of graphics and game development. Discuss creating stunning visuals, optimizing game mechanics, and share resources for game developers.
Post
Replies
Boosts
Views
Activity
Apple's own USDZ files from their website does not display properly both in OPReview and in Keynote when imported. It displays properly, however, in Reality Converter bit with this error:
"Invalid USD shader node in USD file
Shader nodes must have “id” as the implementationSource, with id values that begin with “Usd”. Also, shader inputs with connections must each have a single, valid connection source."
I tried importing other models from external sources and they work without any issue at all.
Is there any potential fix or workaround this?
Thanks in advance.
I use xcode16 and swiftUI for programming on a macos15 system. There is a problem. When I render a picture through mtkview, it is normal when displayed on a regular view. However, when the view is displayed through the .sheet method, the image cannot be displayed. There is no error message from xcode.
import Foundation
import MetalKit
import SwiftUI
struct CIImageDisplayView: NSViewRepresentable {
typealias NSViewType = MTKView
var ciImage: CIImage
init(ciImage: CIImage) {
self.ciImage = ciImage
}
func makeNSView(context: Context) -> MTKView {
let view = MTKView()
view.delegate = context.coordinator
view.preferredFramesPerSecond = 60
view.enableSetNeedsDisplay = true
view.isPaused = true
view.framebufferOnly = false
if let defaultDevice = MTLCreateSystemDefaultDevice() {
view.device = defaultDevice
}
view.delegate = context.coordinator
return view
}
func updateNSView(_ nsView: MTKView, context: Context) {
}
func makeCoordinator() -> RawDisplayRender {
RawDisplayRender(ciImage: self.ciImage)
}
class RawDisplayRender: NSObject, MTKViewDelegate {
// MARK: Metal resources
var device: MTLDevice!
var commandQueue: MTLCommandQueue!
// MARK: Core Image resources
var context: CIContext!
var ciImage: CIImage
init(ciImage: CIImage) {
self.ciImage = ciImage
self.device = MTLCreateSystemDefaultDevice()
self.commandQueue = self.device.makeCommandQueue()
self.context = CIContext(mtlDevice: self.device)
}
func mtkView(_ view: MTKView, drawableSizeWillChange size: CGSize) {}
func draw(in view: MTKView) {
guard let currentDrawable = view.currentDrawable,
let commandBuffer = commandQueue.makeCommandBuffer()
else {
return
}
let dSize = view.drawableSize
let drawImage = self.ciImage
let destination = CIRenderDestination(width: Int(dSize.width),
height: Int(dSize.height),
pixelFormat: view.colorPixelFormat,
commandBuffer: commandBuffer,
mtlTextureProvider: { () -> MTLTexture in
return currentDrawable.texture
})
_ = try? self.context.startTask(toClear: destination)
_ = try? self.context.startTask(toRender: drawImage, from: drawImage.extent,
to: destination, at: CGPoint(x: (dSize.width - drawImage.extent.width) / 2, y: 0))
commandBuffer.present(currentDrawable)
commandBuffer.commit()
}
}
}
struct ShowCIImageView: View {
let cii = CIImage.init(contentsOf: Bundle.main.url(forResource: "9-10", withExtension: "jpg")!)!
var body: some View {
CIImageDisplayView.init(ciImage: cii).frame(width: 500, height: 500).background(.red)
}
}
struct ContentView: View {
@State var showImage = false
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
ShowCIImageView()
Button {
showImage = true
} label: {
Text("showImage")
}
}
.frame(width: 800, height: 800)
.padding()
.sheet(isPresented: $showImage) {
ShowCIImageView()
}
}
}
In my project I need to do the following:
In runtime create metal Dynamic library from source.
In runtime create metal Executable library from source and Link it with my previous created Dynamic library.
Create compute pipeline using those two libraries created above.
But I get the following error at the third step:
Error Domain=AGXMetalG15X_M1 Code=2 "Undefined symbols:
_Z5noisev, referenced from: OnTheFlyKernel
" UserInfo={NSLocalizedDescription=Undefined symbols:
_Z5noisev, referenced from: OnTheFlyKernel
}
import Foundation
import Metal
class MetalShaderCompiler {
let device = MTLCreateSystemDefaultDevice()!
var pipeline: MTLComputePipelineState!
func compileDylib() -> MTLDynamicLibrary {
let source = """
#include <metal_stdlib>
using namespace metal;
half3 noise() {
return half3(1, 0, 1);
}
"""
let option = MTLCompileOptions()
option.libraryType = .dynamic
option.installName = "@executable_path/libFoundation.metallib"
let library = try! device.makeLibrary(source: source, options: option)
let dylib = try! device.makeDynamicLibrary(library: library)
return dylib
}
func compileExlib(dylib: MTLDynamicLibrary) -> MTLLibrary {
let source = """
#include <metal_stdlib>
using namespace metal;
extern half3 noise();
kernel void OnTheFlyKernel(texture2d<half, access::read> src [[texture(0)]],
texture2d<half, access::write> dst [[texture(1)]],
ushort2 gid [[thread_position_in_grid]]) {
half4 rgba = src.read(gid);
rgba.rgb += noise();
dst.write(rgba, gid);
}
"""
let option = MTLCompileOptions()
option.libraryType = .executable
option.libraries = [dylib]
let library = try! self.device.makeLibrary(source: source, options: option)
return library
}
func runtime() {
let dylib = self.compileDylib()
let exlib = self.compileExlib(dylib: dylib)
let pipelineDescriptor = MTLComputePipelineDescriptor()
pipelineDescriptor.computeFunction = exlib.makeFunction(name: "OnTheFlyKernel")
pipelineDescriptor.preloadedLibraries = [dylib]
pipeline = try! device.makeComputePipelineState(descriptor: pipelineDescriptor, options: .bindingInfo, reflection: nil)
}
}
I'm using the Apple RoomPlan sdk to generate a .usdz file, which works fine, and gives me a 3D scan of my room.
But when I try to use Model I/O's MDLAsset to convert that output into an .obj file, it comes out as a completely flat model shaped like a rectangle. Here is my Swift code:
let destinationURL = destinationFolderURL.appending(path: "Room.usdz")
do {
try FileManager.default.createDirectory(at: destinationFolderURL, withIntermediateDirectories: true)
try finalResults?.export(to: destinationURL, exportOptions: .model)
let newUsdz = destinationURL;
let asset = MDLAsset(url: newUsdz);
let obj = destinationFolderURL.appending(path: "Room.obj")
try asset.export(to: obj)
}
Not sure what's wrong here. According to MDLAsset documentation, .obj is a supported format and exporting from .usdz to the other formats like .stl and .ply works fine and retains the original 3D shape.
Some things I've tried:
changing "exportOptions" to parametric, mesh, or model.
simply changing the file extension of "destinationURL" (throws error)
I have an app which have an Immersive Space view and it needs the user to have a button in the bottom which have a fixed place in front of the user head like a dashboard in game or so but when the user get too close to any3d object in the view it could cover the button and make it inaccessible and it mainly would prevent the app for being approved like that in appstoreconnect I was working before on SceneKit and there was something like camera view Znear and Zfar which decide when to hide the 3d model if it comes too close or gets too far and I wonder if there is something like that in realityView / RealityKit 4.
Here is My Code and the screenshots follows
import SwiftUI
import RealityKit
struct ContentView: View {
@State var myHead: Entity = {
let headAnchor = AnchorEntity(.head)
headAnchor.position = [-0.02, -0.023, -0.24]
return headAnchor
}()
@State var clicked = false
var body: some View {
RealityView { content, attachments in
// create a 3d box
let mainBox = ModelEntity(mesh: .generateBox(size: [0.1, 0.1, 0.1]))
mainBox.position = [0, 1.6, -0.3]
content.add(mainBox)
content.add(myHead)
guard let attachmentEntity = attachments.entity(for: "Dashboard") else {return}
myHead.addChild(attachmentEntity)
}
attachments: {
// SwiftUI Inside Immersivre View
Attachment(id: "Dashboard") {
VStack {
Spacer()
.frame(height: 300)
Button(action: {
goClicked()
}) {
Text(clicked ? "⏸️" : "▶️")
.frame(maxWidth: 48, maxHeight: 48, alignment: .center)
.font(.extraLargeTitle)
}
.buttonStyle(.plain)
}
}
}
}
func goClicked() {
clicked.toggle()
}
}
Hi,
I am trying to use PhotogrammetrySample input sequence according to the WWDC video.
I modified only the following code in the sample:
var images = try FileManager.default.contentsOfDirectory(at: captureFolderManager.imagesFolder,
includingPropertiesForKeys: nil,
options: .skipsHiddenFiles)
let inputSequence = images.lazy.compactMap { file in
return self.loadSampleAndMask(file: file)
}
// Next line causes the exception
photogrammetrySession = try PhotogrammetrySession(
input: inputSequence,
configuration: configuration)
private func loadSampleAndMask(file: URL) -> PhotogrammetrySample? {
do {
var sample = try PhotogrammetrySample(contentsOf: file)
return sample
} catch {
return nil
}
}
I am getting following runtime error:
Thread 1: EXC_BREAKPOINT (code=1, subcode=0x240d88904)
Hello.
I have an application that exports a 3D object with vertex color to USDC. I'm using an MDLAsset and its functionality to export to USDC with [asset exportAssetToURL:[NSURL fileURLWithPath:filePath]]. In version 1.3 of the system, everything works correctly. But after updating to version 2.0, the exported object appears white (using the same code).
Any suggestions?
Thank you very much.
If I import a USDZ model with blendMode set to alpha, occlusion does not work on iPhone with iOS 18. How should transparent materials and occlusion be properly used in the new RealityKit? Additionally, new artifacts have appeared when working with transparent objects overlapping each other. The transparency results do not blend but rather parts of the model just not rendering.
I have followed the documentation to download the UnityPlugins from https://github.com/apple/unityplugins. When I run through the quick guide to create the .tgz builds it builds all the packages except for the Apple.GameKit package, which is the one I need.
It looks like during the build process there is a build failure which is likely causing this issue I will post the code below. This is blocking me and I have tried multiple times to the same result. (I removed some of the code error because it was too long just showing start and finish)
Building Release GameKit native libraries for platform: iOS
Build command: xcodebuild -scheme iOS - Release -destination generic/platform=iOS clean build
** BUILD FAILED **
The following build commands failed:
SwiftCompile normal arm64 Compiling\ GKAchievementDescription.swift,\ GKLeaderboard.swift,\ GKTurnBasedMatchmakerViewControllerDelegate.swift,\ GKChallengeDelegate.swift,\ GKMatchDelegate.swift,\ GKMatchmakerViewControllerDelegate.swift,\ GKInvite.swift,\ GKChallenge.swift,\ DefaultHandlers.swift,\ GKTurnBasedParticipant.swift,\ GKLocalPlayerListener.swift,\ GKGameCenterViewController.swift,\ GKSavedGameDelegate.swift,\ GKAccessPoint.swift,\ GKBasePlayer.swift,\ GKAchievementChallenge.swift,\ GKLeaderboardEntry.swift,\ GKTurnBasedExchangeReply.swift,\ GKTurnBasedMatchmakerViewController.swift,\ AppleCoreRuntimeShared.swift,\ GKErrorCodeExtension.swift,\ GKMatchmaker.swift,\ GKTurnBasedExchange.swift,\ GKNotificationBanner.swift,\ GKScoreChallenge.swift,\ GKLocalPlayer.swift,\ GKLeaderboardSet.swift,\ GKSavedGame.swift,\ GKMatchRequest.swift,\ GKMatch.swift,\ GKAchievement.swift,\ GKVoiceChat.swift,\ GKTurnBasedMatchDelegate.swift,\ UiUtilities.swift,\ GKTurnBasedMatch.swift,\ GKMatchmakerViewController.swift,\ GameKitUIDelegateHandler.swift,\ GKPlayer.swift,\ GKInviteDelegate.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKAchievementDescription.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKLeaderboard.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKTurnBasedMatchmakerViewControllerDelegate.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKChallengeDelegate.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKMatchDelegate.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKMatchmakerViewControllerDelegate.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKInvite.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKChallenge.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/DefaultHandlers.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKTurnBasedParticipant.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKLocalPlayerListener.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKGameCenterViewController.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKSavedGameDelegate.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKAccessPoint.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKBasePlayer.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKAchievementChallenge.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKLeaderboardEntry.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKTurnBasedExchangeReply.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKTurnBasedMatchmakerViewController.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/AppleCoreRuntimeShared.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKErrorCodeExtension.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKMatchmaker.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKTurnBasedExchange.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKNotificationBanner.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKScoreChallenge.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKLocalPlayer.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKLeaderboardSet.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKSavedGame.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKMatchRequest.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKMatch.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKAchievement.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKVoiceChat.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKTurnBasedMatchDelegate.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/UiUtilities.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKTurnBasedMatch.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKMatchmakerViewController.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GameKitUIDelegateHandler.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKPlayer.swift /Users/brookehowell/Downloads/apple/unityplugins/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKInviteDelegate.swift (in target 'GameKitWrapper iOS' from project 'GameKitWrapper')
CompileSwift normal arm64 (in target 'GameKitWrapper iOS' from project 'GameKitWrapper')
(2 failures)
The following code runs fine when compiled with Swift 5, but crashes when compiled with Swift 6 (stack trace below). In the draw method, commenting out the addCompletedHandler line fixes the problem. I'm testing on iOS 18.0 and see the same behavior in both the simulator and on a device. What's going on here?
import Metal
import MetalKit
import UIKit
class ViewController: UIViewController {
@IBOutlet var metalView: MTKView!
private var commandQueue: MTLCommandQueue?
override func viewDidLoad() {
super.viewDidLoad()
guard let device = MTLCreateSystemDefaultDevice() else {
fatalError("expected a Metal device")
}
self.commandQueue = device.makeCommandQueue()
metalView.device = device
metalView.enableSetNeedsDisplay = true
metalView.isPaused = true
metalView.delegate = self
}
}
extension ViewController: MTKViewDelegate {
func mtkView(_ view: MTKView, drawableSizeWillChange size: CGSize) {}
func draw(in view: MTKView) {
guard let commandQueue,
let commandBuffer = commandQueue.makeCommandBuffer()
else { return }
commandBuffer.addCompletedHandler { _ in } // works with Swift 5, crashes with Swift 6
commandBuffer.commit()
}
}
Here's the stack trace:
Thread 10 Queue : connection Queue (serial)
#0 0x000000010581c3f8 in _dispatch_assert_queue_fail ()
#1 0x000000010581c384 in dispatch_assert_queue ()
#2 0x00000002444c63e0 in swift_task_isCurrentExecutorImpl ()
#3 0x0000000104d71ec4 in closure #1 in ViewController.draw(in:) ()
#4 0x0000000104d71f58 in thunk for @escaping @callee_guaranteed (@guaranteed MTLCommandBuffer) -> () ()
#5 0x0000000105ef1950 in __47-[CaptureMTLCommandBuffer _preCommitWithIndex:]_block_invoke_2 ()
#6 0x00000001c50b35b0 in -[MTLToolsCommandBuffer invokeCompletedHandlers] ()
#7 0x000000019e94d444 in MTLDispatchListApply ()
#8 0x000000019e94f558 in -[_MTLCommandBuffer didCompleteWithStartTime:endTime:error:] ()
#9 0x000000019e95352c in -[_MTLCommandQueue commandBufferDidComplete:startTime:completionTime:error:] ()
#10 0x0000000226ef50b0 in handleMainConnectionReplies ()
#11 0x00000001800c9690 in _xpc_connection_call_event_handler ()
#12 0x00000001800cad90 in _xpc_connection_mach_event ()
#13 0x000000010581a86c in _dispatch_client_callout4 ()
#14 0x0000000105837950 in _dispatch_mach_msg_invoke ()
#15 0x0000000105822870 in _dispatch_lane_serial_drain ()
#16 0x0000000105838c10 in _dispatch_mach_invoke ()
#17 0x0000000105822870 in _dispatch_lane_serial_drain ()
#18 0x00000001058237b0 in _dispatch_lane_invoke ()
#19 0x00000001058301f0 in _dispatch_root_queue_drain_deferred_wlh ()
#20 0x000000010582f75c in _dispatch_workloop_worker_thread ()
#21 0x00000001050abb74 in _pthread_wqthread ()
Hi there, I'm trying to test the "Drawing fully immersive content using Metal" , but when I select Language: Swift, it still shows Objective C code in some sample codes.
Please check and update the document Swift Code, thank you.
Hello,
I’m working with the GameKit API, and I am encountering an issue when submitting a player’s score to a leaderboard at the end of a game.
Goal:
After submitting the new score to a leaderboard, I want to immediately fetch and display the updated leaderboard that reflects the new score.
Problem:
After successfully submitting the player’s score, when I fetch the leaderboard, the entries are not updated right away. The fetched leaderboard still shows the outdated player score.
Is this delay in updating the leaderboard expected behavior, or am I missing something in my implementation?
Steps to Reproduce:
Submit the local player’s score to Leaderboard X.
On successful submission, fetch the leaderboard entries for Leaderboard X.
Expected Result:
The fetched leaderboard should reflect the updated player score immediately.
Actual Result:
The fetched leaderboard shows the outdated score, with no immediate update.
As a workaround, I update the leaderboard myself locally, that does the job, but is error-prone and require more efforts.
I am sure others will agree with me on this. I personally don’t like the way the new reactions look. Too many different color for the reactions. I honestly prefer the old grey version for the reactions to text messages. The extra emoji thing is okay but the change in color for the heart, thumbs up and the other reactions are not the best. Auto correct is horrible in this new update by the way
I'll leave this here for anyone who's interested but it is possible to slightly use Windows VR on ARM Mac, right now it's just some demos but I am still working on solutions: https://www.youtube.com/watch?v=qbucnU0dpDo&t=431s&ab_channel=NightSightProductions
I have created a turn based game using GameKit. Everything is pretty much done, last thing left to do is the turn time out.
I am passing GKTurnTimeoutDefault into the timeout argument in:
func endTurn(withNextParticipants nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data)
However when I check the .timeoutDate property of the GKTurnBasedParticipant participants, the value is always nil.
What am I doing wrong? Am I checking the right property or is there another one instead that I don't know about? I have tried passing different values to the timeout parameter but the timeoutDate is always nil.
Has anyone successfully implemented a timeout using GKTurnBasedMatch ?
Hi, I'm trying to understand how I can get 3- or 4-channel per-vertex data into the Graph Editor.
From my tests, it seems that:
the "Geometric Property" node does not give access to 4-channel data,
"Geometric Property (vector3)" does not give me access to custom properties besides the ones defined in MaterialX core
the "Texture Coordinates" node has a vector4f mode (yay!), but according to MaterialX spec, texcoords must have 2 or 3 channels, and I can't get 4-channel data to show up there either.
My assumption so far is that I must be missing some "magic" – for example, do the primvars in a file have to be in a specific order, independent of their names? Or do their names matter? (E.g. convention would be primars:st and primvars:st1 and so on)
Unfortunately the forum doesn't allow me to attach any USDZ or ZIP files or GDrive links; if there's a way to share a test file I'm happy to do so!
So I get JPEG data in my app. Previously I was using the higher level NSBitmapImageRep API and just feeding the JPEG data to it.
But now I've noticed on Sonoma If I get a JPEG in the CMYK color space the NSBitmapImageRep renders mostly black and is corrupted. So I'm trying to drop down to the lower level APIs. Specifically I grab a CGImageRef and and trying to use the Accelerate API to convert it to another format (to hopefully workaround the issue...
CGImageRef sourceCGImage = `CGImageCreateWithJPEGDataProvider(jpegDataProvider,`
NULL,
shouldInterpolate,
kCGRenderingIntentDefault);
Now I use vImageConverter_CreateWithCGImageFormat... with the following values for source and destination formats:
Source format: (derived from sourceCGImage)
bitsPerComponent = 8
bitsPerPixel = 32
colorSpace = (kCGColorSpaceICCBased; kCGColorSpaceModelCMYK; Generic CMYK Profile)
bitmapInfo = kCGBitmapByteOrderDefault
version = 0
decode = 0x000060000147f780
renderingIntent = kCGRenderingIntentDefault
Destination format:
bitsPerComponent = 8
bitsPerPixel = 24
colorSpace = (DeviceRBG)
bitmapInfo = 8197
version = 0
decode = 0x0000000000000000
renderingIntent = kCGRenderingIntentDefault
But vImageConverter_CreateWithCGImageFormat fails with kvImageInvalidImageFormat. Now if I change the destination format to use 32 bitsPerpixel and use alpha in the bitmap info the vImageConverter_CreateWithCGImageFormat does not return an error but I get a black image just like NSBitmapImageRep
I wanted to try the new logging feature for Metal but could not get it to work.
I modified the PerformingCalculationsOnAGPU example by adding os_log_default.log_debug("Hello thread: %d", index); to log the current thread id. But never saw any messages neither in the console nor in Xcode.
I also added the -fmetal-enable-logging flag. I am running the Sequoia release candidate 15.0 (24A335) on M1 Max and Xcode 16.0 (16A242).
What am I missing?
In my app, I have an ARView that has cameraMode set to nonAR.
I occasionally hide the ARView when it is not needed and reveal it again later.
While the ARView is hidden, I'd like to pause the animation to save iPhone battery life. I'd also like to do this when I know that animation in my scene has paused and the contents of the view, although still visible, is static.
This was possible using SceneKit, but I can't seem to find an equivalent way to do it using RealityKit.
At least as of iOS 18, a hidden ARView with an empty scene appears to use approximately 30% of the CPU.
How can I pause ARView so that it won't use the battery unnecessarily?
Thank you for considering this question.