I am unable to use a framework that uses SwiftUI, built with the Xcode 16 release candidate, in Xcode 15.4. Attempting to build an app that uses the pre-built framework results in "Cannot find type 'SwiftUICore' in scope errors in the framework's private swift interface (.private.swiftinterface) file. For example
error: cannot find type 'SwiftUICore' in scope
@_Concurrency.MainActor @preconcurrency public var body: some SwiftUICore.View {
^~~~~~~~~~~
The problem is reproducible by creating a new framework project in Xcode 16, adding SwiftUI code to it, adjusting the deployment target, building the framework, then creating a new app project in Xcode 15.4, adding the framework to it, and attempting to build. In my test framework, I added the following type:
public struct BoldText: View {
let string: String
public init(_ string: String) {
self.string = string
}
public var body: some View {
Text(string).bold()
}
}
When I removed that type, a build of the framework with Xcode 16 became useable in Xcode 15.4.
Is this expected or is this a bug?
Xcode
RSS for tagBuild, test, and submit your app using Xcode, Apple's integrated development environment.
Posts under Xcode tag
134 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
How to fix this error ? I have try multiple times with internet connection but the error still the same...
Yo Devs,
After updating to MacOS Sequoia: Newly Updated XCode16.
Getting error: Predictive Code Completion Model Failed
com.apple.fm.code.generate_small_v1.tokenizer
Tried Manually Updating the component. Still the same error.
Any fixes ?
Hi,
I am trying to achieve biometric authentication in iOS 18 Simulator but getting the below error. The same things works in iOS 17.2 simulator in the same Xcode version that is Xcode 16 Beta 2.
- some : Error Domain=com.apple.LocalAuthentication Code=-1000 "UI service connection invalidated." UserInfo={NSDebugDescription=UI service connection invalidated., NSLocalizedDescription=Authentication failure.}
We are experiencing an issue with withCheckedContinuation in our Swift project. Our implementation was working perfectly in a previous version of Xcode and continues to work in the simulator. However, it fails to work on a real device. Here’s a brief description of the problem:
• Environment:
Xcode Version: Xcode 16.0 Beta 5
Swift Version: Swift 5
OS: IOS18 beta 5
• Problem:
The code using withCheckedContinuation behaves as expected in the simulator but fails on a physical device. We are receiving a “bad access to memory” error when running on a real device.
• What We’ve Tried:
Verified that the code works in previous Xcode versions.
Tested on different simulators, where it runs without issues.
Checked for any obvious errors in memory handling or threading.
Code Example: Here’s a simplified version of the problematic code:
var body: some View {
VStack {
Text("Hello, world!")
}
.padding()
.onAppear {
Task {
await self.checkTrialOrIntroductoryDiscountEligibilityAsync()
}
}
}
func checkTrialOrIntroductoryDiscountEligibilityAsync() async {
return await withCheckedContinuation { continuation in
checkTrialOrIntroDiscountEligibility() {
continuation.resume()
}
}
}
func checkTrialOrIntroDiscountEligibility(completion: () -> Void) {
completion()
}
}
I have 5 sticker packs in the App Store. I had an older Mac and it finally was too old for more MacOS updates and therefore too old to update xCode, so I haven't done any updates to my packs or looked at xCode in nearly 3 years. I FINALLY got a new Mac. I've got xCode 15 installed and with latest updates - and it looks so foreign!
Things I can't find:
Where in xCode can I change the version and build #? This used to be so obvious. I decided to start from scratch with my project. Clicked on new Sticker Pack App. Dragged in my icons and stickers and new updates I've created. When I went to archive, it says it can't because it already exists. Oh boy.
In addition to this, I'm also lost on how to put in ALT tags for accessibility. This was also super obvious in the version of xCode I was using 3 years ago - I could click on each sticker and in the right pane I could put in the words for voice over for visually impaired. Now that is gone. One of my reviews thanked me for making my sticker pack accessible. I don't want to lose that ability - but I cannot find out where the heck it's hiding. The OnDemand Resource Tags definitely aren't it - since adding info in one puts the same tags on ALL the stickers.
My Mac is on 15.1.
Xcode will not validate Mac apps — even for TestFlight.
I have been patient in not doing a full reset back to 14 and then back to 15.0, assuming this will go away soon.
Am I being naive?
Is there a chance validating apps on 15.1 is something that is months away and I need to do the annoying work of resetting my entire Mac back to 14->15?
I have added core data to my project and below is the code block of how it's section in pbxproj file looks like.
However whenever I make any changes to the project i.e. changing build version or adding a deleting new files to the project, I have noticed "name = "sample-app.xcdatamodeld";" gets deleted automatically from the project file and I have to manually reverse that change.
Am I missing any setting for core data or is it a bug somewhere in XCode or Core Data? I am using XCode 15.
/* Begin XCVersionGroup section */
4683EC5B2C10F8B800A5081B /* sample-app.xcdatamodeld */ = {
isa = XCVersionGroup;
children = (
4683EC5C2C10F8B800A5081B /* sample-app.xcdatamodel */,
);
currentVersion = 4683EC5C2C10F8B800A5081B /* sample-app.xcdatamodel */;
name = "sample-app.xcdatamodeld";
path = "sample-app.xcdatamodeld";
sourceTree = "<group>";
versionGroupType = wrapper.xcdatamodel;
};
/* End XCVersionGroup section */
I have an application with storyboard and I'm trying to set a constraint for the minimum size of my window (the view), but now matter what I do the constraint window is always grayed out, how do I go about this?
I recently switched to the macOS Sequoia Developer Beta, but when I tried to run Xcode, I encountered an issue where it stated that my OS was not supported. I updated to the latest version of Xcode 15 and even tried the Xcode 16 beta, but the problem persisted.
After trying several methods, I found this to be the easiest and most reliable temporary solution. It allows you to use Xcode with all features running smoothly and no bugs
Install the latest version of Xcode from the App Store.
Go to the Applications folder.
Find Xcode, right-click on it, and select “Show Package Contents.”
A new window will open. Navigate to the folder named “Contents.”
Open the folder named “MacOS.”
Inside, you’ll find an executable file named “Xcode.” Click on it to launch Xcode.
Using this method, Xcode should work without any bugs or issues. Hope this helps anyone else facing the same problem!
I am having trouble releasing my app to the app store since I am collecting tacking user data. However, this is an ue5 project that I imported over to Xcode to release my game and I don't have any tracking permissions. After making a blank ue5 project and doing the same the tracking permission is there automatically so I guess for ue5 projects they activate this. Is there any way to remove this feature in Xcode. I've also tried requesting the data from the user but since I made the project in xcode, I don't know how to code additional things into the game using xcode. I tried adding some code for requesting permission but it didnt show nor effect my game at all. If impossible to remove the tracking where should I write the permission code if this is an ue5 project?
Topic:
App Store Distribution & Marketing
SubTopic:
App Review
Tags:
App Tracking Transparency
Frameworks
Xcode
Developer Tools
I am trying to integrate the new iOS 18 document launching experience with my app, but opening or saving files fails with the RC version of Xcode 16. The error I receive is "Publishing changes from background threads is not allowed."
I downloaded Apple's new sample code ("Writing app"), and it fails with the same error.
Is there an easy fix for this?
I've got an existing app using storyboards and would like to incorporate the new iOS 18 ContactAccessButton() and contactAccessPicker() into the GUI.
However, how can that be done? If I try to do something like add a UIView to a view controller in the storyboard, then ContactAccessButton can't be assigned to it (even though ContactAccessButton inherits from UIView).
Nor can a ContactAccessButton be used as a type within the Storyboard/the View Controller.
How do I go about integrating this new iOS feature into an existing app using Storyboards and view controllers?
I can't seem to upload my standalone watchOS app to TestFlight. Xcode never offers me the proper distribution scheme. I only get file-based distribution mechanisms.
The metadata in AppStoreConnect are present, the bundle ids are correct, this is a freshly new created project without any custom content.
How is this supposed to work?
I'm experiencing an issue where my app freezes when built with Xcode 16 on iOS 18.
Additional Information:
The issue does not occur when building the app with Xcode 16 on iOS 17 or lower.
The issue does not occur when building the app with Xcode 15 on iOS 18.
The CPU usage spikes to 100% when the app freezes.
The app specifically freezes after the code runs into .sink(receiveValue:).
Here is the relevant code snippet:
@Published var selectedCardData: CardData?
@Published var selectedRootTab: RootViewTab = .statement
override func load() {
state = .loading
$selectedCardData.ignoreNil()
.removeDuplicates()
.map { [unowned self] cardData in
$selectedRootTab.filter { $0 == .statement }
.first()
.map { _ in cardData }
}
.switchToLatest()
.sink(receiveValue: { value in
print(value) // value not nil
print("Execution reaches this point and the app freezes (CPU 100%).")
})
.store(in: &cancellables)
}
Are there any known changes in iOS 18 or Xcode 16 that might affect this code?
On Xcode Version 15.3 (15E204a), the project builds successfully without any errors. However, on Xcode Version 16.0 (16A242), I encounter the errors mentioned below.
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Additional Context:
Faced same issue earlier and fixed: Add "-ld64" under Build Setting -> Other Linker Flags
The project navigator in my project keeps collapsing for no apparent reason. I've hunted high and low but can't find a setting to keep it expanded. This is not a new project and the issue began recently after an Xcode upgrade. I am currently using Xcode 15.3 release candidate.
If anyone knows how to fix this I'd be very grateful if they could let me know.
Hello Apple community !
I'm facing an issue regarding xcstrings in a local package in my project.
It's an iOS application with a local package containing multiple targets.
The Localizable.xcstrings is located in the app target and contains keys for the app and targets of the local package (Views in the targets look for keys in the main bundle)
My issue is that auto detection/extraction seems to work only for keys used inside the app bundle. It doesn't look in the package. However, if I add a Localizable.xcstrings inside a package target, it gets populated.
Is this normal behaviour & is there any way to make extraction put the keys in the main bundle xcstrings instead ? I feel like it should be normal behaviour if no xcstrings is found in the package
My fallback would be to set all keys in manual extraction state but it's not ideal ;)
Thanks in advance for the great work
Eric
So I have this program that displays events on the window using NSWindow and a NSTextField. Basically it tracks the mouse position and the keyboard state.
I created a simple class named MyEventWindow:
//
// MyEventWindow.h
// AppTest
#ifndef MyEventWindow_h
#define MyEventWindow_h
@interface MyEventWindow : NSWindow
{
}
@property(nonatomic, strong) NSTextField* label;
@property(nonatomic, strong) NSString* labelText;
- (BOOL)windowShouldClose:(id)sender;
- (instancetype) init;
- (void) setLabelText:(NSString *)labelText;
@end
@implementation MyEventWindow
-(instancetype) init
{
self = [super initWithContentRect:NSMakeRect(100, 100, 300, 300)
styleMask:(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable)
backing:NSBackingStoreBuffered
defer:NO];
if( !self )
{
return nil;
}
[self setTitle: @"Event tracker"];
[self setIsVisible: YES];
_label = [[NSTextField alloc] initWithFrame:NSMakeRect(5, 100, 290, 100)];
[_label setBezeled: NO];
[_label setDrawsBackground: NO];
[_label setEditable: NO];
[_label setSelectable: YES];
NSFont *currentFont = [_label font];
NSFont *resizedFont = [NSFont fontWithName:[currentFont fontName] size:18];
NSFont *boldFont = [[NSFontManager sharedFontManager] convertFont:resizedFont toHaveTrait:NSFontBoldTrait];
// convert the bold font to have the italic trait
NSFont *boldItalicFont = [[NSFontManager sharedFontManager] convertFont:boldFont toHaveTrait:NSFontItalicTrait];
[_label setFont:boldItalicFont];
[_label setTextColor:[NSColor colorWithSRGBRed:0.0 green:0.5 blue:0.0 alpha:1.0]];
// attach label to the damn window
[[self contentView] addSubview: _label];
return self;
}
-(BOOL)windowShouldClose:(id)sender
{
return YES;
}
-(void) setLabelText:(NSString *)newText
{
[_label setStringValue: newText];
}
@end
#endif /* MyEventWindow_h */
Then in the main file I try to handle event loop manually:
//
// main.m
#import <Cocoa/Cocoa.h>
#import "MyEventWindow.h"
NSString* NSEventTypeToNSString(NSEventType eventType);
NSString* NSEventModifierFlagsToNSString(NSEventModifierFlags modifierFlags);
int main(int argc, char* argv[])
{
@autoreleasepool
{
[NSApplication sharedApplication];
MyEventWindow* eventWindow = [[MyEventWindow alloc] init];
[eventWindow makeKeyAndOrderFront:nil];
NSString* log = [NSString string];
// my own message loop
[NSApp finishLaunching];
while (true)
{
@autoreleasepool
{
NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate: [NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES];
log = [NSString stringWithFormat:@"Event [type=%@ location={%d, %d} modifierFlags={%@}]", NSEventTypeToNSString([event type]), (int)[event locationInWindow].x, (int)[event locationInWindow].y, NSEventModifierFlagsToNSString([event modifierFlags])];
//NSLog(@"log: %@", log);
[eventWindow setLabelText: log];
[NSApp sendEvent:event];
//[NSApp updateWindows]; // redundant?
}
}
}
return 0;
}
NSString* NSEventTypeToNSString(NSEventType eventType)
{
switch (eventType)
{
case NSEventTypeLeftMouseDown: return @"LeftMouseDown";
case NSEventTypeLeftMouseUp: return @"LeftMouseUp";
case NSEventTypeRightMouseDown: return @"RightMouseDown";
case NSEventTypeRightMouseUp: return @"RightMouseUp";
case NSEventTypeMouseMoved: return @"MouseMoved";
case NSEventTypeLeftMouseDragged: return @"LeftMouseDragged";
case NSEventTypeRightMouseDragged: return @"RightMouseDragged";
case NSEventTypeMouseEntered: return @"MouseEntered";
case NSEventTypeMouseExited: return @"MouseExited";
case NSEventTypeKeyDown: return @"KeyDown";
case NSEventTypeKeyUp: return @"KeyUp";
case NSEventTypeFlagsChanged: return @"FlagsChanged";
case NSEventTypeAppKitDefined: return @"AppKitDefined";
case NSEventTypeSystemDefined: return @"SystemDefined";
case NSEventTypeApplicationDefined: return @"ApplicationDefined";
case NSEventTypePeriodic: return @"Periodic";
case NSEventTypeCursorUpdate: return @"CursorUpdate";
case NSEventTypeScrollWheel: return @"ScrollWheel";
case NSEventTypeTabletPoint: return @"TabletPoint";
case NSEventTypeTabletProximity: return @"TabletProximity";
case NSEventTypeOtherMouseDown: return @"OtherMouseDown";
case NSEventTypeOtherMouseUp: return @"OtherMouseUp";
case NSEventTypeOtherMouseDragged: return @"OtherMouseDragged";
default:
return [NSString stringWithFormat:@"%lu", eventType];
}
}
NSString* NSEventModifierFlagsToNSString(NSEventModifierFlags modifierFlags)
{
NSString* result = @"";
if ((modifierFlags & NSEventModifierFlagCapsLock) == NSEventModifierFlagCapsLock)
result = [result stringByAppendingString:@"CapsLock, "];
if ((modifierFlags & NSEventModifierFlagShift) == NSEventModifierFlagShift)
result = [result stringByAppendingString:@"NShift, "];
if ((modifierFlags & NSEventModifierFlagControl) == NSEventModifierFlagControl)
result = [result stringByAppendingString:@"Control, "];
if ((modifierFlags & NSEventModifierFlagOption) == NSEventModifierFlagOption)
result = [result stringByAppendingString:@"Option, "];
if ((modifierFlags & NSEventModifierFlagCommand) == NSEventModifierFlagCommand)
result = [result stringByAppendingString:@"Command, "];
if ((modifierFlags & NSEventModifierFlagNumericPad) == NSEventModifierFlagNumericPad)
result = [result stringByAppendingString:@"NumericPad, "];
if ((modifierFlags & NSEventModifierFlagHelp) == NSEventModifierFlagHelp)
result = [result stringByAppendingString:@"Help, "];
if ((modifierFlags & NSEventModifierFlagFunction) == NSEventModifierFlagFunction)
result = [result stringByAppendingString:@"Function, "];
return result;
}
in main I added a second @autoreleasepool inside the while loop it seemed to decrease memory usage significanly, however if I keep moving my mouse a lot the memory usage will still increase.
I don't think this should be happening since the labelText is being destroying and recreated each iteration, is something wrong with my code? Why do I have a memory leak here?
Any feedback regarding the code is also appreciated
Cheers
I am creating a iOS library project using Xcode 15 in objective C lang which has dependency XCTest framework and Objective C run time and having UI test cases which can be use used in various projects.
I am able to build and run unit test cases using Xcode fine but when try to run test using command line getting below issue
Command
env NSUnbufferedIO=YES xcodebuild clean test -workspace EnptyLibrary.xcworkspace -scheme EnptyLibrary -configuration Debug -destination 'platform=iOS Simulator,OS=latest,name=iPhone 15 Pro' -destination 'platform=iOS Simulator,OS=latest,name=iPad Pro (12.9-inch) (6th generation)' -testPlan EnptyLibrary -derivedDataPath build -disable-concurrent-destination-testing -retry-tests-on-failure=NO
Error log
** TEST SUCCEEDED **
2024-09-12 16:36:34.822 xcodebuild[8345:45388802] Writing error result bundle to /var/folders/12/rcxtcvjs08169cc_fzhyc8x40000gq/T/ResultBundle_2024-12-09_16-36-0034.xcresult
2024-09-12 16:36:34.832 xcodebuild[8345:45388802] [MT] DVTAssertions: ASSERTION FAILURE in IDEFrameworks/IDEFoundation/ProjectModel/ActionRecords/IDESchemeActionsInvocationRecord.m:458
Details: Assertion failed: !self.hasSaved
Object: <IDESchemeActionsInvocationRecord: 0x112c21ce0>
Method: -saveWithCompletionBlock:
Thread: <_NSMainThread: 0x600000e441c0>{number = 1, name = main}
Hints:
Backtrace:
0 -[DVTAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in DVTFoundation)
1 _DVTAssertionHandler (in DVTFoundation)
2 _DVTAssertionFailureHandler (in DVTFoundation)
3 _DVTAssertionWarningHandler (in DVTFoundation)
4 -[IDESchemeActionsInvocationRecord saveWithCompletionBlock:] (in IDEFoundation)
5 -[IDESchemeActionsInvocationRecord saveSynchronouslyWithError:] (in IDEFoundation)
6 -[Xcode3CommandLineBuildTool saveResultBundleForError:triageWithSchemeTask:error:] (in Xcode3Core)
7 -[Xcode3CommandLineBuildTool _printError:schemeTask:andFailWithCode:] (in Xcode3Core)
8 -[Xcode3CommandLineBuildTool _printErrorWithSchemeTaskUserInfo:] (in Xcode3Core)
9 -[Xcode3CommandLineBuildTool _buildWithTimingSection:] (in Xcode3Core)
10 -[Xcode3CommandLineBuildTool run] (in Xcode3Core)
11 XcodeBuildMain (in libxcodebuildLoader.dylib)
12 -[XcodebuildPreIDEHandler loadXcode3ProjectSupportAndRunXcode3CommandLineBuildToolWithArguments:] (in xcodebuild)
13 -[XcodebuildPreIDEHandler runWithArguments:] (in xcodebuild)
14 main (in xcodebuild)
15 start (in dyld)
zsh: abort env NSUnbufferedIO=YES xcodebuild clean test -workspace -scheme EnptyLibrary