Hi,
python "import foundation" crushes without error message (but with a macos crush report) if the app is codesigned with Developer ID Application Certificate.(Without codesign, it works fine.)
1-test_simple_foundation.py(already attached):
import socket
import Foundation
print("hallo")
2-Install Nuitka:
pip install Nuitka
3-Generate App File via Nuitka:
echo *** | sudo -S python3.9 -m nuitka --run --standalone --macos-create-app-bundle --macos-app-mode=ui-element --macos-app-icon=icons/app_icon.png --include-data-dir=icons=icons test_simple_foundation.py
4-Copy app file under /applications
5-Execute test_simple_foundation.app file from terminal ./Applications/test_simple_foundation.app/Contents/MacOS/test_simple_foundation and observer that "hallo" is printed out
6-Codesign with following sh file(already attached):
7-Execute test_simple_foundation.app file from terminal ./Applications/test_simple_foundation.app/Contents/MacOS/test_simple_foundation and observer that code freezes with a macos crush report(already attached), after import Foundation nothing printed out.
MacOS_crush_report.txt
build-app_no_sand-sh.txt
test_simple_foundation-py.txt
pip list freeze.txt
app.entitlements.txt
Requirement:
python3.9 -m nuitka --version
1.9rc5
Commercial: None
Python: 3.9.12 (v3.9.12:b28265d7e6, Mar 23 2022, 18:22:40)
Flavor: CPython Official
Executable: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9
OS: Darwin
Arch: x86_64
Version C compiler: /usr/bin/clang (clang).
MacOS: Sonoma 14.2.1
1,6 GHz Dual-Core Intel Core i5
8 GB 2133 MHz LPDDR3
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
One of our apps has some failing unit tests that I traced back to a change in the way Calendar.date(from:) works on iOS 18 beta (22A5307d) as compared to earlier versions. The simple demo unit test below passes in iOS 17.5 and fails in 18 beta 3. I did not test this in other beta versions.
import XCTest
final class DateComponentsMath_Tests: XCTestCase {
func testAddingWeek() throws {
var components = DateComponents(
year: 2024,
weekOfYear: 1,
yearForWeekOfYear: 2024
)
let date1 = Calendar.current.date(from: components)!
// add a few weeks to the components
components.weekOfYear = components.weekOfYear! + 5
let date2 = Calendar.current.date(from: components)
XCTAssertNotEqual(date1, date2, "We added five weeks to the components so this should not result in the same date")
}
}
It appears that in iOS 18 (22A5307d), year, weekOfYear, and yearForWeekOfYear are no longer enough to uniquely specify a date. With those three values, Calendar.date(from:) always returns January 1 of the specified year. In earlier versions of iOS this was not the case.
I submitted this as FB14323984
In the recent MacOS Sequoia Beta 3 NSTextAttachment initialized with custom data and an Image cell as attachmentCell are shown as a file icon istead of the image cell.
I am creating a NSAttributedString and showing it in NSTextView like this:
NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithData:[text dataUsingEncoding:NSUTF8StringEncoding] ofType:nil];
attachment.attachmentCell = [[NSTextAttachmentCell alloc] initImageCell:img];
NSMutableAttributedString *res = [[NSMutableAttributedString alloc] initWithAttributedString:[NSAttributedString attributedStringWithAttachment:attachment]];
...
Starting from Xcode 16 Beta 2, NSValue.CGSizeValue is no longer available on watchOS, whereas this method was supported in previous versions of Xcode. The Xcode header files mark this method as unavailable on watchOS, but after manually modifying the Xcode files to remove the unavailable macro, the code compiles and runs normally. Is there a change in this API that makes it unsupported on watchOS, or is this an error?
Previously, I submitted feedback FB14072192, and the status of this feedback was updated to "Unable to diagnose with current information" without any further response. If this is indeed an issue, I hope it can be fixed.
I have an iPad 10 running iOS 18. I changed my icons to dark and it went well except for the Microsoft 365
I am developing a watchOS-only app, and whenever I attempt to make a network request, it always fails and throws the following error:
Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline."
I noticed that when I turn off Wi-Fi and Bluetooth in the settings of the iPhone paired with the Apple Watch (thus disconnecting the Apple Watch from the iPhone), my app can successfully connect to the network.
Additionally, when the app contains both an iOS app and a watchOS app, after granting network permissions on the iOS app, the watchOS app can access the network normally when connected to the iPhone.
When opening some system apps on the Apple Watch (such as the "Workout" app), the app will display a network permission request similar to that on iOS, but this request does not automatically pop up when my watchOS app attempts to access the network.
Is there a way to request network permissions in a watchOS-only app so that it can access the network while connected to the iPhone?
It looks like that, with Sequoia, it is not possible to open an NSURLSession or any other TCP connection to a machine on the local network if the application is not in the "Applications" folder. That is pretty inconvenient when debugging or running via Xcode since the build folder is not within the Applications folder.
And, yes, the NSLocalNetworkUsageDescription key and description strings are in the Info.plist file (and it asks for permission).
How can we expect to debug applications like that ?
Is anybody else experiencing this ?
Dear All,
Going through the list of currency codes in
Locale.commonISOCurrencyCodes
the following expression returns currency names
Locale.autoupdatingCurrent.localizedString(forCurrencyCode: currencyCode)
Surprisingly, this expression does not return names for some of the most common currency codes like EUR, USD and other.
How do I get a full list of names?
Any hint appreciated!
I need to decode JSON into a class. The JSON has a field called "Type", and I cannot declare a property with that name in my class since Type is a reserved word.
I tried declaring CodingKeys, but that doesn't work unless I declare EVERY property in the CodingKeys. This class has about a hundred properties and I have others like it, I do not want to do this.
Is there a better solution?
After iOS beta 2. download in iPhone 12 touch not work properly. Please fix this issue and please understand my problem. It’s a difficult problem for me. Please fix this issue as soon as possible.
Hello, I cannot accept that our completely original dating project was rejected by the App Store with the message 'there are too many similar applications'. How can I overcome this problem?
Hello,
I recently encountered an issue following the transfer of my app between Apple Developer accounts and would appreciate any insights or solutions.
Here's a summary of the situation:
App Transfer: I transferred an app from one Apple Developer account to another. The app's bundle ID remained unchanged during this process.
App Update: After the transfer, I integrated a new feature into the app and pushed the updated version to TestFlight under the new account.
Installation Issue: When I installed the TestFlight version of the app from the new account on my device, which already had the app installed from the old account, the app logged out the user. It appears that the UserDefaults data was not retained, resulting in the loss of stored user data.
My hypothesis is that the transfer between accounts caused the user defaults to reset, leading to the data loss.
Has anyone else experienced this issue, and if so, are there any recommended solutions or best practices to prevent UserDefaults from resetting during such transfers?
Thank you in advance for your assistance.
NSString *filePath = @"/var/mobile/Media/DCIM/100APPLE/IMG_0800.MP4";
NSURL *fileURL = [NSURL fileURLWithPath:filePath];
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:fileURL options:nil];
Before iOS 18, you could access AVAsset using the method mentioned above, but starting from the iOS 18 beta version, the following error appears
Error Domain=NSCocoaErrorDomain Code=257 "未能打开文件“IMG_0800.MP4”,因为你没有查看它的权限。" UserInfo={NSURL=file:///var/mobile/Media/DCIM/100APPLE/IMG_0800.MP4, AVErrorFailedDependenciesKey=(
"assetProperty_AssetType"
), NSUnderlyingError=0x30c497f60 {Error Domain=NSOSStatusErrorDomain Code=-12203 "(null)"}}
Hello VisionOS Developer Community,
I am currently working on a demo application for VisionOS, tailored for the Vision Pro. In my application, I have implemented a feature to prevent the screen from sleeping using the following code:
UIApplication.shared.isIdleTimerDisabled = true
This works perfectly on iOS, ensuring the screen remains active regardless of other system settings. However, I've run into a snag with VisionOS. Even with isIdleTimerDisabled set to true, the screen still sleeps when I take off the Vision Pro.
My app uses AttributedString for both text formatting and storage using MarkdownDecodableAttributedStringKey. The new API for Genmoji looks very interesting but I don't see an AttributeScope for it.
Is it possible to work around this and stick with AttributedString, am I in the wrong room or should I send in an enhancement request via Feedback Assistant?
Thanks a lot for your time!
I want to ask about NSDecimalNumber. is it any changes for use this function ? i test use number like this.
example:
a = "1000000.0"
var a i make number formatter use NumberFormatter
b = NSDecimalNumber(string: a with number formatter).decimalValue
i try to print b. the value return 1. Anyone can help ?
Hi,
I’ve identified an issue with the “hidden” feature that was added to IOS 18.0.
The issue causes the stuff you would like to hide, to become not so hidden anymore.
This due to the fact that the apps you are trying to hide are still visible in other parts of the phone.
Examples are:
Battery consumption
location services (and A number of other features in privacy & securit)
-Siri -> Apps.
I kindly ask the development team to go through the actual feature and identify the possible locations the apps you try to huse could be visible.
thanks
jorn
After updating iOS, my Cordova app behaves incorrectly after receiving a voip push.
When a push notification is received, my application launches CallKit, displays the Native Dialer screen and starts other necessary services.
Until 17.5.1 (possibly 17.5) everything worked correctly. All services and sockets were established/ connected and working. After updating iOS to 17.5, the application crashes, and while voice connection is established the app is no longer active. Xcode logs have these error messages:
Invalidating grant <invalid NS/CF object> failed
Type: Error | Timestamp: 2024-06-20 13:27:44.719601+02:00 | Process: MyApp | Library: WebKit | Subsystem: com.apple.WebKit | Category: ProcessCapabilities | TID: 0x3a4929
Invalidating grant <invalid NS/CF object> failed
Type: Error | Timestamp: 2024-06-20 13:27:44.732219+02:00 | Process: MyApp | Library: WebKit | Subsystem: com.apple.WebKit | Category: ProcessCapabilities | TID: 0x3a4929
Invalidating grant <invalid NS/CF object> failed
Type: Error | Timestamp: 2024-06-20 13:27:44.733996+02:00 | Process: MyApp | Library: WebKit | Subsystem: com.apple.WebKit | Category: ProcessCapabilities | TID: 0x3a4929
I am using:
Cordova iOS: 6.2
iOS 17.5.1
Can anyone please help?
Bom dia, o áudio externo após a última atualização ficou baixo, não escuto nada. Iphone [11]
Currently, there must be a request for access to documents with xcode, but we do not request access.
Added NSDocumentDirectoryUsageDescription to info.
import SwiftUI
import AVFoundation
import UniformTypeIdentifiers
struct ContentView: View {
@State private var audioPlayer: AVAudioPlayer?
@State private var isPlaying = false
@State private var currentFileName: String = "No file selected"
@State private var showingDocumentPicker = false
@State private var songList: [String] = UserDefaults.standard.stringArray(forKey: "SavedSongs") ?? []
@State private var currentSongIndex: Int = 0
var body: some View {
VStack {
Text(currentFileName)
.font(.headline)
.padding()
List {
ForEach(songList, id: \.self) { song in
HStack {
Text(song)
.onTapGesture {
loadAndPlaySong(named: song)
}
Spacer()
Button(action: {
removeSong(named: song)
}) {
Image(systemName: "trash")
.foregroundColor(.red)
}
}
}
}
.listStyle(PlainListStyle())
HStack(spacing: 10) {
Button(action: {
showingDocumentPicker = true
}) {
Text("Load")
.font(.system(size: 12))
.frame(width: 50, height: 25)
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(5)
}
.padding(.bottom, 20)
}
.padding()
.sheet(isPresented: $showingDocumentPicker) {
DocumentPicker(audioPlayer: $audioPlayer, currentFileName: $currentFileName, songList: $songList)
}
.onAppear {
if !songList.isEmpty {
loadAndPlaySong(named: songList[currentSongIndex])
}
}
}
func playSong() {
audioPlayer?.play()
isPlaying = true
}
func pauseSong() {
audioPlayer?.pause()
isPlaying = false
}
func stopSong() {
audioPlayer?.stop()
audioPlayer?.currentTime = 0
isPlaying = false
}
func nextSong() {
currentSongIndex = (currentSongIndex + 1) % songList.count
loadAndPlaySong(named: songList[currentSongIndex])
}
func previousSong() {
currentSongIndex = (currentSongIndex - 1 + songList.count) % songList.count
loadAndPlaySong(named: songList[currentSongIndex])
}
func loadAndPlaySong(named songName: String) {
guard let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { return }
let fileURL = documentsURL.appendingPathComponent(songName)
do {
audioPlayer = try AVAudioPlayer(contentsOf: fileURL)
audioPlayer?.prepareToPlay()
currentFileName = songName
playSong()
} catch {
print("Error loading file: \(error.localizedDescription)")
}
}
func removeSong(named songName: String) {
songList.removeAll { $0 == songName }
UserDefaults.standard.set(songList, forKey: "SavedSongs")
}
}
struct DocumentPicker: UIViewControllerRepresentable {
@Binding var audioPlayer: AVAudioPlayer?
@Binding var currentFileName: String
@Binding var songList: [String]
func makeCoordinator() -> Coordinator {
return Coordinator(self)
}
func makeUIViewController(context: Context) -> UIDocumentPickerViewController {
let documentPicker = UIDocumentPickerViewController(forOpeningContentTypes: [UTType.audio])
documentPicker.delegate = context.coordinator
return documentPicker
}
func updateUIViewController(_ uiViewController: UIDocumentPickerViewController, context: Context) {}
class Coordinator: NSObject, UIDocumentPickerDelegate {
let parent: DocumentPicker
init(_ parent: DocumentPicker) {
self.parent = parent
}
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
guard let url = urls.first else { return }
do {
if url.startAccessingSecurityScopedResource() {
defer { url.stopAccessingSecurityScopedResource() }
let fileName = url.lastPathComponent
let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let destinationURL = documentsURL.appendingPathComponent(fileName)
if FileManager.default.fileExists(atPath: destinationURL.path) {
try FileManager.default.removeItem(at: destinationURL)
}
try FileManager.default.copyItem(at: url, to: destinationURL)
parent.audioPlayer = try AVAudioPlayer(contentsOf: destinationURL)
parent.audioPlayer?.prepareToPlay()
parent.currentFileName = fileName
if !parent.songList.contains(fileName) {
parent.songList.append(fileName)
UserDefaults.standard.set(parent.songList, forKey: "SavedSongs")
}
} else {
print("I can't get file access.")
}
} catch {
print("An error occurred while loading the file: \(error.localizedDescription)")
}
}
func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) {
}
}
}