General:
TN3151 Choosing the right networking API
Networking Overview document — Despite the fact that this is in the archive, this is still really useful.
TLS for App Developers DevForums post
Choosing a Network Debugging Tool documentation
WWDC 2019 Session 712 Advances in Networking, Part 1 — This explains the concept of constrained networking, which is Apple’s preferred solution to questions like How do I check whether I’m on Wi-Fi?
TN3135 Low-level networking on watchOS
Adapt to changing network conditions tech talk
Foundation networking:
DevForums tags: Foundation, CFNetwork
URL Loading System documentation — NSURLSession, or URLSession in Swift, is the recommended API for HTTP[S] on Apple platforms.
Network framework:
DevForums tag: Network
Network framework documentation — Network framework is the recommended API for TCP, UDP, and QUIC on Apple platforms.
Network Extension (including Wi-Fi on iOS):
See Network Extension Resources
Wi-Fi Fundamentals
Wi-Fi on macOS:
DevForums tag: Core WLAN
Core WLAN framework documentation
Wi-Fi Fundamentals
Secure networking:
DevForums tags: Security
Apple Platform Security support document
Preventing Insecure Network Connections documentation — This is all about App Transport Security (ATS).
Available trusted root certificates for Apple operating systems support article
Requirements for trusted certificates in iOS 13 and macOS 10.15 support article
About upcoming limits on trusted certificates support article
Apple’s Certificate Transparency policy support article
Technote 2232 HTTPS Server Trust Evaluation
Technote 2326 Creating Certificates for TLS Testing
QA1948 HTTPS and Test Servers
Miscellaneous:
More network-related DevForums tags: 5G, QUIC, Bonjour
On FTP DevForums post
Using the Multicast Networking Additional Capability DevForums post
Investigating Network Latency Problems DevForums post
Local Network Privacy FAQ DevForums post
Extra-ordinary Networking DevForums post
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Foundation
RSS for tagAccess essential data types, collections, and operating-system services to define the base layer of functionality for your app using Foundation.
Posts under Foundation tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hi All,
I am from a non tech background and always felt a need that I am missing on the most interesting skills in today's world. I wish to learn Xcode to build applications and much more. Could any of you kindly suggest how I can learn and engage online.
Thank You
Govind
Forgot to turn off the ui element status bar. visual garbage.
is it not important? your opinion
https://developer.apple.com/hello/december24/?cid=ht-hello
Team, I am seeing following crash with no trace of evidence to reproduce the crash.
Any ideas how to reproduce this/ do potential fixes?
Application Specific Information:
*** Terminating app due to uncaught exception 'b'MACH_EXCEPTION_TYPE: Unknown type:999'', reason: 'b'Unknown Type:999/code:999''
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00001d9b951d4 0x1d9b89000 + 49620
1 libsystem_c.dylib 0x0000191587ad8 0x191510000 + 490200
2 libc++abi.dylib 0x0000211b0d5b8 0x211afa000 + 79288
3 libc++abi.dylib 0x0000211afbbac 0x211afa000 + 7084
4 libobjc.A.dylib 0x0000186ae6e14 0x186ab4000 + 208404
5 libc++abi.dylib 0x0000211b0c87c 0x211afa000 + 75900
6 libc++abi.dylib 0x0000211b100ac 0x211afa000 + 90284
7 libobjc.A.dylib 0x0000186ae2650 0x186ab4000 + 190032
8 CoreFoundation 0x00001897c8934 0x189776000 + 338228
9 GraphicsServices 0x00001d57a81c4 0x1d57a7000 + 4548
10 UIKitCore 0x000018c32eeb0 0x18bf5c000 + 4009648
11 UIKitCore 0x000018c3dd5b4 0x18bf5c000 + 4724148
12 Chase 0x00001032d98e0 main + 5789920 (main.swift:29)
13 ?-?-? 0x00001af1b6ec8 0x0 + 0
I ask apple , my identity,com.lgxsgj.xsgj is in company account (Loudi Hualing Yunchuang Shuzhi Technology Co., Ltd)
but xcode shows error, xcode shows my profile doesn't incude signing certificate (Loudi Hualing Yunchuang Shuzhi Technology Co., Ltd).
but I have other com.lgxsgj.xsgj1,com.lgxsgj.xsgj2, it's correct
Hi,
we have a CFArray, which we store in a CFDictionary and this in a SCPreference. When loading it from the SCPreference the order of the CFArray contents is undefined. All data is there though.
Is this the intended behaviour? Is it possible to ensure the correct data order?
Thanks, any hint is highly appreciated!
For some reason Xcode said my certificate was revoked. Developer support says it’s active. Could someone point me towards the steps to reactivate it?
Good evening. I have come up with this amazing and revolutionary idea that is going to change the ent world for the better.
I’m a 23 year old Design Engineer from Greece and I would like to come to direct contact with the Apple Design Team, in order to discuss this project and the best case scenario, sell it to you.
The foldable iPhone is not a good idea. Its not revolutionary and it’s going to leave a big black mark in Apple history.
With my idea, the whole world will see again the greatness of the biggest company in history.
I am porting an old app from ObjC. The app uses many defined constants such as:
#define COM_OFFSET 12.5
and many variables that are read and/or written throughout the App, such as:
PCDate* Dates[367];
@class PCMainView;
PCMainView* MainView;
in one file called "PCCommon.h"
How do I duplicate this function in Swift? I have looked around and have found no help.
Thanks in advance.
We enabled WebGPU feature flag on Safari on iOS 18.2. This does give Safari an access to GPU but WKWebView still doesn't have GPU access.
Can WKWebView not access GPU through Safari feature flag? Is there some other mechanism through which we can enable GPU access for WKWebView?
We are testing gpu access by loading : https://webgpureport.org/
Regards
Saalis Umer
Microsoft
Safari Feature Flag - webgpu = true
Safari GPU Access:
WKWebView GPU Access:
Dear my fellow developer,
Question:
why viewDidLayoutSubviews is getting called when I kill the app? is that normal?
That behavior only happens on this device:
iPhone 8
iPhone SE
On the newer iPhone that will not happen.
Thank you
Greetings! I want to add my pre-compiled binary of v2ray to my application so I can activate it in background as a proxy and run stuff through it.
I've codesigned it via:
codesign -s - -i production.myproject.v2ray -o runtime --entitlements v2ray.entitlements -f v2ray
Contents of entitlements file:
<?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>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.downloads.read-write</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
</dict>
</plist>
Originally I ran it like this without sandboxing from my main target app:
guard let v2rayPath = Bundle.main.path(forResource: "v2ray", ofType: nil) else {
throw NSError(domain: "ProxyController", code: 1, userInfo: [NSLocalizedDescriptionKey: "V2Ray binary not found in bundle"])
}
let task = Process()
task.executableURL = URL(fileURLWithPath: v2rayPath)
task.arguments = ["-config", configURL.path]
// Redirect output for debugging
let pipe = Pipe()
task.standardOutput = pipe
task.standardError = pipe```
And it ran flawlessly. Now it refuses to start. Any help, pointers or examples of such usage will be greatly appreciated
In my project, i am initialising bytes with some character in cpp function, func CreateByteWithVal (), and passing to a function, func CreateNSStringFromCString(_ pPtr : UnsafeMutableRawPointer, _ pLength : Int), in swift using Swift-Cpp interop.
CreateByteWithVal () allocates bytes on heap with value "AAAAAAAAAA", also calls swift function CreateNSStringFromCString.
And func CreateNSStringFromCString (_ pPtr : UnsafeMutableRawPointer, _ pLength : Int) creates a NSString instance using NSString's BytesNoCopy initialiser using the bytes (pPtr) passed to it in parameter.
Cpp code:
void
CppClass::CreateByteWithVal ()
{
char * bytesForString = (char *) malloc (10);
memset (bytesForString, 65, 10);
Interop_Swift::CreateNSStringFromCString (bytesForString, 10);
}
Swift code:
public func CreateNSStringFromCString (_ pPtr : UnsafeMutableRawPointer, _ pLength : Int) {
let ns_string:NSString = NSString (bytesNoCopy: pPtr, length: pLength, encoding: String.Encoding.utf8.rawValue, freeWhenDone: false)
}
If we modify the byte values in memory from C++ directly, the NSString instance, which is supposed to be immutable by nature, reflects these changes. Is this approach appropriate, or is there something we're overlooking or need to address? In our project, we are mutating the byte values directly like this, and the changes are being reflected in the NSString instance :
memset (bytesForString, 66, 5);
Essentially, I want to confirm whether we can use this method to modify values through C++ without directly mutating the NSString instance.
For the UI, we'll be reading the NSString instance by creating a native Swift String instance from it, like this:
let str:String = ns_string as String
Will the value of str remain consistent as long as we ensure that the correct bytes are provided by C++?
crash log
Anyone can understand the log? I really don't understand.
Please see the attachment crash and help to resolve it, thanks very much.
Hiya 👋! While loading some data, I'm having issues decoding arrays of basic types, specifically Int and Bool – they return nil. My app has existing data (live on the App Store for years) that is saved and loaded using NSKeyedArchiver. I'm updating to support a newer iOS version, which requires me now to adhere to NSSecureCoding. As I understand, NSSecureCoding needs strict type definitions, and it will return nil if things are ambiguous (for security reasons).
Essentially as I load data, it all works when I use strict types, like Int and Bool, because the methods themselves are strict: decodeInteger(forKey:) and decodeBool(forKey:). However, if I want to decode something more complex, like NSDate or basic type arrays (in my case [Int], [[[Int]]], [Bool] and [[Bool]]), I assume I have to decode an object: decodeObject(of:forKey:). While I was able to make NSDate work by forcing the type (decodeObject(of: NSDate.self, forKey: "modifyDate")! as Date), getting arrays to decode is proving difficult. They always return nil.
I've now tried forcing the type to different arrays, including NSArray, and listing array types. I also tried decodeArrayOfObjects(ofClass:forKey:), but no luck.
Example:
Here are some data items I might have:
var id: Int?
var isModified: Bool?
var modifyDate: Date?
var myIntegers: [Int]?
var myEmbedIntegers: [[[Int]]]?
var myBooleans: [Bool]?
var myEmbedBooleans: [[Bool]]?
Here's how I encode them:
encode(id!, forKey: "id")
encode(isModified!, forKey: "isModified")
encode(modifyDate!, forKey: "modifyDate")
encode(myIntegers!, forKey: "myIntegers")
encode(myEmbedIntegers!, forKey: "myEmbedIntegers")
encode(myBooleans!, forKey: "myBooleans")
encode(myEmbedBooleans!, forKey: "myEmbedBooleans")
This is how Int, Bool and Date are apparently successfully decoded (where Date is forced to search for NSDate type):
decodeInteger(forKey: "id")
decodeBool(forKey: "isModified")
decodeObject(of: NSDate.self, forKey: "modifyDate")! as Date
Here are attempts with Int (same with Bool) arrays, which are erroneously decoded (these all either get compiler errors or return nil):
decodeObject(forKey: "myIntegers") as! [Int] // This used to work before NSSecureCoding, but now returns nil.
decodeObject(of: [NSArray.self], forKey: "myIntegers") as! [Int] // Returns nil.
decodeObject(of: [Int.self], forKey: "myIntegers") // Compiler error about value type conversion.
decodeArrayOfObjects(ofClass: Int.self, forKey: "myIntegers") // Compiler error complaining that Int doesn't conform to NSSecureCoding.
decodeArrayOfObjects(ofClass: NSArray.self, forKey: "myIntegers") as! [Int] // Returns nil.
The funny thing is I don't even remotely need security. My data is for song compositions in an entertainment app, so it's strictly loaded and saved to device by my own code without networking, hashing or anything else being involved. Nevertheless I'm now stuck on this 😥.
How do I decode arrays (without returning nil)?
iOS 18 broke some functionality in my Objective-C app with regard to using the DatePicker.
The key lines are as follows:
datePicker.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:timezoneOffset];
datePicker.date = [NSDate date];
When timezoneOffset is -29380, the value for San Francisco, the Date Picker is a whole MONTH off. It shows November instead of December.
But when it is -29359, the value for Seattle, which is in the same time zone (PST), it shows the correct month. In fact, even towns surrounding San Francisco usually return the correct value. Some other cities in other time zones also cause the Date Picker to be a month off.
Are there any differences (either performance or memory considerations) between removing an array of model objects directly using .removeAll() vs using modelContext? Or, are they identical?
Attached below is an example to better illustrate the question (i.e., First Way vs Second Way)
// Model Definition
@Model
class GroupOfPeople {
let groupName: String
@Relationship(deleteRule: .cascade, inverse: \Person.group)
var people: [Person] = []
init() { ... }
}
@Model
class Person {
let name: String
var group: GroupOfPeople?
init() { ... }
}
// First way
struct DemoView: View {
@Query private groups: [GroupOfPeople]
var body: some View {
List(groups) { group in
DetailView(group: group)
}
}
}
struct DetailView: View {
let group: GroupOfPeople
var body: some View {
Button("Delete All Participants") {
group.people.removeAll()
}
}
// Second way
struct DemoView: View {
@Query private groups: [GroupOfPeople]
var body: some View {
List(groups) { group in
DetailView(group: group)
}
}
}
struct DetailView: View {
@Environment(\.modelContext) private var context
let group: GroupOfPeople
var body: some View {
Button("Delete All Participants") {
context.delete(model: Person.self, where: #Predicate { $0.group.name == group.name })
} // assuming group names are unique. more of making a point using modelContext instead
}
We have a Push-To-Talk application, which also allow user's to share the PDF file documents.
On receiving a PDF file document, which has a space in its file name.
On saving the document in the DB with space. When user is trying to access the PDF file, in order to rule out issues where there can be special character's in its file name, we are encoding the file name using stringByAddingPercentEncodingWithAllowedCharacters, and URLPathAllowedCharacterSet is the character set used which converts space character (" ") to %20.
Later, path of the same encoded file name is sent to fileURLWithPath:.
When the encoded URL is passed to [NSFileManager fileExistsAtPath:] the file is not found in the since in DB, file is saved with a space, but in the URL %20 is been swapped in-place of space character.
Issue case: Here, on passing the same encoded URL path of the PDF file to [NSFileManager fileExistsAtPath:] is returning false;
Query: On passing the filename with spaces encoded with stringByAddingPercentEncodingWithAllowedCharacters to [NSFileManager fileExistsAtPath:], the path is not converted back to the decoded file name and returning false
We have used a work around on this case, by forming the URL of the PDF file without encoding and passing it to fileURLWithPath, issue is not seen here.
We have a query here, i.e. will fileURLWithPath will be able to handle different special characters without encoding.
We have also raised a Feedback Ticket on same: https://feedbackassistant.apple.com/feedback/16049504
Hi there,
I've encountered a file permission bug in iOS 18.1.1 when using FileManager.default.copyItem(at:to:) to copy files from an iCloud shared folder to the app sandbox. This issue occurs under the following conditions:
The source file resides in an iCloud shared folder.
The iCloud shared folder is owned by another iCloud user and shared with read-only permissions.
The app copies the file to its sandbox using the copyItem(at:to:) method.
Observed Behavior:
After copying the file to the app sandbox, the original file's read-only permissions are propagated to the copied file. This results in an inability to delete the copied file from the app sandbox, with the following error message:
NSCocoaErrorDomain, Code 513: "The file couldn’t be removed because you don’t have permission to access it."
Steps to Reproduce:
Access a shared iCloud folder owned by another user with read-only permissions.
Copy a file from this folder to the app sandbox using FileManager.default.copyItem(at:to:).
Attempt to delete the copied file within the app sandbox.
Workaround:
Until this issue is resolved, the bug can be avoided by initializing the UIDocumentPickerViewController with the asCopy: true parameter:
UIDocumentPickerViewController(forOpeningContentTypes: contentTypes, asCopy: true)
This ensures that the copied file does not inherit the original permissions from the shared source file.
Example Project:
To reproduce the issue and observe the error, I’ve created a sample project hosted on GitHub:
https://github.com/giomurru/FileDeletePermissionBug
This project provides step-by-step instructions for testing and reproducing the bug.
Environment:
iOS/iPadOS Version: 18.1.1
Devices: [iPhone 15, iPad 9th Gen]
Development Tool: Xcode 16.1
I hope this helps Apple engineers and other developers experiencing the same issue. Feedback or additional insights would be appreciated.
Giovanni
I have been trying to open Minecraft on my mac, however my java keeps quitting expectedly. I am not sure how to solve that considering I've tried deleting and reinstalling both java and minecraft a few times.
Translated Report (Full Report Below)
Process: java [896]
Path: /Users/USER/Library/Application Support/minecraft/*/jre.bundle/Contents/Home/bin/java
Identifier: java
Version: ???
Code Type: X86-64 (Native)
Parent Process: launcher [836]
Responsible: launcher [836]
User ID: 501
Date/Time: 2024-12-02 22:17:03.1605 +0000
OS Version: macOS 12.7.6 (21H1320)
Report Version: 12
Bridge OS Version: 3.0 (14Y910)
Anonymous UUID: 63D094BB-378F-96E3-C961-AD71A2DDD236
Time Awake Since Boot: 370 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Java: Render thread Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_INVALID_ADDRESS at 0x00007fc700000000
Exception Codes: 0x0000000000000001, 0x00007fc700000000
Exception Note: EXC_CORPSE_NOTIFY
VM Region Info: 0x7fc700000000 is not in any region. Bytes after previous region: 17347201724417 Bytes before following region: 2347761664
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
Stack 70000a243000-70000a341000 [ 1016K] rw-/rwx SM=COW thread 45
---> GAP OF 0xfc781bbf000 BYTES
MALLOC_TINY 7fc78bf00000-7fc78c000000 [ 1024K] rw-/rwx SM=PRV
Application Specific Information:
abort() called