Post not yet marked as solved
Hello, technical friends, I am developing a custom keyboard extension, currently encountered a technical difficulty, almost asked AI and Google have not solved my problem.
Problem description:
When my App was first installed, I opened Settings from the App, enabled full access, and crashed when I returned to the App. Run the App for the second time, open the Settings from the App, update the full access permission, and automatically re-run the App after returning to the App, and then the third, fourth, and NTH times will not crash.
Seems like ios will kill host apps for custom keyboard extensions after full access is updated?
I want my App installed for the first time to update full access to return App without crashing, but don't know how to fix this problem. I look forward to the technical experts working in Apple development to help me provide relevant technical methods and ideas so that I can solve this problem. Thank you very much!
When tracing debugging in xcode, after the App forces exit, the console prompts:
Message from debugger: Terminated due to signal 9
When I was monitoring CPU and memory usage, it was very low and I didn't see anything unusual.
Post not yet marked as solved
Im making an API call using notions API to access and retrieve data from my Notion page and I'm successfully making the url request and accessing the page, however I seem to be struggling with returning the actual data that I have in that page and parsing the JSON data as right now, my console only outputs the makeup of my notion page rather than the formatted and parsed data. I made a codable struct meant to replicate the structure of a notion page based off their documentation then I'm passing that struct to my JSON parsing function but my data still is not being parsed and returned. heres what I have.
import Foundation
struct Page: Codable, Hashable { //Codable struct for notion "Page" for defining content aswell as object representation in a codable struct of all the basic components that make up a notion page per notion's documentation
let created_time: String
let created_by: String
let last_edited_time: String
let object: String
let cover: String
let emoji: String
let icon: String
struct properties: Codable, Hashable {
let title: String
let dueDate: String
let status: String
}
struct dueDate: Codable, Hashable {
let id: String
let type: String
let date: String
let start: String
let end: String? //optionals added to "end" and "time_zone" as these values are set to null in the documentation
let time_zone: String?
}
struct Title: Codable,Hashable {
let id: String
let type: String
let title: [String]
}
struct annotations: Codable, Hashable {
let bold: Bool
let italic: Bool
let strikethrough: Bool
let underline: Bool
let code: Bool
let color: String
}
let English: String
let Korean: String
let Pronounciation: String
let in_trash: Bool
let public_url: String?
let annotations: Bool
}
let url = URL(string: "https://api.notion.com/v1/pages/8efc0ca3d9cc44fbb1f34383b794b817")
let apiKey = "secret_Olc3LXnpDW6gI8o0Eu11lQr2krU4b870ryjFPJGCZs4"
let session = URLSession.shared
func makeRequest() {
if let url = url {
var request = URLRequest(url: url)
let header = "Bearer " + apiKey //authorization header declaration
request.addValue(header, forHTTPHeaderField: "authorization") //append apikey
request.addValue("2022-06-28",forHTTPHeaderField: "Notion-Version") //specify version per notions requirments
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let httpError = error {
print("could not establish HTTP connection:\(httpError)")
} else {
if let httpResponse = response as? HTTPURLResponse {
if httpResponse.statusCode == 200 {
} else {
print("invalid api key:\(httpResponse.statusCode)")
}
}
}
if let unwrapData = data { //safely unwrapping the data value using if let
if let makeString = String(data: unwrapData, encoding: .utf8) {
print(makeString)
} else {
print("no data is being returned:")
}
do {
let decoder = JSONDecoder() //JSONDecoder method to decode api data,
let codeUnwrappedData = try decoder.decode(Page.self,from: unwrapData) //Page. specifies its a struct, from: passes the data parmeter that contains the api data to be decoded //PASS STRUCTURESDATABASE STRUCT
print("data:\(codeUnwrappedData)")
} catch {
print("could not parse json data")
}
if let httpResponse = response as? HTTPURLResponse {
if httpResponse.statusCode == 200 {
print(String(data: unwrapData, encoding: .utf8)!)
} else {
print("unsuccessful http response:\(httpResponse)")
}
}
}
}
task.resume()
}
}
Post not yet marked as solved
Issue:
Our app is currently experiencing an unexpected behavior related to VPN functionality on iOS devices. Despite having the "OnDemandUserOverrideDisabled" parameter set to 1 in our VPN profile, users have reported that they can create a shortcut to disable the "Connect On Demand" feature. However, upon doing so, toggling off the VPN does not re-enable the feature as anticipated. This oversight results in unfiltered browsing, potentially compromising user security and privacy.
Explanation:
The presence of "OnDemandUserOverrideDisabled" set to 1 in our VPN profile should theoretically prevent users from toggling the "Connect On Demand" feature via any means. However, users have found a workaround using shortcuts to bypass this safeguard. Consequently, the VPN does not automatically re-engage after being disabled, leading to unintended consequences for users.
Impact:
The inability to reliably control VPN settings, despite profile configurations, poses a significant risk to user data privacy and security. Unintended unfiltered browsing can expose users to malicious actors and compromise sensitive information.
Post not yet marked as solved
Hi everyone i am having trouble with layout. I am using storyboard for UI. While most of the iphone version are ok with my auto layout ... the first generation Iphone SE is giving me errors. To publish app on app store do i need it to be working perfectly on first generation Iphone SE too ? Any link or knowledge on layout for story board is much appreciated.
Post not yet marked as solved
When I try to share a image of a component using the ImageRenderer, the type is not .png while sharing the image created using ShareLink
(The type is .jpeg for some reasons...)
My code looks like this:
ShareLink(
"Share",
item: (
ImageRenderer(
content: shareView.frame(
width: 420,
height: 520
)
).uiImage?.pngData()
)!,
preview: SharePreview(
"Share Preview",
image: (
ImageRenderer(
content: shareView.frame(
width: 420,
height: 520
)
).uiImage?.pngData()
)!
)
)
Also the image shared is always in low resolution, if anyone knows what to do in this case let me know!
Any helps will be appreciated!
Post not yet marked as solved
Hi all! Do you know if there is a sample project in Swift that I can use to detect obstacles using the Ultra Wideband?
I'm getting an "No exact matches in call to instance method 'setValue'" error for a property that has a enum as a value. How do I fix this? Any help would be appreciated.
enum FluidUnit: CaseIterable, Identifiable {
case ounce, liter
var id: Self { self }
var title: String {
switch self {
case .ounce:
return "ounce"
case .liter:
return "liters"
}
}
}
@Model
class Drink: Identifiable, Hashable {
let id: UUID = UUID()
let name: String = ""
var shortName: String = ""
var amount: Double = 0.0
let unitOfMeasure: FluidUnit = FluidUnit.ounce
let date: Date = Date()
var image: String = "water"
var favorite: Bool = false
init(name: String, amount: Double, unitOfMeasure: FluidUnit, image: String, favorite: Bool = false, shortName: String = "") {
self.id = UUID()
self.name = name
self.amount = amount
self.unitOfMeasure = unitOfMeasure
self.date = Date()
self.image = image
self.favorite = favorite
self.shortName = shortName
}
static func == (lhs: Drink, rhs: Drink) -> Bool {
lhs.id == rhs.id
}
func hash(into hasher: inout Hasher) {
hasher.combine(id)
}
}
Post not yet marked as solved
[visionOS Question]
I’m using the hierarchy of an entity loaded from a RealityKit Pro project to drive the content of a NavigationSplitView. I’d like to render any of the child entities in a RealityKitView in the detail pane when a user selects the child entity name from the list in the NavigationSplitView. I haven’t been able to render the entity in the detail view yet.
I have tried updating the position/scaling to no avail. I also tried adding an AnchorEntity and set the child entity parent to it. I’m starting to suspect that the way to do it is to create a scene for each individual child entity in the RealityKit Pro project. I’d prefer to avoid this approach as I want a data-driven approach.
Is there a way to implement my idea in RealityKit in code?
Post not yet marked as solved
Hi,
Looking for some guidance on getting my code approved through app connect.
Based on the crash logs, it appears the application is experiencing crashes related to an EXC_CRASH (SIGABRT), which is typically triggered by the app receiving an abort signal, often as a result of an unhandled exception or other critical errors that cause the app to terminate abruptly.
Any ideas on how to resolve?
Post not yet marked as solved
I used a custom time format in the DateTimePicker, such as 'hh:mm a' for 12-hour format. Although the device's time format is set to 24-hour mode, my sample app displays time in 24-hour format like '23:10' instead of the desired 12-hour format like '11:10 PM'.
I've already set the locale for the 12-hour format. Has anyone else encountered this issue, and what could be the solution?
Post not yet marked as solved
Is it possible to link CBPeripheral which comes from scan delegate with the peripheral which comes from retrieveConnectedPeripherals result ? My assumption is that is not fully possible, but I want to confirm.
They don't have nothing in common, except the name. But in my use case I have products which don't have name.
Post not yet marked as solved
The app downloads assets consisting of custom fonts using tags from On-Demand Resources, registers them in the system font, and provides them to other apps such as Freeform through UIFontPickerViewController.
Custom Fonts that were applied well until iOS 16 appear as Helvetica starting from iOS 17 and cannot be used. As the font list appears in the device's Settings > General > Font, the font downloaded from On-Demand Resources is registered in the system font. It has been confirmed to occur particularly frequently starting from iPhone 15 and iOS 17 and above.
The app requests download from On-Demand Resources with NSBundleResourceRequest along with tags, receives assets in response with conditionally beginAccessingResources and beginAccessingResources, and then registers them in the system using CTFontManagerRegisterFontURLs.
Post not yet marked as solved
On versions iOS 14+, my app which is connected by bluetooth to another device will become slow to write information. This isn't a couple hundred ms or a second or two, but upwards of 10 minutes for it to be sent and then 400 ms to be processed by the device and send its response back. I've confirmed with PacketLogger and with system logs that what commands we are sending with .writeValue are taking over 10 minutes.
This is the timestamp of when we are writing to the device
This is the PacketLogger timestamp of when the phone actually wrote to our device
This doesn't occur immediately, but is intermittent and once it does begin to occur, there's nothing to do to get out of it except for connecting once again to the device. Which, overtime, the issue begins to spring up again. So why is it taking 13 minutes for it to go through the phone and finally being sent?
Post not yet marked as solved
I am trying to create an iOS app where I need to immediately know when the iPhone is unlocked.
Let's say I want to print a log on the Xcode console whenever the phone is unlocked.
From my app, how do I detect if the phone is unlocked? Some code pointers will be highly appreciated. I am a newbie in iOS/APP development.
It should work even if my app is not running.
Is it even possible to do so?
Post not yet marked as solved
I was following the Swiftui tutorial at section 6 (https://developer.apple.com/tutorials/swiftui/creating-and-combining-views) to use a circle image to create an overlapping effect on the map. Turns out that when using a GeometryReader, the bottom padding was not working at all:
VStack{
MapView().frame(height:300)
CircleImage()
.offset(y: -130)
.padding(.bottom, -130)
VStack(alignment:.leading){
Text(
"Turtle Rock"
)
.font(
.title
)
HStack {
Text(
"Joshua Tree National Park"
)
.font(
.subheadline
)
Spacer()
Text(
"California"
)
.font(
.subheadline
)
}
}.padding(/*@START_MENU_TOKEN@*/10/*@END_MENU_TOKEN@*/)
}
This is the code for the CicleImage view: GeometryReader(content: { geometry in
let _ = print(
geometry.size.width
)
AsyncImage(
url: URL(
string: "https://cms.rationalcdn.com/v3/assets/blteecf9626d9a38b03/bltf5486c52361f2012/6144fafd39dff133fc23de9f/img-ios.png"
)
)
.frame(width: geometry.size.width)
.clipShape(
Circle()
).overlay{
Circle().stroke(
.white,
lineWidth: 4
)
}.shadow(
radius: 7
)
})
I just purchased a new M3 chip MacBook Air a little after it came out. I was able to create and deploy an iOS application. However, now that I am trying to create a new project Xcode throws an error upon launch.
Steps to recreate the error (if possible)
Open Xcode
Select create new app
An error is where the preview should be.
At this point I have added no code. It is all boiler plate from Apple.
Post not yet marked as solved
Hello. I've been looking all over this forum and stack and done some internet searches but unfortunately have found nothing to assist in fixing an error I'm receiving on my project in Xcode.
Every view shows an error identical to the one shown above, only with that specific file name displayed instead. When I go to fix the error, this is the error detail displayed:
== PREVIEW UPDATE ERROR:
LinkDylibError: Failed to build TabBar.swift
Linking failed: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: search path '/Applications/Xcode.app/Contents/SharedFrameworks-iphonesimulator' not found
ld: unsupported mach-o filetype (only MH_OBJECT and MH_DYLIB can be linked) in '/Users/brycemchose/Library/Developer/Xcode/DerivedData/Service_Square_App-dnblqgabcrxprhaizjtkcvouyzln/Build/Intermediates.noindex/Previews/iphonesimulator/Service Square App/Products/Debug-iphonesimulator/Service Square.app/Service Square'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Note that I can run the app successfully to a simulator or to my iPhone, but cannot see the preview within the Xcode canvas. I've been blindly developing the last two app updates, pushing the changes to the simulator and then tweaking the code based on the simulated version. I can keep doing this for a little while but it is significantly slower and more difficult, especially to fix small bugs and make tiny changes, so I'd really like to see if anyone has an idea for how I can get the preview back to being properly displayed. I'm brand new to this whole thing and have no idea how to fix this issue, so I'd be really grateful if someone with more experience could offer some suggestions! Thanks in advance! :)
I'm writing a SpriteKit game in Swift that does this familiar dance in my GameScene touchesEnded(...)...
let touch = touches.first!.location(in: self)
let nodes = self.nodes(at: touch)
...but sometimes when the game is running, the nodes collection is empty, even though there are clearly, visibly nodes under the touch. All of the nodes I care about are children of a single SKNode, MapNode, that is one of two children of the GameScene.
After a bunch of debugging, I've noticed that when this problem happens, something is causing calculateAccumulatedFrame() to return a frame that is way, way smaller than the real bounds of MapNode.
When the scene begins, calculateAccumulatedFrame() is perfect, but something that happens later on breaks it. I've tried adding a node to MapNode that is the correct size to 'force' calculateAccumulatedFrame to do the right thing, but this doesn't work.
Is there something obvious I am doing wrong, or some common pitfalls? Is there some way to force calculateAccumulatedFrame to return this correct size?
Post not yet marked as solved
Hi People :)
I'm experimenting with Swift/C++ interoperability these days.
I'd like to understand how could I conform a Swift class to Cxx header:
Like this:
import Application
class App: Application {
public func run() {
let app = NSApplication.shared
let delegate = AppDelegate()
app.delegate = delegate
app.run()
}
}
But I got this error:
/Users/tonygo/oss/native-research/App.swift:27:7: error: inheritance from non-protocol, non-class type 'Application'
class App: Application {
^
ninja: build stopped: subcommand failed.
That seems normal indeed.
Reproductible example: https://github.com/tony-go/native-research/tree/conform-swift-to-cxx-header (Just run make)
I also have another branch on that repo where I use an intermediate Cxx bridge file that conforms to the :Application class and use the Swift API, like this: https://github.com/tony-go/native-research/tree/main/app
Bit I think that its a lot of boilerplate.
So I wonder which approach could I take for this?
Cheers :)
Post not yet marked as solved
I want to change the display language, particularly for week and the year and date on MultiDatePicker.
By adjusting the locale, the year and date can be changed.
However, I'm unable to change the display for week .
I've tried several methods, such as setting the calendar and adjusting the time zone, but none of them seem to work.
Are there any good way to solve it?