Hi, I'm using network extension on my VPN app. I'm override the sleep method and send some data to my server when the method call.
I noticed that the server requests are succeeded when I'm connecting with a WiFi networks and failed when I'm connecting with cellular networks.
Does the OS blocks immediately the connectivity when I'm on the cellular networks and the device enter to sleep?
Delve into the world of built-in app and system services available to developers. Discuss leveraging these services to enhance your app's functionality and user experience.
Post
Replies
Boosts
Views
Activity
I was able to successfully archive my main app that has a NotificationServiceExtension.
However, once I installed the app via Testflight, I was able to receive a notification, but the push notification modifications I did were not applied.
When I just ran it via Xcode, the push notification modifications worked.
Do I need to archive the NotificationServiceExtension instead of my main app?
We are trying to access and copy some files [e.g., video file] from another PC on local network using SMB protocol.
We found some third party libraries like AMSMB2 for this.
But we want to try to use Apple inbuilt features like File management mentioned in - https://developer.apple.com/videos/play/wwdc2019/719/
We could able to select file from SMB server using document picker in app manually. Also we got its url in debug which gets generated under "Shared" section in files app.
The URL I get from document picker is -> /private/var/mobile/Library/LiveFiles/com.apple.filesystems.smbclientd/asd0QUsers/testuser/iOS/SMB_ShareFolder
Now we want to avoid manual selection of file to user.We want directly open "/private/var/mobile/Library/LiveFiles/com.apple.filesystems.smbclientd/asd0QUsers/testuser/iOS/SMB_ShareFolder" path as soon as document picker opens. So that user can directly select file. But it is not working. It opens normal files app and all folders.
Getting below error -
Access Shared URL directly using documentPicker "Error - CFURLResourceIsReachable failed because it was passed a URL which has no scheme"
Sharing the code which I tried to open this shared folder directly :
let url = URL (string: "/private/var/mobile/Library/LiveFiles/com.apple.filesystems.smbclientd/asd0QUsers/Pranjali/iOS/SMB_ShareFolder")
let documentPicker = UIDocumentPickerViewController(forOpeningContentTypes: [UTType.folder])
documentPicker.delegate = self
documentPicker.allowsMultipleSelection = false
documentPicker.modalPresentationStyle = .custom
documentPicker.definesPresentationContext = true
documentPicker.directoryURL = url!
documentPicker.transitioningDelegate = customTransitioningDelegate
present(documentPicker, animated: true, completion: nil)
I get error in console - CFURLResourceIsReachable failed because it was passed a URL which has no scheme 2024-07-05 17:49:38.501059+0530 VideoImportPOC[1327:336989] [DocumentManager] revealDocumentAtURL encountered an error: Error Domain=NSCocoaErrorDomain Code=262 "The file couldn’t be opened because the specified URL type isn’t supported."
Can you please provide inputs if it is possible to access files directly in this way? or any other suggestions.
Hello, I would like to implement the function of unsubscribe FCM topics that I was subscribing to when I received a specific push from the server.
It was implemented through "willPresent" when the app was running, but I don't know how to do it when the app is not running.
I activated the 'Background fetch' and 'Remote Notifications' options for now.
const message = {
notification: {
title: 'FCM Topic UnSubscribe',
body: 'TestTestTest',
},
data: {
payload: JSON.stringify(payloadJson)
},
apns: {
payload: {
aps: {
sound: 'default',
'mutable-content': 1,
'content-available': 1
}
}
},
topic: 'unsubscribe_topic',
};
Test node code
Payload contains the type of topic you want to unsubscribe from.
And I added a function to receive push from didReceiveRemoteNotification and handle logic.
But this doesn't work.
Does Remote Notification (content-available) not work in iOS's Not running and Suspended state??
I'm also using the Notification Service Extension, is this related to it?
hi
After upgrading Xcode 16 beta 2 and iOS 18 beta 2, my project will run a hit assertion after executing
sqlite3_finalize
Assertion failed: (0), function isBulkReadStatement, file SQLiteDatabaseTracking.cpp, line 710.
Xcode 15 does not have this problem.
Users of my app have reported that they are sometimes unable to receive Voice-over-IP (VoIP) push notifications when using a SIM.
(There is no problem when using WiFi)
VoIP push notifications were not received during the following period.
Could you confirm diagnostic logs and could you please tell me why my app can't receive VoIP push?
[diagnostic logs]
https://drive.google.com/drive/folders/1gSAbr1Fy1SrjlmRXuAzoXqiaxnNbFhj8?usp=sharing
[Problem period]
2024/06/17 05:34:59 - 2024/06/17 09:04:42
Number of times that the push server pushed and it received a normal APNs response: 31
Number of times that iPhone received pushes: 0
2024/06/17 23:05:03 - 2024/06/18 09:02:16
Number of times that the push server pushed and it received a normal APNs response: 192
Number of times that iPhone received pushes: 0
2024/06/15 00:35:56 - 2024/06/15 09:55:57
Number of times that the push server pushed and it received a normal APNs response: 138
Number of times that iPhone received pushes: 0
QLPreview keeps blinking and stops previewing the file when opening some high-resolution PDF files with heavy content. This can only be simulated in a real device built in xcode simulators cant simulate the issue.
Tested in Xcode Version 15.4 (15F31d) and iPadOS Version 17.5.1.
Following is My Sample code :
import UIKit
import QuickLook
class ViewController: UIViewController {
var currentViewFilePath = ""
let preview = QLPreviewController()
override func viewDidLoad() {
super.viewDidLoad()
self.setupQLPreview()
loaddata()
// Do any additional setup after loading the view.
}
func loaddata(){
if let fileURL = Bundle.main.url(forResource: "CD28048D", withExtension: "pdf") {
self.currentViewFilePath = fileURL.relativePath
self.preview.reloadData()
// Use the fileURL here
print("File URL: \(fileURL)")
} else {
print("File not found")
}
}
}
extension ViewController:QLPreviewControllerDelegate,QLPreviewControllerDataSource{
func setupQLPreview(){
preview.delegate = self
preview.dataSource = self
self.view.addSubview(preview.view)
let previewhight = (UIScreen.main.bounds.height - ((self.navigationController?.navigationBar.frame.height ?? 0)))
preview.view.translatesAutoresizingMaskIntoConstraints = false
preview.view.topAnchor.constraint(equalTo: self.view.topAnchor).isActive = true
preview.view.leftAnchor.constraint(equalTo: self.view.leftAnchor,constant: 4).isActive = true
preview.view.rightAnchor.constraint(equalTo: self.view.rightAnchor,constant: -4).isActive = true
preview.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor,constant: 4).isActive = true
preview.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor,constant: -4).isActive = true
preview.view.widthAnchor.constraint(equalToConstant: self.view.frame.width-8).isActive = true
preview.view.heightAnchor.constraint(equalToConstant: previewhight-4).isActive = true
preview.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor).isActive = true
preview.navigationController?.isNavigationBarHidden = true
self.addChild(preview)
preview.didMove(toParent: self)
}
func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
if self.currentViewFilePath.isEmpty || self.currentViewFilePath == ""{
return 0
}else{
return 1
}
}
func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
let fileUrl = URL(fileURLWithPath: self.currentViewFilePath)
return fileUrl as QLPreviewItem
}
}
while running the above code Xcode debugger prints following errors:
View service did terminate with error:
Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted} #Remote
Preview collection viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted} #Remote
[u 0AA9D4C5-BBA1-56F6-8FFF-F5F56B99399A:m (null)] [com.apple.quicklook.extension.previewUI(1.0)] Connection to plugin invalidated while in use.
What is the proper use case of blockedApplications in the Screen Time API? I seem to be using it exactly as the documentation describes, however it is being rejected from the App Store. I am passing in bundle identifiers to block/hide the applications from the device.
What would be the proper way to use blockedApplications? Or is there a way to use it at all in an app being submitted for review?
Thanks!
Hi. The WWDC video of the v2 weatherkit api showed some examples for the REST API. However, they were very limited.
The documentation for the REST API is currently for the v1 weatherkit API. When will the documentation for the v2 API be released? There are some new features of the v2 that I would really like to use, but I can't without knowing the new v2 REST API specifications.
Any guidance would be much appreciated. Thanks!
TL;DR: Does Apple keep a list of ubiquity containers that a user has deleted, and prevent apps from creating the same ubiquity containers again?
If so, where is this list, and how can I reset it?
Long version:
I'm developing an app that relies on having an ubiquity container (iCloud Drive folder). This was working fine until I decided to rename the folder.
I deleted the existing folder with the old name, changed the value of "NSUbiquitousContainerName," and expected my app's code to create the new folder with the new name, as it had done originally.
But the result has been a disaster.
Now, in the simulator, all of my code is running without errors. The app thinks the iCloud Drive folder exists and can read and write files to it, but the folder only seems to exist in the simulator and is not visible via any iCloud Drive UI.
When I run the exact same code on my iPhone, the code fails with the error 'You don’t have permission to save the file “Documents” in the folder “[whatever]”.'
I have tried changing my app's bundle identifier and everything works swimmingly: the iCloud Drive folder is created instantly and is visible everywhere.
So something is preventing things from working with the original bundle identifier and I need to figure out what it is and how to fix it. Does anybody have any ideas? Thanks in advance.
Hello,
I‘m a developer and I want to integrate apple pay to my app but I don’t want to pay the 30% charges (in fact I can’t because if apple does I’m in deficit i’ll explain below)
My app is a ticketing app for events like parties, gigs, etc… and I don’t know if it is eligible for not using iap but apple pay (like that I’m not charged 30%). I’m also using a third party payment provider. In my case is it authorized by apple?
I was saying I’m in deficit if apples charges me 30% because when a user buys a ticket I keep around 3% of the ticket and the rest goes for the organization of the event. If apple takes 30% I’ll not be able to fit in my prices.
Lastly, if I’m eligible to using only apple pay and not iap, how do I say to apple « hey I don’t want to use iap but just apple pay ». Is it in the apple store connect panel? Or it has to be declared somewhere else?
is there an announcement or workaround to get the set wallpaper action in shortcuts back to work?
Hey, I have a problem. I was using MKMapView in my app, and in the view where I had a background at the top of the screen, in the example it was Color.red, it extended all the way to the top of the screen. Now, I wanted to switch to the newer Map and I'm seeing an issue because I'm getting a navigation bar that cuts off my color as I indicated in the picture. Does anyone know why this is happening and if there's another way to achieve this?
Steps to reproduce:
Change MapView() to Map() to see difference
import SwiftUI
import MapKit
@main
struct TestAppApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
struct ContentView: View {
var body: some View {
NavigationStack {
ScrollView(.vertical) {
Color.red
.padding(.top, -200)
.frame(height: 200)
MapView().frame(minHeight: 300) // change this line to Map
}
.navigationTitle("Title")
.navigationBarTitleDisplayMode(.large)
}
}
}
private typealias ViewControllerRepresentable = UIViewControllerRepresentable
struct MapView: ViewControllerRepresentable {
typealias ViewController = UIViewController
class Controller: ViewController {
var mapView: MKMapView {
guard let tempView = view as? MKMapView else {
fatalError("View could not be cast as MapView.")
}
return tempView
}
override func loadView() {
let mapView = MKMapView()
view = mapView
}
}
func makeUIViewController(context: Context) -> Controller {
Controller()
}
func updateUIViewController(_ controller: Controller, context: Context) {
update(controller: controller)
}
func update(controller: Controller) {
}
}
#Preview {
ContentView()
}
I got:
I want:
Hi, I'm having an issue where I'm trying to sort the applications related to the FamilyActivityPicker in the FamilyControls library. I'm able to populate a List in SwiftUI and able to see that a token is associated, but in general, there's no comparable to sort the Set which I converted into an array. Any help is appreciated!
I have the same app running on both a child ipad and a parent iphone. On the child device, I enable screentime controls (via requestAuthorization(for:)). The on the parent device, I want to be able to monitor the child's apps, so I expect that when I display a FamilyActivityPicker, I would choose from the apps on the child iPad. But instead, when I show FamilyActivityPickeron the parent iPhone, it shows the apps on the parent iPhone and none of the apps on the child iPad. Are there additional configurations steps that I'm missing?
I already have an iOS 17 App Intent that works with a URL:
@available(iOS 16, *)
struct MyAppIntent: AppIntent {
static let title : LocalizedStringResource = "My App Inent"
static let openAppWhenRun : Bool = true
@MainActor
func perform() async throws -> some IntentResult{
await UIApplication.shared.open(URL(string: "myapp://myappintent")!)
return .result()
}
}
Now, with iOS 18 and Control Widgets, I want to create a Control Widget button that smply opens the app with the same URL. However UIApplication code is not allowed within extensions. For this, Apple says to use OpenIntent which is shown here:
Link
Apple Sample Code from the link:
import AppIntents
struct LaunchAppIntent: OpenIntent {
static var title: LocalizedStringResource = "Launch App"
@Parameter(title: "Target")
var target: LaunchAppEnum
}
enum LaunchAppEnum: String, AppEnum {
case timer
case history
static var typeDisplayRepresentation = TypeDisplayRepresentation("Productivity Timer's app screens")
static var caseDisplayRepresentations = [
LaunchAppEnum.timer : DisplayRepresentation("Timer"),
LaunchAppEnum.history : DisplayRepresentation("History")
]
}
WWDC session video about this does not cover this particular method in detail and also this sample code is a bit confusing.
So how can I alter this code to just open the app with a URL?
Since ios 17 I can’t choose the destination of airdropped files anymore.
why this error persists?
GM,
I'm kinda new in SwiftData,
I'm trying to build an app with Steppers and I need to acess the value of steppers in other views and save them.
I started with this code but it doen't save the results, can someone please help? Thanks alot.
import SwiftData
@main
struct TesteStepApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
.modelContainer(for: GroceryListItem.self)
}
}
@Model
class GroceryListItem {
let stepperValue: Int
init(stepperValue: Int = 0) {
self.stepperValue = stepperValue
}
}
struct ContentView: View {
@Environment(\.modelContext) var context
@State private var stepperValue: Int = 0
var body: some View {
VStack {
Stepper("Value: \(stepperValue)", value: $stepperValue, in: 0...100)
.padding()
}
.padding()
.onChange(of: stepperValue) { oldValue, newValue in
insertValue(newValue)
}
}
private func insertValue(_ value: Int) {
}
}
#Preview {
ContentView()
}
I haven’t figured out a way to have my phone automatically restart between the hours of midnight and 6am when the battery reaches 100%. Is there a way to do this?
try to update my app from iOS 17 to io 18, I'm using SwiftData to save the data on the memory, on iOS 17 all works fine but I tried to export my app to iOS 18 and I get a strange error when I try to delate a playlist from SwiftData memory.
Thread 10: Fatal error: Never access a full future backing data - PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(url: x-coredata://4885953A-BDB2-4CD1-9299-B2FBBB899EB7/PlaylistItem/p372), implementation: SwiftData.PersistentIdentifierImplementation) with Optional(B2A80504-2FE1-4C86-8341-3DDE8B6AB913)
the code where this error happen is very simple,
func deletePlaylist(_ playlist: PlayListModel) async throws {
print("attempt to delate :, \(playlist.playlistName)")
context.delete(playlist)
try context.save() // error here on the save
}
Error only happen on iOS 18 not on the 17.