in Project/Package Dependencies, some problem occurs while i add Exact Version value like '1.1.0-0fec058'. the finally value i input will be random updated to 1.0.0 or other value. Reproduce by input any version value like '1.2.0-"0"' which second part begin with 0. So bad experience.
Xcode
RSS for tagBuild, test, and submit your app using Xcode, Apple's integrated development environment.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have an iOS application view that contains an AVCaptureSession, AVCaptureVideoPreviewLayer (created with the AVCaptureSession), and a UIImageView (in the backend the app takes the output of the AVCaptureSession, runs it through a Semantic Segmentation model, and displays the output in the UIImageView).
When I pause the app and run the “Debug View Hierarchy”, it shows the UIImageView, the relevant buttons and labels.
However, it does not seem to show AVCaptureVideoPreviewLayer that I have set up in my application.
Is there some special set up that needs to be done to be able to view Camera Related features?
The following is part of the view code, a component that is used to render the AVCaptureVideoPreviewLayer (not sure if this is enough, please let me know if its not):
class CameraViewController: UIViewController {
var session: AVCaptureSession?
var frameRect: CGRect = CGRect()
var rootLayer: CALayer! = nil
private var previewLayer: AVCaptureVideoPreviewLayer! = nil
init(session: AVCaptureSession) {
self.session = session
super.init(nibName: nil, bundle: nil)
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override func viewDidLoad() {
super.viewDidLoad()
setUp(session: session!)
}
private func setUp(session: AVCaptureSession) {
previewLayer = AVCaptureVideoPreviewLayer(session: session)
previewLayer.videoGravity = AVLayerVideoGravity.resizeAspectFill
previewLayer.frame = self.frameRect
DispatchQueue.main.async { [weak self] in
self!.view.layer.addSublayer(self!.previewLayer)
//self!.view.layer.addSublayer(self!.detectionLayer)
}
}
}
struct HostedCameraViewController: UIViewControllerRepresentable{
var session: AVCaptureSession!
var frameRect: CGRect
func makeUIViewController(context: Context) -> CameraViewController {
let viewController = CameraViewController(session: session)
viewController.frameRect = frameRect
return viewController
}
func updateUIViewController(_ uiView: CameraViewController, context: Context) {
}
}
After building the app and moving to the select for distribution, there is no option to submit to the app store
Topic:
Developer Tools & Services
SubTopic:
Xcode
Update Xcode 16.2 but i get error Assets Validation Failed upload to Appstore,
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
App Store
App Store Connect
Xcode
Organizer Window
I am currently developing a No-Sandbox application.
What I want to achieve is to use AuthorizationCopyRights in a No-Sandbox application to elevate to root, then register SMAppService.daemon after elevation, and finally call the registered daemon from within the No-Sandbox application.
Implementation Details
Here is the Plist that I am registering with SMAppService:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.agent</string>
<key>BundleProgram</key>
<string>/usr/local/bin/test</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/test</string>
<string>login</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Code that successfully performs privilege escalation (a helper tool popup appears)
private func registerSMAppServiceDaemon() -> Bool {
let service = SMAppService.daemon(plistName: "com.example.plist")
do {
try service.register()
print("Successfully registered \(service)")
return true
} catch {
print("Unable to register \(error)")
return false
}
}
private func levelUpRoot() -> Bool {
var authRef: AuthorizationRef?
let status = AuthorizationCreate(nil, nil, [], &authRef)
if status != errAuthorizationSuccess {
return false
}
let rightName = kSMRightBlessPrivilegedHelper
return rightName.withCString { cStringName -> Bool in
var authItem = AuthorizationItem(
name: cStringName,
valueLength: 0,
value: nil,
flags: 0
)
return withUnsafeMutablePointer(to: &authItem) { authItemPointer -> Bool in
var authRights = AuthorizationRights(count: 1, items: authItemPointer)
let authFlags: AuthorizationFlags = [.interactionAllowed, .preAuthorize, .extendRights]
let status = AuthorizationCopyRights(authRef!, &authRights, nil, authFlags, nil)
if status == errAuthorizationSuccess {
if !registerSMAppServiceDaemon() {
return false
}
return true
}
return false
}
}
}
Error Details
Unable to register Error Domain=SMAppServiceErrorDomain Code=1 "Operation not permitted" UserInfo={NSLocalizedFailureReason=Operation not permitted}
The likely cause of this error is that /usr/local/bin/test is being bundled.
However, based on my understanding, since this is a non-sandboxed application, the binary should be accessible as long as it is run as root.
Trying
post as mentioned in the response, placing the test binary under Contents/Resources/ allows SMAppService to successfully register it. However, executing the binary results in a different error.
Here is the plist at that time.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.agent</string>
<key>BundleProgram</key>
<string>Contents/Resources/test</string>
<key>ProgramArguments</key>
<array>
<string>Contents/Resources/test</string>
<string>login</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Here is the function at that time.
private func executeBin() {
let bundle = Bundle.main
if let binaryPath = bundle.path(forResource: "test", ofType: nil) {
print(binaryPath)
let task = Process()
task.executableURL = URL(fileURLWithPath: binaryPath)
task.arguments = ["login"]
let pipe = Pipe()
task.standardOutput = pipe
task.standardError = pipe
do {
try task.run()
let outputData = pipe.fileHandleForReading.readDataToEndOfFile()
if let output = String(data: outputData, encoding: .utf8) {
print("Binary output: \(output)")
}
task.waitUntilExit()
if task.terminationStatus == 0 {
print("Binary executed successfully")
} else {
print("Binary execution failed with status: \(task.terminationStatus)")
}
} catch {
print("Error executing binary: \(error)")
}
} else {
print("Binary not found in the app bundle")
}
}
Executed After Error
Binary output:
Binary execution failed with status: 5
Are there any other ways to execute a specific binary as root when using AuthorizationCopyRights?
For example, by preparing a Helper Tool?
I am having issues loading my model from a Swift Package with the following structure:
| Package.swift
| Sources
| - | SamplePackage
| - | - Core
| - | - | - SamplePackageDataStack.swift
| - | - | - DataModel.xcdatamodeld
| - | - | - | - Model.xcdatamodel ( <- is this new? )
As mentioned, I am not required to list the xcdatamodeld as a resource in my Package manifest.
When trying to load the model in the main app, I am getting
CoreData: error: Failed to load model named DataModel
Code:
In my swift Package:
public class SamplePackageDataStack: NSObject {
public static let shared = SamplePackageDataStack()
private override init() {}
public lazy var persistentContainer: NSPersistentContainer = {
let container = NSPersistentContainer(name: "DataModel")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()
/// The managed object context associated with the main queue. (read-only)
public var context: NSManagedObjectContext {
return self.persistentContainer.viewContext
}
public func saveContext () {
if context.hasChanges {
do {
try context.save()
} catch {
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
}
}
Main App:
import SamplePackage
class ViewController: UIViewController {
override func viewDidLoad() {
					super.viewDidLoad()
	var container = SamplePackageDataStack.shared.persistentContainer
print(container)
		}
}
Hi everyone,
I’ve been experiencing a persistent issue with my MacBook Pro (M2 Pro, macOS 15.2) when using Xcode (version 16.2). If Xcode is open and my Mac goes into sleep mode, the screen size changes upon waking. Specifically, I notice 3mm bezels appear on each side of the screen, making the display slightly smaller, and everything scales down to fit this reduced size.
This issue happens multiple times a day and has been ongoing for over a year. It’s quite disruptive to my workflow.
Here is a video to illustrate the problem:
Has anyone encountered this before? If so, do you have any suggestions for fixing it or steps I can take to debug the issue?
Thanks in advance for your help and support!
Topic:
Developer Tools & Services
SubTopic:
Xcode
Hello.
We have a few iOS devices connected to CI macs. We test our 3D engine, so we really need hardware devices for that. The issue is that Xcode loses connection to the devices once in a while, mostly after mac reboot, which requires a human to enter test room and unplug and plug cable again. Even if device is visible and accessible in Finder, Xcode may still don't see it, and devicectl shows it as disconnected.
Are there any hacks to make connection stable? The best what we could achieve so far was to remove iOS device screen lock - otherwise mac reboot would in 100% cases require human interaction to reconnect the device.
Both iOS and mac are logged into the same Apple ID.
Mac is logged in automatically after reboot
iOS devices have no screen lock
Thank you.
I can’t view energy reports in the Xcode Organizer. I keep getting the message “An error occurred while downloading energy reports. Please provide a valid value”
Feedback ID: FB16595567
The simulator will not work. No matter How much I restart, when I open my app, it tells me either Build succeeded but I see a loading bar or a loading automatic phone simulator but it never shows up like the line would. keep going in a loop, for example this is what it looks like,
Hello,
I recently received feedback from two users that they charged twice after entering their password when trying to initiate payment on the app. I checked my front-end and back-end codes, both of which only initiate one order, but I don't know why the user deducts two payments after entering the password.
I hope everyone can help me analyze this problem and how it came about?
Additionally, I wonder if there is a possibility that the system may prompt the user to enter their password again due to network issues, resulting in the deduction of two payments. But the user told us that they only entered the password once (I don't know if the user lied).
I am unable to find how the problem arose. I hope you can help me analyze how to solve this problem?
If you also encounter such a problem, can you teach me how to solve it?
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
StoreKit
App Store Connect
In-App Purchase
Apple Pay
I can sucessfully send pushes to an app (which has been installed/run via Xcode) when the pushes are going through the Apple sandbox server.
However I want to test the server is configured correctly to send them through the Apple production server.
In the Xcode scheme I tried to change the build configuration to release (and ticked debug executable off) ,however the pushes still only work when sent through the sandbox.
Is there a way of installing/running the app using Xcode such that its compatible with the push production environment?
Does the APS Environment entitlement come into play here? this only ever says development.
(The app is on behalf of a 3rd party company, they've added me to their apple developer account but with limited powers, I can't upload to Testflight nor make an ad-hoc release with with to test with)
Since updating to Sequoia, Xcode no longer opens some projects.
What I’ve tried so far:
Opening the project directly from the .xcworkspace file, but it still doesn’t open. The app doesn’t crash, but the project simply won’t load, and the UI doesn’t appear.
What I tried:
Uninstalled and reinstalled Xcode.
Cloned the project from scratch.
I’m currently using Sequoia 15.3.1 on a macbook pro M3.
Topic:
Developer Tools & Services
SubTopic:
Xcode
They said something like hold option or whatever but It didn't seems to work with me...
I can't add my iPhone to my Apple Developer team, even though my iPhone is properly connected to my Mac.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Hi,
I am in the last step "preparing for submission" and everything excepts "age rating" is fine. How can I fix this?
I have two apps and on neither i can edit "age rating" :(
I am using Xcode 15.2. I am loading a URL in a WKWebView, but a hand cursor appears above the web view. Scrolling up and down does not work. I tried adjusting the scroll bounds and isUserInteractionEnabled, but the hand cursor is still visible. How can I fix this?
Topic:
Developer Tools & Services
SubTopic:
Xcode
This is using Xcode 16.2 (16C5032a), MacOS 15.2, on MacbookPro 16 M1 Pro.
I have two repositories, one for an application and another one for a framework. The repository framework is integrated into the application one as git submodule.
I was going to push the submodule to Github using Xcode git integration. It detects some conflicts and ask to pull. I pull. A window appears with some conflicting files (5 or 6). Review them. While reviewing something in Xcode crashed, but as Xcode was still up and running, ignored the crash. Decided to cancel the conflicts window and inspect my local files. Pull again but this time I decided to pull both repos. Review the conflicting changes and decided to cancel again to continue by hand in a terminal.
Then, I notice that the project for the submodule is in red and that the "Changes" tab shows a bunch of files with and admiration mark. I go to the submodule folder in Finder and... everything inside the submodule folder was gone, disappeared, lost... everything, even the ".git" folder (only remained a binary folder for a component I use for the framework but is empty).
I decided to run a recovery tool. It finds nothing to recover inside that folder, nothing. A lot of files even from years ago but nothing inside that folder? how is that possible?
I filled a Feedback assistant issue: FB16307182
Could it be possible that Xcode "moved" everything to another place (I'm desperate so I'm starting to think in absurd explanations)
Thanks
Or is it not possible? My idea is a program that can disable low power mode, change my display type to apple XDR, and set my refresh rate to ProMotion (120)
Setup
I have 2 swift packages and I try to use stirng catalog to manage your localizations
I would like to use some specific keys in these packages and some common ones (e.g. "ok_button_tittle")
Problem statement
I really don't like the idea of creating separate (but the same) translations in these packages
I have tried using something like
String(
localized: "ok_button_title",
table: "Localizable",
bundle: .main,
comment: "Ok button title"
)
This does use translations from the main bundle, however this does not automatically create the keys in string catalog
Question
Is there any possibility to reuse the translations from the main bundle?
Maybe there is a hack to make the keys appear automatically in the correct bundle? Or is it a bug?
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
Swift Packages
Swift
Asset Catalog
Localization