Dive into the world of programming languages used for app development.

All subtopics

Post

Replies

Boosts

Views

Activity

unknown argument: '-cxx-interoperability-mode=default'
I am creating an Xcode project using xcode generator in Cmake. The project has a library which contains cpp files and swift files. I m trying to test swift-cpp interoperability that is introduced in xcode15 to perform direct cpp calls from swift and vice-versa. For this to work, we need to set a xcode build setting 'C++ and Objective-C Interoperability' which I m doing via cmake, Below is my cmake file: cmake_minimum_required(VERSION 3.18) project(CxxInterop LANGUAGES CXX Swift) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_Swift_LANGUAGE_VERSION 5.0) add_executable(CxxInterop ./Sources/CxxInterop/main.swift ./Sources/CxxInterop/Student.cpp ) #include the directory with modulemap file and Student.hpp target_include_directories(CxxInterop PUBLIC ${CMAKE_SOURCE_DIR}/Sources/CxxInterop) #setting the xcode C++ and Objective-C Interoperability setting target_compile_options(CxxInterop PRIVATE "-cxx-interoperability-mode=default") when building the generated xcode project I get the error unknown argument: '-cxx-interoperability-mode=default'. However the weird thing is when I separate out the cpp code in a different library and swift files in a different one, then this works and I m able to invoke the cpp methods in my swift file after importing the clang module from the module map file. Is there any reason to why having cpp and swift files in same library producing this error? I m following this link to setup the project via cmake.
0
0
476
Oct ’23
UIAlertController new design on Mac OS Sonoma
The new alert on sonoma when you have 8 > actions its shows horizontal and goes out of the screen. Is there any way to bring back the old alert? let alert = UIAlertController(title: "Alert", message: "Message", preferredStyle: UIAlertController.Style.alert) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.destructive, handler: nil)) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil)) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil)) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.destructive, handler: nil)) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil)) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil)) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.destructive, handler: nil)) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil)) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil)) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil)) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.destructive, handler: nil)) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil)) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil)) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.destructive, handler: nil)) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil)) alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil)) self.present(alert, animated: true, completion: nil)
8
0
997
Oct ’23
new swift concurrency model with core data willSave()
anyone know how to use the new swift concurrency model (ie. await context.perform and context.perform) core data willSave()? for example. how would I ensure this is thread safe? changing self.managedObjectContext!.performAndWait to await self.managedObjectContext!.perform means I have to change willSave() to async which then means it never gets called because its not overriding the correct method anymore. override public func willSave() { self.managedObjectContext!.performAndWait { if self.modifiedDate == nil || Date().timeIntervalSince(self.modifiedDate!) >= 1 { self.modifiedDate = Date() } } super.willSave() }
0
0
652
Oct ’23
From the running applications, How can i get the details/PrinterName of the selected printer from the printcenter in the latest MacOS14 Sonoma?
Previously in MacOS13 and below versions, we used get the printer name from the running applications by this below code:- let apps = NSWorkspace.shared.runningApplications for app in apps{ if(app.bundleIdentifier == "com.apple.print.PrinterProxy"){ let spoolerName = app.bundleURL?.deletingPathExtension().lastPathComponent print("spooler name is : \(spoolerName ?? "")") //spooler name is : HP LaserJet Pro M428f-M429f } } In MacOS 14, the same approach is not able get the printer name as the implementation is modified to PrintCenter. So, can someone please suggest me the way to the fetch selected printer details from the printCenter. let apps = NSWorkspace.shared.runningApplications for app in apps{ if(app.bundleIdentifier == "com.apple.printcenter"){ let spoolerName = app.bundleURL?.deletingPathExtension().lastPathComponent print("spooler name is : \(spoolerName ?? "")") //spooler name is : Print Centre } }
0
0
635
Oct ’23
UIPrinter, "contactPrinter" method returns TRUE in iOS 17 even if iPad not connected to the same network as the printer
Environment→ ・Device: iPad 9th generation ・OS:iPadOS17.1、iPadOS16.6 ・Printer model:EPSON PX-S730 What I want→ I want to determine whether the printer and iPad are connected to the same Wi-Fi network. Current issues→ When I run the below code on an iOS17 iPad, contactPrinter() becomes true even though you are not connected to the same network as the printer. Problem Description→ I want to pass the URL of the printer that I have set in advance and print directly from the device to the printer. So in iOS 16 when i execute the below code, without connecting to the same network as printer, return value of the "contactPrinter" method is FALSE. once i update to iOS 17 and ran the same code with the same conditions(iPad and printer not connected to same network), return value becomes TRUE. [I'm using "contactPrinter" method because after update to iOS 17 i was able to successfully launch a print job even if your device isn't connected to the same network as your printer.But in iOS 16 it return as an Error.] Is this a bug in iOS 17? Or is the method used incorrectly? Test code: let printer = UIPrinter(url: URL(string: "printer url")!) printer.contactPrinter { (available) -> Void in if (available) { // iOS17.1:true, iOS16.6:false print("connected to printer") printController.print(to: printer, completionHandler: printCompletionHandler) } else { print("not connected to printer") } }
0
0
780
Oct ’23
Xcode ‘C++ and Objective-C Interoperability’ build setting not getting set
I m trying to create an xcode project with cpp-swift interoperability(introduced in xcode15) using cmake xcode generator. I m able to invoke cpp code in swift and vice-versa but when opening the project in xcode, the build setting for 'C++ and Objective-C Interoperability' is still set to 'C/Objective C' like in image below. I want to set it to 'C++/Objective-C++'. I m using the below cmake for this: . . add_library(cxx-support ./Sources/CxxSupport/Student1.cpp ./Sources/CxxSupport/Teacher.swift ) #include the directory to access modulemap content target_include_directories(cxx-support PUBLIC ${CMAKE_SOURCE_DIR}/Sources/CxxSupport) target_compile_options(cxx-support PUBLIC "$<$<COMPILE_LANGUAGE:Swift>:-cxx-interoperability-mode=default>" ) . . I Have also tried the below in cmake, but it didn't work. #set(SWIFT_OBJC_INTEROP_MODE "objcxx" CACHE STRING "") #target_compile_options(cxx-support PUBLIC #"SWIFT_OBJC_INTEROP_MODE=objcxx") Any help on how this can be achieved?
1
0
859
Oct ’23
Error during archive
Good Morning, I get this error every time I try to make the archive and I don't see any more information, nor have I found a solution, could you please help me to solve it? ld: building for 'iOS', but linking in object file (/Users/juanjo/Documents/Jabali/platforms/ios/build/Debug-iphonesimulator/XCFrameworkIntermediates/GoogleAppMeasurement/WithoutAdIdSupport/GoogleAppMeasurement.framework/GoogleAppMeasurement[arm64][3](apm_experimentation .pb.o)) built for 'iOS-simulator' clang: error: linker command failed with exit code 1 (use -v to see invocation)
1
0
576
Oct ’23
Issues with "AR not supported in Simulator"
I am trying to implement Hand Tracking in a visionOS application I am developing. Initially, I encountered errors such as "Cannot find type 'ARAnchor' in scope." Upon investigation, I realized the error arose because "import ARKit" is required, which was already in the code. Digging a bit deeper, I discovered that ARKit is not compatible with the simulator, or at least that's what I believe. My ultimate understanding is: "ARKit requires the specific hardware of an actual iOS device to operate, as it relies on features like the device's camera and motion sensors." Having reached this point, I noticed in the "HappyBeam" application documentation for visionOS there was a function "#if !targetEnvironment(simulator)". Upon researching, it turns out that this compilation conditional is used so that the application can compile in the simulator (without ARKit functionality) and on a real device. After applying "#if !targetEnvironment(simulator)" it allowed me to compile, but now when I run the application in Simulator, I receive a message on the main window stating: "AR not supported in Simulator." My current question is: Can I simulate Hand Tracking in any way without using ARKit, or is it essential to run the application on a physical device? And if Hand Tracking can be simulated in "Simulator", how is it done? I haven't been able to find a way to do it.
1
1
521
Oct ’23
Swift String Catalog Localisable
I have been desperately trying to fill the string catalogue with values in a Swift project (storyboard interface) for days. If I have implemented the instructions on the internet correctly, it is only required: add a string catalogue file set the entry "Localization Prefers String Catalogs" to YES in the Build options. add a second language in the string catalogue file. Build the project Contrary to expectations, there are no entries in the catalogue that could be translated, it simply remains empty. What am I doing wrong? Is the string catalogue only available for SwiftUI Interface? Thanks in advance. Stephan
4
1
1.2k
Oct ’23
CarPlay tab bar issues
Adding CPTabBarTemplate to my Root Template seems to break CPListTemplate, it ends up highlighting the second indexed value. I'm unable to figure out what's causing this issue. Removing the tab bar does fix the issue but I need to use tabs. Any help would be greatly appreciated! func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, didConnect interfaceController: CPInterfaceController) { self.interfaceController = interfaceController let listTemplate = CPListTemplate(title: "List", sections: []) listTemplate.tabImage = UIImage(systemName: "person.crop.rectangle.stack.fill") let settingsTemplate = CPListTemplate(title: "Settings", sections: []) settingsTemplate.tabImage = UIImage(systemName: "gear") let tabBarTemplate = CPTabBarTemplate(templates: [listTemplate, settingsTemplate]) interfaceController.setRootTemplate(tabBarTemplate, animated: true, completion: nil) }
4
0
1.1k
Oct ’23
Memory issue message from xcode
The app “MyProductAPP” has been killed by the operating system because it is using too much memory. When I run my project the home view open with Google Map View after 2 min app crashed with above message, I try to check what's going on with xcode memory tools, I don't have any clue the reson and from where this crashed occured. Please help me to know how will over this crashed
0
1
423
Oct ’23
Fetching battery capacity percentage value from iOS/iPadOS Devices
Our goal is to fetch Battery Health Capacity Percentage through an swift App or through any Mobile device Management Protocol. I can surf through internet and can find only there is an api to fetch the battery level from the iOS/iPadOS devices. Is there any way to fetch the battery health. Eventhough there are plenty of apple forums regarding this problem, Still we cant able to find any possible way to do it. https://developer.apple.com/forums/thread/693614 - With respect to Apple's Reply in this thread, We have raised an Enhancement Request with Feedback Id : FB13322108 on this context. We request you to have a look on it, as most of them are waiting for a solution.
0
0
549
Nov ’23
Opening an App Conditionally with Swift and App Intents in iOS Shortcuts
I am trying to create a simple app that "blocks" other apps if a certain condition is not met. I am currently using the IOS shortcuts and have set up an automation that opens my app A whenever another app B opens. If the condition is not met i imagine the flow to look like: Open app A. My app B opens instead. I check a box in my app B. I navigate back to app A and it works as expected. If the condition already is met the app A would work as expected from the beginning. What is have tried so far My first attempt involved using an AppIntent and changing the openAppWhenRun programmatically based on the condition. I did however learn pretty quickly that changing the value of openAppWhenRun does not change if the AppIntent actually opens my app. The code for this looked like this where the value of openAppWhenRun is changed in another function. struct BlockerIntent: AppIntent { static let title: LocalizedStringResource = "Blocker App" static let description: LocalizedStringResource = "Blocks an app until condition is met" static var openAppWhenRun: Bool = false @MainActor func perform() async throws -> some IntentResult { return .result() } } Another attempt involved setting openAppWhenRun to false in an outer AppIntent and opening another inner AppIntent if the condition is met. If the condition in my app is met openAppWhenRun is set to true and instead of opening the inner AppIntent an Error is thrown. This functions as expected but there is an error notification showing every time I open the "blocked" app. struct BlockerIntent: AppIntent { static let title: LocalizedStringResource = "Blocker App" static let description: LocalizedStringResource = "Blocks an app until condition is met" static var openAppWhenRun: Bool = false func perform() async throws -> some IntentResult & OpensIntent { if (BlockerIntent.openAppWhenRun) { throw Error.notFound } return .result(opensIntent: OpenBlockerApp()) } enum Error: Swift.Error, CustomLocalizedStringResourceConvertible { case notFound var localizedStringResource: LocalizedStringResource { switch self { case .notFound: return "Ignore this message" } } } } struct OpenBlockerApp: AppIntent { static let title: LocalizedStringResource = "Open Blocker App" static let description: LocalizedStringResource = "Opens Blocker App" static var openAppWhenRun: Bool = true @MainActor func perform() async throws -> some IntentResult { return .result() } } My third attempt look similar to the previous one but instead I used two different inner AppIntents. The only difference between the two were that on had openAppWhenRun = false and the other had openAppWhenRun = true. struct BlockerIntent: AppIntent { static let title: LocalizedStringResource = "Blocker App" static let description: LocalizedStringResource = "Blacks an app until condition is met" static var openAppWhenRun: Bool = false func perform() async throws -> some IntentResult & OpensIntent { if (BlockerIntent.openAppWhenRun) { return .result(opensIntent: DoNotOpenBlockerApp()) } else { return .result(opensIntent: OpenBlockerApp()) } } } Trying this gives me this error: Function declares an opaque return type 'some IntentResult & OpensIntent', but the return statements in its body do not have matching underlying types I have also tried opening the app with a URL link with little to no success often ending up in an infinity loop, I did try the ForegroundContinuableIntent but it did not function as expected since it relies on the users input. Is there any way to do what I am trying to accomplish? I have seen other apps using a similar concept so I feel like this should be possible. Many thanks!
5
5
1.4k
Nov ’23
ITMS-90428: Invalid Swift Suppor
I am trying to upload a new build of my app from the new Xcode 15.0.1 but it keeps failing with the below error: ITMS-90428: Invalid Swift Support - The files libswiftMetal.dylib, libswiftCoreGraphics.dylib, libswiftCoreLocation.dylib, libswiftObjectiveC.dylib, libswiftCoreAudio.dylib, libswiftos.dylib, libswiftDarwin.dylib, libswiftsimd.dylib, libswiftFoundation.dylib, libswiftCoreImage.dylib, libswiftQuartzCore.dylib, libswiftNetwork.dylib, libswiftUIKit.dylib, libswiftCoreFoundation.dylib, libswiftCoreMedia.dylib, libswiftCore.dylib, libswiftDispatch.dylib, libswiftAVFoundation.dylib don’t match /Payload/goodville.app/Frameworks/libswiftMetal.dylib, /Payload/goodville.app/Frameworks/libswiftCoreGraphics.dylib, /Payload/goodville.app/Frameworks/libswiftCoreLocation.dylib, /Payload/goodville.app/Frameworks/libswiftObjectiveC.dylib, /Payload/goodville.app/Frameworks/libswiftCoreAudio.dylib, /Payload/goodville.app/Frameworks/libswiftos.dylib, /Payload/goodville.app/Frameworks/libswiftDarwin.dylib, /Payload/goodville.app/Frameworks/libswiftsimd.dylib, /Payload/goodville.app/Frameworks/libswiftFoundation.dylib, /Payload/goodville.app/Frameworks/libswiftCoreImage.dylib, /Payload/goodville.app/Frameworks/libswiftQuartzCore.dylib, /Payload/goodville.app/Frameworks/libswiftNetwork.dylib, /Payload/goodville.app/Frameworks/libswiftUIKit.dylib, /Payload/goodville.app/Frameworks/libswiftCoreFoundation.dylib, /Payload/goodville.app/Frameworks/libswiftCoreMedia.dylib, /Payload/goodville.app/Frameworks/libswiftCore.dylib, /Payload/goodville.app/Frameworks/libswiftDispatch.dylib, /Payload/goodville.app/Frameworks/libswiftAVFoundation.dylib. Make sure the files are correct, rebuild your app, and resubmit it. Don’t apply post-processing to /Payload/goodville.app/Frameworks/libswiftMetal.dylib, /Payload/goodville.app/Frameworks/libswiftCoreGraphics.dylib, /Payload/goodville.app/Frameworks/libswiftCoreLocation.dylib, /Payload/goodville.app/Frameworks/libswiftObjectiveC.dylib, /Payload/goodville.app/Frameworks/libswiftCoreAudio.dylib, /Payload/goodville.app/Frameworks/libswiftos.dylib, /Payload/goodville.app/Frameworks/libswiftDarwin.dylib, /Payload/goodville.app/Frameworks/libswiftsimd.dylib, /Payload/goodville.app/Frameworks/libswiftFoundation.dylib, /Payload/goodville.app/Frameworks/libswiftCoreImage.dylib, /Payload/goodville.app/Frameworks/libswiftQuartzCore.dylib, /Payload/goodville.app/Frameworks/libswiftNetwork.dylib, /Payload/goodville.app/Frameworks/libswiftUIKit.dylib, /Payload/goodville.app/Frameworks/libswiftCoreFoundation.dylib, /Payload/goodville.app/Frameworks/libswiftCoreMedia.dylib, /Payload/goodville.app/Frameworks/libswiftCore.dylib, /Payload/goodville.app/Frameworks/libswiftDispatch.dylib, /Payload/goodville.app/Frameworks/libswiftAVFoundation.dylib. These optons are true, ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES EMBEDDED_CONTENT_CONTAINS_SWIFT = YES Error occured after updating Xcode to the latest 15.0.1 from Xcode 14, can anybody point to the reason of this issue ?
2
0
418
Nov ’23