Post not yet marked as solved
Hi,
I'm new to Swift development and encountering an issue that I believe may be due to an error on my part.
I have two questions regarding the following code:
import AppIntents
import SwiftUI
import SwiftData
@available(iOS 17.0, *)
struct CopiarEventoIntent: AppIntent {
@Environment(\.modelContext) private var context
@Parameter(title: "Nome do Evento")
var name: String
@Parameter(title: "Data Inicial")
var datai: Date
@Parameter(title: "Data Final")
var dataf: Date
@Parameter(title: "Tipo de Evento")
var tipo: String
@Parameter(title: "Endereço")
var endereco: String
@Parameter(title: "Lembrete")
var reminder: Bool
static var title: LocalizedStringResource = "Adicionar Eventos"
static var description = IntentDescription("Copiar Eventos e alterar datas", resultValueName: "Resultado")
@MainActor
func perform() async throws -> some IntentResult & ProvidesDialog {
let calData = CalData(title: name, datei: datai, datef: dataf, tipo: tipo, endereco: endereco,reminder: reminder)
context.insert(calData)
return .result(dialog: "Evento copiado com sucesso!")
}
}
@available(iOS 15.0, *)
struct AppShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: CopiarEventoIntent(),
phrases: [
"Copiar Evento"
],
shortTitle: "Copiar Evento",
systemImageName: "square.and.arrow.down"
)
}
}
@available(iOS 15.0, *)
struct ShortcutSelectionView: View {
@Environment(\.modelContext) private var context
@Query(sort: \CalData.title) private var caldatas: [CalData]
@State private var selectedEvent: CalData?
var body: some View {
List(caldatas, id: \.self) { eventData in
Button(action: {
selectedEvent = eventData
handleEventSelection()
}) {
Text(eventData.title)
}
}
}
private func handleEventSelection() {
guard selectedEvent != nil else { return }
}
}
When I run the shortcut, gives me the following error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot insert 'CalData' in this managed object context because it is not found in the associated managed object model.
I attempted to save this using SwiftData with the following model:
import SwiftData
@Model
class CalData {
var title : String
var datei : Date
var datef : Date
var tipo : String
var endereco : String
@Relationship(deleteRule: .cascade) var caldataval = [CalDataVal]()
var reminder: Bool = false
init(title:String, datei:Date, datef:Date, tipo:String, endereco:String, reminder:Bool){
self.title = title
self.datei = datei
self.datef = datef
self.tipo = tipo
self.endereco = endereco
self.reminder = reminder
}
}
As for the second question, how can I add a parameter that can have multiple values to save them to EventDataVal, resembling a one-to-many relationship:
import SwiftData
@Model
class CalDataVal {
var name : String
var value : Double
init(name:String, value:Double){
self.name = name
self.value = value
}
}
Thanks in advanced
Post not yet marked as solved
I want to use Network Extension Relay to implement a system-wide proxy. First, I will setup a local http2 proxy and forward to a local http proxy. The problem is
How to implement this http2relayurl link to? Is it a regular http2 proxy protocol?
What should I pass to raw public keys? Is it a bytes like rsa public key, or is .pem, .pub like plain text string? And I will use self signed certificate, will it be a problem?
Post not yet marked as solved
Here is a link to a super long conversation with a true genius at StackOverflow
https://stackoverflow.com/questions/78343630/what-algorithm-is-available-to-correlate-a-skspritenodes-position-with-the-uibe/78379892#78379892
He has done an extraordinary amount of work to make up for what I consider is the non-working of UIBezierPath’s orientToPath = true.
He’s done multiple hours work to make up for orientToPath = true not working.
What are we missing?
Post not yet marked as solved
I'm using VScode to run flutter app on ios and macos. It showed this error. How can I solve this. I've been working on this with many ways but nothing can solve this.
Post not yet marked as solved
I'm trying to appoint another developer as admin + account owner. However, the screen and menus in the instructions do not appear for me. My developer license expired a few days ago. Could the problem be related to this?
Post not yet marked as solved
We have an C++ app which runs on multiple platforms and is build using the Qt framework. For a while we had issues with unexplainable stack traces reported by testflight users.
Now I found out that if I just put throw std::runtime_error("something"); at the start of my main method the resulting crash call stack would not point to my main method.
Is there something I can do (compiler flags/variables/code etc) to have the call stack from the actual throw show up in XCode and testflight?
Post not yet marked as solved
Automating the release process. (For policy reason need to use curl cmd, not permitted to use fastlane/etc for this step)
Reading the App Store Connect API, I am uncertain what to pass as the "http body" during the POST action. What is AppStoreVersionReleaseRequestCreateRequest I would guess it goes in the "--data-raw" of curl cmd?
There doesn't seem to be example snippet.
Draft cmd:
curl --location --request POST "<appStoreVersionReleaseRequests-api>" --header "Authorization: Bearer ${JWT}" --header 'Content-Type: application/json' --data-raw '{ "key?": "value?" }'
REF
https://developer.apple.com/documentation/appstoreconnectapi/manually_release_an_app_store_approved_version_of_your_app?changes=latest_major
Post not yet marked as solved
Hello,
I'm working with Mac Book Pro M3 Sonoma 14.4.1 and I have an issue with compilation, sometimes after compilation of the project the symlink files inside Xcode.app are updated, and further compilation will do full recompilation. According to the build log, the issue is pthread.h :
Module.NiagaraEditor.9.cpp: Dependency /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h is newer than the last execution of the action: 04/23/2024 14:33:55 vs 04/23/2024 00:20:32
I tried to trace the reason for the symlink update with the fs_usage utility like this: sudo fs_usage -w | grep pthread.h and according to the output the only things that coincide with the file modification time:
13:55:37.157163 lstat64 [ 2] -B918-ED122786C40E.activeSandbox/Root//Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread/pthread.h 0.000034 installd.1747894
13:55:37.159691 link ED122786C40E.activeSandbox/Root//Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/pthread/pthread.h 0.000753 installd.1747894
13:55:37.176355 fsgetpath -ED122786C40E.activeSandbox/Root/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/pthread/pthread.h 0.000039 mds.1764823
13:55:37.176612 fsgetpath activeSandbox/Root/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include/pthread/pthread.h 0.000026 mds.1764823
13:55:37.176641 fsgetpath 18-ED122786C40E.activeSandbox/Root/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/pthread/pthread.h 0.000016 mds.1764823
13:55:37.176666 fsgetpath E.activeSandbox/Root/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/pthread/pthread.h 0.000014 mds.1764823
13:55:37.176689 fsgetpath 8-B918-ED122786C40E.activeSandbox/Root/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread/pthread.h 0.000014 mds.1764823
13:55:37.186224 lstat64 [ 2] A13-4108-B918-ED122786C40E.activeSandbox/Root//Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h 0.000022 installd.1747894
13:55:37.186717 unlink [ 2] A13-4108-B918-ED122786C40E.activeSandbox/Root//Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h 0.000010 installd.1747894
There are link and unlink caused by installd process, which makes me think that it could be related to the system software update, but disabling it did not help.
Post not yet marked as solved
I have uploaded 5 binaries to the app store, intending to publish it, not to test it.
Every time I do, the builds appear inside TestFlight marked as “invalid binary”.
Why do they appear on TestFlight is a mystery...
I have uploaded it by two methods, Xcode and xcrun altool. The app passes the validation.
No reason is given, no email received from Apple. I have contacted Apple two days ago, and as expected, no answer.
How can I discover what is going on?
Post not yet marked as solved
Hi to all.
I'm building a Mac application using QT (PySide6).
After updating XCode to 15.3.0 (Sonoma), the Accessibility Inspector stopped working correctly, it does not display the attributes of nested elements, but only the title of the window. When using XCode 14.2 (Monterey) - everything worked correctly.
main.py
from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import QQmlApplicationEngine
app = QGuiApplication(sys.argv)
engine = QQmlApplicationEngine()
engine.quit.connect(app.quit)
engine.load("main.qml")
sys.exit(app.exec())
main.qml
import QtQuick.Controls
ApplicationWindow {
visible: true
width: 600
height: 500
title: "MyApp"
Rectangle {
anchors.fill: parent
Text {
id: my_text
anchors.centerIn: parent
text: "My APP"
font.pixelSize: 45
Accessible.role: Accessible.StaticText
Accessible.name: my_text.text
Accessible.description: "my app text"
}
Accessible.role: Accessible.StaticText
Accessible.name: "Rectagle"
Accessible.description: "my app rectangle"
}
}
The code is the same for both applications
On Monterey i can select any region with accessible
On Sonoma - only title
Does anyone know a solution?
Maybe someone has a similar problem?
Post not yet marked as solved
Hi,
it seems like the wachOS sysdiagnose debug profile is no longer valid and needs to be updated. Any idea to whom we should reach out to get this fixed?
I am talking about the profile linked here:
https://developer.apple.com/bug-reporting/profiles-and-logs/?platform=watchos
Kind regards
Alex
Post not yet marked as solved
We've been working on a SwiftUI app that randomly crashes with an exception. When navigating from one view to another, a rare exception is thrown, maybe every 1 / 200 times or so:
<SwiftUI.UIKitNavigationController: 0x109888400> is pushing the same view controller instance (<_TtGC7SwiftUI32NavigationStackHostingControllerVS_7AnyView_: 0x10792d400>) more than once which is not supported and is most likely an error in the application : com.<companyName>.<appName>
We haven't coded anything to directly push an instance of a view controller outside of what SwiftUI is doing. It seems to happen when the user taps on a NavigationLink view. It happens both in simulator and on device. Does anyone know what might cause this?
Post not yet marked as solved
Dear Community,
I have a use case where I have to present multiple sheets of different, non-resizable heights from a View.
It seems like when multiple .presentationDetents() are specified and you control the current detent with selection:, SwiftUI always allows the user to resize the sheet, even if .presentationDragIndicator(.hidden) is set.
In my use case, however, I wouldn't like to let the user do so, because this would result in a small view presented on a large sheet with lot of empty space around.
Specifying just one presentationDetent and changing it or its height programmatically doesn't seem to work: the change does not reflect immediately, even if the view in the sheet is given a new id() every time.
The only thing I could come up with is a custom detent as follows:
import SwiftUI
public class DynamicDetent: CustomPresentationDetent {
static var height: CGFloat = 80
public static func height(in context: Context) -> CGFloat? {
return height
}
}
extension PresentationDetent {
static let dynamic = Self.custom(DynamicDetent.self)
}
As the height() functon is being called every time the sheet is being displayed, setting DynamicDetent.height before displaying a new sheet works. Is there any other, less hacky way to achieve the same result?
Post not yet marked as solved
I'm currently developing an application where the models present inside a volumetric window may exceed the clipping boundaries of the window. ( Which I currently understand to be a maximum of 2m )
Because of this, as models move through the clipping boundaries, the interior of the models becomes visible. If possible, I'd like to cap these interiors with a solid fill so as to make them more visually appealing.
However, as far as I can tell, I'm quite limited in how I might be able to achieve this when using RealityKit on VisionOS.
Some approaches I've seen to accomplish similar effects seem to use multiple passes of model geometries rendering into stencil buffers and using that to inform whether or not a cap should be drawn. However, afiact, if I have opted into using a RealityView and RealityKit, I don't have the level of control over my render pipeline such that I can render ModelEntities and also have multiple rendering passes over the set of contained entities to render into a stencil buffer that I then provide to a separate set of "capping planes" ( how I currently imagine I might accomplish this effect ).
Alternatively ( due to the nature of the models I'm using ) I considered using a height map to construct an approximation of a surface cap, but how I might use a shader to construct a height map of rendered entities seems similarly difficult using the VisionOS RealityView pipeline. It is not obvious to me how I could use a ShaderGraphMaterial to render to an arbitrary image buffer that I might then pass to other functions to use as an input; ShaderGraphMaterial seems biased to the fact that all image inputs and outputs are either literal files or the actual rendered buffer.
Would anyone out there have already created an effect like this that might have some advice? Or, potentially correct any misunderstandings I have with regards to accessing the Metal pipeline for RealityView or using ShaderGraphMaterial to construct a height map?
Post not yet marked as solved
I have a stream.m3u8 file with the following contents:
#EXTM3U
#EXT-X-VERSION:11
#EXT-X-DEFINE:QUERYPARAM="token"
#EXT-X-STREAM-INF:BANDWIDTH=400000,RESOLUTION=640x360
360.m3u8{$token}
#EXT-X-DEFINE:QUERYPARAM="token"
#EXT-X-STREAM-INF:BANDWIDTH=1000000,RESOLUTION=960x540
540.m3u8{$token}
#EXT-X-STREAM-INF:BANDWIDTH=2000000,RESOLUTION=1280x720
#EXT-X-DEFINE:QUERYPARAM="token"
720.m3u8{$token}
#EXT-X-STREAM-INF:BANDWIDTH=8000000,RESOLUTION=1920x1080
#EXT-X-DEFINE:QUERYPARAM="token"
1080.m3u8{$token}
#EXT-X-STREAM-INF:BANDWIDTH=16000000,RESOLUTION=3840x2160
#EXT-X-DEFINE:QUERYPARAM="token"
2160.m3u8{$token}
The requesting URL is https://example.com/stream.m3u8!?token= and I am using an iPhone 15 running iOS 17.1.
The QUERYPARAM substitution as described here is not working, because the requested URL for 540.m3u8 does not have a token appended it; I know this because I checked my apache error log.
The file is hosted on a Debian 11 server.
Have I implemented this correctly, and do I have the correct tech stack? Furthermore, what debugging tools should I be running to investigate further?
Post not yet marked as solved
An archived documentation article about Universal Links,
https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html
states:
"In your com.apple.developer.associated-domains entitlement, include a list [...], prefixed with applinks:, such as applinks:sub.mywebsite.com. Limit this list to no more than about 20 to 30 domains."
This document was updated last in 2016 and it appears to be archived since 2018.
Newer documentation, like
https://developer.apple.com/documentation/xcode/supporting-associated-domains
or
https://developer.apple.com/documentation/xcode/configuring-an-associated-domain
do not mention any limitations and since iOS 14 there is also an Apple provided CDN that apps use to fetch domain association data, which lets one think that the limit may have been lifted.
However, I'm in the process of implementing
universal links and shared web credentials for a portal app with many customers, a few hundreds of them have their own domain, and would like to be sure this is supported before putting all the work into it.
So if anyone with a similar setup or someone from Apple could share/verify that there is no such limit anymore (or if any, what number) I would highly appreciate it.
Bests
bbjay
Post not yet marked as solved
Hi
We getting error in
Apple Sign In "Sign-Up not completed", Apple sign in working fine for old Apps and old Bundle ids, But it's not working in new Apps and new Bundle ids
We checked with other Apple Developer team accounts Apple Sign In is working on the same source code. But my Team account is getting an error.
We enabled signing capabilities and added Sign in with Apple and we added Provisioning profile certificate also , but I am still getting the same error.
Post not yet marked as solved
The following is a UIKit app that uses a collection view with list layout and a diffable data source.
It displays one section that has 10 empty cells and then final cell whose content view contains a text view, that is pinned to the content view's layout margins guide.
The text view's scrolling is set to false, so that the line collectionView.selfSizingInvalidation = .enabledIncludingConstraints will succeed at making the text view's cell resize automatically and animatedly as the text changes.
import UIKit
class ViewController: UIViewController {
var collectionView: UICollectionView!
var dataSource: UICollectionViewDiffableDataSource<String, Int>!
let textView: UITextView = {
let tv = UITextView()
tv.text = "Text"
tv.isScrollEnabled = false
return tv
}()
override func viewDidLoad() {
super.viewDidLoad()
configureHierarchy()
configureDataSource()
if #available(iOS 16.0, *) {
collectionView.selfSizingInvalidation = .enabledIncludingConstraints
}
}
func configureHierarchy() {
collectionView = .init(frame: .zero, collectionViewLayout: createLayout())
view.addSubview(collectionView)
collectionView.frame = view.bounds
collectionView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
}
func createLayout() -> UICollectionViewLayout {
let configuration = UICollectionLayoutListConfiguration(appearance: .insetGrouped)
return UICollectionViewCompositionalLayout.list(using: configuration)
}
func configureDataSource() {
let cellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, Int> { _, _, _ in }
let textViewCellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, Int> { [weak self] cell, _, _ in
guard let self else { return }
cell.contentView.addSubview(textView)
textView.pin(to: cell.contentView.layoutMarginsGuide)
}
dataSource = .init(collectionView: collectionView) { collectionView, indexPath, itemIdentifier in
if indexPath.row == 10 {
collectionView.dequeueConfiguredReusableCell(using: textViewCellRegistration, for: indexPath, item: itemIdentifier)
} else {
collectionView.dequeueConfiguredReusableCell(using: cellRegistration, for: indexPath, item: itemIdentifier)
}
}
var snapshot = NSDiffableDataSourceSnapshot<String, Int>()
snapshot.appendSections(["section"])
snapshot.appendItems(Array(0...10))
dataSource.apply(snapshot)
}
}
extension UIView {
func pin(
to object: CanBePinnedTo,
top: CGFloat = 0,
bottom: CGFloat = 0,
leading: CGFloat = 0,
trailing: CGFloat = 0
) {
self.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
self.topAnchor.constraint(equalTo: object.topAnchor, constant: top),
self.bottomAnchor.constraint(equalTo: object.bottomAnchor, constant: bottom),
self.leadingAnchor.constraint(equalTo: object.leadingAnchor, constant: leading),
self.trailingAnchor.constraint(equalTo: object.trailingAnchor, constant: trailing),
])
}
}
@MainActor
protocol CanBePinnedTo {
var topAnchor: NSLayoutYAxisAnchor { get }
var bottomAnchor: NSLayoutYAxisAnchor { get }
var leadingAnchor: NSLayoutXAxisAnchor { get }
var trailingAnchor: NSLayoutXAxisAnchor { get }
}
extension UIView: CanBePinnedTo { }
extension UILayoutGuide: CanBePinnedTo { }
How do I make the UI move to accomodate the keyboard once you tap on the text view and also when the text view changes size, by activating the view.keyboardLayoutGuide.topAnchor constraint, as shown in the WWDC21 video "Your guide to keyboard layout"?
My code does not resize the text view on iOS 15, only on iOS 16+, so clearly the solution may allow the UI to adjust to text view changes on iOS 16+ only.
Recommended, modern, approach:
Not recommended, old, approach:
I've tried to say view.keyboardLayoutGuide.topAnchor.constraint(equalTo: textView.bottomAnchor).isActive = true in the text view cell registration, as well as view.keyboardLayoutGuide.topAnchor.constraint(equalTo: collectionView.bottomAnchor).isActive = true in viewDidLoad(), but both of these approaches fail (Xcode 15.3 iPhone 15 Pro simulator with iOS 17.4, physical iPhone SE on iOS 15.8).
Post not yet marked as solved
I have requested for enrollment like month ago but still have not received any answer, I have wrote 2 email to support, but there is not any response too. Does anybody faced this kind of issue?
Post not yet marked as solved
I've been working with the Screen Time API for almost 6 months now.
I found out it's completely unreliable, testing on iOS 17.4, the DeviceActivityReport is not showing, the DeviceActivityMonitor more often than not does not fire intervalDidStart. It's very frustrating.
Has anyone found out a workaround?
We all know there has to be something we're doing wrong, since apps like Opal and Jono does not present those types of issues.
Let's please unite our forces and find a solution. How to use this API should not be a secret!