My goal is to print a debug message from a shader. I follow the guide that orders to set -fmetal-enable-logging metal compiler flag and following environment variables:
MTL_LOG_LEVEL=MTLLogLevelDebug
MTL_LOG_BUFFER_SIZE=2048
MTL_LOG_TO_STDERR=1
However there's an issue with the guide, it's only covers Xcode project setup, however I'm working on a Swift Package. It has a Metal-only target that's included into main target like this:
targets: [
// A separate target for shaders.
.target(
name: "MetalShaders",
resources: [
.process("Metal")
],
plugins: [
// https://github.com/schwa/MetalCompilerPlugin
.plugin(name: "MetalCompilerPlugin", package: "MetalCompilerPlugin")
]
),
// Main target
.target(
name: "MegApp",
dependencies: ["MetalShaders"]
),
.testTarget(
name: "MegAppTests",
dependencies: [
"MegApp",
"MetalShaders",
]
]
So to apply compiler flag I use MetalCompilerPlugin which emits debug.metallib, it also allows to define DEBUG macro for shaders. This code compiles:
#ifdef DEBUG
logger.log_error("Hello There!");
os_log_default.log_debug("Hello thread: %d", gid);
// this proves that code exectutes
result.flag = true;
#endif
Environment is set via .xctestplan and valideted to work with ProcessInfo. However, nothing is printed to Xcode console nor to Console app.
In attempt to fix it I'm trying to setup a MTLLogState, however the makeLogState(descriptor:) fails with error:
if #available(iOS 18.0, *) {
let logDescriptor = MTLLogStateDescriptor()
logDescriptor.level = .debug
logDescriptor.bufferSize = 2048
// Error Domain=MTLLogStateErrorDomain Code=2 "Cannot create residency set for MTLLogState: (null)" UserInfo={NSLocalizedDescription=Cannot create residency set for MTLLogState: (null)}
let logState = try! device.makeLogState(descriptor: logDescriptor)
commandBufferDescriptor.logState = logState
}
Some LLMs suggested that this is connected with Simulator, and truly, I run the tests on simulator. However tests don't want to run on iPhone... I found solution running them on My Mac (Mac Catalyst). Surprisingly descriptor log works there, even without MTLLogState. But the Simulator behaviour seems like a bug...
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello! I want to clarify the usage scope of auto-renewable subscriptions. The guideline telling us:"If you offer an auto-renewing subscription, you must provide ongoing value to the customer. While the following list is not exhaustive, examples of appropriate subscriptions include: new game levels; episodic content; multi-player support; apps that offer consistent, substantive updates; access to large collections of, or continually updated, media content; software as a service (“SAAS”); and cloud support."So, it's emphasises, that there could be other cases. I want to be sure will my app be approved by the review, or not.My application is an offline business utility. It doesn't provide any cloud services or updating media content. The only reason to use subscriptions is that the app will be consistently updated according to: iOS updates, user suggestions, new features and bug fixes. So it's probably one of "apps that offer consistent, substantive updates", isn't it?What should I write to users and to Apple so that the app will be able to pass review?There are many reasons why I like auto-renewable subscription model, besides 85% revenue. It sufficiently lowers barriers for a user, thanks to the free trial and ability to cancel if the first experience was not satisfying. Moreover, it provides great feedback: looking at subscribed users count I'm able to decide, should I spend more time supporting this application, or should I pay attention to another, more successful aps. I also can release the app earlier, and gradually improve it constantly listening to user feedback. It's better than make a technically ideal paid app that nobody will buy. And I think it just more fair, because todays app are not "fire and forget" products and require continuous maintenance and updates.
What is the process named com.apple.dt.DTConditionInducerSupportService on my iPhone 6S, iOS 14.4?
There is a such method in Bundle:
func classNamed(_ className: String) -> AnyClass?
The description says it loads the Class object for className. It's, obviously, an Objective-C stuff. I started from Objective-C but didn't used it, preferring NSClassFromString.
Now I suddenly tested it in various applications. I was surprised that it doesn't work in iOS apps neither in Playground:
import Foundation
class TalkingFruit {
func greet() {
print("Hello, playground")
}
}
@objc class LagacyFruit: NSObject {
}
print(Bundle.main.classNamed("TalkingFruit") ?? "no class")
// no class
print(Bundle.main.classNamed("LegacyFruit") ?? "no class")
// no class
print(Bundle.main.classNamed("NSObject") ?? "no class either")
// no class either
And now I have a question: Does it even work? And how it's supposed to be used? Working use case example would be great.
On May 1 I started to see this image instead of watch UI preview. It worked well before. I didn't update Xcode, neither I deleted or installed any new simulator OS. It was harmful to my work, since simulator download is 4GB and I need to wait when it downloads, instead of reviewing PRs and closing tasks.
Did anyone had the same issue? Do you know how to prevent it?
I'm trying to delete many records with one CKModifyRecordsOperation and getting this error:
<CKError 0x600000dbe4f0: "Limit Exceeded" (27/1020); "Your request contains 552 items which is more than the maximum number of items in a single request (400)">
This obviously means, that Modify Operation has record limit of 400 which is equal to CKQueryOperation.maximumResults. The good solution here would be to chunk the array of records into subarrays with length less than 400 and add multiple delete operations to the database.
The only problem is that the limit for CKModifyRecordsOperation is neither documented nor provided with a constant, so it's basically a magic number.
In hope that my prayers would be heard I want to ask to add maximumResults constant to CKModifyRecordsOperation.
I need to track user actions, for example video view count. Then the data is used to get most popular videos for last 7 days, 30 days and for a year. For this purpose I have created a Downloads table with timestamp and video fields.
Each time user opens the catalog, I'm running queries to get Downloads and sort the videos based on them. This is a working, but not the efficient solution. A good option is to add aggregated data table storing summary counts for the popular queries - countFor7Days, etc. This will improve query performance. But it requires a job that would update the aggregate table every day.
The question is how to implement this job in CloudKit? Is there are such built-in feature, or I need a custom service running somewhere?
I posted a question 7 days ago and now it looks like I can't edit or delete it.
Hello! I'm working on the watchOS app that provides user with multiple fancy complication sets. There are about 50 widgets in our WidgetBundle now. With this amount we reached memory limit and the app crashes:
Thread 1: EXC_RESOURCE (RESOURCE_TYPE_MEMORY: high watermark memory limit exceeded) (limit=15 MB)
I inspected complicationExtension.appex content and find out that most volume is occupied by the executable:
Localized strings (12 langs) altogether - 165 KB
Assets.car - 1.1 MB
Imported fonts TTF files altogether - 866 KB
complicationsExtension executable file - 8.2 MB
Why it takes so much space and how can it be made smaller?
Topic:
App & System Services
SubTopic:
General
Tags:
WatchKit
Watch Complications
Extensions
WidgetKit