Posts

Post not yet marked as solved
1 Replies
723 Views
I have a bunch of apps I built and installed on my devices. They're all personal projects that have never been uploaded to the app store. After updating my devices to iOS 15, some of my apps crash as soon as they launch, one app gives me an alert that says "App Name Needs to Be Update. The developer of this app needs to update it to work with this version of iOS." I tried to reinstall some of my apps and Xcode gives me an error that says "Could not launch App Name. failed to get the task for process -1" Could not launch “App Name” Domain: IDEDebugSessionErrorDomain Code: 3 Failure Reason: failed to get the task for process -1 User Info: { DVTRadarComponentKey = 855031; IDERunOperationFailingWorker = DBGLLDBLauncher; RawUnderlyingErrorMessage = "failed to get the task for process -1"; } -- Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : { "device_isWireless" = 1; "device_model" = "iPhone12,8"; "device_osBuild" = "15.0.2 (19A404)"; "device_platform" = "com.apple.platform.iphoneos"; "launchSession_schemeCommand" = Run; "launchSession_state" = 1; "launchSession_targetArch" = arm64; "operation_duration_ms" = 17899; "operation_errorCode" = 3; "operation_errorDomain" = IDEDebugSessionErrorDomain; "operation_errorWorker" = DBGLLDBLauncher; "operation_name" = IDEiPhoneRunOperationWorkerGroup; "param_consoleMode" = 0; "param_debugger_attachToExtensions" = 0; "param_debugger_attachToXPC" = 1; "param_debugger_type" = 5; "param_destination_isProxy" = 0; "param_destination_platform" = "com.apple.platform.iphoneos"; "param_diag_MainThreadChecker_stopOnIssue" = 0; "param_diag_MallocStackLogging_enableDuringAttach" = 0; "param_diag_MallocStackLogging_enableForXPC" = 1; "param_diag_allowLocationSimulation" = 1; "param_diag_gpu_frameCapture_enable" = 0; "param_diag_gpu_shaderValidation_enable" = 0; "param_diag_gpu_validation_enable" = 0; "param_diag_memoryGraphOnResourceException" = 0; "param_diag_queueDebugging_enable" = 1; "param_diag_runtimeProfile_generate" = 0; "param_diag_sanitizer_asan_enable" = 0; "param_diag_sanitizer_tsan_enable" = 0; "param_diag_sanitizer_tsan_stopOnIssue" = 0; "param_diag_sanitizer_ubsan_stopOnIssue" = 0; "param_diag_showNonLocalizedStrings" = 0; "param_diag_viewDebugging_enabled" = 1; "param_diag_viewDebugging_insertDylibOnLaunch" = 1; "param_install_style" = 0; "param_launcher_UID" = 2; "param_launcher_allowDeviceSensorReplayData" = 0; "param_launcher_kind" = 0; "param_launcher_style" = 0; "param_launcher_substyle" = 0; "param_runnable_appExtensionHostRunMode" = 0; "param_runnable_productType" = "com.apple.product-type.application"; "param_runnable_swiftVersion" = "5.5"; "param_runnable_type" = 2; "param_testing_launchedForTesting" = 0; "param_testing_suppressSimulatorApp" = 0; "param_testing_usingCLI" = 0; "sdk_canonicalName" = "iphoneos15.0"; "sdk_osVersion" = "15.0"; "sdk_variant" = iphoneos; } -- System Information macOS Version 11.6 (Build 20G165) Xcode 13.0 (19234) (Build 13A233) Timestamp: 2021-10-20T15:55:11+09:00
Posted Last updated
.
Post marked as solved
6 Replies
6.3k Views
I wanna create a button with SwiftUI that fires the moment my finger touches it (like UIKit's touch down). I also want the opacity of the button to become 0.7 when my finger is pressing the button. When my finger leaves the button, I want the opacity of the button to change back to 1I've tried 2 different types of button styles to achieve this but both of them failed:struct ContentView: View { var body: some View { Button(action: { print("action triggered") }){ Text("Button").padding() } .buttonStyle(SomeButtonStyle()) } } struct SomeButtonStyle: ButtonStyle { func makeBody(configuration: Self.Configuration) -> some View { configuration.label .background(Color.green) .opacity(configuration.isPressed ? 0.7 : 1) .onLongPressGesture( minimumDuration: 0, perform: configuration.trigger//Value of type 'SomeButtonStyle.Configuration' (aka 'ButtonStyleConfiguration') has no member 'trigger' ) } } struct SomePrimativeButtonStyle: PrimitiveButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label .background(Color.green) .opacity(configuration.isPressed ? 0.7 : 1)//Value of type 'SomePrimativeButtonStyle.Configuration' (aka 'PrimitiveButtonStyleConfiguration') has no member 'isPressed' .onLongPressGesture( minimumDuration: 0, perform: configuration.trigger ) } }How should I configure my button style to create such a button?
Posted Last updated
.
Post not yet marked as solved
0 Replies
262 Views
The first time I tap the button it plays all 3 sound files / items. But if I tap the button again, it would only play the first item in the queue, even though there are 3 items in the queue.import SwiftUI import AVFoundation let item1 = AVPlayerItem(url: Bundle.main.url(forResource: "Cshort", withExtension: "mp3")!) let item2 = AVPlayerItem(url: Bundle.main.url(forResource: "Dshort", withExtension: "mp3")!) let item3 = AVPlayerItem(url: Bundle.main.url(forResource: "Eshort", withExtension: "mp3")!) var itemArray = [item1, item2, item3] var player: AVQueuePlayer = { let queue = AVQueuePlayer(items: itemArray) return queue }() struct ContentView: View { var body: some View { Button(action: { if player.items().isEmpty { print("queue is empty") print("about to insert") for item in itemArray { if player.items().isEmpty { player.insert(itemArray[0], after: nil) } else { player.insert(item, after: player.items().last) } } print("inserted these items \(player.items())") } else { print("queue has items to play, no need to insert") } player.seek(to: .zero) print("will play from this item: \(player.currentItem!)") print("about to play these items: \(player.items())") player.play() print("done playing——————————————————") }){ Text("Button") } } }If I tap the button for the first time, it plays all 3 items one after another, and this is what gets printed in the console:queue has items to play, no need to insertwill play from this item: <AVPlayerItem: 0x283a44390, asset = <AVURLAsset: 0x283853ce0, URL = file:///private/var/containers/Bundle/Application/F30EC8BB-9C51-42AD-AEF7-840DBAEFCF79/AVQueue.app/Cshort.mp3>>about to play these items: [<AVPlayerItem: 0x283a44390, asset = <AVURLAsset: 0x283853ce0, URL = file:///private/var/containers/Bundle/Application/F30EC8BB-9C51-42AD-AEF7-840DBAEFCF79/AVQueue.app/Cshort.mp3>>, <AVPlayerItem: 0x283a44b20, asset = <AVURLAsset: 0x28386ca60, URL = file:///private/var/containers/Bundle/Application/F30EC8BB-9C51-42AD-AEF7-840DBAEFCF79/AVQueue.app/Dshort.mp3>>, <AVPlayerItem: 0x283a44c60, asset = <AVURLAsset: 0x28386c9c0, URL = file:///private/var/containers/Bundle/Application/F30EC8BB-9C51-42AD-AEF7-840DBAEFCF79/AVQueue.app/Eshort.mp3>>]done playing——————————————————And after that, every I tap the button it only plays the first item, and this is what gets printed in the console every time:queue is emptyabout to insertinserted these items [<AVPlayerItem: 0x283a44390, asset = <AVURLAsset: 0x283853ce0, URL = file:///private/var/containers/Bundle/Application/F30EC8BB-9C51-42AD-AEF7-840DBAEFCF79/AVQueue.app/Cshort.mp3>>, <AVPlayerItem: 0x283a44b20, asset = <AVURLAsset: 0x28386ca60, URL = file:///private/var/containers/Bundle/Application/F30EC8BB-9C51-42AD-AEF7-840DBAEFCF79/AVQueue.app/Dshort.mp3>>, <AVPlayerItem: 0x283a44c60, asset = <AVURLAsset: 0x28386c9c0, URL = file:///private/var/containers/Bundle/Application/F30EC8BB-9C51-42AD-AEF7-840DBAEFCF79/AVQueue.app/Eshort.mp3>>]will play from this item: <AVPlayerItem: 0x283a44390, asset = <AVURLAsset: 0x283853ce0, URL = file:///private/var/containers/Bundle/Application/F30EC8BB-9C51-42AD-AEF7-840DBAEFCF79/AVQueue.app/Cshort.mp3>>about to play these items: [<AVPlayerItem: 0x283a44390, asset = <AVURLAsset: 0x283853ce0, URL = file:///private/var/containers/Bundle/Application/F30EC8BB-9C51-42AD-AEF7-840DBAEFCF79/AVQueue.app/Cshort.mp3>>, <AVPlayerItem: 0x283a44b20, asset = <AVURLAsset: 0x28386ca60, URL = file:///private/var/containers/Bundle/Application/F30EC8BB-9C51-42AD-AEF7-840DBAEFCF79/AVQueue.app/Dshort.mp3>>, <AVPlayerItem: 0x283a44c60, asset = <AVURLAsset: 0x28386c9c0, URL = file:///private/var/containers/Bundle/Application/F30EC8BB-9C51-42AD-AEF7-840DBAEFCF79/AVQueue.app/Eshort.mp3>>]done playing——————————————————
Posted Last updated
.
Post not yet marked as solved
4 Replies
527 Views
Apple's doc says: "classes with public access, or any more restrictive access level, can be subclassed only within the module where they're defined"However, Apple's doc also says: "Open access and public access enable entities to be used within any source file from their defining module, and also in a source file from another module that imports the defining module."These two sentences seem to be contradictory. One is saying that a public class can only be subclassed within its defining module. The other one is implying that a public class can be subclassed within non-defining modules that import the defining module.So I'm wondering which one is correct? Are these 2 quotes contradictory? or am I misinterpreting them?Thanks for the answers in advance.
Posted Last updated
.
Post not yet marked as solved
1 Replies
339 Views
Accoding to Apple's doc: "The default memberwise initializer for a structure type is considered private if any of the structure’s stored properties are private. Likewise, if any of the structure’s stored properties are file private, the initializer is file private. Otherwise, the initializer has an access level of internal."But what if a structure contains both private AND file private stored properties? Is the memberwise initializer for that structure private or file private? Or is it internal?
Posted Last updated
.
Post marked as solved
5 Replies
3.3k Views
Apple's documentations says "define a capture in a closure as an unowned reference when the closure and the instance it captures will always refer to each other, and will always be deallocated at the same time"But if a closure and a class instance refer to each other and have a strong reference cycle, by definition, they will never be deallocated. How can they be deallocated at the same time when they can never be deallocated at all due to their strong reference cycle?
Posted Last updated
.
Post marked as solved
2 Replies
990 Views
Apple's documentation says that "Define a capture in a closure as an unowned reference when the closure and the instance it captures will always refer to each other, and will always be deallocated at the same time."So if I understand this correctly, Apple is saying that, in order to define a capture in a closure as an unowned reference. The closure and the instance it captures have to always deallocate at the same time. But how does a closure deallocate? I know that an instance deallocates when there's no strong references to it. But how and when exactly does a closure deallocate?
Posted Last updated
.