"kotlin-multiplatform"^^ . "<p>I don't know why I'm getting this error in objective c while integrating CashFree Payment service.</p>\n<p>I'm trying to integrate cashfree payment gateway service in my iOS through Objective-C but don't know where I'm getting this error</p>\n<p>ViewController.h:</p>\n<pre><code>@interface ViewController : UIViewController &lt;CFResponseDelegate&gt;\n</code></pre>\n<p>ViewController.m:</p>\n<pre><code>@interface ViewController() &lt;CFResponseDelegate&gt;\n\n-(void) cashFreePayment;\n\n@end\n\n@implementation ViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n [self cashFreePayment];\n}\n\n-(void) cashFreePayment {\n @try {\n \n CFSessionBuilder* sessionBuilder = [[CFSessionBuilder alloc]init];\n sessionBuilder = [sessionBuilder setEnvironment:CFENVIRONMENTSANDBOX];\n sessionBuilder = [sessionBuilder setPaymentSessionId:@&quot;&quot;];\n sessionBuilder = [sessionBuilder setOrderID:@&quot;&quot;];\n sessionBuilder = [sessionBuilder buildAndReturnError:nil];\n \n CFPaymentComponentBuilder *paymentComponent = [[CFPaymentComponentBuilder alloc]init];\n paymentComponent = [paymentComponent enableComponents:@&quot;order-details&quot;];\n paymentComponent = [paymentComponent enableComponents:@&quot;card&quot;];\n paymentComponent = [paymentComponent enableComponents:@&quot;upi&quot;];\n paymentComponent = [paymentComponent enableComponents:@&quot;wallet&quot;];\n paymentComponent = [paymentComponent enableComponents:@&quot;netbanking&quot;];\n paymentComponent = [paymentComponent enableComponents:@&quot;emi&quot;];\n paymentComponent = [paymentComponent enableComponents:@&quot;paylater&quot;];\n paymentComponent = [paymentComponent buildAndReturnError:nil];\n \n \n CFThemeBuilder *theme = [[CFThemeBuilder alloc]init];\n theme = [theme setPrimaryFont:@&quot;Futura&quot;];\n theme = [theme setSecondaryFont:@&quot;Menlo&quot;];\n theme = [theme setButtonTextColor:@&quot;#FFFFFF&quot;];\n theme = [theme setButtonBackgroundColor:@&quot;#FF0000&quot;];\n theme = [theme setNavigationBarTextColor: @&quot;#FFFFFF&quot;];\n theme = [theme setNavigationBarBackgroundColor:@&quot;#C3C3C3&quot;];\n theme = [theme buildAndReturnError:nil];\n \n CFWebCheckoutPaymentBuilder *payout = [[CFWebCheckoutPaymentBuilder alloc]init];\n payout = [payout setSession:sessionBuilder];\n payout = [payout buildAndReturnError:nil];\n \n } @catch (NSException *exception) {\n NSLog(@&quot;%@&quot;, exception.reason);\n }\n}\n\n\n- (void)onError:(CFErrorResponse * _Nonnull)error order_id:(NSString * _Nonnull)order_id {\n NSLog(error, order_id);\n}\n\n- (void)verifyPaymentWithOrder_id:(NSString * _Nonnull)order_id {\n NSLog(order_id);\n}\n</code></pre>\n"^^ . "<p>We have a reader app similar to apple books. We are facing following accessibility issue on mac catalyst version of the app:</p>\n<p>When the content on the page is read out by voice over and we turn the page using keyboard arrow keys, even though the page gets turned and the focus also goes to the next page, the voice over continues to read the previous page.</p>\n<p>Can you please suggest what needs to be done and how it is fixed in apple books mac app.</p>\n<p>I tried following things but none of them worked:</p>\n<p>Post <code>UIAccessibilityAnnouncementNotification</code> when page is turned. This didn’t work and the announcement does not interrupts it, it just continues to read the previous page. Though the announcement string gets appended in the end and VO speaks when it is done with reading. (we don't have <code>UIAccessibilitySpeechAttributeQueueAnnouncement</code> overridden, i even tried to set it to false explicitly as well)\nPost <code>UIAccessibilityLayoutChangedNotification</code> or <code>UIAccessibilityLayoutChangedNotification</code> or <code>UIAccessibilityLayoutChangedNotification</code> when page is turned.\nI know that apple books also has similar issue till macOS Monterey but it is fixed in macOS Ventura but for us this issue is still in macOS ventura.</p>\n"^^ . "Either that or adding an wrapper for the initialisation part, if it not possible to convert the AppDelegate to objc itself.\n\nAnyway, the most of the services and types are plain swift and won't be accessible through objc. For these adapters would have to be implemented.\n\nThe reason is that the SDK uses a lot of async code (promises etc.) which rely on generic types. Generic types are not supported by objc in that way. Additional not all native swift types are available via in objc."^^ . "0"^^ . "As the kswift developer said from this medium https://medium.com/icerock/how-to-implement-swift-friendly-api-with-kotlin-multiplatform-mobile-e68521a63b6d. From the Swift side Kotlin’s sealed interface looks like a set of classes with a common protocol. Of course, in this case, one cannot hope to check the completeness of the switch implementation, since it is not an enum."^^ . "nskeyedunarchiver"^^ . . . . "<p>Check this out as well. My WSDL-generated code is generating a read-write var (String) for description. And, of course, this conflicts with the (NSObject-provided?) &quot;description&quot; that is a get-only property for any object (and which seems to return the class name.</p>\n<p>So in the debugger, if I do this I see that things are ambiguous:</p>\n<pre><code>(lldb) po self.description\nerror: expression failed to parse:\n__ObjC.MFBWebServiceSvc_SimpleMakeModel:19:14: note: found this candidate\n open var description: String! { get set }\n ^\n\nObjectiveC.NSObject:105:14: note: found this candidate\n open var description: String { get }\n ^\n\nerror: &lt;EXPR&gt;:8:1: error: ambiguous use of 'description'\nself.description\n^\n\n__ObjC.MFBWebServiceSvc_SimpleMakeModel:23:14: note: found this candidate\n open var description: String! { get set }\n ^\n\nObjectiveC.NSObject:109:14: note: found this candidate\n open var description: String { get }\n</code></pre>\n<p>Note that the NSObject runtime-getter is not implicitly unwrapped, but the read/write property is. So if I now type &quot;po self.description!&quot;, it seems to explicitly return the correct underlying description read/write property.</p>\n<p>I'm not entirely sure why that happens - I thought &quot;description!&quot; meant &quot;I know description is non-nil, so unwrap it&quot;, I didn't think it was also a means of disambiguation. Am I relying here on an artifact that could change, or is this deliberate in swift?</p>\n"^^ . "0"^^ . . "0"^^ . "<p>I also thought about using an Objective-C category to extend the WDSL-generated class to provide another property for accessing the <code>Description</code>. It's still messy, but I think it is cleaner than passing an object to a top-level function.</p>\n<p>Here's how I mocked it up.</p>\n<p>First, here's the WSDL-generated class which you cannot change. It has a <code>Description</code> property:</p>\n<pre><code>// WDSLClass.h - auto-generated\n\n#import &lt;Foundation/Foundation.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface WSDLClass: NSObject\n\n// the `Description` property that you want to access\n@property (strong, readonly) NSString *Description;\n\n// lots of other stuff\n\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<pre><code>// WDSLClass.m - autogenerated\n\n#import &quot;WSDLClass.h&quot;\n\n@implementation WSDLClass\n\n- (NSString *)Description\n{\n return @&quot;This is the Description!&quot;;\n}\n\n// lots of other stuff\n\n@end\n</code></pre>\n<p>To provide access to the <code>Description</code> property under another name I created an Objective-C extension on <code>WSDLClass</code>:</p>\n<pre><code>// WSDLClass+Extensions.h\n\n#import &quot;WSDLClass.h&quot;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface WSDLClass (Extensions)\n\n// This is an alias for the `Description` property\n@property (strong, readonly) NSString *getDescription;\n\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<pre><code>// WSDLClass+Extensions.m\n\n#import &quot;WSDLClass+Extensions.h&quot;\n\n@implementation WSDLClass (Extensions)\n\n- (NSString *)getDescription\n{\n return self.Description;\n}\n</code></pre>\n<p>The bridging header needs to import <code>WDSLClass+Extensions.h</code> to gain access to this. I can then do this in Swift:</p>\n<pre><code>let wsdlObject = WSDLClass()\nprint(wsdlObject.getDescription)\n</code></pre>\n<p>I.e. I can use the <code>getDescription</code> property (from Swift or Objective-C) to access the Objective-C <code>Description</code> property.</p>\n<p>Of course, you would need to rename <code>WSDLClass</code> to whatever class name you need and maybe <code>getDescription</code> isn't the best name for the alias.</p>\n<p>If there are mutiple objects with a <code>Description</code> property then you would need to create an extension for each of them (best combined into a single file for simplicity).</p>\n<p>Granted you still need to keep a bit more Objective-C in your project, but it's a little easier to use than your current hacky workaround.</p>\n<p>If <code>Description</code> isn't readonly then you would need to implement a custom getter and setter in the Objective-C category for getting/setting the underlying <code>Description</code> property.</p>\n"^^ . "<p>Post the <code>UIAccessibilityScreenChangedNotification</code> notification, and pass along the your new view that should be focussed-on by the accessibility system.</p>\n<p><a href="https://developer.apple.com/documentation/uikit/uiaccessibilityscreenchangednotification?language=objc" rel="nofollow noreferrer">See documentation here</a>. It states</p>\n<blockquote>\n<p>Post this notification using the <a href="https://developer.apple.com/documentation/uikit/uiaccessibilityscreenchangednotification?language=objc#:%7E:text=UIAccessibilityPostNotification" rel="nofollow noreferrer"><code>UIAccessibilityPostNotification</code></a> function. Optionally, include a parameter that contains the accessibility element for VoiceOver to move to after processing the notification.</p>\n</blockquote>\n<p>You can use this function like so:</p>\n<p><code>UIAccessibility.post(notification: .screenChanged, argument: viewToBeFocussed)</code></p>\n<p>where <code>viewToBeFocussed</code> is the view that contains the text to be read by the accessibility system.</p>\n"^^ . . . . "Slow load time with UITextView as compared to UITextField"^^ . . . . "0"^^ . "1"^^ . . "0"^^ . "Objective c iPhone microphone self adjusts after loud noise"^^ . . "0"^^ . "0"^^ . . . . "0"^^ . . . . . "Could you provide some sample of the input data to be sorted?"^^ . . . . "<pre><code>NSArray *arrTemp = @[\n @{@&quot;Appearance&quot; : @&quot;Copper&quot;,\n @&quot;Bitterness&quot; : @(50),\n @&quot;Style&quot; : @&quot;India Pale Ale (IPA)&quot;},\n\n @{@&quot;Appearance&quot; : @&quot;Jet Black&quot;,\n @&quot;Bitterness&quot; : @(35),\n @&quot;Style&quot; : @&quot;Stout&quot;},\n\n @{@&quot;Appearance&quot; : @&quot;Copper&quot;,\n @&quot;Bitterness&quot; : @(25),\n @&quot;Style&quot; : @&quot;English Brown Ale&quot;},\n\n @{@&quot;Appearance&quot; : @&quot;Deep Gold&quot;,\n @&quot;Bitterness&quot; : @(25),\n @&quot;Style&quot; : @&quot;Bock&quot;}\n ];\n</code></pre>\n<p>From the above structure, how can we get the array of &quot;Appearance&quot; values.\nPlease help.</p>\n"^^ . "0"^^ . . . . . . "How to get array of values from array of dictionary?"^^ . . . . "<p>I have an Xcode project that is a mix of Objective-C(++), C++, and Swift. Some of the Objective-C++ serves as a bridge between Swift and C++.</p>\n<p>Say I have an Objective-C class with a public property whose type is a C++ class that I want to use from other parts of the Objective-C code. This will cause a compiler error if the header is imported in the Swift bridging header. Is there a way to hide part of the header of this Objective-C class from Swift?</p>\n<p>EDIT: here's a sample header file to illustrate what I mean.</p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n\nclass MyCppType;\n\n@interface SwiftCancelationToken : NSObject\n\n//I need to expose this so Obj-C can interact with it\n@property MyCppType *cppProperty;\n\n-(void)doSomethingWithCppObject;\n\n@end\n</code></pre>\n"^^ . . . . "1"^^ . . . . "I have tried this. but I am getting only one value\nbut we need array of values\nlike : Copper,Jet Black, Copper,Deep Gold"^^ . . . . . "0"^^ . . . "@TheNextman thanks for the suggestion! I'll look into it. So far the `LocateMe.swift` file is not prompting me for permissions access either, but I'll try to adapt my CLLocation code to see if it does. If I can get it working I'll gladly accept this as a solution!"^^ . "@Rob `NS_SWIFT_UNAVAILABLE` may work for hiding properties and methods, but I have to expose my C++ object as a property on the wrapper object, which means either forward-declaring its type or importing its header, both of which cause a compiler error. See the edit to the question."^^ . "<p>Going to ask this question because I cannot find a sufficient answer. I have an application that needs to play some audio. It needs to pause the current media player (Spotify, Apple Music, etc), and when my audio is done playing it needs to release and notify such that the previously playing media resumes. This works properly when the screen is on, and my app is active on the screen, aka my application is running in the foreground. However, this does not work properly when my application is in the background (eg the screen is locked, or another app is present on the screen).</p>\n<p>Here is the setup that works when my app is on screen in the foreground.</p>\n<p>Initial setup</p>\n<pre><code>-(void) viewDidLoad {\n [super viewDidLoad];\n \n // deactivate session\n BOOL success = [[AVAudioSession sharedInstance] setActive:NO error: nil];\n if (!success) { NSLog(@&quot;deactivationError&quot;); }\n // set audio session category AVAudioSessionCategoryPlayAndRecord\n success = [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];\n if (!success) { NSLog(@&quot;setCategoryError&quot;); }\n // set audio session mode to default\n success = [[AVAudioSession sharedInstance] setMode:AVAudioSessionModeDefault error:nil];\n if (!success) { NSLog(@&quot;setModeError&quot;); }\n // activate audio session\n success = [[AVAudioSession sharedInstance] setActive:YES error: nil];\n if (!success) { NSLog(@&quot;activationError&quot;); }\n</code></pre>\n<p>The code below is called when I want to pause the background audio player (Spotify, Apple Music, etc.):</p>\n<pre><code>-(void) pauseBackgroundAudio {\n \n // activate a non-mixable session\n // set audio session category AVAudioSessionCategoryPlayAndRecord\n BOOL success;\n AVAudioSessionCategoryOptions AVAudioSessionCategoryOptionsNone = 0;\n success = [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionsNone error:nil];\n if (!success) { NSLog(@&quot;setCategoryError&quot;); }\n\n // set audio session mode default\n success = [[AVAudioSession sharedInstance] setMode:AVAudioSessionModeDefault error:nil];\n if (!success) { NSLog(@&quot;setModeError&quot;); }\n\n // activate audio session\n success = [[AVAudioSession sharedInstance] setActive:YES error: nil];\n if (!success) { NSLog(@&quot;activationError&quot;); }\n \n NSLog(@&quot;starting playback (pauseBackgroundAudio)&quot;);\n \n NSURL* sound = [[NSBundle mainBundle ] URLForResource:@&quot;path1&quot; withExtension:@&quot;wav&quot;];\n NSLog(@&quot;%@&quot;, sound);\n AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:sound error:NULL];\n [audioPlayer play];\n}\n}\n</code></pre>\n<p>The following code is called when I want to resume the background audio (Spotify, Apple Music, etc.):</p>\n<pre><code>-(void) resumeBackgroundAudio {\n NSError *sessionError = nil;\n [[AVAudioSession sharedInstance] setActive:NO\n withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation\n error:&amp;sessionError];\n\n NSLog(@&quot;stopping playback (resumeBackgroundAudio)&quot;);\n}\n</code></pre>\n<p>This works fine WHEN MY APP IS ON SCREEN. However when my app is backgrounded, or the screen is off, pausing the previously playing audio does not work properly (unpausing and resuming works correctly).</p>\n<p>When the app is in the foreground everything works perfect. When the app is in the background or the screen is off I see the following error:</p>\n<pre><code>ATAudioSessionClientImpl.mm:274 activation failed. status = 560557684\n</code></pre>\n<p>I see the above error code is this:</p>\n<p><a href="https://developer.apple.com/documentation/avfaudio/avaudiosession/errorcode/cannotinterruptothers" rel="nofollow noreferrer">https://developer.apple.com/documentation/avfaudio/avaudiosession/errorcode/cannotinterruptothers</a></p>\n<p>If you have any ideas on how to make this code work properly when my app is in the background that would be awesome!</p>\n"^^ . . "If you test that code with your sample, you exactly get `@[@"Copper", @"Jet Black", @"Copper", @"Deep Gold"]`, which is the expected result."^^ . . "0"^^ . "Yeah, for other reasons. It's on the to-do list."^^ . "3"^^ . . . . . . "0"^^ . "I just tried with my project details with same structure and separate class which I should not post it here"^^ . . . . . . . . . . "From what I see: `[paymentComponent enableComponents:@"order-details"];` seems wrong. Instead, you should do: `paymentComponent enableComponents:@[@"order-details", @"netbanking", @"upi"...]];` as I read `componentS` with an "s" (plural), and see the method https://github.com/cashfree/core-ios-sdk/blob/6ea73372d0ae25bd2ec9f5aef951ea7d906ff329/CashfreePGUISDK.xcframework/ios-arm64_x86_64-simulator/CashfreePGUISDK.framework/Headers/CashfreePGUISDK-Swift.h#L301 `- (CFPaymentComponentBuilder * _Nonnull)enableComponents:(NSArray<NSString *> * _Nonnull)components` Don't you have a warning in code?"^^ . "xcode"^^ . . "1"^^ . "0"^^ . . "1"^^ . . . "0"^^ . . . . . "0"^^ . . . "1"^^ . . . . "0"^^ . . . "swift"^^ . . . "1"^^ . . "I just checked, and the build server uses Xcode13. Maybe that's the difference."^^ . . . . . . . . "<p>I get this error message when trying to use the Tapkey Mobile SDK for iOS in a Objective C AppDelegate:</p>\n<blockquote>\n<p>No visible @interface for 'TKMServiceFactoryBuilder' declares the selector 'build'</p>\n</blockquote>\n<p>This is the code I use to initialize the ServiceFactory:</p>\n<p><code>TKMServiceFactoryBuilder *builder = [[TKMServiceFactoryBuilder alloc] init]; self.tapkeyServiceFactory = [builder build];</code></p>\n<p>Here is the error message as screenshot:</p>\n<p><a href="https://i.sstatic.net/95sJl.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/95sJl.png" alt="enter image description here" /></a></p>\n<p>Am I missing some imports? The code above with the config has a valid build method. I can also use the <code>setConfig</code> to use the config above.</p>\n<p>Or am I just not using the library correctly in Objetcive C?</p>\n<p>The project is React Native. The SDK is working with Android using the React Native Bridge and I want to add it to iOS to.</p>\n<p>The SDK is prepared for iOS but unfortunately the AppDelegate is in objetcive c and not swift. There is no documentation on how to use it with that.</p>\n"^^ . "sorting"^^ . . "<p>I have a question concerning sorting of a multidimensional array. The array holds <code>n</code> elements, each element has three objects, an <code>NSString</code>, an <code>NSNumber</code>, and another <code>NSString</code>. The two objects, the <code>NSNumber</code> and the second string need to stay with the first string in an array but I need to alphabetize the array by the first string.</p>\n<p>I previously used the following code to alphabetize a single element array:</p>\n<pre class="lang-objc prettyprint-override"><code>theSortedFilenames = [NSArray arrayWithArray:[filenamesArray sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]];\n</code></pre>\n<p>However, a version of that code modified to alphabetize the bigger multidimensional array by the first object’s name does not work:</p>\n<pre class="lang-objc prettyprint-override"><code>theSortedFilenames = [NSArray arrayWithArray:[elementsArray[0] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]];\n</code></pre>\n<p>I also tried:</p>\n<pre><code>NSComparisonResult alphaSort(NSString *string1, NSString *string2, void *context)\n{\n return [string1 caseInsensitiveCompare:string2];\n}\n\n// sort things\nNSArray *sortedArray;\nsortedArray = [elementsArray[0] sortedArrayUsingFunction:alphaSort context:NULL];\n</code></pre>\n<p>Which didn’t work and also a variant given in an answer to a previous question here on stack overflow:</p>\n<pre><code>static NSInteger order (id a, id b, void* context) {\n NSString* catA = [a firstObject];\n NSString* catB = [b firstObject];\n return [catA caseInsensitiveCompare:catB];\n}\n\nsortedArray = [theArrayToSort sortedArrayUsingFunction:order context:self];\n</code></pre>\n<p>Which also did not work. Can anyone suggest a way to alphabetize the array of three object elements by the first element while maintaining the relationship between all three objects?</p>\n"^^ . "1"^^ . "How can I hide part of an Objective-C class's interface from Swift?"^^ . . . . "Hey @DonMag, I just replaced my UITextView with your MyTextView. I was amazed to see the performance improved by 50%. A form that took 8 seconds to render was loaded in just 3.69 seconds after the update. Thank you for the support!"^^ . "0"^^ . "Unfortunately, I can't get this to work as `other._data` isn't available because `_data` isn't in the bridge. I can add `_data: Any?` as a property in the bridge class, but I can't treat the objects I need abstractly as I can with the protocol. I'll update the question to provide even more context."^^ . . . "Voice over continues to read previous page even when page is turned"^^ . . "4"^^ . "0"^^ . . "Maybe, but from my own (limited) working with Objective-C and Objective-C++ and Swift: **no**. (But as said, "maybe", I may be wrong.)"^^ . . "0"^^ . "I tried to convert an old project to ARC and don't have issues with disappearing errors or selectors. It's easier to do the ARC and new deployment target steps one by one. Switch "show live issues" off when fixing the ARC errors. Post a [mre] if you want help with the selectors."^^ . . . "Override Objc NSObject conformance within Swift protocol"^^ . . "0"^^ . . . . "1"^^ . . "2"^^ . . "0"^^ . . . . "<p>According to Apple's official documentation:</p>\n<p>A scene is represented by a <code>UIScene</code> object. Apple defines this as:</p>\n<blockquote>\n<p>&quot;An object that represents one instance of your app’s user interface&quot;<br>\nsource: <a href="https://developer.apple.com/documentation/uikit/uiscene" rel="nofollow noreferrer">https://developer.apple.com/documentation/uikit/uiscene</a></p>\n</blockquote>\n<p>A window is represented by a <code>UIWindow</code> object. Apple defines this as:</p>\n<blockquote>\n<p>&quot;The backdrop for your app’s user interface and the object that dispatches events to your views.&quot;<br>\nsource: <a href="https://developer.apple.com/documentation/uikit/uiwindow" rel="nofollow noreferrer">https://developer.apple.com/documentation/uikit/uiwindow</a></p>\n</blockquote>\n<p>So then in this <a href="https://i.sstatic.net/W4zj4.jpg" rel="nofollow noreferrer">image</a>, is this best represented as one scene containing two windows or two separate scenes?</p>\n<blockquote>\n<p>image source: <a href="https://developer.apple.com/documentation/uikit/app_and_environment/scenes" rel="nofollow noreferrer">https://developer.apple.com/documentation/uikit/app_and_environment/scenes</a></p>\n</blockquote>\n<p>To my understanding, this is the high-level structure of an iOS application:<br>\n<code>UIApplication</code> -&gt; <code>UIScene</code> -&gt; <code>UIWindow</code> -&gt; <code>UIView</code></p>\n<p>What is the purpose of being able to have both multiple scenes per application and multiple windows per scene? And the differences / distinct usages of the two. Thanks.</p>\n<p>The Apple documentation is thorough, but I find its definitions and usages of technical terms to be inconsistent. It also doesn't help that there is no clear example code, especially for Objective-C. The Apple documentation archives have a lot of Objective-C introductory material to learn the language, but not actual iOS development using UIKit.</p>\n<p>I also haven't been able to find a definitive answer from the web either. Any insight is appreciated.</p>\n"^^ . . "mac-catalyst"^^ . . . "KSwift can't convert your class to swift enum, it generates class with `Ks` suffix, e.g. `UIStateKs`, and you can convert `UIState` to `UIStateKs` and back using code generated by KSwift."^^ . . "0"^^ . . . . . "0"^^ . . "2"^^ . . . "0"^^ . . . . . "2"^^ . . . . . "I've tried to use KSwift multiple times for my KMM Library but the generated xcframework still not generating the enum for Swift. It's still detected as empty protocol and the other UIState inside it detected as split class implementing the protocol. If you want to try it out for yourself, here's the link to the repository https://github.com/Fostahh/MySharedKMMLibrary . Thank you for the advice though! @PhilDukhov"^^ . "0"^^ . "0"^^ . "0"^^ . "I'm confused how I would do that? From Objc its easy, but if I do the category extension in swift, how would I access the original property? That's more or less what I'm currently doing, but it means additional pieces of objc I need to hang onto."^^ . . . . "@DonMag I donot have an option to avoid creating multiple textviews. I have explained the scenario as a comment to below answer."^^ . . . . "0"^^ . . . . . "Lots of ways to do something incorrectly and cause problems. If I try to load 1000 4K images, it will take a long time (and problem cause a memory crash). The simple answer is: *"I shouldn't do that."* -- If you are seeing a **4 seconds minimum** difference, then: *"You shouldn't do that."* Evaluate what it is that you're doing and ***why*** you're taking the wrong approach."^^ . "Is Show live Issues switched on? What is reventing you from copying the isssues? Doesn't select all, Copy work? Have you tried Oen Build Log in the context menu?"^^ . "1"^^ . . . . . . . . . . . . . "0"^^ . . . . . "0"^^ . . . . . "multidimensional-array"^^ . . . . "0"^^ . "0"^^ . . . . "0"^^ . "0"^^ . "2"^^ . . . . . . "Well, I finally got it to work! I really didn't understand how sortedArrayUsingFunction:order worked. Thank you Larme for insisting it would. I spent a lot more time studying how it does work and came up with an approach that works. I'm very grateful to Larme for causing me to try that approach again. Thanks to all for helping with this, it turned out more difficult than I originally thought but now it works perfectly. Sorry about the formatting of the question and response, the web site seems not to be cooperating as it should. Thanks again."^^ . "0"^^ . . . "DonMag, Thank you taking time to help me out. This seems to be helpful. I checked the performance using Profiler. The performance is drastically reduced if I replace the UILabel in your code with just UItextView. This makes clear that UITextView does take little longer as compared to other UI elements to be rendered.\n\nYour suggested code is definitely a starting point for me and would help me improve the performance. I am gonna accept this answer. But I would also like to give some credit to @Evgeny Karkan, whose clarifications did make sense to me why a UITextView would render slowly."^^ . . "0"^^ . . "CAMetalLayer leaks memory during resize"^^ . . "0"^^ . "For the ARC conversion feature, the list of errors is very squirrely. It shows the errors specific to ARC conversion for a few seconds; sometimes it clears the first batch and shows another batch, and then all the conversion errors go away and it reverts to showing normal build warnings. It's maddening, and all but impossible to use."^^ . "0"^^ . . . . "1"^^ . . . . "<p>The <code>Tapkey Mobile SDK for iOS</code> does not support objc:\n<a href="https://developers.tapkey.io/mobile/ios/getting_started/#requirements" rel="nofollow noreferrer">https://developers.tapkey.io/mobile/ios/getting_started/#requirements</a></p>\n"^^ . "2"^^ . . . "automatic-ref-counting"^^ . . . . . . . "<p>The image you reference in the documentation is two scenes. On an iPad, when using split screen multitasking, you are creating additional scenes.</p>\n<p>Think of the old, pre-scene, iOS app structure as always having just a single scene. Now, apps can have multiple scenes to support iPad multitasking. Or if you use Mac Catalyst, your app can have multiple scenes when running on a Mac.</p>\n<p>Whether your app currently has one scene or several, each scene may have one or more windows (though it's most common to have just one). The windows of a scene will be one on top of the other and will fill the full frame of its associated scene.</p>\n<p>In short, use scenes to support multitasking on the iPad. Just stick to one window per scene to host the scene's root view controller and any further view controllers you display. Don't worry about adding additional windows to a scene unless you come across a clear reason to do so.</p>\n"^^ . "0"^^ . . "How to reject incoming call programatically"^^ . "0"^^ . . . . . . "1"^^ . . . . . . "0"^^ . . "0"^^ . . . . . . . . "0"^^ . "0"^^ . . . "@HangarRash that has another limitation: they would have to provide _all the parameters_ (since default arguments are not translated from swift to objc). I.e. if I have `init(b: Bool? = true)` it becomes `initWithB:` on objc and they have to provide a value for `b` - not quite convenient either. I guess I will have to have something like a builder pattern interface..."^^ . "gaussian"^^ . . . "I have "show live issues" unchecked and the ARC errors don't disappear."^^ . "That's exactly the point isn't it? It's at the bottom of the pile - so the only solution I can think of (and I'm trying to see if there's a better way) is to create a new view which sits on top of all the others, and is just the border. But…\n\nApple has clearly solved this problem already (Finder etc) so is there a standard way of achieving this end that I'm missing?"^^ . "0"^^ . . . . . . "0"^^ . . "<p>I'm using AVAudioRecorder and calling averagePowerForChannel. When I start the app, the ambient noise, produces and a decibel value of, for example, -50. However, if the iPhone is exposed to sustained loud noise that value looks to automatically adjust. So, for example, if I blow into the microphone, then let it return to ambient noise level, the decibel value is now, for example, -90.</p>\n<p>This does not happen on my iPhone 8. However, this is occurring on my iPhone 12 Pro Max.</p>\n<p>Is there a way that this can be disabled?</p>\n"^^ . . . . . . . . . "uiscene"^^ . . "0"^^ . . . "iphone"^^ . . . "I’d advise against `NSException` catching because these are bugs that should be resolved during development, not simply caught and logged at runtime. If your program catches these, we can’t use the exception breakpoint and/or look at the stack trace. Bottom line, as Larme said, some method was provided a string rather than an array, but why should we be guessing. And exception breakpoint and associated stack track would tell you precisely where the problem was. Don’t using exception handling, or if you do, look at `callStackSymbols`."^^ . . "1"^^ . "0"^^ . . "1"^^ . "0"^^ . . "Undo is registered after `[txtCode setStringValue:@""]` with the selected range before `[txtCode setStringValue:@""]`. Post a [mre] without `[txtCode setStringValue:@""]` please."^^ . "0"^^ . . . . . "1"^^ . . . . . . . "1"^^ . . . "Provide an Objective-C compatibility to non-compliant Swift types"^^ . . "<p>MacOS 13.2.1, Xcode 14.2</p>\n<p>I'm struggling to get CLLocation to work on Ventura from a command line executable. It works fine from a GUI app. I have the same experience with Swift and Objective C (using the <code>app</code> template works but <code>command line tool</code> doesn't); I'm using ObjC for the example below.</p>\n<p>I found some example code online that I've put into two Xcode projects at <a href="https://github.com/n8henrie/test-location" rel="nofollow noreferrer">https://github.com/n8henrie/test-location</a>.</p>\n<ul>\n<li><a href="https://github.com/n8henrie/test-location/tree/master/location-objc-app" rel="nofollow noreferrer"><code>location-objc-app</code></a> was created with the <code>Xcode</code> -&gt; <code>new project</code> -&gt; <code>macos</code> -&gt; <code>app</code> template (using <code>storyboard</code> and <code>objective c</code>)</li>\n<li><a href="https://github.com/n8henrie/test-location/tree/master/location-objc" rel="nofollow noreferrer"><code>location-objc</code></a> was created with the <code>Xcode</code> -&gt; <code>new project</code> -&gt; <code>macos</code> -&gt; <code>Command Line Tool</code> template (<code>objective c</code>)</li>\n</ul>\n<p>When I run it in Xcode, <code>location-objc</code> does <strong>not</strong> prompt for any permissions, and can't retrieve the location:</p>\n<pre><code>2023-03-18 09:30:50.109158-0600 location-objc[92344:8383074] authorization status: 0\n2023-03-18 09:30:52.121832-0600 location-objc[92344:8383074] status: 1\n2023-03-18 09:30:52.121868-0600 location-objc[92344:8383074] 0.000000.0.000000\nProgram ended with exit code: 0\n</code></pre>\n<p><code>location-objc-app</code> <strong>does</strong> give me a popup for permissions and successfully prints the location:</p>\n<pre><code>2023-03-18 09:30:56.815837-0600 location-objc-app[92346:8383607] authorization status: 0\n2023-03-18 09:30:56.823216-0600 location-objc-app[92346:8383607] status: 0\n2023-03-18 09:30:56.823263-0600 location-objc-app[92346:8383607] 12.REDACTED.-34.REDACTED\n</code></pre>\n<p>I've ensured that the resulting <code>location-objc</code> binary has the <code>Info.plist</code> information embedded:</p>\n<pre><code>$ otool -P location-objc \nlocation-objc:\n(__TEXT,__info_plist) section\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;\n&lt;plist version=&quot;1.0&quot;&gt;\n&lt;dict&gt;\n &lt;key&gt;BuildMachineOSBuild&lt;/key&gt;\n &lt;string&gt;22D68&lt;/string&gt;\n &lt;key&gt;CFBundleExecutable&lt;/key&gt;\n &lt;string&gt;location-objc&lt;/string&gt;\n &lt;key&gt;CFBundleIdentifier&lt;/key&gt;\n &lt;string&gt;com.n8henrie.location-objc&lt;/string&gt;\n &lt;key&gt;CFBundleInfoDictionaryVersion&lt;/key&gt;\n &lt;string&gt;6.0&lt;/string&gt;\n &lt;key&gt;CFBundleName&lt;/key&gt;\n &lt;string&gt;location-objc&lt;/string&gt;\n &lt;key&gt;CFBundleShortVersionString&lt;/key&gt;\n &lt;string&gt;1.0&lt;/string&gt;\n &lt;key&gt;CFBundleSupportedPlatforms&lt;/key&gt;\n &lt;array&gt;\n &lt;string&gt;MacOSX&lt;/string&gt;\n &lt;/array&gt;\n &lt;key&gt;CFBundleVersion&lt;/key&gt;\n &lt;string&gt;1&lt;/string&gt;\n &lt;key&gt;DTCompiler&lt;/key&gt;\n &lt;string&gt;com.apple.compilers.llvm.clang.1_0&lt;/string&gt;\n &lt;key&gt;DTPlatformBuild&lt;/key&gt;\n &lt;string&gt;14C18&lt;/string&gt;\n &lt;key&gt;DTPlatformName&lt;/key&gt;\n &lt;string&gt;macosx&lt;/string&gt;\n &lt;key&gt;DTPlatformVersion&lt;/key&gt;\n &lt;string&gt;13.1&lt;/string&gt;\n &lt;key&gt;DTSDKBuild&lt;/key&gt;\n &lt;string&gt;22C55&lt;/string&gt;\n &lt;key&gt;DTSDKName&lt;/key&gt;\n &lt;string&gt;macosx13.1&lt;/string&gt;\n &lt;key&gt;DTXcode&lt;/key&gt;\n &lt;string&gt;1420&lt;/string&gt;\n &lt;key&gt;DTXcodeBuild&lt;/key&gt;\n &lt;string&gt;14C18&lt;/string&gt;\n &lt;key&gt;LSMinimumSystemVersion&lt;/key&gt;\n &lt;string&gt;13.1&lt;/string&gt;\n &lt;key&gt;NSLocationAlwaysAndWhenInUseUsageDescription&lt;/key&gt;\n &lt;string&gt;Always and When!&lt;/string&gt;\n &lt;key&gt;NSLocationAlwaysUsageDescription&lt;/key&gt;\n &lt;string&gt;Always!&lt;/string&gt;\n &lt;key&gt;NSLocationUsageDescription&lt;/key&gt;\n &lt;string&gt;General!&lt;/string&gt;\n &lt;key&gt;NSLocationWhenInUseUsageDescription&lt;/key&gt;\n &lt;string&gt;When in use&lt;/string&gt;\n&lt;/dict&gt;\n&lt;/plist&gt;\n</code></pre>\n<p>and it seems to have appropriate entitlements:</p>\n<pre><code>$ codesign -dvv --entitlements - location-objc \nExecutable=/Users/n8henrie/Library/Developer/Xcode/DerivedData/location-objc-gxafbuxirpiqouanzeqrgitsgzss/Build/Products/Debug/location-objc\nIdentifier=com.n8henrie.location-objc\nFormat=Mach-O thin (arm64)\nCodeDirectory v=20500 size=795 flags=0x10002(adhoc,runtime) hashes=14+7 location=embedded\nSignature=adhoc\nInfo.plist entries=21\nTeamIdentifier=not set\nRuntime Version=13.1.0\nSealed Resources=none\nInternal requirements count=0 size=12\n[Dict]\n [Key] com.apple.security.app-sandbox\n [Value]\n [Bool] true\n [Key] com.apple.security.files.user-selected.read-only\n [Value]\n [Bool] true\n [Key] com.apple.security.get-task-allow\n [Value]\n [Bool] true\n [Key] com.apple.security.personal-information.location\n [Value]\n [Bool] true\n</code></pre>\n<p>I've tried every combination I can think of enabling and disabling the sandbox, hardened runtime, manually re-codesigning (with numerous combinations of the below flags):</p>\n<pre><code>$ codesign --sign - --force --deep --strict --timestamp --options runtime --entitlements entitlements.plist --identifier com.n8henrie.location-objc ./location-objc \n./location-objc: replacing existing signature\n$ ./location-objc \n2023-03-18 09:40:34.517 location-objc[96782:8398475] authorization status: 0\n2023-03-18 09:40:36.527 location-objc[96782:8398475] status: 1\n2023-03-18 09:40:36.527 location-objc[96782:8398475] 0.000000.0.000000\n</code></pre>\n<p>I've tried manually opening the executable from Finder, hoping that would give me the permissions popup, but no matter what I try it doesn't work.</p>\n<p>In console, <code>locationd</code> looks like it's <em>trying</em> to prompt me:</p>\n<pre><code>{&quot;msg&quot;:&quot;Showing #AuthPrompt&quot;, &quot;requestType&quot;:5, &quot;client&quot;:&quot;92F5C54E-CAEB-44A5-AF60-85E44A017BD2:com.n8henrie.location-objc&quot;}\n{&quot;msg&quot;:&quot;#AuthPrompt AuthorizationRequest completion&quot;, &quot;ClientKey&quot;:&quot;92F5C54E-CAEB-44A5-AF60-85E44A017BD2:com.n8henrie.location-objc&quot;, &quot;RequestType&quot;:&quot;CLClientManager_Type::AuthorizationRequestTypeLegacyAlways&quot;}\n{&quot;msg&quot;:&quot;#AuthPrompt sending message to #CoreLocationAgent&quot;, &quot;MessageDict&quot;:&quot;{\\n bundleid = \\&quot;com.n8henrie.location-objc\\&quot;;\\n isMarzipan = 0;\\n isMasquerading = 0;\\n pid = 97813;\\n uuid = \\&quot;09278F43-651E-4E29-9E34-0AC87F7ABE35\\&quot;;\\n}&quot;, &quot;Connection&quot;:&quot;\\/System\\/Library\\/CoreServices\\/CoreLocationAgent.app\\/Contents\\/MacOS\\/CoreLocationAgent&quot;, &quot;User&quot;:&quot;92F5C54E-CAEB-44A5-AF60-85E44A017BD2&quot;}\nclient '[92F5C54E-CAEB-44A5-AF60-85E44A017BD2]com.n8henrie.location-objc' not authorized for location; not starting yet\n{&quot;msg&quot;:&quot;client not currently authorized for location; sending error&quot;, &quot;client&quot;:&quot;[92F5C54E-CAEB-44A5-AF60-85E44A017BD2]com.n8henrie.location-objc&quot;}\n</code></pre>\n<p>but nothing ever shows.</p>\n<p>How can I get a standalone CLI executable to use <code>CLLocation</code>? I do <em>not</em> consider using <code>Shortcuts.app</code> to be a reasonable workaround in this case, though users looking for a &quot;quick and dirty&quot; solution might take this approach.</p>\n<p>Sidenote:</p>\n<p>This was originally <a href="https://apple.stackexchange.com/questions/457341/cllocation-doesnt-work-from-cli-app-on-macos-ventura">asked on AskDifferent</a> but closed as off-topic (with a recommendation to post at SO) based on <a href="https://apple.stackexchange.com/help/on-topic">their rules</a>, though I had thought this fell under their specific example of Xcode for non-language specific tasks (as I think the issue is with permissions, codesigning, sandboxing, etc and not swift or objc).</p>\n<blockquote>\n<p>Code-level programming questions (cocoa, LLVM, etc…) are off-topic here. We do encourage AppleScript, Automator, and UNIX shell scripting questions as well as how to use tools like Xcode for non-language specific tasks.</p>\n</blockquote>\n<p>EDIT: I've added an additional Xcode project to the example repo: <a href="https://github.com/n8henrie/test-location/tree/master/test-location-app-makefile" rel="nofollow noreferrer">https://github.com/n8henrie/test-location/tree/master/test-location-app-makefile</a>. This one is in Swift and uses a Makefile to build (instead of Xcode). It seems to show the same issue -- as is, if I create an app folder structure (<code>test-location.app/Contents/MacOS/test-location</code>), include an <code>Info.plist</code>, and codesign with <code>--entitlements</code> (even if the <code>entitlements.plist</code> is empty), it works. However, if I don't put <strong>the same binary</strong> into an app folder / structure, the bare binary doesn't work.</p>\n<p>So it doesn't seem to be any special sauce that Xcode is doing.</p>\n"^^ . "apple-push-notifications"^^ . . . . "A simple for loop should do the trick. It's basic algorithm (and quite base to learn). It doesn't work with your code? What code?"^^ . . "1"^^ . "c++"^^ . "0"^^ . "Where is the `MyWindowView` view in the view hierarchy?"^^ . "window"^^ . . . . . "2"^^ . "Yes, it is not your app's job to decide if an incoming call should be rejected. The user should see a screen that asks them what to do. If they reject the call, ios will handle it. If they choose to end your call and accept the incoming call then ios will send the appropriate event to your app. Is your app using CallKit correctly so that iOS is aware that a VoIP call is in progress?"^^ . . . . . . . . . . "1"^^ . "avaudiorecorder"^^ . . "0"^^ . "0"^^ . "<p>I want to write a command-line tool which will display window in certain situations (but not always). Now I'm trying to create a simple application which just displays a window. I need it to behave like any other window (but without main menu). I need icon to appear in the Dock.</p>\n<p>Right now I've come with some code that follows below. But this code creates a window that behave strange. I commented out <code>level = 1</code> line. With this line this windows appears on top of other windows. Without this line this window appears below other windows and I can't bring it to the top. Also it does not set cursor properly, e.g. I can move cursor from textbox to this app and the cursor keeps text appearance even when hovering over title or other parts of this window. I feel like I missing some important part of the puzzle.</p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &lt;AppKit/AppKit.h&gt;\n\n@interface ApplicationDelegate : NSObject &lt;NSApplicationDelegate&gt;\n@end\n\nint main(int argc, const char * argv[]) {\n NSApplication *application = [NSApplication sharedApplication];\n ApplicationDelegate *applicationDelegate = [[ApplicationDelegate alloc] init];\n application.delegate = applicationDelegate;\n [application run];\n return 0;\n}\n\n@implementation ApplicationDelegate {\n NSWindow *window;\n}\n- (void)applicationDidFinishLaunching:(NSNotification *)notification {\n window = [\n [NSWindow alloc]\n initWithContentRect:NSMakeRect(100, 100, 600, 400)\n styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskMiniaturizable\n backing:NSBackingStoreBuffered\n defer:NO\n ];\n window.title = @&quot;My Title&quot;;\n// window.level = 1;\n [window makeKeyAndOrderFront:nil];\n}\n\n@end\n</code></pre>\n"^^ . "uitextview"^^ . . . "1"^^ . "drag-and-drop"^^ . . . . "1"^^ . "0"^^ . "Your last attempt should work: `NSMutableArray *arrayToSort = [[NSMutableArray alloc] init]; for (NSInteger i = 5; i > 0; i--) [arrayToSort addObject:@[[NSString stringWithFormat:@"String1-%d", i], @(i), [NSString stringWithFormat:@"String2-%d", i]]];} NSArray *sorted = [arrayToSort sortedArrayUsingComparator:^NSComparisonResult(NSArray * _Nonnull obj1, NSArray * _Nonnull obj2) { return [[obj1 firstObject] caseInsensitiveCompare:[obj2 firstObject]]; }]; NSLog(@"Sorted: %@", sorted); NSArray *sorted2 = [arrayToSort sortedArrayUsingFunction:order context:NULL]; NSLog(@"Sorted2: %@", sorted2);`"^^ . . "0"^^ . . . . . "How to apply gaussian noise to an existing image in iOS?"^^ . . "<p>You cannot override a method in an extension. If you want to change the default implementation of <code>isEqual</code>, you'll have to subclass NSObject. (If the compiler doesn't force you to include the word <code>override</code>, you're not overriding.)</p>\n<p>I doubt what you're trying to do is possible in an ObjC bridge, but it definitely cannot be done with an extension.</p>\n"^^ . . "1"^^ . . . . . . . . . . . "<p>I'm using an old version of AFNetworking in an app, it works fine except I'm getting on deprecation warning from Xcode from this line in an <code>initWithCoder</code> method:</p>\n<pre class="lang-objectivec prettyprint-override"><code>self.queryStringSerializationStyle = (AFHTTPRequestQueryStringSerializationStyle)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))] unsignedIntegerValue];\n</code></pre>\n<p>The specific warning is:</p>\n<blockquote>\n<p>*** -[NSKeyedUnarchiver decodeObjectForKey:]: value for key (queryStringSerializationStyle) is not an object. This will become an error in the future.</p>\n</blockquote>\n<p>From what I can tell with the code (ObjectiveC isn't a big strength of mine) it's because of <code>@selector(queryStringSerializationStyle)</code> which looks to be an attempt to convert the &quot;getter&quot; selector for <code>querySerializationStyle</code> to an <code>NSString</code>. But I don't understand why that's wrong, in fact it works for the line before:</p>\n<pre class="lang-objectivec prettyprint-override"><code>self.mutableHTTPRequestHeaders = [[decoder decodeObjectOfClass:[NSDictionary class] forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))] mutableCopy];\n</code></pre>\n<p>How should I be fixing this?</p>\n"^^ . . . . . "I managed to slog through all the conversion warnings by quickly taking a screen-shot while they were on screen and then fixing them one by one. (For the selector errors I used `NSSelectorFromString:` to get around them.) Now that I have finished the ARC conversion, I just tried, and I am able to go back to `@selector()` syntax and it works. The ARC converter seems to not have been able to find the functions in their owning classes but the normal compiler on an ARC project does."^^ . "1"^^ . . . "1"^^ . "Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/252641/discussion-between-duncan-c-and-willeke)."^^ . . "0"^^ . . . . . "0"^^ . . "-2"^^ . . . "2"^^ . . . . . . . . . . . . "cgrectmake"^^ . . . "So I would need to convert my Objective C AppDelegate to one written in swift?"^^ . "FYI - Any examples you might find in Swift show the same information that applies to Objective-C. It's all the same UIKit APIs, just in a different programming language."^^ . "<p>I am trying to understand what would be a good pattern for providing an Objective-C compatibility to non-compliant Swift types.</p>\n<p>Consider the following example:</p>\n<pre><code>class Model {\n var b: Bool? // Optional Bool cannot be marked as @objc\n var i: Int? // Optional Int cannot be marked as @objc\n var e: MyEnum // Swift enums, except for Integer type, cannot be marked as @objc\n}\n</code></pre>\n<p>My current naive implementation is:</p>\n<pre><code>extension Model {\n @objc func setB(_ value: Bool) { b = value }\n @objc func unsetB() { b = nil }\n @objc var isB: NSNumber? { guard let b = b else {return nil }; return NSNumber(value: b) }\n}\n</code></pre>\n<p>That works, but with many properties, this is very tedious to define, and even worse on usage from Objective-C (while in Swift all properties can be provided on <code>init</code>, in Objective-C they would have to be set / unset one by one).</p>\n<p>So are there any better patterns to provide an Objective-C compatibility to the properties of non-compliant Swift types?</p>\n<p>Any tips are welcome. Thanks.</p>\n"^^ . . . . . . "javascript"^^ . "<p>Since we have no idea what else you might be doing...</p>\n<p>One thing to try is to use a <code>UIView</code> subclass that contains a label and a text view. Only show the text view after tapping on the label.</p>\n<p>Try replacing your <code>SecondViewController</code> with this:</p>\n<pre><code>class SecondViewController: UIViewController {\n\n let scrollView = UIScrollView()\n let stackView = UIStackView()\n \n var myData: [String] = []\n \n let spinner = UIActivityIndicatorView()\n override func viewDidLoad() {\n super.viewDidLoad()\n view.backgroundColor = .yellow\n \n scrollView.backgroundColor = UIColor(white: 0.95, alpha: 1.0)\n scrollView.keyboardDismissMode = .onDrag\n\n stackView.axis = .vertical\n stackView.spacing = 20\n \n stackView.translatesAutoresizingMaskIntoConstraints = false\n scrollView.addSubview(stackView)\n scrollView.translatesAutoresizingMaskIntoConstraints = false\n view.addSubview(scrollView)\n \n let g = view.safeAreaLayoutGuide\n let cg = scrollView.contentLayoutGuide\n let fg = scrollView.frameLayoutGuide\n \n NSLayoutConstraint.activate([\n \n scrollView.topAnchor.constraint(equalTo: g.topAnchor, constant: 20.0),\n scrollView.leadingAnchor.constraint(equalTo: g.leadingAnchor, constant: 20.0),\n scrollView.trailingAnchor.constraint(equalTo: g.trailingAnchor, constant: -20.0),\n scrollView.bottomAnchor.constraint(equalTo: g.bottomAnchor, constant: -20.0),\n\n stackView.topAnchor.constraint(equalTo: cg.topAnchor, constant: 8.0),\n stackView.leadingAnchor.constraint(equalTo: cg.leadingAnchor, constant: 8.0),\n stackView.trailingAnchor.constraint(equalTo: cg.trailingAnchor, constant: 0.0),\n stackView.bottomAnchor.constraint(equalTo: cg.bottomAnchor, constant: -8.0),\n \n stackView.widthAnchor.constraint(equalTo: fg.widthAnchor, constant: -16.0),\n\n ])\n\n spinner.style = .large\n spinner.translatesAutoresizingMaskIntoConstraints = false\n view.addSubview(spinner)\n spinner.hidesWhenStopped = true\n spinner.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true\n spinner.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true\n spinner.startAnimating()\n \n myData = (1...1000).compactMap({ &quot;Element \\($0)&quot; })\n\n DispatchQueue.main.asyncAfter(deadline: .now() + 0.05, execute: {\n self.addTheViews()\n })\n }\n\n func addTheViews() {\n let start = CFAbsoluteTimeGetCurrent()\n \n let n: Int = 1000\n for i in 0..&lt;n {\n addTextView(i)\n }\n \n let diff = CFAbsoluteTimeGetCurrent() - start\n print(&quot;Took \\(diff) seconds&quot;)\n \n spinner.stopAnimating()\n }\n \n private func addTextView(_ idx: Int) {\n let textView = MyTextView()\n textView.myID = idx\n textView.text = myData[idx]\n textView.backgroundColor = .white\n textView.heightAnchor.constraint(equalToConstant: 120.0).isActive = true\n stackView.addArrangedSubview(textView)\n }\n \n}\n</code></pre>\n<p>and an example <code>MyTextView</code> class:</p>\n<pre><code>class MyTextView: UIView, UITextViewDelegate {\n \n public var myID: Int = 0\n \n public var text: String = &quot;&quot; {\n didSet { label.text = text }\n }\n \n public var textChanged: ((Int, String) -&gt; ())?\n \n private let label = UILabel()\n private var textView: UITextView!\n private var tap: UITapGestureRecognizer!\n \n override init(frame: CGRect) {\n super.init(frame: frame)\n commonInit()\n }\n required init?(coder: NSCoder) {\n super.init(coder: coder)\n commonInit()\n }\n private func commonInit() {\n label.numberOfLines = 0\n label.translatesAutoresizingMaskIntoConstraints = false\n addSubview(label)\n let g = self\n NSLayoutConstraint.activate([\n\n label.topAnchor.constraint(equalTo: g.topAnchor, constant: 8.0),\n label.leadingAnchor.constraint(equalTo: g.leadingAnchor, constant: 5.0),\n label.trailingAnchor.constraint(equalTo: g.trailingAnchor, constant: -5.0),\n label.bottomAnchor.constraint(lessThanOrEqualTo: g.bottomAnchor, constant: 0.0),\n \n ])\n \n tap = UITapGestureRecognizer(target: self, action: #selector(gotTap(_:)))\n addGestureRecognizer(tap)\n \n }\n @objc func gotTap(_ g: UITapGestureRecognizer) {\n if textView == nil {\n textView = UITextView()\n if let f = label.font {\n textView.font = f\n }\n }\n textView.text = self.text\n textView.frame = self.bounds\n textView.autoresizingMask = [.flexibleHeight, .flexibleWidth]\n addSubview(textView)\n \n textView.delegate = self\n \n textView.becomeFirstResponder()\n }\n func textViewDidChange(_ textView: UITextView) {\n textChanged?(myID, textView.text ?? &quot;&quot;)\n }\n func textViewDidBeginEditing(_ textView: UITextView) {\n removeGestureRecognizer(tap)\n }\n func textViewDidEndEditing(_ textView: UITextView) {\n textView.removeFromSuperview()\n addGestureRecognizer(tap)\n }\n \n}\n</code></pre>\n<p>This is, of course, just a &quot;starting point&quot; but my be helpful.</p>\n"^^ . "0"^^ . . . "Something must have changed. I just realized that `CGRectMake` is listed in the Swift documentation (https://developer.apple.com/documentation/coregraphics/1455245-cgrectmake) and I can use it in a Swift project with Xcode 14. I would have sworn it didn't exist in earlier versions of Swift. Sounds like you need to update your build server with Xcode 14."^^ . . . "voip"^^ . . . . . . "KMM generates ObjC headers, there's no ObjC enum analog that can hold data. But you can generate swift code for your sealed classes using [KSwift](https://github.com/icerockdev/moko-kswift)"^^ . . . . . "Thank you for your response. These things seems to be fine. My Objective-C class is visible to the Swift class and vice versa. Also the class from the Swift Package is visible to both. What is causing problems is the inheritance from Objective-C to Swift. The sub class in Swift will not get functions or properties from the Objective-C class when it is using the class from the Swift Package as type."^^ . . . . . "0"^^ . . . . . "<p><a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/KeyValueCoding/BasicPrinciples.html#//apple_ref/doc/uid/20002170-BAJEAIEE" rel="nofollow noreferrer">Key Value Coding</a> is your friend. See the paragraph <em>Getting Attribute Values Using Keys</em></p>\n<pre><code>NSArray *appearances = [arrTemp valueForKey:@&quot;Appearance&quot;];\n</code></pre>\n<p><code>valueForKey</code> called on an array of dictionaries returns an array of all values for the specific key.</p>\n"^^ . "Is the selector visible? Is the selector in the header of the class and is the header included?"^^ . . . "1"^^ . . . . "1"^^ . . . "0"^^ . . "0"^^ . "nswindow"^^ . "I'm thinking Apple has not put much effort into maintaining the ARC converter and it's gotten buggy. I haven't tried to use it myself in a lot of years."^^ . "0"^^ . "4"^^ . . "What is a "normal" image in this context? Typically you'd do this with CIImage. https://developer.apple.com/documentation/coreimage/processing_an_image_using_built-in_filters For a specific example that includes a noise filter, see https://developer.apple.com/documentation/coreimage/simulating_scratchy_analog_film"^^ . . "0"^^ . . . . "0"^^ . . . . "0"^^ . . "0"^^ . . "@RobNapier Normal just means any image. Like a photograph for example. I took a brief look at the filter api but it doesn’t look like there is Gaussian noise?"^^ . . "0"^^ . "1"^^ . . . "@willeke, there are a bunch of selectors with the same problem. I just checked one of them, and sure enough it is declared in the header of the class that defines it and the .m file that references it imports that header."^^ . . . . . "Use NS_SWIFT_NAME away from the file where a property is declared?"^^ . . "Show relevant code in your question. FYI - I have a screen with 8 UITextView instances and that view controller loads instantly. It's certainly not taking .68 seconds per text view to initialize."^^ . . "1"^^ . "0"^^ . . "Thanks for the response. I did try that and I still observed the same behavior."^^ . . . . . . . . . . . . "0"^^ . . "@Shawn the missing `_data` property is just a typo, somehow it got lost when I posted the answer. What are the problems you have with the new code you added to the question?"^^ . . "It's likely you need to setup and run a runloop to get callbacks from the location framework. This is done for you in a GUI app but not CLI. See [here](https://stackoverflow.com/questions/42634584/corebluetooth-on-mac-command-line-application/42635036#42635036)"^^ . "2"^^ . "<p>The runtime error is saying this: I tried to call the method/getter <code>count</code> on an object I supposed had it, but in fact it's a <code>NSString</code> object (<code>__NSCFConstantString</code> being an internal class of Apple for <code>NSString</code> for optimization purposes). And since it doesn't have that method, it will throw a <code>unrecognized selector</code> exception.</p>\n<p><code>count</code> being a common method, we could guess, since <code>NSArray</code> has it, that you put a <code>NSString</code> instead of a <code>NSArray</code> somewhere. It could also be a <code>NSString</code> instead of a <code>NSDictionary</code>.</p>\n<p>Now, let's try your code:</p>\n<p><strong>You are ignoring compiler warning!</strong> Why?</p>\n<p>If you don't ignore them, you'll see them on:</p>\n<pre><code>paymentComponent = [paymentComponent enableComponents:@&quot;order-details&quot;];\n</code></pre>\n<p>The warning says:</p>\n<pre><code>Incompatible pointer types sending 'NSString *' to parameter of type 'NSArray&lt;NSString *&gt; * _Nonnull'\n</code></pre>\n<p>If we see the method, it's as said by the warning:</p>\n<pre><code>- (CFPaymentComponentBuilder * _Nonnull)enableComponents:(NSArray&lt;NSString *&gt; * _Nonnull)components SWIFT_WARN_UNUSED_RESULT;\n</code></pre>\n<p>So instead of</p>\n<pre><code>paymentComponent = [paymentComponent enableComponents:@&quot;order-details&quot;];\npaymentComponent = [paymentComponent enableComponents:@&quot;card&quot;];\npaymentComponent = [paymentComponent enableComponents:@&quot;upi&quot;];\npaymentComponent = [paymentComponent enableComponents:@&quot;wallet&quot;];\npaymentComponent = [paymentComponent enableComponents:@&quot;netbanking&quot;];\npaymentComponent = [paymentComponent enableComponents:@&quot;emi&quot;];\npaymentComponent = [paymentComponent enableComponents:@&quot;paylater&quot;];\n</code></pre>\n<p>Do:</p>\n<pre><code>let components = @[@&quot;order-details&quot;, @&quot;card&quot;, @&quot;upi&quot;, @&quot;wallet&quot;, @&quot;netbanking&quot;, @&quot;emi&quot;, @&quot;paylater&quot;];\npaymentComponent = [paymentComponent enableComponents:components];\n</code></pre>\n"^^ . "metal"^^ . . . . . . "0"^^ . "<p>I have few knowledge of Objective-C and Swift but after spending several hours to write a native plugin to collect compass data using a background thread in iOS, below there is the plugin so far</p>\n<pre><code>// MyPlugin.m\n \nextern &quot;C&quot; {\n#import &lt;CoreLocation/CoreLocation.h&gt;\n#import &quot;MyPlugin.h&quot;\n \n@implementation MyPlugin\n \nNSThread *_magneticHeadThread;\nBOOL _shouldStop;\nNSMutableArray *readings;\n \n- (void)startBackgroundThread {\n dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{\n // Put your code here that should run in the background when the app enters background.\n NSLog(@&quot;Background thread started!&quot;);\n readings = [NSMutableArray array];\n _magneticHeadThread = [[NSThread alloc] initWithTarget:self selector:@selector(retrieveMagneticHeadPosition) object:nil];\n [_magneticHeadThread start];\n });\n}\n \n- (void)applicationDidEnterBackground:(NSNotification *)notification {\n _shouldStop = NO;\n [self startBackgroundThread];\n}\n \n- (void)applicationWillEnterForeground:(NSNotification *)notification {\n _shouldStop = YES;\n [_magneticHeadThread cancel];\n NSLog(@&quot;Magnetic head position: %lu&quot;, [readings count]);\n}\n \n+ (instancetype)sharedInstance {\n static MyPlugin *sharedInstance = nil;\n static dispatch_once_t onceToken;\n dispatch_once(&amp;onceToken, ^{\n sharedInstance = [[MyPlugin alloc] init];\n });\n return sharedInstance;\n}\n \n- (void)retrieveMagneticHeadPosition {\n CLLocationManager *locationManager = [[CLLocationManager alloc] init];\n \n locationManager.headingFilter = kCLHeadingFilterNone;\n [locationManager startUpdatingHeading];\n int c = 0;\n while (!_shouldStop) {\n \n NSLog(@&quot;Magnetic head position: %i&quot;, c);\n c++;\n [readings addObject:@(locationManager.heading.magneticHeading)];\n [NSThread sleepForTimeInterval:0.1];\n }\n \n [locationManager stopUpdatingHeading];\n}\n \n@end\n \n \nvoid UnityMyPlugin_StartBackgroundThread() {\n [[NSNotificationCenter defaultCenter] addObserver:[MyPlugin sharedInstance] selector:@selector(applicationDidEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil];\n \n [[NSNotificationCenter defaultCenter] addObserver:[MyPlugin sharedInstance] selector:@selector(applicationWillEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil];\n}\n}\n</code></pre>\n<p>It is called in a MonoBehaviour in a Start function:</p>\n<pre><code>void Start()\n {\n Application.runInBackground = true;\n#if UNITY_IPHONE &amp;&amp; !UNITY_EDITOR\n UnityMyPlugin_StartBackgroundThread();\n#endif\n }\n</code></pre>\n<p>I've read that dispatch_async expects to finish in a fixed time, but i haven't find any clue for indefinite thread nor information about services to request informations such as magneticHeading, can you point me out where to check or who to ask for a solution? Am I looking for anything possible? Did I make any bad choice in this code?\nThanx</p>\n<p>This solution, which compile and work for ~ 2s before being canceled by the SO but I'm looking for a thread which collect data for a longer period or a service to ask a range of timestamp and obtain infos.</p>\n"^^ . . "0"^^ . "<p>Long story short - this is a mistake in the class API design. If you want to have a header compatible with Objective-C/Swift, it cannot expose any C++ stuff, such as C++ classes, templates, keywords, etc... There is only Swift - Objective-C interoperability (and sometimes C), but not Swift - Objective-C++ interoperability (there is however Swift - C++ interop project ongoing).</p>\n<p>On the other hand, you can technically put pre-processor, which may omit any C++ parts from the header, when the compiler-frontend is in another language mode with use of <code>__cpluplus</code> guards:</p>\n<pre class="lang-objc prettyprint-override"><code>#import &lt;Foundation/Foundation.h&gt;\n\n#ifdef __cplusplus\nclass MyCppType;\n#endif\n\n@interface SwiftCancelationToken : NSObject\n\n#ifdef __cplusplus\n@property MyCppType *cppProperty;\n#endif\n\n-(void)doSomethingWithCppObject;\n\n@end\n</code></pre>\n"^^ . "1"^^ . . . . "This doesn’t fix the memory leak; even with this change the application leaks hundreds of megabytes a second during resizing."^^ . . . . . . . . . "<p>There is no direct way to detect if the user has cleared all the notifications.</p>\n<p>But u can try a workaround as follows.</p>\n<p>Following function give the count of the delivered notifications.</p>\n<pre><code>func hasUserClearedNotifications() {\n UNUserNotificationCenter.current().getDeliveredNotifications { (notifications) in\n let deliveredCount = notifications.count\n }\n}\n</code></pre>\n<p>U have to keep checking that count periodically inside ur application. If that count goes to zero or the count drops suddenly then there is a high chance that user have cleared the notifications.</p>\n<p>(Please note that this is a workaround. Not a best practise)</p>\n"^^ . "1"^^ . . . . "1"^^ . . "Indeed that's precisely what I had done, but it feels like a hack because it prevents a full swift migration. But it absolutely works fine. I was just hoping there was some way I could tell the compiler to use the original property name without modifying the autogenerated code. Thanks!!"^^ . . . . . . "react-native-firebase"^^ . "0"^^ . . . "0"^^ . . . . "0"^^ . . "0"^^ . . . . "I think that you're right - when dropping into Finder it's the view that gets highlighted. So, in this case, it would be the contentView of the NSWindow (i.e. the border is drawn around the content excluding the titlebar and toolbar, rather than around the entire window itself). Thank you for clarifying my thinking - and in doing so helping understand the answer for myself. I think that this question should be closed as badly worded. Thank you for your help."^^ . "1"^^ . "Try adding an exception breakpoint, that should hopefully tell you where the error occurs: https://stackoverflow.com/questions/17802662/"^^ . . "How do I properly use a getter as a selector in Objective-C? Getting deprecation warnings in modern Xcode"^^ . . . "How to detect/identify when the User clears all the push notifications from the NotificationCenter tray in iOS"^^ . . . . . . . . . . . . "0"^^ . . "1"^^ . "0"^^ . "KMM Library - How to implement Kotlin sealed class/interface into Swift switch"^^ . . . . . . . . . . . "CLLocation doesn't work from CLI app on MacOS Ventura"^^ . "0"^^ . "Please provide enough code so others can better understand or reproduce the problem."^^ . "1"^^ . . . . "I added some `(__bridge)` casts and recompiled with the flag, and that solved it. Thank you so much!"^^ . . . "The second `sortedArrayUsingFunction` should work. How did it not work?"^^ . "0"^^ . . . . . "<p>I am creating a window on macOS whose entire content is a subclass of <code>CAMetalLayer</code>. I re-render at the display’s refresh rate using a <code>CVDisplayLink</code>; the window is constantly being re-rendered, even at idle.</p>\n<p><strong>Each time I resize the window, memory usage increases by hundreds of megabytes per second.</strong></p>\n<p>While the window is not being resized, memory usage increases by maybe 0.3 MB/s (a small memory leak because I haven’t included an <code>@autoreleasepool</code> anywhere – this is ok for demo purposes). This makes me think that new framebuffers are being allocated during resize, but are never freed.</p>\n<p>I’ve investigated using Instruments.app, and all this memory is being allocated in <code>CAMetalLayer</code>’s <code>nextDrawable</code> method.</p>\n<p>Here is the code most significant to the question:</p>\n<pre class="lang-objectivec prettyprint-override"><code>// ...\n\n- (void)setFrameSize:(NSSize)size\n{\n [super setFrameSize:size];\n metalLayer.drawableSize = size;\n}\n\n// ...\n\n- (void)renderOneFrame\n{\n id&lt;CAMetalDrawable&gt; drawable = [metalLayer nextDrawable];\n id&lt;MTLCommandBuffer&gt; commandBuffer = [commandQueue commandBuffer];\n\n MTLRenderPassDescriptor* passDesc = [[MTLRenderPassDescriptor alloc] init];\n passDesc.colorAttachments[0].texture = drawable.texture;\n passDesc.colorAttachments[0].loadAction = MTLLoadActionClear;\n passDesc.colorAttachments[0].storeAction = MTLStoreActionStore;\n\n id&lt;MTLRenderCommandEncoder&gt; commandEncoder =\n [commandBuffer renderCommandEncoderWithDescriptor:passDesc];\n [commandEncoder setRenderPipelineState:renderPipeline];\n\n [commandEncoder endEncoding];\n\n [commandBuffer presentDrawable:drawable];\n [commandBuffer commit];\n}\n\n// ...\n</code></pre>\n<p>This really is a minimal working example – I’m not even rendering anything!</p>\n<p>Note how I ask Metal to resize the frame buffer simply by modifying <code>CAMetalLayer</code>’s <code>drawableSize</code> property. I checked the docs both for that and for <code>nextDrawable</code>, but I didn’t see anything that would be relevant to this.</p>\n<p><a href="https://developer.apple.com/documentation/metal/onscreen_presentation/creating_a_custom_metal_view?language=objc" rel="nofollow noreferrer">Apple’s example code for <code>CAMetalLayer</code></a> resizes the layer in the same way I do, and I couldn’t see it doing anything else that might affect this (though clearly I’m wrong since the Apple example code doesn’t leak memory like my code does).</p>\n<hr />\n<p>Just to be safe, here is my full source code:</p>\n<pre class="lang-objectivec prettyprint-override"><code>// main.m\n\n#import &lt;Cocoa/Cocoa.h&gt;\n#import &lt;Metal/Metal.h&gt;\n#import &lt;QuartzCore/QuartzCore.h&gt;\n\n@interface MainView : NSView {\n CAMetalLayer* metalLayer;\n CVDisplayLinkRef displayLink;\n id&lt;MTLDevice&gt; device;\n id&lt;MTLCommandQueue&gt; commandQueue;\n id&lt;MTLRenderPipelineState&gt; renderPipeline;\n}\n@end\n\n@implementation MainView\n- (id)initWithFrame:(CGRect)frame\n{\n self = [super initWithFrame:frame];\n self.wantsLayer = YES;\n self.layer = [CAMetalLayer layer];\n metalLayer = (CAMetalLayer*)self.layer;\n device = MTLCreateSystemDefaultDevice();\n metalLayer.device = device;\n\n NSURL* path = [NSURL fileURLWithPath:@&quot;out/shaders.metallib&quot; isDirectory:false];\n id&lt;MTLLibrary&gt; library = [device newLibraryWithURL:path error:nil];\n MTLRenderPipelineDescriptor* desc = [[MTLRenderPipelineDescriptor alloc] init];\n desc.vertexFunction = [library newFunctionWithName:@&quot;vertexShader&quot;];\n desc.fragmentFunction = [library newFunctionWithName:@&quot;fragmentShader&quot;];\n renderPipeline = [device newRenderPipelineStateWithDescriptor:desc error:nil];\n commandQueue = [device newCommandQueue];\n\n CVDisplayLinkCreateWithActiveCGDisplays(&amp;displayLink);\n CVDisplayLinkSetOutputCallback(displayLink, displayLinkCallback, self);\n CVDisplayLinkStart(displayLink);\n\n return self;\n}\n\n- (void)setFrameSize:(NSSize)size\n{\n [super setFrameSize:size];\n metalLayer.drawableSize = size;\n}\n\nstatic CVReturn displayLinkCallback(\n CVDisplayLinkRef displayLink,\n const CVTimeStamp* now,\n const CVTimeStamp* outputTime,\n CVOptionFlags flagsIn,\n CVOptionFlags* flagsOut,\n void* displayLinkContext)\n{\n [(MainView*)displayLinkContext renderOneFrame];\n return kCVReturnSuccess;\n}\n\n- (void)renderOneFrame\n{\n id&lt;CAMetalDrawable&gt; drawable = [metalLayer nextDrawable];\n id&lt;MTLCommandBuffer&gt; commandBuffer = [commandQueue commandBuffer];\n\n MTLRenderPassDescriptor* passDesc = [[MTLRenderPassDescriptor alloc] init];\n passDesc.colorAttachments[0].texture = drawable.texture;\n passDesc.colorAttachments[0].loadAction = MTLLoadActionClear;\n passDesc.colorAttachments[0].storeAction = MTLStoreActionStore;\n\n id&lt;MTLRenderCommandEncoder&gt; commandEncoder =\n [commandBuffer renderCommandEncoderWithDescriptor:passDesc];\n [commandEncoder setRenderPipelineState:renderPipeline];\n\n [commandEncoder endEncoding];\n\n [commandBuffer presentDrawable:drawable];\n [commandBuffer commit];\n}\n@end\n\nint main()\n{\n [NSApplication sharedApplication];\n [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];\n\n NSRect rect = NSMakeRect(100, 100, 500, 400);\n\n NSWindow* window = [NSWindow alloc];\n [window initWithContentRect:rect\n styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskResizable\n backing:NSBackingStoreBuffered\n defer:NO];\n MainView* view = [[MainView alloc] initWithFrame:rect];\n window.contentView = view;\n\n [window makeKeyAndOrderFront:nil];\n\n [NSApp activateIgnoringOtherApps:YES];\n [NSApp run];\n}\n</code></pre>\n<p>And here are my shaders:</p>\n<pre class="lang-cpp prettyprint-override"><code>// shaders.metal\n\nstruct V {\n float4 p [[position]];\n};\n\nvertex V vertexShader(const device V* v [[buffer(0)]], uint i [[vertex_id]])\n{\n return v[i];\n}\n\nfragment float4 fragmentShader(V v [[stage_in]])\n{\n return v.p;\n}\n</code></pre>\n<p>Shaders can be compiled with <code>xcrun -sdk macosx metal shaders.metal -o out/shaders.metallib</code>, and the Objective C source can be compiled with <code>clang -framework Cocoa -framework QuartzCore -framework Metal -o out/example main.m</code>.</p>\n"^^ . "0"^^ . . . . . . . . "0"^^ . "0"^^ . . "0"^^ . . "0"^^ . . . . . "0"^^ . "How to get list of ARC conversion errors"^^ . . . . . . "2"^^ . "0"^^ . . "@AmritSidhu - ***15 seconds in iOS** only takes about a second in android*??? Gotta wonder what else you are doing that is taking up so much time. Maybe use a table view and split your "20 pages" into 20 rows... or, "20 pages" into 20 sections and split "page" elements into rows."^^ . . "0"^^ . "1"^^ . . "<p>I have a class hierarchy like this: <code>MySwiftSubViewController</code> -&gt; <code>ViewController</code> -&gt; <code>UIViewController</code>. Here is the code:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &lt;UIKit/UIKit.h&gt;\n\n@class SwiftClassFromPackage;\n\n@interface ViewController : UIViewController\n@property (nonatomic, strong) SwiftClassFromPackage* _Nullable someSwiftObjectFromPackage;\n\n@end\n</code></pre>\n<p>This class is using a type from an SwiftPackage for a property. Inside the Objective-C class it seems to be fine:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &quot;ViewController.h&quot;\n@import MyPackage;\n\n@implementation ViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n\n _someSwiftObjectFromPackage = [[SwiftClassFromPackage alloc] init];\n}\n@end\n</code></pre>\n<p>But in the Swift subclass it got an compile error when I use this property like this:</p>\n<pre class="lang-swift prettyprint-override"><code>import UIKit\nimport MyPackage\n\nclass MySwiftSubViewController: ViewController {\n\n override func viewDidLoad() {\n super.viewDidLoad()\n\n print(&quot;\\(self.someSwiftObjectFromPackage.text)&quot;) \n // Value of type 'MySwiftSubViewController' has no member 'someSwiftObjectFromPackage'\n }\n}\n</code></pre>\n<p>When I use this <code>SwiftClassFromPackage</code> class outside the package then it is working but not when it is coming from an package.</p>\n<p>Any suggestions why this is not working?</p>\n"^^ . "3"^^ . "How to collect compass data, in iOS, when a Unity Application is in background?"^^ . . . . "1"^^ . . . "0"^^ . . "Is the `MyWindowView` the content view? Do you want to add a border to a view (code) or a window (title of the question)? How do I get a drop target indication on a Finder window?"^^ . . . "0"^^ . . . "0"^^ . . . "<p>I am working on a project that creates a form dynamically based on an XML file. Everything works fine, except that if a form has too many textViews, it loads very slowly. Analyzing the app performance through xcode Time profiler, I came to know that whenever a textView is initailized it consumes a lot of CPU.</p>\n<p>To make this easier to understand, I created a sample project that recreates this issue. The sample project just adds about 1000 UITextViews when a <code>ViewController</code> is loaded. I checked the performance of this code using Xcode Profiler. I was able to figure out that if UITextView is replaced by UITextField, the performance increases dramatically. The demo project would show a slight improvement since the view is limited with just textviews or textfields. But in my actual app, I see an improvement of 4 seconds minimum when I try to load a heavy XML.</p>\n<p><strong>Sample Project:</strong> <a href="https://github.com/amrit42087/TextView_Performance" rel="nofollow noreferrer">https://github.com/amrit42087/TextView_Performance</a></p>\n<p><strong>Here is the screenshot of the Xcode Profiler with UITextView:</strong></p>\n<p><a href="https://i.sstatic.net/fDPHJ.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/fDPHJ.jpg" alt="enter image description here" /></a></p>\n<p><strong>Here is the screenshot of the Xcode Profiler with UITextField:</strong></p>\n<p><a href="https://i.sstatic.net/FWlCd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/FWlCd.png" alt="enter image description here" /></a></p>\n<p>UITextField reduces the load time to 960 ms from 1.49 seconds which is in case of UITextView. My actual project notices quite a lot of improvement since that is a heavy application.</p>\n<p><strong>Question:</strong> If anyone could suggest a solution to improve the performance while using a UITextView, that would be greatly appreciated. Using UITextField is not an option since I need multiline text.</p>\n"^^ . . . . "1"^^ . . . . . . . . . "0"^^ . . . "<p>From apple sample code that you provide:</p>\n<pre><code>The CVDisplayLink callback, displayLinkCallback, never executes\non the main thread.\n</code></pre>\n<p>So you need to add <code>autoreleasepool</code> to your callback function:</p>\n<pre><code>static CVReturn displayLinkCallback(\n CVDisplayLinkRef displayLink,\n const CVTimeStamp* now,\n const CVTimeStamp* outputTime,\n CVOptionFlags flagsIn,\n CVOptionFlags* flagsOut,\n void* displayLinkContext)\n{\n @autoreleasepool {\n [(MainView*)displayLinkContext renderOneFrame];\n }\n\n return kCVReturnSuccess;\n}\n</code></pre>\n<p>It looks like ARC is disabled in your project. To explicitly enable ARC add the <code>-fobjc-arc</code> flag to your compile command.</p>\n<pre><code>clang -fobjc-arc -framework Cocoa -framework QuartzCore -framework Metal -o out/example main.m\n</code></pre>\n"^^ . . . "Resume media player (Spotify, Apple Music, etc) while my ios app is in background"^^ . . . "1"^^ . "bridging-header"^^ . . . . . . . . "0"^^ . "0"^^ . "Not getting the error through these exception breakpoints."^^ . "2"^^ . . . "objective-c"^^ . "0"^^ . "<p>The problem here isn't related to the selector. It's the serialized value. It's likely that the encoder used <code>-encodeInteger:forKey:</code>, so the actual thing encoded is an integer, not an NSNumber. When you then decode it as an NSNumber (an object), it's complaining that the types mismatch. Make sure that your encoding and decoding logic match.</p>\n"^^ . "1"^^ . . . "Create NSWindow from the command line tool"^^ . "1"^^ . . "0"^^ . "I noticed this in a Swift project as well! Had to wrap the DisplayLink callback code in autorelease (inside the callback), and it was fixed. Didn't know have to do it from Swift too! -- edit typos"^^ . "2"^^ . . . "0"^^ . . . . "`NS_SWIFT_UNAVAILABLE`? https://developer.apple.com/documentation/swift/making-objective-c-apis-unavailable-in-swift"^^ . "@Willeke, what do you mean "is the selector visible"? Visible where? The compiler can't find the selector, so it just flags it as being unknown selectors. In Swift, there is a straightforward syntax for qualifying a selector by the class it belongs to, but I am not aware of a way to do that in Objective-C. (My Objective-C has gotten very rusty.)"^^ . . . . "What is the difference between a scene and a window in iOS app development?"^^ . . . "Interface of Objective-C class that needs to be visible by swift must be imported in the bridging header file in your project. On the other direction, Swift class are automatically converted to Objective-C interface in the Project-Swift.h file which must be included in Objective-C or prefix header."^^ . "0"^^ . . . . . . . "0"^^ . "cametallayer"^^ . . . . . "0"^^ . "1"^^ . "When the app crashes, the stack trace should show you the exact line causing the crash."^^ . . . . "<p>I have a textfield for which i'd like to clear the input if the word 'ERROR' has been put in there.</p>\n<p>I have made my ViewController the delegate and have setup the following method.</p>\n<pre><code>- (void)controlTextDidBeginEditing:(NSNotification *)obj {\n if ([[txtCode stringValue] isEqual:@&quot;ERROR&quot;]) {\n [txtCode setStringValue:@&quot;&quot;];\n }\n}\n</code></pre>\n<p>Every time the first character is pressed in that text field, regardless of what's in it (ie even if it doesn't have the word 'ERROR' in it), the app crashes with:</p>\n<pre><code>[General] -[__NSCFString replaceCharactersInRange:withString:]: Range or index out of bounds\n</code></pre>\n<p>I have narrowed it down to the if statement, or really this line:</p>\n<pre><code>[[txtCode stringValue] isEqual:@&quot;ERROR&quot;]\n</code></pre>\n<p>is what's causing the crash, but I can't understand why?</p>\n"^^ . . "I'm continuously getting this error, Don't know why? <-[__NSCFConstantString count]: unrecognized selector sent to instance>"^^ . . . "callkit"^^ . . "0"^^ . "@n8henrie If adding a runloop doesn't seem to change anything, then why did you [post an answer](https://stackoverflow.com/a/75795467/20287183) stating that adding `RunLoop.main.run()` allowed you to get the location permission?"^^ . "<p>We can detect/identify if the User clears each push notification explicitly at</p>\n<pre><code>func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -&gt; Void)\n</code></pre>\n<p>but is there any way that When the User clears all the push notifications at once from the notification center tray.</p>\n<p>Any help from anyone is very much appreciated.</p>\n<p>I have tried setting up the UNNotitificationCategory for each push notifications but still no luck in getting this callback at</p>\n<pre><code>func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -&gt; Void)\n</code></pre>\n<p>for clearing all the push notifications at once.</p>\n"^^ . . . . "1"^^ . "<p>Apparently I needed the following line in main function:</p>\n<pre><code> application.activationPolicy = NSApplicationActivationPolicyRegular;\n</code></pre>\n<p>With this line I'm getting Dock icon and proper behaviour for the window.</p>\n"^^ . . . . . "<p>I'm trying to add a border to an NSWindow for a drag operation (in the same way that dragging into a Finder window puts a blue border around it). The problem I'm experiencing is that the border is drawn underneath all of the subviews in the window.</p>\n<p>Note, in the interests of simplicity I've left out the code in MyWindowController, which calls draggingEntered, draggingExited and performDragOperation. I've also removed the code that removes the border - if the code as it stands is run then the window will always have a yellow border under the subviews because the problem that I need to solve is the layering rather than anything else.</p>\n<pre><code>@implementation MyWindowView\n\n- (void)drawRect:(NSRect)dirtyRect {\n \n [NSColor.yellowColor set]; // just for debug purposes because I don't use yellow for any other reason\n NSBezierPath *path = [NSBezierPath bezierPathWithRect:self.bounds];\n path.lineWidth = 10.0; \n \n [path stroke];\n}\n\n@end\n</code></pre>\n<p>How do I need to implement this so that the border is drawn on top of the subviews?</p>\n"^^ . "tapkey"^^ . . . . . "0"^^ . . . . "0"^^ . . . "<p>Your approach here is wrong. You don't constantly poll CLLocationManager on a thread. You start CLLocationManager one time, and let it run for as long as you want the information. The app will receive periodic updates. There is no need for a thread of any kind, and definitely not a polling loop.</p>\n<p>For obtaining permissions, and other required setup, see <a href="https://developer.apple.com/documentation/corelocation/configuring_your_app_to_use_location_services" rel="nofollow noreferrer">Configuring your app to use location services</a>. For more details on reading location information in the background, see <a href="https://developer.apple.com/documentation/corelocation/handling_location_updates_in_the_background" rel="nofollow noreferrer">Handling location updates in the background</a>. Your app does not continually poll for information in the background. The OS will deliver events when they are available, potentially launching your app if needed.</p>\n<p>While no threads or queues are required for your current problem, it's worth noting that DISPATCH_QUEUE_PRIORITY_BACKGROUND is a very low-priority queue that often does not run at all when the app is in the background. (I'd never really thought about how counter-intuitive that name is.) Even in cases where this code should run while the app is in the background, you wouldn't want to use that priority.</p>\n<p>As a rule, if you find yourself using <code>sleepForTimeInterval:</code>, you're probably doing something wrong. It's sometimes the correct tool, but it's extremely rare, particularly if you're a beginner.</p>\n"^^ . "1"^^ . . . "0"^^ . "I'm sorry can you explain what you mean? I don't understand. Also if i comment just that line out, i still have the problem. The problem only goes away if i comment the if statement out."^^ . "nscoder"^^ . "0"^^ . . . . . . "0"^^ . . . "0"^^ . . . . . "0"^^ . "react-native"^^ . "0"^^ . . "I would expect this to be impossible by design. Apple very rarely allows apps to mess with calls they don't directly control. I'd dig into why your VoIP call doesn't behave correctly when a PSTN call comes in and try to fix that instead. Make sure you're properly responding to audio interruptions: https://developer.apple.com/documentation/callkit/#3730350"^^ . . . . . "And the comments on that question/answer link a [specific solution](https://gist.github.com/cmittendorf/2c6eefc6dd128b323428) for your problem."^^ . "4"^^ . "<p>Protocol extensions are a Swift-only feature, meaning everything you declare in a protocol extension won't be visible/callable from Objective-C code.</p>\n<p>As others have said, if you want to provide a custom <code>isEqual</code>, then the only viable approach is to subclass <code>NSObject</code>. However in that case you run into the generics problem you described.</p>\n<p>However, not all is lost, you could push the generic constraint to the initializer, with a class crafted like this:</p>\n<pre class="lang-swift prettyprint-override"><code>@objc class Bridge: NSObject {\n private let _isEqual: (Any?) -&gt; Bool\n\n init&lt;T: Equatable&gt;(_ data: T) {\n _isEqual = { object in\n guard let other = object as? Bridge, let otherData = other._data as? T else {\n return false\n\n }\n return data == otherData\n }\n }\n\n override func isEqual(to object: Any?) -&gt; Bool {\n _isEqual(object)\n }\n}\n</code></pre>\n<p>Pushing the generic constraint to the initializer allows Objective-C to consume the class, however, as you might've already noticed, this increases the amount of boilerplate code you need to write in the class definition. Basically, every method you want to support will need to be backed up by a closure created in the initializer</p>\n"^^ . . . . . . . . . . "uikit"^^ . "0"^^ . "1"^^ . . . . "Are you saying that you are using `CGRectMake` in Swift code? `CGRectMake` should only be used in Objective-C code, not Swift code. Use `CGRect(x:y:width:height:)` in Swift."^^ . "2"^^ . . "<p>The only relevant thread I could found is this:\n<a href="https://stackoverflow.com/questions/4960197/gaussian-noise-using-core-graphics-only">Gaussian Noise using Core Graphics only?</a></p>\n<p>Which has a solution of creating complete noise using:</p>\n<pre><code>CGImageRef CGGenerateNoiseImage(CGSize size, CGFloat factor) CF_RETURNS_RETAINED {\n NSUInteger bits = fabs(size.width) * fabs(size.height);\n char *rgba = (char *)malloc(bits);\n srand(124);\n\n for(int i = 0; i &lt; bits; ++i)\n rgba[i] = (rand() % 256) * factor;\n\n CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();\n CGContextRef bitmapContext = CGBitmapContextCreate(rgba, fabs(size.width), fabs(size.height),\n 8, fabs(size.width), colorSpace, kCGImageAlphaNone);\n CGImageRef image = CGBitmapContextCreateImage(bitmapContext);\n\n CFRelease(bitmapContext);\n CGColorSpaceRelease(colorSpace);\n free(rgba);\n\n return image;\n}\n</code></pre>\n<p>Or another answer that takes a noise image and combine it with an image</p>\n<pre><code>// draw background\nCGContextFillRect(context, ...)\n\n// blend noise on top\nCGContextSetBlendMode(context, kCGBlendModeOverlay);\nCGImageRef cgImage = [UIImage imageNamed:@&quot;noise&quot;].CGImage;\nCGContextDrawImage(context, rect, cgImage);\nCGContextSetBlendMode(context, kCGBlendModeNormal);\n</code></pre>\n<p>But I couldn't quite figure out how to take an existing <strong>normal</strong> image and apply gaussian noise to it (with varying amount). Much like Photoshop noise filter.</p>\n"^^ . . . . . . . "0"^^ . . "Maybe set it to measurement mode? https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616608-measurement"^^ . . "0"^^ . . . "Kotlin\n`sealed interface UIState<out T> {\n object Loading : UIState<Nothing>\n data class Data<T>(val value: T) : UIState<T>\n data class Error(val throwable: Throwable) : UIState<Nothing>\n}\n`\n\nGenerated xcframework\n`public protocol UIState { }\npublic class UIStateLoading : KotlinBase, UIState { }\npublic class UIStateData<T> : KotlinBase, UIState where T : AnyObject {\n open var value: T? { get }\n}\npublic class UIStateError : KotlinBase, UIState {\n open var throwable: KotlinThrowable { get }\n}\n`"^^ . . . . . . . . "<p>I need to identify some hardware keyboards connected via bluetooth to my app.</p>\n<p>I have it connected via bluetooth and I can access to it via <code>GCKeyboard.coalesced</code>; I know that it comes from class <code>GCKeyboard</code> that implements <code>GCDevice</code> and I cannot get an unique identifier of the device currently connected: I only can get the vendorName and product category that only returns &quot;Keyboard&quot;.</p>\n<p>I also tried to get the bluetooth device but that keyboard is not BLE and neither is MFi compliant.</p>\n<p>Is there a turnaround that I could do?</p>\n"^^ . . . . . . . "Objective-C initializers used by Swift (or not)"^^ . . . . . . "0"^^ . "0"^^ . . . . . . . . . "Try this https://stackoverflow.com/a/33215044/1934750"^^ . "@TheNextman https://github.com/fulldecent/corelocationcli/issues/48#issuecomment-1474512866"^^ . . . . . . "afnetworking"^^ . "bluetooth"^^ . . . "0"^^ . . . . "Edit your question with input value and desired output, it should be clearer."^^ . . "0"^^ . . . "firebase-cloud-messaging"^^ . "0"^^ . . "0"^^ . . "objective-c++"^^ . . . "0"^^ . . . "0"^^ . "0"^^ . "0"^^ . "1"^^ . . . . . . . . . "<p>I am dusting off a very old app and trying to get it cleaned up so I can re-submit it to the App Store.</p>\n<p>It was written in Objective-C using manual reference counting. I tried using the automatic ARC conversion in Xcode (14.2).</p>\n<p>It displays a message:</p>\n<blockquote>\n<p>Cannot Convert to Objective-C ARC</p>\n</blockquote>\n<p>and</p>\n<blockquote>\n<p>Xcode found 22 issues that prevent conversion from proceeding. Fix all ARC readiness issues and try again.</p>\n</blockquote>\n<p>(I'm down to 22 after a couple of hours of work.)</p>\n<p>However, the error messages show up in the issue navigator until I click on one to try to resolve it, and then they all disappear. Is there a way to view all the errors, including copying them to a text editor?</p>\n<p>A related question: It looks like a good number of <code>@selector</code> declarations now throw errors in the ARC conversion because they are declaring selectors in a class defined in another file. (They appear to be listed as errors in the ARC conversion preview, but only warnings if I build the project, which is odd.) What is the Objective-C syntax for defining a selector in another class? In swift it's just ClassName.selector, but what is it in Objective-C? I've tried searching the docs and googling it, but haven't found the answer yet.</p>\n"^^ . . . . . . . "This is really good (in a "oh good grief this is horrible" kind of way). I kept mulling around how to pull this off, and this catches the type-erasure trick well with minimal complications."^^ . . . . . . . . . . "Property from Objective-C class is not visible in Swift subclass when that property is from Swift Package"^^ . . . . "1"^^ . . "macos"^^ . "<p>I'm exposing my Swift structs as wrapped classes so I don't pollute my Swift API by converting structs to @objc classes.</p>\n<p>Since I can't use generics in @objc classes, I'm trying to eliminate some boilerplate code within a protocol to provide features like equality as shown below. However, the function in the protocol extension is not getting called.</p>\n<p>Can you think of other tricks to accomplish what I'm trying to do?</p>\n<p>It'd be nice to get rid of the initializer to and move it to a default implementation of the extension too, but I couldn't figure that out either.</p>\n<pre class="lang-swift prettyprint-override"><code>public protocol InitializableConverter: NSObject {\n associatedtype SwiftStructType: Equatable\n var _data: SwiftStructType { get set }\n init(_ data: SwiftStructType)\n}\n\nextension InitializableConverter {\n /// Returns object equality if underlying structs are equal\n func isEqual(_ object: Any?) -&gt; Bool {\n if let other = object as? Self {\n return self._data == other._data\n }\n return false\n }\n}\n\n@objc public class UserSettingsObjc: NSObject, InitializableConverter {\n public var _data: UserSettings\n required public init(_ data: UserSettings) { _data = data }\n\n @objc public var locale: String { _data.locale }\n}\n\npublic struct UserSettings: Equatable {\n public private(set) var locale: String\n\n public init(locale: String) {\n self.locale = locale\n }\n}\n</code></pre>\n<p>UPDATE:</p>\n<p>Here are additional methods for context on how it's used:</p>\n<pre class="lang-swift prettyprint-override"><code>// Original swift method that uses Result&lt;&gt; syntax\nfunc call(username: String?, password: String?, completion: @escaping (Result&lt;UserSettings, MyError&gt;) -&gt; Void) {\n completion(.success(UserSettings(locale: &quot;hello world&quot;)))\n}\n\n// Objc method using non-Result&lt;&gt; syntax (@objc commented out because of playground)\n@objc\nfunc wrappedCall(username: String?, password: String?, completion: @escaping (UserSettingsObjc?, MyErrorObjc?) -&gt; Void) {\n call(username: username, password: password) { result in\n callCompletion(completion, with: result)\n }\n}\n\n// Converting result to non-result via InitializableConverter protocol\nfunc callCompletion&lt;T, TOrig, E, Eorig&gt;(\n _ completion: (T?, E?) -&gt; Void,\n with result: Result&lt;TOrig, Eorig&gt;\n) where T: InitializableConverter, E: InitializableConverter {\n switch result {\n case let .success(torig):\n return completion(T(torig as! T.SwiftStructType), nil)\n\n case let .failure(eorig):\n return completion(nil, E(eorig as! E.SwiftStructType))\n }\n}\n</code></pre>\n"^^ . "Yes, I know that. It was not I, but another dev who was using it, not that it matters. Yes, it's Swift code. The point is, using the Obj-C initializer does NOT produce an error except on the build server. Was it excluded in Xcode13 but not excluded in Xcode14 for some reason? What other explanation could there be? Why are we not getting that error message in Xcode14?"^^ . . . . . "Do you have the stacktrace? From what I guess, at some point, your are using setting a `NSString` where it should be an `NSArray` (or any other class with a `count` method/getter). I don't use CashFree, but check the code, if it uses a value in a plist, it could be there, or also if there a "cloud" values, there too."^^ . "0"^^ . "0"^^ . . "RNFIREBASE MESSENGER push notification not working on iOS"^^ . . . "2"^^ . "0"^^ . . . . "1"^^ . . "Tapkey Mobile SDK missing build when using Objective C for iOS"^^ . "0"^^ . "0"^^ . . . "I do in fact have "show live issues" checked."^^ . "2"^^ . . "core-location"^^ . "0"^^ . "1"^^ . . . . . "1"^^ . "might need to, but I'd have to add it conditionally since a lot of the code is already translated to swift, so I'd have to change the casing on all for that. It's old code, so I'd like to avoid touching it..."^^ . "0"^^ . "Is the selector declared in the header file of the class it belongs to and is this header file imported in the file with the error?"^^ . . . . . . "0"^^ . . "0"^^ . . "core-graphics"^^ . . "0"^^ . . "How can I add a border to NSWindow for a drag operation?"^^ . . "0"^^ . . . . "1"^^ . "@AmritSidhu - there are big differences between *what I **want** to do* -- *what I **CAN** do* -- *what I **shouldn't** do* -- *what I **CANNOT** do* . Your comment of "an xml might have 20 pages in a form and each page might be having 100 textview to enter data" could be interpreted as **shouldn't** do. I'd recommend re-thinking your approach. Or, since you also say *"also makes use of javascript"* you **could** format it as html and use a `WKWebView`"^^ . "@DonMag Thanks for the suggestion but that doesn't work for our solution. It's a well established product that can not be asked to change the complete approach how a UI is rendered but yes minor tweaks are most welcome."^^ . "<p>So I'm trying out KMM Library (not App) that will be imported into .xcframework/.framework for Xcode project and .aar for Android project.</p>\n<p>I wanted to implement UIState (Loading, Success, and Error) so I create a sealed class</p>\n<pre><code>sealed class UIState&lt;out T&gt; {\n object Loading : UIState&lt;Nothing&gt;()\n data class Success&lt;T&gt;(val data: T) : UIState&lt;T&gt;()\n data class Error(val message: String) : UIState&lt;Nothing&gt;()\n}\n</code></pre>\n<p>Then make an API call using Coroutine</p>\n<pre><code>suspend fun getDotaHeroesWithSealedClass(): UIState&lt;List&lt;DotaHero&gt;&gt; =\n when (httpClient.get(&quot;https://api.opendota.com/api/heroes&quot;).status.value) {\n in 200..299 -&gt; {\n UIState.Success(httpClient.get(&quot;https://api.opendota.com/api/heroes&quot;).body())\n }\n else -&gt; {\n UIState.Error(&quot;An error has occured&quot;)\n }\n }\n</code></pre>\n<p>After that, I run <code>./gradlew assembleXCFramework</code> then link the <strong>.xcframework</strong> into my Xcode project. But the function detected as <strong>UIState&lt; NSArray&gt;</strong>.</p>\n<p><a href="https://i.sstatic.net/X4boV.png" rel="nofollow noreferrer">getDotaHeroesWithSealedClass function in Swift</a></p>\n<p>How can I make the function return UIState so I can make a switch case like this</p>\n<pre><code>switch uiState {\n case .loading:\n case .success(let data):\n case .error(let errorMessage):\n}\n</code></pre>\n"^^ . . "keyboard-wedge"^^ . . "0"^^ . . . "2"^^ . "1"^^ . . "1"^^ . "0"^^ . . "Range or index out of bounds crash when i'm a delegate for my NSTextField"^^ . "4"^^ . . . "1"^^ . . . "0"^^ . . . . . "@TheNextman no dice, adding a runloop doesn't seem to change anything."^^ . . . . "Agreed - so how can we get warnings to that effect? Possible?"^^ . . . . . . . . "0"^^ . "1"^^ . "0"^^ . "@DonMag Thanks for the suggestion again. The form that loads in 15 seconds in iOS only takes about a second in android. This is what is not letting us change the approach. Since, android is working fine, we cannot afford to remake both ios and android just because of an issue in one platform. I can still try the next suggestion for replacing it with labels."^^ . "0"^^ . . "Nothing in there linking directly to my code... the only thing i have found is that remarking that if statement disabled this problem."^^ . . . . "<p>I'm having a VoIP app in which calling works normally.</p>\n<p>However, when we have an active VoIP call and the user receives a normal PSTN call, the active VoIP call goes blank - no audio is audible on either side.</p>\n<p>To resolve this issue, we decided to end the new incoming call programmatically and I'm successfully able to detect an incoming PSTN call. But when I try to end the call, I get error saying:</p>\n<pre><code>EndCallAction transaction request failed: The operation couldn’t be completed. (com.apple.CallKit.error.requesttransaction error 4.)\n</code></pre>\n<p>Error code 4 refers to <code>CXErrorCodeRequestTransactionErrorUnknownCallUUID</code>.</p>\n<p>Below is my code:</p>\n<pre><code>// called during initialization\nself.callObserver = [[CXCallObserver alloc] init];\n[self.callObserver setDelegate:self queue:dispatch_get_main_queue()];\n</code></pre>\n<pre><code>- (void)callObserver:(nonnull CXCallObserver *)callObserver callChanged:(nonnull CXCall *)call {\n // isCallInProgress static variable tracks if a VoIP call is active and I verified its value - works as expected\n if(isCallInProgress) {\n if(!call.isOutgoing &amp;&amp; !call.hasConnected &amp;&amp; !call.hasEnded) {\n NSLog(@&quot;*** New incoming call detected while a call is in progress - so reject it&quot;);\n dispatch_async(dispatch_get_main_queue(), ^{\n CXEndCallAction *endCallAction = [[CXEndCallAction alloc] initWithCallUUID:call.UUID];\n CXTransaction *transaction = [[CXTransaction alloc] initWithAction:endCallAction];\n\n CXCallController *controller = [[CXCallController alloc] init];\n [controller requestTransaction:transaction completion:^(NSError *error) {\n if (error) {\n NSLog(@&quot;*** EndCallAction transaction request failed: %@&quot;, [error localizedDescription]);\n }\n else {\n NSLog(@&quot;*** EndCallAction transaction request successful&quot;);\n }\n }];\n });\n }\n }\n} \n</code></pre>\n<p>What can I try next?</p>\n"^^ . "It's only one of the objects with property `Description`. Add category with normal name and use it swift."^^ . . . "1"^^ . "1"^^ . . "0"^^ . . "0"^^ . "<p>I m working on push notification RN firebase, I have followed the rnfirebase documentation, I get the remote message in console.log but not displaying the notifcation on the xcode simulator.</p>\n<p>Below are the relevant files screenshots and code</p>\n<p><strong>filename : notificationservices</strong>\nwhere i have added the respective react-native-firebase code snippets</p>\n<pre><code>import messaging from &quot;@react-native-firebase/messaging&quot;;\nimport PushNotification from &quot;react-native-push-notification&quot;;\nimport {PushNotificationIOS} from &quot;@react-native-community/push-notification-ios&quot;;\nimport {Platform} from &quot;react-native&quot;;\n\nconst getFcmToken = async () =&gt; {\n const fcmToken = await messaging()\n .registerDeviceForRemoteMessages()\n .then(() =&gt; messaging().getToken());\n console.log(&quot;fcmToken ==&gt;&quot;, fcmToken);\n\n if (fcmToken) {\n console.log(&quot;Your Firebase Token is:&quot;, fcmToken);\n } else {\n console.log(&quot;Failed&quot;, &quot;No token received&quot;);\n }\n};\n\nexport const requestUserPermission = async () =&gt; {\n const authStatus = await messaging().requestPermission();\n const enabled =\n authStatus === messaging.AuthorizationStatus.AUTHORIZED ||\n authStatus === messaging.AuthorizationStatus.PROVISIONAL;\n\n if (enabled) {\n getFcmToken();\n console.log(&quot;Authorization status:&quot;, authStatus);\n }\n};\n\nexport const notficationListener = async () =&gt; {\n messaging().onNotificationOpenedApp(remoteMessage =&gt; {\n console.log(\n &quot;Notification caused app to open from background state:&quot;,\n remoteMessage.notification,\n );\n });\n messaging()\n .getInitialNotification()\n .then(remoteMessage =&gt; {\n if (remoteMessage) {\n console.log(\n &quot;Notification caused app to open from quit state:&quot;,\n remoteMessage.notification,\n );\n }\n });\n messaging().onMessage(async remotemessage =&gt; {\n console.log(&quot;remote message11&quot;, JSON.stringify(remotemessage));\n });\n messaging().onNotificationOpenedApp(remotemessage =&gt; {\n console.log(&quot;remote message11&quot;, JSON.stringify(remotemessage));\n PushNotificationIOS.addNotificationRequest({\n id: remotemessage.messageId,\n title: remotemessage.notification.title,\n body: remotemessage.notification.body,\n sound: &quot;default&quot;,\n });\n\n PushNotification.configure({\n onNotification: function (notification) {\n console.log(&quot;push notification&quot;);\n if (!notification.data) {\n return;\n }\n notification.userInteraction = true;\n if (Platform.OS === &quot;ios&quot;) {\n notification.finish(PushNotificationIOS.FetchResult.NoData);\n }\n },\n senderId: &quot;1054317504462&quot;,\n permissions: {\n alert: true,\n badge: true,\n sound: true,\n },\n popInitialNotification: true,\n requestPermissions: true,\n });\n });\n};\n\nexport const remoteMessage = () =&gt; {\n const unsubscribe = messaging().onMessage(async remoteMessage1 =&gt; {\n console.log(&quot;A new FCM message arrived!&quot;, JSON.stringify(remoteMessage1));\n });\n return unsubscribe;\n};\n\n</code></pre>\n<p><strong>screenshot of Signing and Certificates in XCODE</strong>\n<a href="https://i.sstatic.net/Te0YX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Te0YX.png" alt="enter image description here" /></a></p>\n<p><strong>AppDelegate code</strong></p>\n<pre><code>#import &quot;AppDelegate.h&quot;\n\n#import &lt;Firebase.h&gt;\n#import &lt;React/RCTBridge.h&gt;\n#import &lt;React/RCTBundleURLProvider.h&gt;\n#import &lt;React/RCTRootView.h&gt;\n#import &quot;RNNotifications.h&quot;\n\n#ifdef FB_SONARKIT_ENABLED\n#import &lt;FlipperKit/FlipperClient.h&gt;\n#import &lt;FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h&gt;\n#import &lt;FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h&gt;\n#import &lt;FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h&gt;\n#import &lt;SKIOSNetworkPlugin/SKIOSNetworkAdapter.h&gt;\n#import &lt;FlipperKitReactPlugin/FlipperKitReactPlugin.h&gt;\n\nstatic void InitializeFlipper(UIApplication *application) {\n FlipperClient *client = [FlipperClient sharedClient];\n SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];\n [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];\n [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];\n [client addPlugin:[FlipperKitReactPlugin new]];\n [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];\n [client start];\n}\n#endif\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n [FIRApp configure];\n#ifdef FB_SONARKIT_ENABLED\n InitializeFlipper(application);\n#endif\n\n RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];\n RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge\n moduleName:@&quot;AirU_App&quot;\n initialProperties:nil];\n\n if (@available(iOS 13.0, *)) {\n rootView.backgroundColor = [UIColor systemBackgroundColor];\n } else {\n rootView.backgroundColor = [UIColor whiteColor];\n }\n\n self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];\n UIViewController *rootViewController = [UIViewController new];\n rootViewController.view = rootView;\n self.window.rootViewController = rootViewController;\n [self.window makeKeyAndVisible];\n return YES;\n}\n\n</code></pre>\n"^^ . . "0"^^ . . . "2"^^ . . . . "0"^^ . . . . "1"^^ . . . "cocoa"^^ . . "0"^^ . "No, there is no visibility of the state of notifications that the user doesn't actually interact with"^^ . . . . . . "The exception is on `[txtCode setStringValue:@""];`, registering undo is using the old selected range."^^ . . . . . "0"^^ . . . . . "command-line-interface"^^ . . . . . "microphone"^^ . "2"^^ . . "scene"^^ . "0"^^ . "0"^^ . . . "audio"^^ . "@TheNextman thank you! I wrote "location" when I meant "calendar," which is what that question was about; I have since corrected the mistake. I still have not gotten this to work for location with CLI tool (but it works for both camera and calendar access)."^^ . "1"^^ . . "0"^^ . "swift-package"^^ . . "0"^^ . . "@LunaRazzaghipour If you invoke clang from the command line, it does default to ARC being disabled and you must manually add the -fobjc-arc argument."^^ . "ios"^^ . . "int i;\nNSString *arg1 = [NSString stringWithString:@"String1"];\nNSNumber *arg2 = [NSNumber numberWithInt:1];\nNSString *arg3 = [NSString stringWithString:@"String2"];\nNSArray *arrayElement = [NSArray arrayWithObjects:arg1, arg2, arg3, nil];\nNSArray *arrayToSort = [NSArray arrayWithObject:arrayElement];\nfor (i = 0; i < 99; i++) {\n [arrayToSort addObject:arrayElement];\n}\n// arrayToSort now has 101 arrayElements in it\n// I want arrayToSort to be sorted alphabetically on the characters in arg1"^^ . . "kotlin"^^ . "I guess the code generator cannot be configured to emit `NS_SWIFT_NAME`s?"^^ . . . . "0"^^ . . . "What have you tried already?"^^ . . . . . . . . "<p>I have an objective-c iOS codebase that uses a set of files generated (please don't laugh) by a tool from a SOAP WSDL file. One of the objects in the WSDL includes a property &quot;Description&quot;. The tool dutifully - and correctly - translates this into an Objective-C object with a &quot;Description&quot; property. All has worked just fine for 15 years or so.</p>\n<p>I'm in the process of converting my app to Swift because I can read the writing on the wall (despite Apple's protestations to the contrary). And the fact that swift can interact with Objective-C is a key reason that this is possible!</p>\n<p>But alas...when accessing Objective-C code from Swift, the default is to convert the casing of the property from upper-case to camel case, so &quot;Description&quot; becomes &quot;description&quot;, and conflicts with the Swift &quot;description&quot; property on such objective-c objects. (Does XCode raise a compile-time error on this? Of course not, but that's a separate digression). As a result, my code that references the &quot;description&quot; property gets the name of the class rather than the human-readable value in the &quot;Description&quot; (capital-D) property.</p>\n<p>Apple recognizes this issue and provides the &quot;NS_SWIFT_NAME&quot; macro to specify a name to be used from Swift, and that could easily solve the problem, except that this is in code that's generated by a 3rd party tool, so it has no idea when/where to add the &quot;NS_SWIFT_NAME&quot; macro.</p>\n<p>For now, I've got an insane hack on this: I've created an objective-c method visible to Swift that takes the object in question and returns the value of the &quot;Description&quot; field (capital-D), and that works, but (a) man that's an ugly hack, and (b) if my goal is to translate everything except the tool-generated-code to Swift, then...well, tough luck.</p>\n<p>Any thoughts for solutions here? I can't seem to apply the &quot;NS_SWIFT_NAME&quot; macro in an extension or otherwise in a separate file...</p>\n"^^ . . . "<p>Just posting the solution which I decided to go ahead with and which solved the problem for us.</p>\n<p>I decided to listen for the AudioSession interruption which are triggered by the system based on what's happening with the device:</p>\n<pre><code>[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) name:AVAudioSessionInterruptionNotification object:[AVAudioSession sharedInstance]];\n</code></pre>\n<p>Following piece of code is specific to Twilio which solved the current call going blank while a new incoming call is ringing:</p>\n<pre><code>- (void)handleInterruption:(NSNotification *)notification {\n if ([notification.name isEqualToString:AVAudioSessionInterruptionNotification]) {\n if ([[notification.userInfo valueForKey:AVAudioSessionInterruptionTypeKey] isEqualToNumber:[NSNumber numberWithInt:AVAudioSessionInterruptionTypeBegan]]) {\n self.audioDevice.block();\n }\n}\n</code></pre>\n"^^ . . "0"^^ . . . "0"^^ . "0"^^ . . . "Why am I unable to alphabetically sort a multidimensional array in objective-c?"^^ . "Maybe take a look at [this project](https://github.com/fulldecent/corelocationcli) also"^^ . . "@HangarRash I have attached a demo project that recreates this issue. And the time profiler shows isn't per UITextView. It's the time takes to load 1000 UITextViews."^^ . . "0"^^ . "0"^^ . "Even if calling `CGRectMake` from Swift is permitted, it'd seem better and more modern to use the Swift `CGRect()` initializer. `CGRectMake` only exists because structs in C and Obj-C don't have intializers; in Swift, they do, so it makes sense to use the one provided."^^ . . . "1"^^ . . . . "<p>In an app that was originally created in Objective-C but now with a lot of Swift code, initializing a <code>CGRect</code>, for example, using <code>CGRectMake</code> compiles just fine on a developer's Mac using Xcode, but produces an error <code>'CGRectMake' has been explicitly marked unavailable here</code> on the build server.</p>\n<p>If I Command-Click on the function, I'm directed to the Objective_C header, where, given that message, I should see something like <code>NS_SWIFT_UNAVAILABLE</code>, but I don't. What would cause this different behavior on dev computers and the build server? More specifically, what can we do on the dev computer to generate the same errors the build server is generating?</p>\n<p>We're using Xcode 14 with Swift 5.</p>\n"^^ . . "What about adding an `init` that takes an `NSNumber` parameter for each optional `Bool` or `Int`?"^^ . . . . . . . . "1"^^ . "0"^^ . "1"^^ . "unity-game-engine"^^ . "@AmritSidhu - glad it helped... I suspect (based on your other comments) there are a number of things you're doing that could be done much quicker."^^ . . "@AmritSidhu - well, if you cannot change the approach, you're kind of out-of-luck. Another suggestion would be to use labels, and only display a `UITextVIew` when editing... but that would be changing "the complete approach." So... it sounds like you need to add some sort of animated progress view to let the user know your code is formatting the UI."^^ . . . "Is there a way to get an identifier from a physical keyboard?"^^ . . . . . . . . . . "Ii'm wondering if you need to draw in main thread: `dispatch_async(dispatch_get_main_queue(), ^{ [self doitnowpdf]; });`?"^^ . . . "0"^^ . . . "0"^^ . . . . . "<p>Cannot attach a pdf file and open it in gmail app.\nThe gmail app is opening, but the attached file is missing.</p>\n<p>The code used is:</p>\n<pre><code>NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@&quot;MyFile&quot; ofType:@&quot;pdf&quot;];\nNSData *pdfData = [NSData dataWithContentsOfFile:pdfPath];\nNSString *pdfBase64 = [pdfData base64EncodedStringWithOptions:0];\n\nNSString *gmailScheme = [NSString stringWithFormat:@&quot;googlegmail:///co?to=&amp;subject=&amp;body=&amp;attachment=%@&quot;, pdfBase64];\nNSURL *gmailURL = [NSURL URLWithString:gmailScheme];\n\nif ([[UIApplication sharedApplication] canOpenURL:gmailURL]) {\n [[UIApplication sharedApplication] openURL:gmailURL options:@{} completionHandler:nil];\n}\n</code></pre>\n"^^ . "Can you clarify where you added this? Thx"^^ . . . "<p>It may well be that the object is released, when the completion handler is invoked. To know for sure, more code snippets would be needed.</p>\n<p>You should either check for <code>self</code> being <code>nil</code> at the beginning of the completion handler.\nOr you should ensure, that the reference to the instance is strongly held, so it does not get released until the completion handler is called.</p>\n<p>One pattern to ensure, that a reference is weak until the completion handler starts and then is held on strongly while it executes is this:</p>\n<pre><code>__weak typeof(self) weakSelf = self;\n[someObj someCall:^{\n __strong typeof(self) strongSelf = weakSelf;\n if (strongSelf == nil) return;\n ...\n}];\n</code></pre>\n<p>Hope this helps.</p>\n"^^ . . "1"^^ . "1"^^ . . "<p>What it says - functions of the form <code>void func ()</code> rather than <code>void func (void)</code> have been flagged as obsolescent by the C standard since the year 1990. So you should (for now) never write functions with an empty parenthesis in C. Unlike C++ where the two forms are equivalent.</p>\n<p>In the upcoming C23 standard this will no longer be an issue since the old &quot;K&amp;R style&quot; functions are finally removed from the C language and <code>void func ()</code> will get treated as if you typed <code>void func (void)</code>.</p>\n"^^ . . . . . "<p>The property is not required to be an Objective-C property, but you anyway need an Objective-C class to conform to the <a href="https://yandex.ru/dev/mobile-ads/doc/ios/ref/Protocols/YMAInterstitialAdDelegate.html" rel="nofollow noreferrer"><code>YMAInterstitialAdDelegate</code></a> protocol which the <code>YMAInterstitialAd</code> object apparently requires in order to initialize itself.</p>\n<p>Provided you compile the code with Objective-C++ syntax flag, you can just do the initialisation as follows:</p>\n<pre class="lang-objc++ prettyprint-override"><code>class YandexIosInterstitialAd : public InterstitialAd\n{\npublic:\n\n YandexIosInterstitialAd(): delegate{ [TDWAdDelegate new] },\n interstitialAd{ [[YMAInterstitialAd alloc] initWithAdUnitID:&lt;your unique AdUnitId&gt;] } {\n interstitialAd.delegate = delegate;\n [interstitialAd load];\n }\n\nprivate:\n\n id&lt;YMAInterstitialAdDelegate&gt; delegate;\n YMAInterstitialAd *interstitialAd;\n\n};\n</code></pre>\n<p>Be advised, that ARC knows how and when to release the Cocoa objects, even if they are C++ class members, so you don't commonly need to do it manually. <code>TDWAdDelegate</code> in this case is just another Objective-C class which implements the <code>YMAInterstitialAd</code> protocol and looks something like that:</p>\n<pre class="lang-objc prettyprint-override"><code>@interface TDWAdDelegate : NSObject &lt;YMAInterstitialAdDelegate&gt;\n\n- (void)interstitialAdDidLoad:(YMAInterstitialAd *)interstitialAd;\n- (void)interstitialAdDidClick:(nonnull YMAInterstitialAd *)interstitialAd;\n/* ...other methods which your implementation requires... */\n\n@end\n\n@implementation TDWAdDelegate\n\n- (void)interstitialAdDidLoad:(YMAInterstitialAd *)interstitialAd {\n // your implementation goes here\n}\n\n- (void)interstitialAdDidClick:(nonnull YMAInterstitialAd *)interstitialAd {\n // another method implementation\n}\n\n/* ...other methods which your implementation requires... */\n\n@end\n</code></pre>\n"^^ . . . . "0"^^ . "1"^^ . "0"^^ . . . "1"^^ . . . . "opencv"^^ . . "-2"^^ . "1"^^ . . . . . "0"^^ . "0"^^ . . . "1"^^ . . "<p>Suddenly in-app purchases of already productive IAPs are failing in the production with the error code:</p>\n<pre><code>NSUnderlyingError=0x283b42e20 {Error Domain=ASDServerErrorDomain Code=3504 &quot;找不到此项目。&quot; UserInfo={NSLocalizedDescription=找不到此项目。}}} \n</code></pre>\n<p><strong>Environment:</strong> Production</p>\n<p><strong>OS Version:</strong> iOS 15.6.1</p>\n<p>What does Code 3504 represent?</p>\n<p>Where can I find documentation related to error codes?</p>\n<p>I confirm that there have been no prohibited sales areas for the product.</p>\n<p>This issue was not found in the sandbox environment.</p>\n"^^ . "You can only call `viewDidAppear:` in the override of the method itself to call its super: `[super viewDidAppear:animated];`, if you called yourself `viewDidAppear:` elsewhere, you'll get that message. It's hard to tell without code."^^ . . "0"^^ . "<p>&quot;But when I run cv::Imread();, cv::Mat tiffImage image is saved as nil.&quot;<br />\nallocator = nil<br />\nopencv read image fail with tiffImage is nil.\nopencv save image will definitely fail.<br />\nYou need to determine whether the image path and opencv are readable.</p>\n<pre><code> NSString* readFilePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@&quot;read.png&quot;];\nUIImage* image = [[UIImage alloc] initWithContentsOfFile:readFilePath];\nNSLog(@&quot;image:%@&quot;, image);\n\ncv::String readpath_str = [readFilePath cStringUsingEncoding:NSUTF8StringEncoding];\ncv::Mat image_mat = cv::imread(readpath_str);\n\nNSString* saveFilePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@&quot;write.png&quot;];\ncv::String writepath_str = [saveFilePath cStringUsingEncoding:NSUTF8StringEncoding];\nbool res = cv::imwrite(writepath_str, image_mat);\nNSLog(@&quot;cm write:%d&quot;, res);\n</code></pre>\n"^^ . . . . "0"^^ . "<p>Xcode Screenshot:</p>\n<p><a href="https://i.sstatic.net/DzOlk.png" rel="noreferrer"><img src="https://i.sstatic.net/DzOlk.png" alt="enter image description here" /></a></p>\n<p>Project Details:</p>\n<ul>\n<li><p>The project is an Objective-C project originally created in 2012.</p>\n</li>\n<li><p>Roughly 33% of the code base is now in Swift.</p>\n</li>\n<li><p>Project has Cocoapod dependencies.</p>\n</li>\n<li><p>Project compiles with no issues on Xcode 14.2</p>\n</li>\n</ul>\n<p>Xcode 14.3 Issue:</p>\n<ul>\n<li><p>On Xcode 14.3 project does not build and the errors thrown are in Xcode generated files ProjectName.private.swiftinterface and ProjectName.swiftinterface</p>\n</li>\n<li><p>Xcode says 'no such module __ObjC'</p>\n<ul>\n<li>failed to verify module interface 'ProjectName' due to errors above; the textual interface may be broken by project issues or a compiler bug</li>\n</ul>\n</li>\n<li><p>See attached screenshot for full a visual.</p>\n</li>\n</ul>\n<p>What we've tried:</p>\n<ul>\n<li><p>pod install --repo-update</p>\n</li>\n<li><p>full project clean, delete Derived Data folder, clean again, try to build again.</p>\n</li>\n</ul>\n<p>Question:</p>\n<ul>\n<li>Does the community think this is an Xcode issue? Or is there something wrong in our Build Settings/Info.plist file? Has anyone encountered this before?</li>\n</ul>\n<p>Any help would be highly appreciated!</p>\n"^^ . "17"^^ . . "Inconsistent behavior in viewDidAppear Objective C"^^ . . "console"^^ . . "1"^^ . . . . . "<p>I am developing new version for Mapp Intelligence library (<a href="https://github.com/mapp-digital/MappIntelligence-iOS-v5" rel="nofollow noreferrer">https://github.com/mapp-digital/MappIntelligence-iOS-v5</a>) and I had to rename few classes at the latest version to avoid collision with some other library when they are added together.\nAfter that when I run pod lib lint command if gives me errors for every renamed class that can not find the relative path for it.</p>\n<p><code>Encountered an unknown error (No such file or directory @ realpath_rec - /Users/***/Desktop/novagrana/MappIntelligence-iOS-v5/MappIntelligence/UserMatching/DeviceID/APXIdentifier.h) during validation.</code></p>\n<p>and <strong>APXIdentifier.h</strong> is an old name not renamed one.</p>\n<p>I have tried to remove derived data few time and I also tried to remove completely cocoa pods and install them again, also <strong>pod cache clean --all</strong> command does not help.</p>\n<p>It must be some caching problem, but I do not know what I need to clean or remove.</p>\n"^^ . . "Do you know for sure that the Gmail app supports the `attachment` query parameter? Do you know for sure the value is a plain base64 encoding of the data? How big is the PDF? With the resulting base64 encoding, the final URL could be far too long to be valid."^^ . . "0"^^ . . "1"^^ . . . . "What macOS hardware doesn't support Bluetooth? Are you thinking about environments where Bluetooth is disabled by policy? What situation do you have in mind here?"^^ . . . . . . . "0"^^ . "It worked but what about when this app goes to distribution? :) will it matter?"^^ . "0"^^ . . "Can't attach a pdf file in gmail using Objective C"^^ . . . . . "0"^^ . . . "4"^^ . "xcode"^^ . "crash"^^ . . "4"^^ . "No type or protocol named 'AVCapturePhotoCaptureDelegate' error"^^ . "1"^^ . "tvos"^^ . . "macOS check is Bluetooth is supported programmatically"^^ . . "Then why does the documentation say *'NULL on failure'* if it will never ever fail?"^^ . . . . . "0"^^ . . . "6"^^ . . . . . . . . "null"^^ . . "0"^^ . . "0"^^ . . . . . . . . . "@HangarRash That was it, updated my phone to iOS 16.4.1, and now it works. I guess on 15.6.1 there was a bug with the `UIActivityViewController`. You can write an answer with this information and I can mark it as resolved. Or I can, either way works for me(If we consider this resolved, still technically a problem for users under 16). But thanks though."^^ . "1"^^ . "swift"^^ . . "frida"^^ . . "0"^^ . . . . "0"^^ . "I think that's what I just explained. _Any_ Objective-C initializer can return NULL on failure. That doesn't mean it _will_ and it isn't the (very old) documentation's job to worry about that distinction. All Objective-C code checks to see whether it got `nil`."^^ . . "<p>I am trying to resize a pixel buffer with the kCVPixelFormatType_420YpCbCr8BiPlanarFullRange (420f) pixel format to another size with preserving aspect ratio and adding black bars (if needed).</p>\n<p>I am using the vImageScale_Planar8 and vImageRotate90_Planar8 functions from the Accelerate framework to scale and rotate the Y plane, and the vImageScale_CbCr8 and vImageRotate90_Planar16U functions to scale and rotate the CbCr plane.</p>\n<p>Here is the code:</p>\n<pre><code>+ (CVPixelBufferRef)resizeProportionallyBuffer:(CVPixelBufferRef)srcPixelBuffer withOrientation:(CGImagePropertyOrientation)orientation toSize:(CGSize)dstSize {\n OSType pixelFormat = CVPixelBufferGetPixelFormatType(srcPixelBuffer);\n \n CVPixelBufferLockFlags srcFlags = kCVPixelBufferLock_ReadOnly;\n CVPixelBufferLockBaseAddress(srcPixelBuffer, srcFlags);\n \n void *srcLuminanceData = CVPixelBufferGetBaseAddressOfPlane(srcPixelBuffer, 0);\n size_t srcLuminanceWidth = CVPixelBufferGetWidthOfPlane(srcPixelBuffer, 0);//750\n size_t srcLuminanceHeight = CVPixelBufferGetHeightOfPlane(srcPixelBuffer, 0);//1334\n size_t srcLuminanceBytesPerRow = CVPixelBufferGetBytesPerRowOfPlane(srcPixelBuffer, 0);//768\n \n void *srcCbCrData = CVPixelBufferGetBaseAddressOfPlane(srcPixelBuffer, 1);\n int srcCbCrWidth = (int)CVPixelBufferGetWidthOfPlane(srcPixelBuffer, 1);//375\n int srcCbCrHeight = (int)CVPixelBufferGetHeightOfPlane(srcPixelBuffer, 1);//667\n size_t srcCbCrBytesPerRow = CVPixelBufferGetBytesPerRowOfPlane(srcPixelBuffer, 1);//768\n \n vImage_Buffer srcLuminanceBuffer = {\n .data = srcLuminanceData,\n .width = srcLuminanceWidth,\n .height = srcLuminanceHeight,\n .rowBytes = srcLuminanceBytesPerRow\n };\n \n vImage_Buffer srcCbCrBuffer = {\n .data = srcCbCrData,\n .width = srcCbCrWidth,\n .height = srcCbCrHeight,\n .rowBytes = srcCbCrBytesPerRow\n };\n \n size_t srcWidth = srcLuminanceWidth;\n size_t srcHeight = srcLuminanceHeight;\n int dstWidth = (int)dstSize.width;\n int dstHeight = (int)dstSize.height;\n uint8_t rotationConstant = 0;\n size_t scaledWidth = srcLuminanceWidth;\n size_t scaledHeight = srcLuminanceHeight;\n if (orientation == kCGImagePropertyOrientationUp || orientation == kCGImagePropertyOrientationDown) {\n BOOL srcIsWider = dstHeight * srcWidth &gt; dstWidth * srcHeight;\n scaledWidth = srcIsWider ? dstWidth : (size_t)round((CGFloat)(dstHeight * srcWidth) / (CGFloat)srcHeight);\n scaledHeight = srcIsWider ? (size_t)round((CGFloat)(dstWidth * srcHeight) / (CGFloat)srcWidth) : dstHeight;\n rotationConstant = (orientation == kCGImagePropertyOrientationUp) ? kRotate0DegreesClockwise : kRotate180DegreesClockwise;\n } else if (orientation == kCGImagePropertyOrientationLeft || orientation == kCGImagePropertyOrientationRight) {\n BOOL srcIsWider = dstHeight * srcHeight &gt; dstWidth * srcWidth;\n scaledHeight = srcIsWider ? dstWidth: (size_t)round((CGFloat)(srcHeight * dstHeight) / (CGFloat)srcWidth);\n scaledWidth = srcIsWider ? (size_t)round((CGFloat)(srcWidth * dstWidth) / (CGFloat)srcHeight) : dstHeight;\n rotationConstant = (orientation == kCGImagePropertyOrientationLeft) ? kRotate90DegreesClockwise : kRotate90DegreesCounterClockwise;\n }\n \n Pixel_8 backColor = 0;\n \n CVPixelBufferRef dstPixelBuffer = NULL;\n CVReturn result = CVPixelBufferCreate(kCFAllocatorDefault,\n dstWidth,\n dstHeight,\n pixelFormat,\n nil,\n &amp;dstPixelBuffer);\n CVPixelBufferLockBaseAddress(dstPixelBuffer, 0);\n \n void *dstLuminanceData = CVPixelBufferGetBaseAddressOfPlane(dstPixelBuffer, 0);\n int dstLuminanceWidth = (int)CVPixelBufferGetWidthOfPlane(dstPixelBuffer, 0);//1280\n int dstLuminanceHeight = (int)CVPixelBufferGetHeightOfPlane(dstPixelBuffer, 0);//720\n size_t dstLuminanceBytesPerRow = CVPixelBufferGetBytesPerRowOfPlane(dstPixelBuffer, 0);//1280\n \n void *dstCbCrData = CVPixelBufferGetBaseAddressOfPlane(dstPixelBuffer, 1);\n int dstCbCrWidth = (int)CVPixelBufferGetWidthOfPlane(dstPixelBuffer, 1);//640\n int dstCbCrHeight = (int)CVPixelBufferGetHeightOfPlane(dstPixelBuffer, 1);//360\n size_t dstCbCrBytesPerRow = CVPixelBufferGetBytesPerRowOfPlane(dstPixelBuffer, 1);//1280\n \n vImage_Buffer dstLuminanceBuffer = {\n .data = dstLuminanceData,\n .width = dstLuminanceWidth,\n .height = dstLuminanceHeight,\n .rowBytes = dstLuminanceBytesPerRow\n };\n \n vImage_Buffer dstCbCrBuffer = {\n .data = dstCbCrData,\n .width = dstCbCrWidth,\n .height = dstCbCrHeight,\n .rowBytes = dstCbCrBytesPerRow\n };\n \n void *dstLuminanceIntermediateBufferData = malloc(scaledWidth*scaledHeight);\n vImage_Buffer dstLuminanceIntermediateBuffer = {\n .data = dstLuminanceIntermediateBufferData,\n .width = scaledWidth,\n .height = scaledHeight,\n .rowBytes = scaledWidth\n };\n vImage_Error error = vImageScale_Planar8(&amp;srcLuminanceBuffer, &amp;dstLuminanceIntermediateBuffer, nil, kvImageNoFlags);\n error = vImageRotate90_Planar8(&amp;dstLuminanceIntermediateBuffer, &amp;dstLuminanceBuffer, rotationConstant, backColor, kvImageBackgroundColorFill);\n free(dstLuminanceIntermediateBufferData);\n\n void *dstCbCrIntermediateBufferData = malloc(scaledWidth*scaledHeight);\n vImage_Buffer dstCbCrIntermediateBuffer = {\n .data = dstCbCrIntermediateBufferData,\n .width = scaledWidth/2,\n .height = scaledHeight/2,\n .rowBytes = scaledWidth\n };\n error = vImageScale_CbCr8(&amp;srcCbCrBuffer, &amp;dstCbCrIntermediateBuffer, nil, kvImageNoFlags);\n error = vImageRotate90_Planar16U(&amp;dstCbCrIntermediateBuffer, &amp;dstCbCrBuffer, rotationConstant, 127, kvImageBackgroundColorFill);\n free(dstCbCrIntermediateBufferData);\n \n CVPixelBufferUnlockBaseAddress(srcPixelBuffer, srcFlags);\n CVPixelBufferUnlockBaseAddress(dstPixelBuffer, 0);\n \n return dstPixelBuffer;\n}\n</code></pre>\n<p>The code works, but when an image has the kCGImagePropertyOrientationLeft or kCGImagePropertyOrientationRight orientation, green bars are added.</p>\n<p>How can I fix this problem?</p>\n"^^ . . "0"^^ . "ios 16 lockscreen playbutton is disabled but working fine with ios15 (iphone11)"^^ . "<p>Following this topic <a href="https://github.com/rafaelsetragni/awesome_notifications/issues/773" rel="nofollow noreferrer">https://github.com/rafaelsetragni/awesome_notifications/issues/773</a></p>\n<p>I have avoided this issue by comeback to version 0.6.21 of <code>awesome_notifications</code></p>\n"^^ . "2"^^ . "1"^^ . . . "What is the right syntax for adding Objective C @property into C++ class?"^^ . "0"^^ . . . . . . . . . . . . "1"^^ . "0"^^ . . . . . "18"^^ . . "core-data"^^ . . . . . . . . . . "0"^^ . "0"^^ . . . . "0"^^ . "0"^^ . "Weird. I'm still not quite sure I fully get it. So the declarator without an item list, even attached to a definition, is not considered a prototype in C17? Specifically referring to what you said: (C17 6.7.6.3 §14) "An empty list in a function declarator that is part of a definition of that function specifies that the function has no parameters." Is it because the function [body](https://en.wikipedia.org/wiki/Function_prototype#:~:text=In%20computer%20programming%2C%20a%20function,but%20omits%20the%20function%20body.) is omitted that they did not interpret the dec.+def. to be a prototype?"^^ . . . . "firebase"^^ . . . "1"^^ . . . . . "@TheDreamsWind I'll update the code for the persistentContainer property since the implementation is long"^^ . "0"^^ . "@user129393192 Yeah it was a strange call they made. Tbh the latest builds of gcc and clang are so experiemental and out of the loop with bugs and lacking in standard compliance that they can't really be trusted for production purposes. I used to find like at most one bug per year in these compilers, nowadays it's more like one bug per month and that's just my personal findings. And since they are open source, bugs won't get fixed - the maintainers are super busy inventing useless extensions that nobody will use or asked for. It's pretty sad, at least gcc used to be great."^^ . "Understood. So it's just the idea of uniformity that is now being upheld. So back to the original `int main() {}`, it seems like that's been saying that it takes no parameters in C17 (definition-attached), so it is strange to me that the compiler (clang) would yell at me for it."^^ . . "0"^^ . "1"^^ . . . . . . . "Thanks man!, its been a week, i have been checking the issue. finally it got resolved. but i wonder why the Build Libraries for Distribution effect __objC module?"^^ . . "0"^^ . "19"^^ . . . . . . . . "1"^^ . "avplayer"^^ . . . . "@user129393192 But in C23 draft N3096 6.7.6.3 §13 _"For a function declarator without a parameter type list: the effect is as if it were declared with a\nparameter type list consisting of the keyword `void`. A function declarator provides a prototype for the function."_"^^ . "<p>In Objective-C, any object reference can be <code>nil</code>, and any call to an object initializer must cope with the possibility that <code>nil</code> might be returned.</p>\n<p>In Swift, therefore, every Objective-C object would theoretically need to be an Optional — and in Swift 1 this was indeed the case: They were all implicitly unwrapped Optionals. Later, though, every single Objective-C object reference in Swift was hand-tweaked to be either a <em>normal</em> Optional or an ordinary non-Optional, depending on whether it could truly ever by <code>nil</code> or not.</p>\n<p>Well, the object that you get when you call <code>dispatch_group_create()</code> therefore <em>can</em> theoretically be <code>nil</code>, in fact it never will be. The creators of the Swift-style DispatchQueue code knew this, and so the DispatchGroup initializer is not nullable.</p>\n"^^ . . "0"^^ . "Thank you I have to set precompile prefix header to yes and in prefix header => PrefixHeader.pch"^^ . . . . . "0"^^ . . . "<p>I noticed a disparity between the Swift API for dispatch groups and the Objective-C API.</p>\n<p>The <a href="https://developer.apple.com/documentation/dispatch/dispatchgroup/1452975-init" rel="nofollow noreferrer"><code>init()</code> for <code>DispatchGroup()</code></a> returns a non optional value.</p>\n<p>But the Objective-C <a href="https://developer.apple.com/documentation/dispatch/1452975-dispatch_group_create" rel="nofollow noreferrer"><code>dispatch_group_create()</code></a> mentions a possibility for a <code>NULL</code> return:</p>\n<blockquote>\n<h1>Return Value</h1>\n<p>The newly created group, or NULL on failure.</p>\n</blockquote>\n<ul>\n<li>What might cause the Objective-C function to fail? What behind the scenes issues could cause the creation of the group to not be possible?</li>\n<li>Why is the Swift version not optional but the Objective-C version is? If creation could fail for any reason why would those same reasons not apply to Swift?</li>\n</ul>\n"^^ . "0"^^ . "how to downcase rootviewcontroller from appdelegate to define NSPersistentContainer in Objective C"^^ . . . "<p>Posting as answer per a commenter suggestion:</p>\n<p>In the case of this project what solved the issue was setting the &quot;Build Libraries for Distribution&quot; flag to &quot;No&quot;. The errors went away, and the project now compiles in Xcode 14.3.</p>\n"^^ . . . "0"^^ . "<p>My app crashes at line 4 in URLSession:dataTask:didReceiveResponse:completionHandler of AFURLSessionManager.m,it seems like the self object is released, the Func is where we add the callback:</p>\n<pre><code>- (void) Func:(AFHTTPSessionManager *)sessionManager {\n @weakify(self);\n [sessionManager setDataTaskDidReceiveResponseBlock:^NSURLSessionResponseDisposition(NSURLSession * _Nonnull session, NSURLSessionDataTask * _Nonnull dataTask, NSURLResponse * _Nonnull response) {\n @strongify(self);\n if (!self) {\n return NSURLSessionResponseCancel;\n }\n ......\n }\n ......\n}\n\n - (void)URLSession:(NSURLSession *)session\n dataTask:(NSURLSessionDataTask *)dataTask\n didReceiveResponse:(NSURLResponse *)response\n completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler\n {\n1 NSURLSessionResponseDisposition disposition = NSURLSessionResponseAllow;\n2 \n3 if (self.dataTaskDidReceiveResponse) {\n4 disposition = self.dataTaskDidReceiveResponse(session, dataTask, response);(line 1115 of original m file)\n5 }\n6 \n7 }\n</code></pre>\n<p>crash stack:</p>\n<pre><code> Exception Type: SIGSEGV\n Exception Codes: SEGV_ACCERR at 0x58fe10485d20\n Thread 13 Crashed:\n 0 libobjc.A.dylib 0x000000019d5f9c20 objc_msgSend\n 1 APPInfo 0x0000000105204e0c -[AFURLSessionManager URLSession:dataTask:didReceiveResponse:completionHandler:] at AFURLSessionManager.m:1115:28\n 2 CFNetwork 0x00000001a54c9934 CFURLConnectionCreateWithProperties\n 3 Foundation 0x19e75f2f0 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__\n 4 Foundation 0x19e7334a0 -[NSBlockOperation main]\n 5 Foundation 0x19e733430 __NSOPERATION_IS_INVOKING_MAIN__\n 6 Foundation 0x19e6f47d8 -[NSOperation start]\n 7 Foundation 0x19e6f450c __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__\n 8 Foundation 0x19e6f9c20 __NSOQSchedule_f\n 9 libdispatch.dylib 0x1ab8c1114 _dispatch_block_async_invoke2\n 10 libdispatch.dylib 0x1ab8b1fdc _dispatch_client_callout\n 11 libdispatch.dylib 0x1ab8b546c _dispatch_continuation_pop\n 12 libdispatch.dylib 0x1ab8b4ad4 _dispatch_async_redirect_invoke\n 13 libdispatch.dylib 0x1ab8c3a6c _dispatch_root_queue_drain\n 14 libdispatch.dylib 0x1ab8c4284 _dispatch_worker_thread2\n 15 libsystem_pthread.dylib 0x1f133bdbc _pthread_wqthread\n 16 libsystem_pthread.dylib 0x1f133bb98 start_wqthread\n</code></pre>\n"^^ . . "0"^^ . . . "<p>When I put an NSString value in obj c alert, and I updated the string, it doesn’t seem to change the value in the alert but when I print it, it prints the changed value</p>\n<pre><code>NSString *Value = @&quot;1&quot;; // Alert = 1\nNSlog(Value); // 1\nUIAlertController *alert = [UIAlertController alertControllerWithTitle:Value message:nil preferredStyle:UIAlertControllerStyleAlert]; // Alert = 1\n UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController;\n [topController presentViewController:alert animated:YES completion:nil];\n Value = @&quot;2&quot;; // Alert is still = 1\n NSlog(Value); // 2 \n</code></pre>\n"^^ . . . "0"^^ . . . "Can't compile due to no such module '__ObjC'"^^ . . "0"^^ . . . . . "0"^^ . . . . . . "41"^^ . . "1"^^ . . "1"^^ . "<p>I experience the same. I guess it's an Xcode issue, since it works with the prior version. In the meantime I use <code>@_implementationOnly import</code> to get rid of it.</p>\n"^^ . "<blockquote>\n<p>[ViewController] Calling <strong>-viewDidAppear</strong>: directly on a view controller is not supported, and may result in out-of-order callbacks and other inconsistent behavior. Use the -beginAppearanceTransition:animated: and -endAppearanceTransition APIs on UIViewController to manually drive appearance callbacks instead. Make a symbolic breakpoint at UIViewControllerAlertForAppearanceCallbackMisuse to catch this in the debugger</p>\n</blockquote>\n<p>May i know the exact reason causing this issue.</p>\n<p>Thanks in advance</p>\n"^^ . "@user129393192 Yes, a function declarator needed named parameters (or `void`) to have prototype format. This was deprecated in C89 too, I just quoted the current active ISO 9899:2018 ("C17") standard for convenience. In my old copy of C89, then 6.9.5 _"The use of function definitions with separate parameter identifier and declaration lists (not prototype-format parameter type and identifier declarators) is an obsolescent feature._ I think even the esteemed Dennis Ritchie commented about this at some point with regret and in favour of enforcing prototypes."^^ . . . "0"^^ . "0"^^ . . . . "1"^^ . . . "How is your `persistentContainer` property defined in the application delegate class?"^^ . . . . "0"^^ . "Transaction fails with ASDServerErrorDomain Code=3504 in production"^^ . . "1"^^ . . . . "literally `alert.title=@"Some new title";`"^^ . "<p>Is it possible to share <code>NSURL</code> and <code>NString</code> at the same time using the <code>UIActivityViewController</code>?\nI know it's possible using the <code>MFMessageComposeViewController</code> but wanted to use the native UI sheet so the user can select a different app if they wanted.</p>\n<p>In this example, the filePath variable is a path to a video file saved on the device.</p>\n<pre><code>NSMutableArray *items = [NSMutableArray new];\n[items addObject:[NSURL fileURLWithPath:filePath]];\nUIViewController *rootViewController = UnityGetGLViewController();\nUIActivityViewController *activity = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];\n[rootViewController presentViewController:activity animated:YES completion:nil];\n</code></pre>\n<p>Updating the items with an additional string value will result in only the video being shared.</p>\n<pre><code>NSMutableArray *items = [NSMutableArray new];\n[items addObject:[NSURL fileURLWithPath:filePath]];\n[items addObject:[NSString stringWithUTF8String:&quot;Check out this video!&quot;]];\nUIViewController *rootViewController = UnityGetGLViewController();\nUIActivityViewController *activity = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];\n[rootViewController presentViewController:activity animated:YES completion:nil];\n</code></pre>\n<p>The &quot;Check out this video!&quot; text is never included in the iMessage app.</p>\n<p>Is this something that is possible? If not It would be nice to see some official Apple documentation about this. Also, this would be quite surprising considering iMessage is a built-in app, you would imagine it would have this capability.</p>\n"^^ . . . . "8"^^ . . . . . "1"^^ . . "0"^^ . . . . "Sorry I had a mistake. There is no mistake in this code snippet. Now it's working properly. Thank you everyone who reached on this question."^^ . "2"^^ . . "The PDF file size is around 13KB. This file is supposed to be sent out via mail only. If the user haven't logged into the default mail app, I have a check if user uses gmail app, and if yes, I want to perform the above action. The mail is composed in gmail app without the file attached."^^ . "2"^^ . . . . "0"^^ . "Implement picture in picture mode (PIP) for video calls using Objective - C"^^ . "3"^^ . . "1"^^ . . . . . . . "you can't do that, you can mix obejctive-c and c++ in a single file but c++ classes can't have objective-c properties"^^ . . . . . "Have you found any solution for Archiving with this error and XC 14.3 ? The solution works for development, this is not a normal behaviour for production build :/"^^ . . "0"^^ . "0"^^ . . "0"^^ . "0"^^ . "41"^^ . . . "0"^^ . . . . "-1"^^ . . "1"^^ . "1"^^ . "5"^^ . . . . "0"^^ . . "Also, why specifically target the gmail app? Why not share the file using UIActivityViewController and let the user choose what they want to do with the file?"^^ . "Your approach is backwards. Pretend for a moment that your app doesn't need a login screen. Setup your app to initially show the app's main view controller as the root view controller. Now you can deal with the login. If, upon startup, you determine that a login is needed, present the login screen from the main root view. When the login is complete and the login view controller is dismissed, the main view becomes visible again without any need to for any weird changes."^^ . . "0"^^ . . "<p>This is my index.js</p>\n<pre><code>const className = 'NSURLConnection'\nconst methodName = 'sendSynchronousRequest:returningResponse:error:'\n\nInterceptor.attach(ObjC.classes[className][`+ ${methodName}`].implementation, {\n onEnter: function (args) {\n const response = new ObjC.Object(args[3])\n console.log('URL', response.URL())\n }\n})\n</code></pre>\n<p><code>args[3]</code> should be a <code>NSURLResponse</code>. If I understood correctly, based on what is written inside the <a href="https://developer.apple.com/documentation/foundation/nsurlconnection/1411393-sendsynchronousrequest?language=objc" rel="nofollow noreferrer">official documentation</a>, response arg should be a pointer to a pointer. When I try to log response url, everything breaks. How can I access the object like I would do with a normal pointer?</p>\n"^^ . . . . . . . . "0"^^ . . . . . "c"^^ . . "I don't know if this might help, but if you're using cocoapods an archiving issue we encountered was solved by changing source="$(readlink "${source}")" in the Pods-[ProjectName]-frameworks file to source="$(readlink -f "$source")". Article: https://stackoverflow.com/questions/75574268/missing-file-libarclite-iphoneos-a-xcode-14-3"^^ . . "0"^^ . . . "c++"^^ . . . . . . . . . "<p>I have tried with below mentioned code snippet. This code will execute when clicking on minimise button that I have created. But picture in picture mode is not working. Is there any errors in this code?</p>\n<pre class="lang-objc prettyprint-override"><code>AVPictureInPictureVideoCallViewController *hello= [[AVPictureInPictureVideoCallViewController alloc] init];\nhello.preferredContentSize = CGSizeMake(300, 400);\n[hello.view addSubview:self.view];\nAVPictureInPictureControllerContentSource *contentSource = [[AVPictureInPictureControllerContentSource alloc] initWithActiveVideoCallSourceView:self.view contentViewController:hello];\nself.pictureInPictureController = [[AVPictureInPictureController alloc] initWithContentSource:contentSource];\nself.pictureInPictureController.delegate = self;\nself.pictureInPictureController.canStartPictureInPictureAutomaticallyFromInline = YES;\n[self.pictureInPictureController startPictureInPicture];\n</code></pre>\n<p>This <code>self.pictureInPictureController</code> is <code>AVPictureInPictureController</code>.</p>\n<p>I need a proper answer for implement picture in picture mode for video call view.</p>\n"^^ . . "0"^^ . . . . "0"^^ . "Load New View Controller Instead of Presenting Temporary"^^ . . . . . . . "0"^^ . . "0"^^ . . . . "Why can Objective-C dispatch_group_create() return NULL but not Swift DispatchGroup()?"^^ . . . . "<p>I am currently developing a framework in Swift and in order to use NSClassFromString to perform reflection, the class I'm looking for needs to be loaded.</p>\n<p>In Objective-C, I could add -ObjC to the other linker flags in build settings to load the classes at build time and use NSClassFromString, but is there an equivalent for Swift?</p>\n<p>Although adding -ObjC works, I'm wondering if there's a different value for loading Swift classes.</p>\n"^^ . . "1"^^ . . . . "`readFilePath` and `image` are not `nil`. But still the error exists. The error is `error: (-215:Assertion failed) !_img.empty() in function 'imwrite'`."^^ . . "0"^^ . . . "0"^^ . . . "0"^^ . "0"^^ . . . "Mat nil when reading and writing images with openCV in ios"^^ . "So the common convention `int main()` has always been invalid? I received a compile error with strict compile flags on, and that was a first for me."^^ . . . . . . . . . "Unable to Share NSURL and NSString simultaneously to iMessage app"^^ . . . . . . "This solution doesn't seem to be universal. I need to be able to Archive my project which I can't seem to do with this setting unchecked. I can build it though..."^^ . "2"^^ . "0"^^ . . . . . . "0"^^ . . "1"^^ . "Click on your project file in Xcode, then in the Targets select the Project, then Build Settings tab, and search Build Libraries for Distribution. That sets it globally. You can also do it individually for a Pod in the Pods, Build Settings."^^ . . . . . "0"^^ . . . . . . "It seems to me that if you have the definition, and from the definition, you know it takes no parameters, that would suffice as a prototype, but perhaps they didn't see it that way, because the function body was attached, so it wasn't a "true" prototype?"^^ . "1"^^ . "Xcode 14.3 "no such module '__ObjC'""^^ . . "@reactor with help of debugger you can just check whether the controller instance where the exception gets thrown and the controller you create in the `-[UIApplicationDelegate application:didFinishLaunchingWithOptions:]` have the same addresses. If the addresses are the same, keep digging into the property of the controller (when it changes and to what values), if addresses are different, find out where the redundant controller come from."^^ . . . . . "<p>I am trying to use Swift class in objective-c code. I already went through <a href="https://stackoverflow.com/questions/44561770/no-type-or-protocol-named-avcapturephotocapturedelegate">this</a></p>\n<p>and I can't convert my <code>.mm</code> file to <code>.m</code> file as I am using react native's new architecture which requires <code>.mm</code> file</p>\n<p>I am trying this out for react native's new architecture which requires .mm file. Check <a href="https://reactnative.dev/docs/next/the-new-architecture/pillars-fabric-components" rel="nofollow noreferrer">here</a> to learn more</p>\n<p>My header file <code>RTNMyCamera.h</code></p>\n<pre><code>#import &lt;React/RCTViewComponentView.h&gt;\n#import &lt;UIKit/UIKit.h&gt;\nNS_ASSUME_NONNULL_BEGIN\n\n@interface RTNMyCamera : RCTViewComponentView\n\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<p>My <code>objective-c++</code> file <code>RTNMyCamera.mm</code></p>\n<pre><code>#import &quot;RTNMyCamera.h&quot;\n\n#import &lt;react/renderer/components/RTNMyCameraSpecs/ComponentDescriptors.h&gt;\n#import &lt;react/renderer/components/RTNMyCameraSpecs/EventEmitters.h&gt;\n#import &lt;react/renderer/components/RTNMyCameraSpecs/Props.h&gt;\n#import &lt;react/renderer/components/RTNMyCameraSpecs/RCTComponentViewHelpers.h&gt;\n\n#import &quot;myapp-Swift.h&quot;\n#import &quot;RCTFabric/React-RCTFabric-umbrella.h&quot;\n\nusing namespace facebook::react;\n\n@interface RTNMyCamera () &lt;RCTRTNMyCameraViewProtocol&gt;\n@end\n\n@implementation RTNMyCamera {\n UIView *_view;\n MyCamera *myCamera;\n}\n\n+ (ComponentDescriptorProvider)componentDescriptorProvider\n{\n return concreteComponentDescriptorProvider&lt;RTNMyCameraComponentDescriptor&gt;();\n}\n\n- (instancetype)initWithFrame:(CGRect)frame\n{\n if (self = [super initWithFrame:frame]) {\n static const auto defaultProps = std::make_shared&lt;const RTNMyCameraProps&gt;();\n _props = defaultProps;\n\n _view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];\n myCamera = [[MyCamera alloc] initWithFrame:_view.bounds];\n [_view addSubview: myCamera];\n \n self.contentView = _view;\n }\n\n return self;\n}\n\n@end\n\nClass&lt;RCTComponentViewProtocol&gt; RTNMyCameraCls(void)\n{\n return RTNMyCamera.class;\n}\n</code></pre>\n<p>My <code>swift</code> file <code>MyCamera</code></p>\n<pre><code>@objcMembers\nclass MyCamera: UIView,AVCapturePhotoCaptureDelegate,AVCaptureVideoDataOutputSampleBufferDelegate {\n //all of my business logic to capture photo\n}\n</code></pre>\n<p>Entire swift code <a href="https://gist.github.com/CodingWithNobody/8fb37230a34db2127442dd703506912e" rel="nofollow noreferrer">here</a></p>\n<p>I get getting error saying <code>No type or protocol named 'AVCapturePhotoCaptureDelegate'</code></p>\n<p>Here are few things I tried which did not work</p>\n<ol>\n<li>I cannot convert <code>.mm</code> to <code>.m</code></li>\n<li>I tried creating <code>PrefixHeader.pch</code> and added <code>#import &lt;AVFoundation/AVFoundation.h&gt;</code> as well as <code>@protocol AVCapturePhotoCaptureDelegate</code></li>\n<li>In <code>RTNMyCamera.h</code> I added <code>#import &lt;AVFoundation/AVFoundation.h&gt;</code>, <code>&lt;AVCapturePhotoCaptureDelegate,AVCaptureVideoDataOutputSampleBufferDelegate&gt;</code> and <code>@class MyCamera;</code></li>\n</ol>\n<p><a href="https://github.com/CodingWithNobody/Deleteme" rel="nofollow noreferrer">Here</a> is sample repo</p>\n"^^ . "Is there an equivalent to -ObjC in Xcode build settings for Swift?"^^ . "we did add that code: @weakify(self);\n [sessionManager setDataTaskDidReceiveResponseBlock:^NSURLSessionResponseDisposition(NSURLSession * _Nonnull session,\n NSURLSessionDataTask * _Nonnull dataTask,\n NSURLResponse * _Nonnull response) {\n @strongify(self);\n if (!self) {\n return NSURLSessionResponseCancel;\n }"^^ . . . "Did you find any solution? I am experiencing the same issue here after upgrading xcode to 14.3."^^ . "Works, thank you. However, every time I run `ionic cap sync` it reverts to `Yes`. Not sure if there's a way to configure it, for now I just reset it each sync."^^ . "javascript"^^ . . "accelerate-framework"^^ . . . "0"^^ . "Did you remove the old one? Same error code?"^^ . "1"^^ . "1"^^ . . "0"^^ . "dispatchgroup"^^ . "1"^^ . . "So if I'm understanding right, between C89 to C17, a "declarator" with no definition was not a prototype per se, but just some information to let the compiler know that symbol exists ... and now they are saying that the declarator does give a prototype for the function that must be later followed. Seems like if it were in C17 though, it weren't deprecated since C89, unless I'm missing something."^^ . . . . . . "Same issue.........."^^ . . . . . . "0"^^ . . "Your sample code doesn't reproduce this problem. It compiles file if EventEmitter references are commented out. I recommend building a tiny RN app that just imports this one thing, and build up from there until you reproduce the problem. Nothing you've described here seems to involve the C++, so it's unclear why that's your focus. Is there a C++ error you're not telling us about?"^^ . "0"^^ . "0"^^ . "3"^^ . . . . . . . "0"^^ . . "I'd rather not post an answer since all we know at this point is that it didn't work under iOS 15.6.1 and it works with 16.4.1. I have no way to check if it worked on any other versions before 15.6.1 or any other 16.x versions."^^ . . . "1"^^ . "1"^^ . . . "How to add Objective-c library manually to Xcode project"^^ . . . . . "8"^^ . . "0"^^ . . . . . "0"^^ . . . . "0"^^ . "In the asset catalog under the “rendering mode” for that image. Which option is selected! If it is selected as “template” then only the transparency of the image is used. The colour comes from the code. Change it to “original”"^^ . "2"^^ . . . . . . . . . . . . . . . "0"^^ . . . . . . . "This also works for me with Xcode 14"^^ . . "Also, there's no need to guess. libdispatch is open source: https://github.com/apple/swift-corelibs-libdispatch/blob/469c8ecfa0011f5da23acacf8658b6a60a899a78/src/semaphore.c#L29-L49"^^ . . . . "0"^^ . "@HangarRash "I have tried it, but it still won't reject the call"^^ . . . . . . "0"^^ . "0"^^ . "0"^^ . "0"^^ . . "0"^^ . "0"^^ . . . . "<p>Linking as static frameworks by adding <strong>use_frameworks! :linkage =&gt; :static</strong> to your Podfile. Flipper does not work when use_frameworks is enabled, and you should remove it from Podfile.</p>\n<p>Adding the <strong>-no-verify-emitted-module-interface</strong> flag to failing targets to avoid verification failure.\nYou can add the following post install hook to your Podfile to automatically add this flag. In my case my Pods were AEP so I used &quot;AEP&quot;.</p>\n<pre><code>post_install do |installer|\n installer.pods_project.targets.each do |t|\n if t.name.start_with?(&quot;AEP&quot;)\n t.build_configurations.each do |bc|\n bc.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -no-verify-emitted-module-interface'\n end\n end\n end\nend\n</code></pre>\n<p><a href="https://github.com/adobe/aepsdk-rulesengine-ios/issues/68#issuecomment-1548199715" rel="nofollow noreferrer">https://github.com/adobe/aepsdk-rulesengine-ios/issues/68#issuecomment-1548199715</a></p>\n"^^ . "0"^^ . . "<p>Ok one possible solution can be hide the navigation controller before pushing new views into the view hierarchy.</p>\n<pre><code>[homeViewNavigationController setNavigationBarHidden:YES animated:YES];\n</code></pre>\n<p>Reference:\n<a href="https://developer.apple.com/documentation/uikit/uinavigationcontroller/1621885-setnavigationbarhidden?language=objc" rel="nofollow noreferrer">https://developer.apple.com/documentation/uikit/uinavigationcontroller/1621885-setnavigationbarhidden?language=objc</a></p>\n"^^ . "<p>I encountered a weird thing. The colour of my custom image was changed in the running app!\n<a href="https://i.sstatic.net/G9pZ5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/G9pZ5.png" alt="enter image description here" /></a> The original colour of the alert bell image is red as shown. However, when the app runs, the colour of that bell changes to blue! <a href="https://i.sstatic.net/ToIbl.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ToIbl.png" alt="enter image description here" /></a></p>\n<p>The code to add the image is as follows:</p>\n<pre><code>UIImage *alertImage = [UIImage imageNamed:@&quot;alert_bell&quot;];\nUIImageView *imageView = [[UIImageView alloc] initWithImage:alertImage];\n[imageView setBackgroundColor:[UIColor redColor]];\nUIGestureRecognizer *tapGR = [[UIGestureRecognizer alloc] initWithTarget:self action:@selector(disruptionsAlertAction:)];\n[self.view addGestureRecognizer:tapGR];\ncell.accessoryView = imageView; // cell is a TableViewCell\n</code></pre>\n<p>I have idea what changed the colour if the bell and how to fix.</p>\n<p>I would very much appreciate it if anyone can please explain this and let me know how I can fix it. Heaps of thanks!</p>\n"^^ . . . . "22"^^ . . "<p>I'm trying to build for iOS in flutter. However, the compilation could not be completed because the module <code>__ObjC</code> was not found.</p>\n<pre><code>Launching lib/main.dart on iPhone 13 Pro Max in debug mode...\nmain.dart:1\nXcode build done. 42.7s\nFailed to build iOS app\nSwift Compiler Error (Xcode): Using bridging headers with module interfaces is unsupported\n\nUncategorized (Xcode): Command SwiftDriver emitted errors but did not return a nonzero exit code to indicate failure\n\nError (Xcode): no such module '__ObjC'\n/Users/myname/Library/Developer/Xcode/DerivedData/Runner-gnvomxdvkbnvhiftqgeatxtbshib/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/arm64/Runner.private.swiftinterface:11:18\n\nError (Xcode): failed to verify module interface of 'Runner' due to the errors above; the textual interface may be broken by project issues or a compiler bug\n/Users/myname/Library/Developer/Xcode/DerivedData/Runner-gnvomxdvkbnvhiftqgeatxtbshib/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/arm64/Runner.private.swiftinterface:0:0\n\nError (Xcode): no such module '__ObjC'\n/Users/myname/Library/Developer/Xcode/DerivedData/Runner-gnvomxdvkbnvhiftqgeatxtbshib/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/arm64/Runner.swiftinterface:11:18\n\nError (Xcode): failed to verify module interface of 'Runner' due to the errors above; the textual interface may be broken by project issues or a compiler bug\n/Users/myname/Library/Developer/Xcode/DerivedData/Runner-gnvomxdvkbnvhiftqgeatxtbshib/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/arm64/Runner.swiftinterface:0:0\n\nCould not build the application for the simulator.\nError launching application on iPhone 13 Pro Max.\nExited\n</code></pre>\n<p>What is __ObjC? This happens after upgrading Xcode version to 14.3.\nHow can this be fixed? Please someone answer.</p>\n<pre><code>[✓] Flutter (Channel stable, 3.7.6, on macOS 13.3.1 22E261 darwin-arm64, locale ja-JP)\n • Flutter version 3.7.6 on channel stable at /Users/myname/flutter\n • Upstream repository https://github.com/flutter/flutter.git\n • Framework revision 12cb4eb7a0 (6 weeks ago), 2023-03-01 10:29:26 -0800\n • Engine revision ada363ee93\n • Dart version 2.19.3\n • DevTools version 2.20.1\n\n[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)\n • Android SDK at /Users/myname/Library/Android/sdk\n • Platform android-33, build-tools 32.1.0-rc1\n • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java\n • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)\n • All Android licenses accepted.\n\n[✓] Xcode - develop for iOS and macOS (Xcode 14.3)\n • Xcode at /Applications/Xcode.app/Contents/Developer\n • Build 14E222b\n • CocoaPods version 1.12.0\n\n[✓] Chrome - develop for the web\n • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome\n\n[✓] Android Studio (version 2021.2)\n • Android Studio at /Applications/Android Studio.app/Contents\n • Flutter plugin can be installed from:\n https://plugins.jetbrains.com/plugin/9212-flutter\n • Dart plugin can be installed from:\n https://plugins.jetbrains.com/plugin/6351-dart\n • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)\n\n[✓] VS Code (version 1.77.1)\n • VS Code at /Applications/Visual Studio Code.app/Contents\n • Flutter extension version 3.62.0\n\n[✓] Connected device (3 available)\n • iPhone 13 Pro Max (mobile) • 63E17FF6-0922-418E-A209-49173C8A4E71 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator)\n • macOS (desktop) • macos • darwin-arm64 • macOS 13.3.1 22E261 darwin-arm64\n • Chrome (web) • chrome • web-javascript • Google Chrome 112.0.5615.49\n\n[✓] HTTP Host Availability\n • All required HTTP hosts are available\n\n• No issues found!\n</code></pre>\n"^^ . . "1"^^ . "<p>This is a very simple issue I'm having, but I can't find anything about how to log an event like this in my debug console. This is what I am trying to po:</p>\n<p>I've tried accessing the logEvent message and selectedValue<a href="https://i.sstatic.net/FZj0R.png" rel="nofollow noreferrer">enter image description here</a> anyway I could think to and nothing seems to be working.</p>\n"^^ . . . . . . . "0"^^ . . "parse-platform"^^ . . . "1"^^ . "0"^^ . "What specific programmatic thing "like LInux" do you mean? What C code would you write on Linux that would do what you mean? (Bluetooth is a broad topic that includes several somewhat unrelated protocols. BLE is not the same as BT Audio is not the same as a BT network adapter. Perhaps `system_profiler SPBluetoothDataType` is what you're looking for?"^^ . "0"^^ . "0"^^ . . "uiactivityviewcontroller"^^ . . . . . . . . . . . . "0"^^ . . . "0"^^ . . . . "1"^^ . . . . . . . . . "5"^^ . . . "Update String in objective C alert"^^ . "3"^^ . . "This is correct answer as with Xcode 15. Thanks!"^^ . . . "1"^^ . "@user129393192 It confused me too, see https://stackoverflow.com/questions/76063843/regarding-mainstream-compilers-and-int-main-in-c23"^^ . "<p>You need to import AVFoundation into your Swift file that uses AVCapturePhotoCaptureDelegate, not your ObjC++. In MyCamera.swift you want <code>import AVFoundation</code>.</p>\n<hr />\n<p>Looking at your repo, you created a prefix header, but didn't configure the project to use it.</p>\n<pre><code>// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.\n</code></pre>\n<p>The build setting you want is in the general pane:</p>\n<p><a href="https://i.sstatic.net/SvS8k.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/SvS8k.png" alt="Apple Clang - Language section, Prefix Header" /></a></p>\n<p>It's called <code>GCC_PREFIX_HEADER</code>.</p>\n"^^ . . . . "vimage"^^ . . "image-processing"^^ . "0"^^ . . . . "I have also tried to download the pdf early, maybe 40 minutes or more before it is needed, but have the same results when it is time to draw it"^^ . . . . . . . . . . . . . . . "imessage"^^ . . "2"^^ . "I can't reproduce this. In my own app, if I pass an array with a file NSURL for a local video (a .mov file originally selected from the photo library) and the same string shown in your question, then when the activity view appears, selecting Messages results in the New Message screen appearing and the message contains the text followed by the video. Selecting Mail also shows a new email screen with the text and the video both in place in the message body. I tested this with an Objective-C app on a real iPhone 13 Pro running iOS 16.4.1."^^ . "I found a solution here: https://stackoverflow.com/questions/41243007/how-to-include-nspersistentcontainer-in-appdelegate where instead of passing the persistent container from the appdelegate, I would define it in the view controller like so `self.persistentContainer = ((AppDelegate *)[UIApplication sharedApplication].delegate).persistentContainer;`. I'm not super happy about this solution but it's the only one I found that works. if there's a better solution, I'm game."^^ . . "How can I read ObjC pointer to pointer (**) using Fida Javascript APIs?"^^ . "3"^^ . . . "How to resize CVPixelBufferRef 420f with preserving aspect ratio?"^^ . . "1"^^ . . . . "pfquery"^^ . "`applicationWillTerminate` is rarely called. Even when it is called, the app will be terminated long before the code in the `dispatch_after` blocks is ever called. Try without the use of `dispatch_after`."^^ . . . . "How can I read a NSDictionary using Frida Javascript APIs?"^^ . "A 13kB attachment becomes roughly 18kB as a base64 encoded string. So you are trying to create a URL with over 18,000 characters. I just did a test on an iPhone 13 Pro running iOS 16.4.1 and it had no trouble with such a URL. I was able to decode a 16kB attachment just fine. So that's not the issue. Again, does the gmail app support the `attachment` query parameter? If so, what format does it expect?"^^ . . . . "1"^^ . . . "@AlexeyStarinsky frankly i don't know which exact methods you need here. As far as I can see from [the documentation](https://yandex.ru/dev/mobile-ads/doc/ios/ref/Protocols/YMAInterstitialAdDelegate.html) most of the methods are optional, so it's probably up to you to decide which one needs customisation. I added a sample code for such a class which should give you a general idea of the approach"^^ . . . . "-1"^^ . "<p>For simple key-value dictionaries you can easily convert everything to a Java JSON structure by looping through all keys and their values:</p>\n<pre><code>const className = 'NSURLConnection'\nconst methodName = 'sendSynchronousRequest:returningResponse:error:'\n\nInterceptor.attach(ObjC.classes[className][`+ ${methodName}`].implementation, {\n onEnter: function (args) {\n const request = new ObjC.Object(args[2])\n let json = convertNsDictionaryToJson(request.allHTTPHeaderFields);\n console.log('HTTPHeaders', JSON.stringify(json));\n }\n})\n\n\nfunction convertNsDictionaryToJson(nsDict) {\n let jsDict = {};\n let keys = nsDict.allKeys();\n let keyCount = keys.count();\n for (var i = 0; i &lt; keyCount; i++) {\n let key = keys.objectAtIndex_(i);\n let value = new ObjC.Object(nsDict.objectForKey_(key));\n jsDict[key] = String(value); // convert everything to a JavaScript String representation\n }\n return jsDict;\n}\n</code></pre>\n<p>Note that the code converts every value to it's String representation. Depending on what is stored inside the <code>NSDictionary</code> this may be necessary or not. The posted code converts everything to String to make sure no ObjC specific types remain as these types can not be serialized if you plan to serialize the JSON structure to a String and print it or use Frida's <code>send()</code> method.</p>\n"^^ . . . "@user129393192 It does indirectly since it is a non-prototype format and the compiler can't know the types passed until it finds a function definition. But this was never really a "feature", just a language flaw."^^ . "1"^^ . "5"^^ . . . "The issue with AVPlayer was fixed in iOS 16.1. Can you mention the OS version"^^ . . "3"^^ . . . . "0"^^ . "You need to test what? If there's a hardware problem, there definitely isn't a simple API call that will tell you the hardware is broken. (In that case, Bluetooth is "supported," so to your question, the correct response would be true, even though it doesn't work.) Do you have broken hardware that you're trying to help users diagnose? That's likely a very complex project."^^ . . . . "Downloaded PDF Not Accessible"^^ . . "<p>I think you need to make sure the class implementing <code>AVCapturePhotoCaptureDelegate</code> extends <code>NSObject</code>.</p>\n"^^ . "6"^^ . "0"^^ . . . . "3"^^ . . "1"^^ . . . . . "40"^^ . "1"^^ . "@Rob Napier\n what does `system_profiler SPBluetoothDataType` return if no bluetooth card is available"^^ . . . . . . "0"^^ . "0"^^ . . "<p>I am attempting to run the MasterPass sandbox sample app in Xcode 13.3 provided by the <a href="https://developer.mastercard.com/masterpass-merchant-integration-v7/documentation/mobile-integration/masterpass-checkout-ios-sdk-v28/" rel="nofollow noreferrer">MasterPass docs</a>, however the</p>\n<pre><code>error: using bridging headers with module interfaces is unsupported\n</code></pre>\n<p>error in my logs keeps persisting. I am attempting to do this because I would prefer to tinker with it first before integrating it with my project</p>\n<p>I am using Xcode 13.3, macOS Monterrey mac mini 2018 32GB. I have gone through quite a number of similar questions here on stackoverflow on the same issue, but the solutions thereof have been unsuccessful on my project at this time, hence the need to ask a separate question, with particularity on using the MasterPass iOS SDK</p>\n<ol>\n<li>First, I got the following error message during compilation on the MerchantServices and MCCMerchant frameworks</li>\n</ol>\n<pre><code>building for ios simulator, but the linked and embedded framework 'mcc merchant.framework' was built for ios + ios simulator\n</code></pre>\n<p>I resolved that by going to my Build Settings on the specified target and setting the value on Validate Workspace to YES</p>\n<ol start="2">\n<li>I attempted to build the project and this second error popped up</li>\n</ol>\n<pre><code>module compiled with swift 5.0 cannot be imported by the swift 5.6 compiler\n</code></pre>\n<p>This I resolved by setting the Build Settings &gt; Build Options &gt; Build Libraries for Distribution option to Yes</p>\n<ol start="3">\n<li>Next build attempt resulted in the following error messages, but this time, it was in the crash logs</li>\n</ol>\n<pre><code>remark: incremental compilation has been disabled: it is not compatible with whole module optimization\n\nerror: using bridging headers with module interfaces is unsupported\n</code></pre>\n<p>I then resolved the remark by setting the Build Settings &gt; Swift Compiler &gt; Compilation Mode option to Incremental</p>\n<p>leaving</p>\n<pre><code> error: using bridging headers with module interfaces is unsupported \n</code></pre>\n<p>unresolved</p>\n<ol start="4">\n<li>I took the following steps to try to resolve the issue</li>\n</ol>\n<p>4.a - Created a modulemap file to expose the Objective-C headers to my Swift project, BridgingMerchantModule.modulemap</p>\n<p>4.b - the following code was in the provided MerchantCheckoutApp-Bridging-Header.h file</p>\n<pre><code>//\n// Use this file to import your target's public headers that you would like to expose to Swift.\n//\n\n#import &quot;SDWebImage/UIImageView+WebCache.h&quot;\n</code></pre>\n<p>4.c - I wrote the following Swift code in my modulemap file</p>\n<pre><code>module BridgingMerchantModule {\n header &quot;SDWebImage/UIImageView+WebCache.h&quot;\n export *\n}\n</code></pre>\n<p>4.d - Removed the provided bridging header file from the project (MerchantCheckoutApp-Bridging-Header.h)</p>\n<p>4.e - In Project Settings &gt; Build Settings &gt; Swift Compiler - Search Paths &gt; Import Paths I added the path to the module map file on my Mac</p>\n<p>However the error persists, I am at my wits end and I would appreciate any help</p>\n<p>The following is the complete build log</p>\n<p>Compile Swift source files (x86_64)</p>\n<pre><code>CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'MerchantCheckoutApp' from project 'MerchantCheckoutApp')\n cd /Users/user226714/Desktop/masterpass_merchant_ios_sdk_v280-2/SampleSourceCode/MerchantCheckoutApp\n export DEVELOPER_DIR\\=/Applications/Xcode13.3.app/Contents/Developer\n export SDKROOT\\=/Applications/Xcode13.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.4.sdk\n /Applications/Xcode13.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name MerchantCheckoutApp -O -enable-batch-mode -enforce-exclusivity\\=checked @/Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Intermediates.noindex/MerchantCheckoutApp.build/Release-iphonesimulator/MerchantCheckoutApp.build/Objects-normal/x86_64/MerchantCheckoutApp.SwiftFileList -DDEBUG -sdk /Applications/Xcode13.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.4.sdk -target x86_64-apple-ios9.0-simulator -g -module-cache-path /Users/user226714/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -enable-testing -enable-library-evolution -swift-version 4 -I /Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Products/Release-iphonesimulator -F /Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Products/Release-iphonesimulator -F /Users/user226714/Desktop/masterpass_merchant_ios_sdk_v280-2/SampleSourceCode/MerchantCheckoutApp/Carthage/Build/iOS -F MerchantCheckoutApp/ExternalComponents -c -j4 -output-file-map /Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Intermediates.noindex/MerchantCheckoutApp.build/Release-iphonesimulator/MerchantCheckoutApp.build/Objects-normal/x86_64/MerchantCheckoutApp-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Intermediates.noindex/MerchantCheckoutApp.build/Release-iphonesimulator/MerchantCheckoutApp.build/Objects-normal/x86_64/MerchantCheckoutApp.swiftmodule -emit-module-interface-path /Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Intermediates.noindex/MerchantCheckoutApp.build/Release-iphonesimulator/MerchantCheckoutApp.build/Objects-normal/x86_64/MerchantCheckoutApp.swiftinterface -Xcc -I/Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Intermediates.noindex/MerchantCheckoutApp.build/Release-iphonesimulator/MerchantCheckoutApp.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Intermediates.noindex/MerchantCheckoutApp.build/Release-iphonesimulator/MerchantCheckoutApp.build/MerchantCheckoutApp-generated-files.hmap -Xcc -I/Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Intermediates.noindex/MerchantCheckoutApp.build/Release-iphonesimulator/MerchantCheckoutApp.build/MerchantCheckoutApp-own-target-headers.hmap -Xcc -I/Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Intermediates.noindex/MerchantCheckoutApp.build/Release-iphonesimulator/MerchantCheckoutApp.build/MerchantCheckoutApp-all-target-headers.hmap -Xcc -iquote -Xcc /Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Intermediates.noindex/MerchantCheckoutApp.build/Release-iphonesimulator/MerchantCheckoutApp.build/MerchantCheckoutApp-project-headers.hmap -Xcc -I/Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Products/Release-iphonesimulator/include -Xcc -I/Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Intermediates.noindex/MerchantCheckoutApp.build/Release-iphonesimulator/MerchantCheckoutApp.build/DerivedSources-normal/x86_64 -Xcc -I/Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Intermediates.noindex/MerchantCheckoutApp.build/Release-iphonesimulator/MerchantCheckoutApp.build/DerivedSources/x86_64 -Xcc -I/Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Intermediates.noindex/MerchantCheckoutApp.build/Release-iphonesimulator/MerchantCheckoutApp.build/DerivedSources -Xcc -DDEBUG\\=1 -emit-objc-header -emit-objc-header-path /Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Intermediates.noindex/MerchantCheckoutApp.build/Release-iphonesimulator/MerchantCheckoutApp.build/Objects-normal/x86_64/MerchantCheckoutApp-Swift.h -import-objc-header /Users/user226714/Desktop/masterpass_merchant_ios_sdk_v280-2/SampleSourceCode/MerchantCheckoutApp/MerchantCheckoutApp/Modules/BridgingMerchantModule.modulemap -pch-output-dir /Users/user226714/Library/Developer/Xcode/DerivedData/MerchantCheckoutApp-evrhdgvhehrtuybmevsukiurddrn/Build/Intermediates.noindex/PrecompiledHeaders -working-directory /Users/user226714/Desktop/masterpass_merchant_ios_sdk_v280-2/SampleSourceCode/MerchantCheckoutApp\n\nerror: using bridging headers with module interfaces is unsupported\nCommand CompileSwiftSources failed with a nonzero exit code\n\n</code></pre>\n"^^ . . "0"^^ . . "1"^^ . . . "@HangarRash Interesting, I tested it on a real iPhone 12 iOS 15.6.1 using an mp4 file downloaded into the app data. There are several differences in our test cases, I could try using the same conditions as you. Also, it would be great if you could post a snippet of the code so we could compare that as well, thanks."^^ . . . "Maybe you need update `cocoapods` itself?"^^ . . . . "1"^^ . . . "5"^^ . . . "avkit"^^ . "cocoapods"^^ . . . "0"^^ . . . . "0"^^ . . "I've tried this out, and as I didn't have a property for the image view, I tried it out using the existing image view, but it refused to draw anything when I ran it."^^ . . . "<p>I think you need to set the rendering mode of the image view as <strong>&quot;UIImageRenderingModeAlwaysOriginal&quot;</strong></p>\n<pre><code>UIImage *myIcon = [[UIImage imageNamed:@&quot;alert_bell&quot;] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];\nUIImageView *myImageView = [[UIImageView alloc] initWithImage:myIcon];\n</code></pre>\n<p>This could solve your issue.</p>\n"^^ . . "pod lib lint error for objective C library"^^ . . "bridging-header"^^ . . . "0"^^ . . . . . "1"^^ . "0"^^ . . . "objective-c"^^ . "I don't know if it's possible, I think yes (a hardware problem, ...), I need to test it."^^ . "1"^^ . . . . . . "0"^^ . . . "1"^^ . "1"^^ . . . . "0"^^ . "As long as you develop an iOS application, which anyway requires Cocoa Touch framework, you are required to have an Objective-C compatible compiler. Why can't you just use an Objective-C class here?"^^ . . . . . "Why AFNetWork crashes in URLSession:dataTask:didReceiveResponse:completionHandler"^^ . . . . . "0"^^ . "<p>I'm trying to follow the steps <a href="https://developer.apple.com/documentation/coredata/setting_up_a_core_data_stack?language=objc" rel="nofollow noreferrer">Setting Up a Core Data Stack documentation</a> for setting up Core Data using Objective-C but it appears to only show Swift implementation. The main view controller I have is of class <code>TodoListTableViewController</code>, which is embedded in a navigation controller like so:</p>\n<blockquote>\n<p>Application Entry Point-&gt;<code>UINavigationController</code>-&gt;<code>TodoListTableViewController</code></p>\n</blockquote>\n<p>I tried defining my <code>-[UIApplicationDelegate application:didFinishLaunchingWithOptions:]</code> like so:</p>\n<pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n // Override point for customization after application launch.\n if (self.persistentContainer == nil) {\n [NSException raise:@&quot;did not initialize persistent container in app delegate&quot; format:@&quot;no init&quot;];\n }\n\n UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@&quot;Main&quot; bundle:nil];\n TodoListTableViewController *todoListVC = [mainStoryboard instantiateViewControllerWithIdentifier:@&quot;TodoListTableViewController&quot;];\n todoListVC.persistentContainer = self.persistentContainer;\n UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:todoListVC];\n self.window.rootViewController = navController;\n \n return YES;\n}\n</code></pre>\n<p>but I'm getting a missing container exception since I added a check for the existence of <code>persistentContainer</code> in <code>TodoListTableViewController</code> class like so:</p>\n<pre><code>- (void)viewDidLoad {\n [super viewDidLoad];\n if (self.persistentContainer == nil) {\n [NSException raise:@&quot;missing container&quot; format:@&quot;missing container&quot;];\n }\n}\n</code></pre>\n<hr />\n<p><strong>EDIT</strong>: below is the boilerplate Ccore Data related code in my <code>AppDelegate</code> class for adding both the persistent container and context generated by Xcode when opting in for Core Data, that I'm using:</p>\n<pre><code>@synthesize persistentContainer = _persistentContainer;\n\n- (NSPersistentContainer *)persistentContainer {\n // The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it.\n @synchronized (self) {\n if (_persistentContainer == nil) {\n _persistentContainer = [[NSPersistentContainer alloc] initWithName:@&quot;ToDoList&quot;];\n [_persistentContainer loadPersistentStoresWithCompletionHandler:^(NSPersistentStoreDescription *storeDescription, NSError *error) {\n if (error != nil) {\n // Replace this implementation with code to handle the error appropriately.\n // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.\n \n /*\n Typical reasons for an error here include:\n * The parent directory does not exist, cannot be created, or disallows writing.\n * The persistent store is not accessible, due to permissions or data protection when the device is locked.\n * The device is out of space.\n * The store could not be migrated to the current model version.\n Check the error message to determine what the actual problem was.\n */\n NSLog(@&quot;Unresolved error %@, %@&quot;, error, error.userInfo);\n abort();\n }\n }];\n }\n }\n \n return _persistentContainer;\n}\n\n#pragma mark - Core Data Saving support\n\n- (void)saveContext {\n NSManagedObjectContext *context = self.persistentContainer.viewContext;\n NSError *error = nil;\n if ([context hasChanges] &amp;&amp; ![context save:&amp;error]) {\n // Replace this implementation with code to handle the error appropriately.\n // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.\n NSLog(@&quot;Unresolved error %@, %@&quot;, error, error.userInfo);\n abort();\n }\n}\n</code></pre>\n<p>And the header file included by xcode in AppDelegate:</p>\n<pre><code>@property (readonly, strong) NSPersistentContainer *persistentContainer;\n</code></pre>\n<p>thank you.</p>\n"^^ . . . "0"^^ . "0"^^ . . . . . . . "0"^^ . "Also swift have own reflection: https://developer.apple.com/documentation/swift/debugging-and-reflection"^^ . "pdf"^^ . . "0"^^ . . . "segmentation-fault"^^ . . "1"^^ . "under what heading in xcode? Where do i find this?"^^ . . "callkit"^^ . . . ""error: using bridging headers with module interfaces is unsupported" when attempting to run the sample MerchantCheckoutApp from MasterPass docs"^^ . . "0"^^ . "Were you able to solve your issue? I have been stuck on this for a few weeks myself."^^ . "0"^^ . . "Do you want to know if Bluetooth is switched on in the system prefs?"^^ . . "0"^^ . "mastercard"^^ . . . "3"^^ . . "0"^^ . . . . . . "Thanks for your reply. I did the same for now. Couldn't get it working on Xcode 14.3, sadly."^^ . . . "0"^^ . . . "0"^^ . "0"^^ . . . . . . . . . . . . . . . . "@Cy-4AH \nI'm sorry for being late. \nIf there is a `module B` in `module A`, I am attempting to perform reflection. Therefore, in `module A`, I am trying to retrieve a class without importing the `module B`, using `NSClassFromString` to check if the class exists and then obtain it. However, if the class is not already loaded because I did not use the `-ObjC` or `-all_load` flags, `NSClassFromString` will return nil. Therefore, I am wondering if there is a flag in Swift that can load classes beforehand similar to the `-ObjC` flag."^^ . . . "It register the message to its database, so you'd need to ask the database the last event registered. I don't know if Firebase provides a method to do so..."^^ . . "1"^^ . . . "2"^^ . "1"^^ . . . . . . . "react-native"^^ . "1"^^ . "0"^^ . . "0"^^ . . "1"^^ . . . . "0"^^ . "0"^^ . "uikit"^^ . "0"^^ . "3"^^ . . . . . . "0"^^ . . . . . . . "2"^^ . "No. It is a separate line after you create `alert`. You simply need to assign a new value to the `title` property."^^ . "0"^^ . "<p>Images in both coregraphics and corevideo can have an orientation tag. This means that the image may be rotated or flipped in the storage container relative to how it is supposed to be drawn. VImage however doesn’t have any such concept. As far as it is concerned, pixels is pixels. Where things go wrong is when the logical height and width don’t match the physical height and width. VImage is concerned only with the physical height and width, whereas these other APIs will likely feed you the logical height and width, as it would appear on screen so you can position it correctly. (They regard the storage format as an Implementation detail, while VImage does not.) When the rotation is left or right, I would suggest trying swapping the height and width when populating the vImage_Buffer structure so that it matches the storage orientation.</p>\n<p>If the stripe is really tiny for a resampling filter, like 1-3 pixels wide, then I’d probably also look at whether I’d correctly described the size of the image. Resampling filters will look at at least the 6 nearest src pixels to the center of the new pixel. If some of those are garbage, particularly off the right or bottom of the image, then you get garbage in / garbage out. Vimage is very careful not to touch nonexistent or logically nonexistent pixels, but if the data is incorrectly described in the vimage_buffer struct then it may be licensed to use that data and then you’ll get stripes at edges and/or a crash.</p>\n<p>Note that vimage scale is not appropriate for tiled images. It will need to see the surrounding area outside the tile to work correctly, which is likely absent. This will cause stitching edges visible in the result at tile boundaries. To solve this problem, you’d need to fall back on the lower level shear routines. Alas vImage doesn’t provide a way to know how many extra scanlines / columns will be needed, so this is <em>hard</em> for downsampling.</p>\n"^^ . . "0"^^ . "<p>Bluetooth is always supported. But I believe the thing you're looking for is the IOBluetoothHostController:</p>\n<pre><code>import IOBluetooth\n\nlet controller = IOBluetoothHostController.default()!\nprint(controller.powerState)\n</code></pre>\n<p>While <code>.default()</code> returns an implicitly unwrapped optional (because it lacks optionality annotations), I don't believe it's possible for it to actually return nil. There is always a Bluetooth module.</p>\n<p>You probably want to read <a href="https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/Bluetooth/BT_Bluetooth_On_MOSX/BT_Bluetooth_On_MOSX.html#//apple_ref/doc/uid/TP30000997-CH215-TPXREF16" rel="nofollow noreferrer">Bluetooth on OS X</a>, though I don't believe it's fully up-to-date (it references some non-existent classes, though it's possible some of those classes are merely private).</p>\n"^^ . . . . . "1"^^ . . "I am not sure why you are getting this error but a prototype of your function is simply `GDTCORNetworkType GDTCORNetworkTypeMessage();`. It is used to split interface and implementation. Try adding this line to the top of your file. But I doubt this would be the only function in the source that has no prototype defined."^^ . . . . . "0"^^ . "sdk"^^ . "0"^^ . . "2"^^ . . . "22"^^ . "<p>add (void) in every function this error occur on</p>\n"^^ . . . . "0"^^ . "`NSClassFromString` is loading ObjC classes, isn't it? Doesn't matter how you describe their interfaces with Objc of Swift. But Swift was designed to get rid from `-ObjC` flag. Could you describe more yours case when you have issues without `-ObjC` flag?"^^ . . . . "0"^^ . "Same as https://stackoverflow.com/questions/75189250/warning-a-function-declaration-without-a-prototype-is-deprecated-in-all-version"^^ . . "I solved by downgrading Xcode to 14.2"^^ . . . . "0"^^ . . . "@Fogmeister Thank you for your comment. I did as you said. And it worked!"^^ . "<p>I have the below code which I wanted to use to load a new view controller after the user enters the app via a login form. The problem with this implementation is that when I load the new view, it's own navigation bar doesn't appear on the screen, I think because i the purpose of this function is temporary presentation, when the user can switch back to the previous view. My question is how could I load the other view to display its on navigation bar and don't let the user to go back to the previous view (login area)?</p>\n<pre><code>UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@&quot;Main&quot; bundle:nil];\nUINavigationController *homeViewNavigationController = [storyboard instantiateViewControllerWithIdentifier:@&quot;Tab&quot;];\n[homeViewNavigationController setModalPresentationStyle:UIModalPresentationFullScreen];\n[self presentViewController:homeViewNavigationController animated:animated completion:nil];\n</code></pre>\n"^^ . . . "afnetworking"^^ . "bluetooth"^^ . . "0"^^ . "2"^^ . . "0"^^ . "<p>In my C++ project I have a base class for interstitial ad:</p>\n<pre><code>class InterstitialAd\n{\npublic:\n\n virtual void initialize(std::string unit_id) = 0;\n\n virtual void load() = 0;\n\n virtual void show() = 0;\n\n virtual void uninitialize() = 0;\n};\n</code></pre>\n<p>and need to implement it of iOS with <a href="https://yandex.ru/dev/mobile-ads/doc/ios/quick-start/interstitial.html?lang=en" rel="nofollow noreferrer">Yandex Mobile Ads</a>. According to their <a href="https://yandex.ru/dev/mobile-ads/doc/ios/quick-start/interstitial.html?lang=en" rel="nofollow noreferrer">docs</a> I need to add a <code>@property</code> and initialize it in my <code>initialize</code> method like this:</p>\n<pre><code>class YandexIosInterstitialAd : public InterstitialAd\n{\n public:\n \n void initialize(std::string unit_id) override\n {\n //access interstitialAd here and add a code like this:\n\n self.interstitialAd = [[YMAInterstitialAd alloc] initWithAdUnitID:&lt;your unique AdUnitId&gt;];\n self.interstitialAd.delegate = self;\n [self.interstitialAd load];\n }\n\n private:\n \n //Need to declare this property \n @property (nonatomic, strong) YMAInterstitialAd *interstitialAd;\n}\n</code></pre>\n<p>what is the right syntax for that?</p>\n<p>Ideally that <code>@property</code> should be declared inside my <code>YandexIosInterstitialAd</code> class, but not globally.</p>\n"^^ . "1"^^ . . . . . . . . . "objective-c++"^^ . . . . "0"^^ . . . "<p>I would like to add the Objective-c version of the <a href="https://github.com/pinterest/PINRemoteImage" rel="nofollow noreferrer">PINRemoteImage library</a> to my project manually. Based on their <a href="https://github.com/pinterest/PINRemoteImage" rel="nofollow noreferrer">Github</a> docs, I should:</p>\n<blockquote>\n<p>Download the latest tag and drag the Pod/Classes folder into your\nXcode project. You must also manually link against PINCache.</p>\n</blockquote>\n<p>So I downloaded the latest version from the given link, extracted it and got the following files in the folder<a href="https://i.sstatic.net/7TOA4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7TOA4.png" alt="enter image description here" /></a></p>\n<p>Then copied the Classes folder into the Xcode project (checked the copy if needed option).\n<a href="https://i.sstatic.net/4TGjH.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4TGjH.png" alt="enter image description here" /></a>\nAnd when I run the app, I get the following error:\n<a href="https://i.sstatic.net/px0t7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/px0t7.png" alt="enter image description here" /></a></p>\n<p>I understand it doesn't find the required file from the package, but can't figure out the issue. I also tried the same with the whole Source folder, but didn't work. What am I doing wrong?</p>\n"^^ . "0"^^ . "0"^^ . "uiviewcontroller"^^ . "<p>You can't call the <code>viewDidAppear:</code> method by yourself.</p>\n<p>Instead put whatever code you have inside <code>viewDidAppear:</code> and relocate to a new method which you define yourself. Then you can call that method just as you are calling <code>viewDidAppear:</code> now :)</p>\n"^^ . "As an example, ObjC considers the possibility that memory may be exhausted and the required data structures cannot be initialized. In practice, it's basically impossible to actually deal with memory exhaustion in ObjC, and no one really does, but it is considered a legitimate non-fatal failure. Swift does not consider memory exhaustion to be a recoverable error."^^ . . . . "1"^^ . . . "<p>The value you provide for the title in the initialiser is copied to the alert's <code>title</code>. Changing the value in the provided variable won't change the <code>title</code>. You can set a new value to <code>alert.title</code> directly.</p>\n<pre><code>UIAlertController *alert = [UIAlertController alertControllerWithTitle:Value message:nil preferredStyle:UIAlertControllerStyleAlert]; // Alert = 1\n UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController;\n [topController presentViewController:alert animated:YES completion:nil];\n\nalert.title = @&quot;2&quot;;\n</code></pre>\n"^^ . "Here is a sample repo, please check https://github.com/CodingWithNobody/Deleteme. Please note it is using react native's new architecture. React native's new architecture internally uses C++ and the docs tells us to use objective-c++ and just using objective-c won't work for the new architecture"^^ . . "in-app-purchase"^^ . . . "1"^^ . "Thank you, @Chintu. Thanks for your comment. I did as you said. It worked on my iPhone, but it still didn't work on the iPhone 14 Pro simulator. Strange thing! Fogmeister above provided an alternative solution which did work on both the real phone and the simulator."^^ . . . "0"^^ . "0"^^ . "<p>Following the discussion on <a href="https://github.com/rafaelsetragni/awesome_notifications/issues/874" rel="nofollow noreferrer">this github issue</a>, I managed to solve the issue without downgrading the version of <code>awesome_nofitications</code>.\nIt seems that changing the following settings in Xcode will solve the problem:</p>\n<p>In Runner Target:</p>\n<p>Build libraries for distribution =&gt; NO</p>\n<p>Only safe API extensions =&gt; NO</p>\n<p>iOS Deployment Target =&gt; 11 or greater</p>\n<p>In all other Targets:</p>\n<p>Build libraries for distribution =&gt; NO</p>\n<p>Only safe API extensions =&gt; YES</p>\n<p>iOS Deployment Target =&gt; 11 or greater</p>\n"^^ . "The os version is 16.3.1 (Iphone 11 pro)"^^ . . . . . . . "<p>I have faced the same issue and below fix worked for me. I am able to build and run the project successfully by disabling Strict Prototypes in your Pods Project Settings.</p>\n<pre><code>Pods =&gt; Build settings =&gt; Strict Prototypes =&gt; set to NO\n</code></pre>\n<p><a href="https://i.sstatic.net/sXhfb.png" rel="noreferrer"><img src="https://i.sstatic.net/sXhfb.png" alt="Pods PROJECT" /></a></p>\n"^^ . "0"^^ . . . "0"^^ . "<p>I want to send a call rejection notification through CallKit when the app is closed. The following code works properly when executed by a button, but when placed in the applicationWillTerminate method, it executes successfully but cannot reject the call. I would like to know what could be the reason for this.</p>\n<pre><code>- (void)applicationWillTerminate:(UIApplication *)application {\n [self endCall];\n}\n\n</code></pre>\n<pre><code>- (void)endCall {\n dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n self.callController = [[CXCallController alloc] init];\n if (self.callController.callObserver.calls.count &gt; 0) {\n CXCall *call = self.callController.callObserver.calls.lastObject;\n if (call.hasConnected == NO) {\n // 拒绝通话\n CXEndCallAction *endAction = [[CXEndCallAction alloc] initWithCallUUID:[[SIMProviderManager sharedInstance] currentCallUUID]];\n CXTransaction *transaction = [[CXTransaction alloc] initWithAction:endAction];\n [self.callController requestTransaction:transaction completion:^(NSError * _Nullable error) {\n if (error) {\n NSLog(@&quot;End call request transaction failed: %@&quot;, [error localizedDescription]);\n } else {\n NSLog(@&quot;End call request transaction success&quot;);\n }\n }];\n }\n }\n });\n}\n</code></pre>\n"^^ . . . "in an objective c class, though from a quick scan of their documentation I don't think you need a property at all, just a member variable. Though when you come to do `self.interstitialAd.delegate = self` you'll probably need an objective-c class"^^ . "@where do I define `@property` then?"^^ . "macos"^^ . "0"^^ . . "@jackdaimond tried that too, unfortunately in this case it just simply missing the .h file."^^ . . "13"^^ . . . . . . . "1"^^ . . . "I have done that. I have to keep my post short and readable so I have not included my entire swift code. Check here if you like to see my entire swift code https://gist.github.com/CodingWithNobody/8fb37230a34db2127442dd703506912e"^^ . "9"^^ . "@RobNapier Based on the linked source, they seem to access members of the object pointer without checking if it is `NULL`. So if it fails undefined behavior will have been invoked anyway."^^ . "Why was the colour of image changed in iOS app?"^^ . "-1"^^ . "<p>I have used avplayer and avplayerViewController to play a video from url.</p>\n<p>I can control lockscreen play/pause button through avaudiosession as below--</p>\n<p>[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:&amp;sessionError];</p>\n<p>[[AVAudioSession sharedInstance] setActive:YES error:nil];</p>\n<p>[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];</p>\n<p>Its working fine with iphone having ios 15, can control play/pause from lockscreen.</p>\n<p>But in ios 16 iphone , the play/pause button is disabled.</p>\n<p>Can anyone please help me why its not working with ios 16.</p>\n"^^ . "I need to add `@implementation YMAInterstitialAdDelegate` with `interstitialAdDidLoad` and `interstitialAdDidFailToLoad` methods, right?"^^ . "gmail"^^ . . . . . "Does seem odd. One would think that Swift's `DispatchGroup` is just a wrapper around Objective-C's `dispatch_group_t`."^^ . "Can you elaborate on how you got it working? What's `self` in your context above?"^^ . . . . . . . "0"^^ . "viewdidappear"^^ . . . "Attempting to po a firebase log event on my Xcode debug console"^^ . . . "0"^^ . . "@user129393192 Between C89 to current C17, there's (C17 6.7.6.3 §14) _"An identifier list declares only the identifiers of the parameters of the function. An empty list in\na function declarator that is part of a definition of that function specifies that the function has no parameters. The empty list in a function declarator that is not part of a definition of that function specifies that no information about the number or types of the parameters is supplied."_"^^ . "<p>This is my index.js</p>\n<pre><code>const className = 'NSURLConnection'\nconst methodName = 'sendSynchronousRequest:returningResponse:error:'\n\nInterceptor.attach(ObjC.classes[className][`+ ${methodName}`].implementation, {\n onEnter: function (args) {\n const request = new ObjC.Object(args[2])\n console.log('HTTPHeaders', request.allHTTPHeaderFields)\n }\n})\n</code></pre>\n<p><code>request</code> should be a <code>NSURLRequest</code>. Whenever I try to log the HTTP headers, this is what I get:</p>\n<pre><code>HTTPHeaders function () { return retType.fromNative.call(this, objc_msgSend(this, sel)); }\n</code></pre>\n<p><code>request.allHTTPHeaderFields</code> should be a <code>NSDictionary</code>. My goal is to save each key/value pair inside a javascript object, like this:</p>\n<pre><code>obj: {\n key1: value1,\n key2: value2\n}\n</code></pre>\n<p>How can I achieve this result?</p>\n"^^ . "0"^^ . . "0"^^ . . . . . . . . "avplayerviewcontroller"^^ . "0"^^ . . "0"^^ . "ios-simulator"^^ . "If you want it to change over time, you need to set the title over time; each time `loader` changes you need to assign the new value to `title`."^^ . "0"^^ . "Welcome to SO. First, please do not include links in questions; if the link breaks future readers will have no idea what's your asking about. Ether embed the image in the question or include it textually. Secondly, the console fully supports print commands `print("some log message")` in Swift or `NSLog( @"Here is a test message: '%@'", message );` in ObjC"^^ . "<h3>TLDR</h3>\n<p>Apply the following in your Podfile (post_install)</p>\n<pre><code> post_install do |installer|\n react_native_post_install(installer)\n __apply_Xcode_12_5_M1_post_install_workaround(installer)\n installer.pods_project.targets.each do |target|\n # Make it build with Xcode 14\n if target.respond_to?(:product_type) and target.product_type == &quot;com.apple.product-type.bundle&quot;\n target.build_configurations.each do |config|\n config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'\n end\n end\n # Make it work with GoogleDataTransport\n if target.name.start_with? &quot;GoogleDataTransport&quot;\n target.build_configurations.each do |config|\n config.build_settings['CLANG_WARN_STRICT_PROTOTYPES'] = 'NO' \n end\n end\n end\n end\n</code></pre>\n<h3>Details</h3>\n<p>First of all, credit to <a href="https://github.com/facebook/react-native/issues/36763#issuecomment-1512798923" rel="noreferrer">this post in Github</a>.</p>\n<p>At the same time, <a href="https://github.com/google/GoogleDataTransport/pull/92/commits/0b1d4028396a711dfafdb8b591fba310fa334885" rel="noreferrer">GDT has released the fix</a> too.</p>\n"^^ . . "0"^^ . . . . . "In your case it might help to change the include to #import "PINRemoteImage.h". Or you can add the path to the header to the HEADER SEARCH PATH setting in your Xcode project."^^ . . . . "@TheDreamsWind yes! I'm seeing that the addresses are different. I even tried to override `initWithCoder` and am seeing this being called twice for the same view controller. How would I make sure that it's only called once for the view controller I added using storyboard?"^^ . "<p><strong>Solved</strong></p>\n<pre><code>cv::Mat tiffImage = cv::imread(test1);\n</code></pre>\n<p>change</p>\n<pre><code>cv::Mat tiffImage;\nUIImageToMat(image, tiffImage, true);\n</code></pre>\n"^^ . . . "It's possible or not to detect is the the bluetooth adapter is active or inactive like Linux ?"^^ . . . "1"^^ . "0"^^ . "0"^^ . . "0"^^ . . . . . . "<p>I am using Firebase Analytics on my pod file of an iOS project. I get the following errors when I run the app.</p>\n<blockquote>\n<p>A function declaration without a prototype is deprecated in all versions of C</p>\n</blockquote>\n<p>it's shown on the following code (on the Firebase library):</p>\n<pre><code>GDTCORNetworkType GDTCORNetworkTypeMessage() {. &lt;----error here\n#if !TARGET_OS_WATCH\n SCNetworkReachabilityFlags reachabilityFlags = [GDTCORReachability currentFlags];\n if ((reachabilityFlags &amp; kSCNetworkReachabilityFlagsReachable) ==\n kSCNetworkReachabilityFlagsReachable) {\n if (GDTCORReachabilityFlagsContainWWAN(reachabilityFlags)) {\n return GDTCORNetworkTypeMobile;\n } else {\n return GDTCORNetworkTypeWIFI;\n }\n }\n#endif\n return GDTCORNetworkTypeUNKNOWN;\n}\n</code></pre>\n<p>I tried doing a <code>pod update</code> but I'm still unable to fix the problem.</p>\n<p>For reference, I have this particular <a href="https://github.com/facebook/react-native/issues/36763" rel="noreferrer">issue</a> besides that I'm on Xcode and not on RN.</p>\n"^^ . . "<p>It sounds like the issue you are facing is related to an asynch programming one.</p>\n<p>The <strong>getDataInBackgroundWithBlock</strong> method that downloads the PDF is asynch, meaning that it runs in background and is not blocking the main thread. This is okay as it prevents the freezing effect in the app, however, this means that the code that renders the PDF is executed prior the PDF itself is ready, which could be the issue here.</p>\n<p>The 5-secs is a workaround but the condition of download in 5 secs is not a warranty that this is enough to have it downloaded always as depends on the network conditions.</p>\n<p>I would recommend a completion block that is executed when the PDF is ready. You can do the next:</p>\n<pre><code>- (void)sermonTime {\nif (theImageView.hidden == NO) {\n theImageView.hidden = YES;\n}\nif ([self.entry[@&quot;SermonPresIncluded&quot;] isEqualToString:@&quot;NO&quot;]) {\n //there are some instances where there is no PDF to download, following method just displays black screen\n [self blankTime];\n}\nelse {\n NSLog(@&quot;SermonTime&quot;);\n PFFileObject *thumbnail = self.entry[@&quot;SermonPDF&quot;];\n NSString *tempDir = NSTemporaryDirectory();\n NSString *pdfPath = [[tempDir stringByAppendingPathComponent:[self.entry valueForKey:@&quot;DateOfService&quot;]] stringByAppendingString:@&quot;.pdf&quot;];\n \n [thumbnail getDataInBackgroundWithBlock:^(NSData *imageData, NSError *error) {\n if (error) {\n NSLog(@&quot;Error downloading PDF: %@&quot;, error);\n [self blankTime];\n } else {\n [imageData writeToFile:pdfPath atomically:YES];\n NSURL *pdfURL = [NSURL fileURLWithPath:pdfPath];\n [self drawPDFWithURL:pdfURL completion:^{\n self.view.backgroundColor = [UIColor blackColor];\n }];\n }\n }];\n}\n</code></pre>\n<p>}</p>\n<blockquote>\n<p>and drawPDFWithURL is like this</p>\n</blockquote>\n<pre><code>- (void)drawPDFWithURL:(NSURL *)url completion:(void (^)(void))completionBlock {\ndispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\n CGPDFDocumentRef pdfDocument = CGPDFDocumentCreateWithURL((__bridge CFURLRef)url);\n size_t pageCount = CGPDFDocumentGetNumberOfPages(pdfDocument);\n if (pageCount == 0) {\n NSLog(@&quot;Error: PDF has no pages&quot;);\n return;\n }\n // Draw the first page of the PDF\n CGPDFPageRef pdfPage = CGPDFDocumentGetPage(pdfDocument, 1);\n CGRect pageRect = CGPDFPageGetBoxRect(pdfPage, kCGPDFCropBox);\n UIGraphicsBeginImageContextWithOptions(pageRect.size, YES, 0.0);\n CGContextRef context = UIGraphicsGetCurrentContext();\n CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);\n CGContextFillRect(context, pageRect);\n CGContextTranslateCTM(context, 0.0, pageRect.size.height);\n CGContextScaleCTM(context, 1.0, -1.0);\n CGContextDrawPDFPage(context, pdfPage);\n UIImage *pdfImage = UIGraphicsGetImageFromCurrentImageContext();\n UIGraphicsEndImageContext();\n CGPDFDocumentRelease(pdfDocument);\n // Display the PDF image on the screen\n dispatch_async(dispatch_get_main_queue(), ^{\n self.imageView.image = pdfImage;\n if (completionBlock) {\n completionBlock();\n }\n });\n});\n</code></pre>\n<p>}</p>\n<p>The <strong>drawPDFWithURL:completion:</strong> method takes the URL and a <code>completion block</code> as parameters. The PDF is rendered on the background thread using the GCD (Grand Central Dispatch). Once the PDF is ready, the completion block is executed on the main thread.</p>\n<p>Remember to initialize correctly your image view for drawing the PDF, add this in your drawDocument method:</p>\n<pre><code>// Configure image view to display PDF content\nimageView.contentMode = UIViewContentModeScaleAspectFit;\nimageView.backgroundColor = [UIColor blackColor];\nimageView.clipsToBounds = YES;\nimageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;\nimageView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);\nimageView.userInteractionEnabled = YES;\n</code></pre>\n<p>Also, ensure that the image view is added to the view hierarchy and is properly positioned in the view. You can add the following line to add the image view to the view hierarchy:</p>\n<pre><code>[self.view addSubview:imageView];\n</code></pre>\n<p>If you are still having issues with the image view not displaying PDF content, you can try creating a new image view and adding it to the view hierarchy instead of using the existing one.</p>\n"^^ . . "@TheDreamsWind It is a cross-platform app in QT that compiles for Android and Windows as well, so it has C++ class `InterstitialAd` base class that is implemented in different ways on different OSes."^^ . . . . . . "Put `void` in the empty parentheses on the error line."^^ . . . . . "40"^^ . . "Not yet. I have deferred implementing the Payment System for now until I can figure it out"^^ . . "1"^^ . . "flutter"^^ . "0"^^ . . "0"^^ . . "0"^^ . . "2"^^ . . . . . . "This worked for me. Thank you for sharing. this is basically \n# set CODE_SIGNING_ALLOWED = NO for com.apple.product-type.bundle\n# set CLANG_WARN_STRICT_PROTOTYPES = NO for GoogleDataTransport"^^ . "0"^^ . . . . . "0"^^ . "lockscreen"^^ . . . . . . . . "0"^^ . "0"^^ . . "How to automatically reject incoming calls when the app is terminated using CallKit in iOS"^^ . "0"^^ . . . . "0"^^ . . . "1"^^ . . . . . . "<p>In general if you want to dereference a pointer like args[3] in Frida you can simply execute <code>readPointer()</code> from Frida <a href="https://frida.re/docs/javascript-api/#nativepointer" rel="nofollow noreferrer">NativePointer</a> API:</p>\n<pre><code>args[3].readPointer()\n</code></pre>\n<p>Unfortunately you are trying to hook the parameter <code>response</code> which is an <code>Out parameter for the URL</code>. That means it will contain the result after the method has been executed. Thus accessing it in <code>onEnter</code> will not work. You have to do it in <code>onLeave</code>:</p>\n<pre><code>Interceptor.attach(ObjC.classes[className][`+ ${methodName}`].implementation, {\n onEnter: function (args) {\n this.savedArg = args[3]; // save argument for onLeave\n },\n onLeave: function (retval) {\n const responsePtr = prt(this.savedArg).readPointer(); // ptr just to make sure\n const response = new ObjC.Object(responsePtr);\n console.log('URL', response.URL());\n }\n})\n</code></pre>\n<p>Not sure if this code will work, just give it a try...</p>\n"^^ . "<p>It seems, from the error message, that you are calling <code>viewDidAppear:</code>. Never do that (except to call super from within your implementation). It is an event method to be called by the runtime, not by you. That is what the error message is telling you.</p>\n<p>If for some reason you don't know how to find your code where you are making this mistake, the error method also tells you how to set a breakpoint to find it when it happens.</p>\n"^^ . "I see. So you’re saying that the feature of “unknown amount of arguments” got deprecated in 1989 … and now in C23 we finally have it mean “void” … but I didn’t quite catch if compilers in meantime support which version. I think I’m missing a key thing here of when using it in prototype vs the definition itself."^^ . . "<p>Read Image (<code>tiff</code>) files in IOS (objectiv-C).<br />\nSave data as <code>NSString*</code> and cast as <code>cv::String</code>.</p>\n<p>So far, the string I want is stored in a variable.</p>\n<pre><code>NSString* strTiff = call.arguments[@&quot;Tiff&quot;];\nNSString* png = call.arguments[@&quot;Path&quot;];\n\ncv::String test1 = [strTiff cStringUsingEncoding:NSUTF8StringEncoding];;\ncv::String test2 = [png cStringUsingEncoding:NSUTF8StringEncoding];;\n \ncv::Mat tiffImage = cv::imread(test1);\nbool res = cv::imwrite(test2, tiffImage);\n</code></pre>\n<p>But when I run <code>cv::Imread();</code>, <code>cv::Mat tiffImage</code> image is saved as <code>nil</code>. Looking at the official documentation, there seems to be no problem with how to use it, but why is nil returned?</p>\n<p><strong>tiffImage Data</strong></p>\n<pre><code>(cv::Mat) tiffImage = {\n flags = 1124007936\n dims = 0\n rows = 0\n cols = 0\n data = 0x0000000000000000\n datastart = 0x0000000000000000\n dataend = 0x0000000000000000\n datalimit = 0x0000000000000000\n allocator = nil\n u = nil\n size = {\n p = 0x000000016cf41098\n }\n step = {\n p = 0x000000016cf410e0\n buf = ([0] = 0, [1] = 0)\n }\n}\n</code></pre>\n"^^ . . . . . "2"^^ . . . . . . . . . "@TheDreamsWind chatgpt had advised that the above is the way I should use the view controller added with storyboard. apparently, there's another version of instantiateViewControllerWithIdentifier which includes a `creator` argument, which is a block with access to an `NSCoder`. however, that doesn't work either"^^ . . . "It says: ‘You must also manually link against PINCache’, and the error looks suspiciously similar to the one you’d get if you didn’t link. Does the library show up in the target settings?"^^ . . "ios16"^^ . "Have you checked whether your app delegate's `persistentContainer` is non-nil at the time you call the line `todoListVC.persistentContainer = self.persistentContainer;`? Have you verified that that line is being called before `viewDidLoad`?"^^ . . "@reactor i can't spot anything that can cause the exception thrown the code you provided. Especially since you have `self.persistentContainer == nil` check in the `AppDelegate` class. You either should have the `AppDelegate` class released for whatever reason (provided you controller doesn't retain the pointer to the persistent container) OR which is more likely - you have another instance of `TodoListTableViewController` allocated somewhere, which doesn't have `persistentContainer` set up. E.g. the storyboard may instantiate a `TodoListTableViewController` as part of the designed hierarchy"^^ . . "0"^^ . . "<p>I had the same problem with Firebase Analytics and followed advice in the comments from @HangarRash.</p>\n<p>Put void in the empty parentheses on the error line.</p>\n<p>There is a 'fix' button which does it for you if you click on the little red x.</p>\n<p>It asked me to unlock but that worked OK and could save and build. There were about half a dozen of these to fix, then it builds.</p>\n"^^ . . . . "ios"^^ . . "<p>My tvOS app is set up with the main capability being drawing PDFs of music sheets that are already embedded into the app itself. There are multiple options here, as it can possibly only display certain verses of the song. The code I use for this is:</p>\n<pre><code>- (void)drawDocument:(CGPDFDocumentRef)pdfDocument\n{ NSLog(@&quot;draw document&quot;);\n // Get the total number of pages for the whole PDF document\n int totalPages= (int)CGPDFDocumentGetNumberOfPages(pdfDocument);\n\n if ([[self.arrayOfVerses firstObject] isEqualToString:@&quot;allverses&quot;]) {\n //This is if all verses have been picked and it will do the entire PDF\n NSLog(@&quot;draw document all verses %d&quot;, totalPages);\n self.pages = totalPages;\n self.subtractingPages = totalPages - 1;\n\n NSMutableArray *pageImages = [[NSMutableArray alloc] init];\n \n // Iterate through the pages and add each page image to an array\n for (int i = 1; i &lt;= totalPages; i++) {\n // Get the first page of the PDF document\n CGPDFPageRef page = CGPDFDocumentGetPage(pdfDocument, i);\n CGRect pageRect = CGPDFPageGetBoxRect(page, kCGPDFMediaBox);\n \n // Begin the image context with the page size\n // Also get the grapgics context that we will draw to\n UIGraphicsBeginImageContext(pageRect.size);\n CGContextRef context = UIGraphicsGetCurrentContext();\n \n // Rotate the page, so it displays correctly\n CGContextTranslateCTM(context, 0.0, pageRect.size.height);\n CGContextScaleCTM(context, 1.0, -1.0);\n CGContextConcatCTM(context, CGPDFPageGetDrawingTransform(page, kCGPDFMediaBox, pageRect, 0, true));\n \n // Draw to the graphics context\n CGContextDrawPDFPage(context, page);\n \n // Get an image of the graphics context\n UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n UIGraphicsEndImageContext();\n [pageImages addObject:image];\n }\n // Set the image of the PDF to the current view\n [self addImagesToScrollView:pageImages];\n }\n else {\n //Only a certain number of verses\n self.pages = [self.arrayOfVerses count];\n self.subtractingPages = self.pages - 1;\n\n NSLog (@&quot;total pages %ld&quot;, (long)self.pages);\n NSMutableArray *pageImages = [[NSMutableArray alloc] init];\n \n \n [pageImages removeAllObjects];\n \n //Getting slide numbers to be used\n NSString *text = self.selectedCountry;\n NSString *substring = nil;\n \n NSRange parenRng = [text rangeOfString: @&quot;(?&lt;=\\\\().*?(?=\\\\))&quot; options: NSRegularExpressionSearch];\n \n if ( parenRng.location != NSNotFound ) {\n substring = [text substringWithRange:parenRng];\n NSLog(@&quot;Substring %@&quot;, substring);\n }\n \n \n // Iterate through the pages and add each page image to an array\n for (int i = 1; i &lt;= totalPages; i++) {\n // Get the first page of the PDF document\n \n \n NSPredicate *valuePredicate=[NSPredicate predicateWithFormat:@&quot;self.intValue == %d&quot;,i];\n \n if ([[self.arrayOfVerses filteredArrayUsingPredicate:valuePredicate] count]!=0) {\n // FOUND\n CGPDFPageRef page = CGPDFDocumentGetPage(pdfDocument, i);\n CGRect pageRect = CGPDFPageGetBoxRect(page, kCGPDFMediaBox);\n \n // Begin the image context with the page size\n // Also get the grapgics context that we will draw to\n UIGraphicsBeginImageContext(pageRect.size);\n CGContextRef context = UIGraphicsGetCurrentContext();\n \n // Rotate the page, so it displays correctly\n CGContextTranslateCTM(context, 0.0, pageRect.size.height);\n CGContextScaleCTM(context, 1.0, -1.0);\n CGContextConcatCTM(context, CGPDFPageGetDrawingTransform(page, kCGPDFMediaBox, pageRect, 0, true));\n \n // Draw to the graphics context\n CGContextDrawPDFPage(context, page);\n \n // Get an image of the graphics context\n UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n UIGraphicsEndImageContext();\n \n \n [pageImages addObject:image];\n }\n \n else {\n //NOT FOUND\n }\n \n }\n // Set the image of the PDF to the current view\n [self addImagesToScrollView:pageImages];\n }\n}\n\n-(void)addImagesToScrollView:(NSMutableArray*)imageArray {\n \n int heigth = 0;\n for (UIImage *image in imageArray) {\n UIImageView *imgView = [[UIImageView alloc] initWithImage:image];\n imgView.contentMode = UIViewContentModeScaleAspectFit;\n imgView.frame=CGRectMake(0, heigth-60, 1920, 1080);\n [_scrollView addSubview:imgView];\n heigth += imgView.frame.size.height;\n }\n}\n-(void)viewDidLayoutSubviews {\n \n _scrollView.contentSize = CGSizeMake(1920, 1080*self.pages);\n \n}\n</code></pre>\n<p>There is however, one section where a PDF needs to be downloaded, and then drawn. I am using Back4app as the host of this, and the average PDF for this is 420kb. I currently have it do this:</p>\n<pre><code>- (void)sermonTime {\n if (theImageView.hidden == NO) {\n theImageView.hidden = YES;\n }\n if ([self.entry[@&quot;SermonPresIncluded&quot;] isEqualToString:@&quot;NO&quot;]) {\n //there are some instances where there is no PDF to download, following method just displays black screen\n [self blankTime];\n }\n else {\n NSLog(@&quot;SermonTime&quot;);\n PFFileObject *thumbnail = self.entry[@&quot;SermonPDF&quot;];\n NSString *tempDir = NSTemporaryDirectory();\n \n NSString *pdfPath = [[tempDir stringByAppendingPathComponent:[self.entry valueForKey:@&quot;DateOfService&quot;]] stringByAppendingString:@&quot;.pdf&quot;];\n\n\n [thumbnail getDataInBackgroundWithBlock:^(NSData *imageData, NSError *error) {\n if (error) {\n NSLog(@&quot;Error downloading PDF: %@&quot;, error);\n [self blankTime];\n } else {\n \n [imageData writeToFile:pdfPath atomically:YES];\n // Use completion block to signal that the PDF is ready to display\n \n sermonPDFURL = [NSURL fileURLWithPath:pdfPath];\n\n [self performSelector:@selector(doitnowpdf) withObject:NULL afterDelay:5];\n \n self.view.backgroundColor = [UIColor blackColor];\n \n \n \n }\n }];\n \n }\n \n}\n-(void)doitnowpdf {\n self.arrayOfVerses = @[@&quot;allverses&quot;];\n\n CGPDFDocumentRef pdfDocument = [self openPDF:sermonPDFURL];\n [self drawDocument:pdfDocument];\n}\n</code></pre>\n<p>I had run into issues where it seemed the problem may be that it was trying to draw the PDF before it was finished downloading, which is why I put a 5 second delay on there. However, it still will mess up, even though the Logs show that it knows there's only 1 page in the PDF at the start of drawing it, so I know it's fully downloaded. When this happens, the previous song's PDF stays on the screen. If I try to execute the code to go to the next PDF, it goes to the one AFTER what's supposed to be downloaded, and if I go back, it then draws it properly. I'm desperate for any way to get this done right.</p>\n"^^ . . . . . . "0"^^ . . "A function declaration without a prototype is deprecated in all versions of C"^^ . . . . . . "1"^^ . "debugging"^^ . . . . "@HangarRash I have tried unlocking the files and adding them but still no luck"^^ . . . "@user129393192 No it (non-prototype format functions) has always been flagged as an obsolescent feature since 1989. Compilers have supported it as required by the standard, but it could have gotten removed at any moment. It finally did with C23, but they chose to synchronize the behavior with C++ so now we can finally type `int main()` without worrying about the feature getting deprecated. Some compilers like clang 16 chose to warn if you compile in strict mode `-std=c17 -pedantic`, but that can be solved by compiling in strict C23 mode `-std=c2x -pedantic`."^^ . . "2"^^ . "I thought that empty parantheses means a function that takes an unspecified number of arguments?"^^ . . . . "<p>I need to determine if the bluetooth is supported on macOS in Objective-C or Swift ?</p>\n<p>Thanks</p>\n"^^ . "1"^^ . . "0"^^ . . . "0"^^ . . "0"^^ . "@HangarRash thanks. I didn't, even after adding the check, I'm getting the same error. I'll update the code to include the nil check"^^ . . "1"^^ . . . "I essentially used your code. I just created the `NSURL` from my own file path to a .mov file stored within the app's sandbox. The key difference seems to be iOS 15.6.1 vs 16.4.1. I can't imagine the mp4 vs mov makes any difference."^^ . . . . . . . . . . . . "0"^^ . "1"^^ . . . . . "1"^^ . "0"^^ . . . . "Get NSHomeDirectory() in pure C"^^ . "0"^^ . . . . . . . . . "You might be looking for [libffi](https://sourceware.org/libffi/)."^^ . "0"^^ . . "@willeke self AppDelegate * 0x6000004d4f60 0x00006000004d4f60 Edit:i use XIP, not NSViewController."^^ . . . "0"^^ . . . . "0"^^ . . . "1"^^ . . . . . . . "What is a valid text representation of NaN? Swift know it, C# know it too."^^ . . . "0"^^ . . . . . . . "0"^^ . "If you are using a storyboard, why have this code at all? Just let the storyboard do its thing."^^ . "0"^^ . . . . "0"^^ . . . . "@Mohab If you `NSLog(NSHomeDirectory())` in Objective-C what do you get?"^^ . . . "@Larme : It's PDFTron not a pspdfkit"^^ . . "0"^^ . . . . . . . "Method Swizzling does not work when methods have parameters"^^ . . . . "0"^^ . . . . . . . "0"^^ . . "With functions that are not `init` I would have a swift-only `func getC(range:) -> C`, and a `@objc(getC) func _getC(min:max:) -> C`. Not optimal, the underscore is widely used in this context."^^ . . . . . . . . . . . . "<p>string &quot;NaN&quot; to float is 0.<br />\n0 is right and you is wrong.</p>\n"^^ . . "Unable to navigate to a controller using the UIPopoverPresentationController _passthroughViews method in iOS using Objective C"^^ . "0"^^ . . . . . "0"^^ . "0"^^ . "<p>As mentioned in the comments, updating from version 7 to the latest version 10 will require going through each of the changelogs between your previous version and new version. It depends on which exact version you are migrating from, but you could start by looking at version <a href="https://docs.apryse.com/documentation/ios/changelog/v7-0-1-72288/" rel="nofollow noreferrer">7.0.1</a> and then all the way up to <a href="https://docs.apryse.com/documentation/ios/changelog/v10-0-0/" rel="nofollow noreferrer">10.0.0</a>.</p>\n<p>For your case specifically, you should look at the <a href="https://docs.apryse.com/api/ios/Classes/PTDocumentController.html" rel="nofollow noreferrer">PTDocumentController</a> class as it provides a drop-in viewer component that handles all of the UI setup and management (and therefore also already handles most API changes between versions for you). This is the recommended approach for the majority of use cases and projects.</p>\n"^^ . . . . . "<p>What's the meaning of the <code>nil</code> in else part?</p>\n<pre><code>+ (NSString *)createFile:(NSData *)data suffix:(NSString *)suffix {\n NSString *tmpPath = [self temporaryFilePath:suffix];\n if ([[NSFileManager defaultManager] createFileAtPath:tmpPath contents:data attributes:nil]) {\n return tmpPath;\n } else {\n nil;\n }\n return tmpPath;\n}\n</code></pre>\n"^^ . "0"^^ . "0"^^ . . "<p>I used an Objective-C method to get the managedObjects on Xcode 9.2.\nToday I have a new iMac with Xcode 14.3 and the method is not called.</p>\n<pre><code>-(void)awakeFromNib\n{\n _center = [NSNotificationCenter defaultCenter];\n [_center addObserver:self\n selector:@selector(selectionDidchange:)\n name:@&quot;NSTableViewSelectionDidChangeNotification&quot;\n object:nil];\n NSLog(@&quot;arraController %@&quot;,_vrController); // o.k\n NSLog(@&quot;tableView %@&quot;,_vrTableView); // o.k\n NSLog(@&quot;center %@&quot;,_center); // o.k\n}\n</code></pre>\n<pre><code>-(void)selectionDidchange:(NSNotification *)notification\n{\n if((_vrController != nil) &amp;&amp; (_vrTableView != nil))\n {\n selected = [_vrController selectedObjects];\n arranged = [_vrController arrangedObjects];\n _currentObject = [selected objectAtIndex:0];\n if(_currentObject != nil)\n {\n NSData * data;\n NSError * error;\n _vrRoot = [NSMutableDictionary new];\n \n data =[NSKeyedArchiver archivedDataWithRootObject:_vrRoot\n requiringSecureCoding:YES error:&amp;error];\n [_currentObject setValue:data forKey:@&quot;kVrRoot&quot;];\n }\n }\n</code></pre>\n<p>In the Developer Documentation I read: NSTableView (macOS 10.0+).\nI assume the doc is not up to date.</p>\n<p>I expect the newest documentation (if there is one).</p>\n"^^ . "1"^^ . . . . . . . . "0"^^ . "0"^^ . "1"^^ . . . . "I've written a method which will perform the scroll in Javascript (it works well with buttons), so my intention is to trap a swipe in the window content view, determine its direction, and then execute that method."^^ . "@Paulw11 In the swift interface header file, there is this line `@import UserNotifications` along with other @imports and @class definitions. But it was wrapped in a macro, so maybe it got excluded. What to do to have `@import UserNotifications` in the swift interface header file? Maybe something's missed in the swift file which has defined UNNotificationCenterDelegate. Since, swift interface header has included this reference, can it not include missing references?"^^ . "<p>I am simply trying to create a colored border along the margins of two subviews, one of which is defined in <em>ViewController</em> and the other in a <em>UIView subclass</em>. Both are subviews of the root view. I would like to make the blue border from the second subview (created in UIView subclass) match the red border from the first subview (created in ViewController).</p>\n<p><strong>ViewController (root view)</strong></p>\n<pre class="lang-objectivec prettyprint-override"><code>- (void)viewDidLoad {\n [super viewDidLoad]; \n self.view.backgroundColor = [UIColor whiteColor];\n\n // add border subview (red)\n UILayoutGuide *margins = self.view.layoutMarginsGuide;\n self.view.translatesAutoresizingMaskIntoConstraints = NO;\n UIView *l3 = [[UIView alloc] init];\n [self.view addSubview:l3];\n l3.layer.borderWidth = (CGFloat)1.0;\n l3.layer.borderColor = UIColor.systemRedColor.CGColor;\n l3.translatesAutoresizingMaskIntoConstraints = NO;\n [l3.trailingAnchor constraintEqualToAnchor:margins.trailingAnchor].active = YES;\n [l3.leadingAnchor constraintEqualToAnchor:margins.leadingAnchor].active = YES;\n [l3.topAnchor constraintEqualToAnchor:margins.topAnchor].active = YES;\n [l3.bottomAnchor constraintEqualToAnchor:margins.bottomAnchor].active = YES;\n\n // add border subview from LibraryView class (blue)\n LibraryView *library = [[LibraryView alloc] initWithFrame:self.view.frame];\n [self.view addSubview:library];\n}\n</code></pre>\n<p><strong>LibraryView (subview, UIView subclass)</strong></p>\n<pre class="lang-objectivec prettyprint-override"><code>@implementation LibraryView\n// LibraryView inherits from UIView\n\n- (instancetype)initWithFrame:(CGRect)frame\n{\n self = [super initWithFrame:frame];\n if (self != nil)\n {\n // add margins of this LibraryView object\n UILayoutGuide *margins = self.layoutMarginsGuide;\n self.layer.borderWidth = (CGFloat)1.0;\n self.layer.borderColor = UIColor.systemBlueColor.CGColor;\n self.translatesAutoresizingMaskIntoConstraints = NO;\n [self.trailingAnchor constraintEqualToAnchor:margins.trailingAnchor].active = YES;\n [self.leadingAnchor constraintEqualToAnchor:margins.leadingAnchor].active = YES;\n [self.topAnchor constraintEqualToAnchor:margins.topAnchor].active = YES;\n [self.bottomAnchor constraintEqualToAnchor:margins.bottomAnchor].active = YES;\n }\n return self;\n}\n\n@end\n</code></pre>\n<p><strong>Result</strong></p>\n<p><a href="https://i.sstatic.net/NGQcJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/NGQcJ.png" alt="iOS Simulator screenshot" /></a></p>\n<p><strong>Error</strong></p>\n<pre><code>&lt;UILayoutGuide: 0x600000a282a0 - &quot;UIViewLayoutMarginsGuide&quot;, layoutFrame = {{0, 0}, {0, 0}}, owningView = &lt;LibraryView: 0x144f06c70; frame = (0 0; 393 852); layer = &lt;CALayer: 0x60000336dc80&gt;&gt;&gt;\n2023-04-22 10:51:48.573386-0400 VoiceMemos[1043:18123] [LayoutConstraints] Unable to simultaneously satisfy constraints.\n Probably at least one of the constraints in the following list is one you don't want. \n Try this: \n (1) look at each constraint and try to figure out which you don't expect; \n (2) find the code that added the unwanted constraint or constraints and fix it. \n(\n &quot;&lt;NSLayoutConstraint:0x60000102bd40 H:[UILayoutGuide:0x600000a282a0'UIViewLayoutMarginsGuide']-(0)-| (active, names: '|':LibraryView:0x144f06c70 )&gt;&quot;,\n &quot;&lt;NSLayoutConstraint:0x600001012580 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x600000a282a0'UIViewLayoutMarginsGuide']-(8)-|(LTR) (active, names: '|':LibraryView:0x144f06c70 )&gt;&quot;\n)\n</code></pre>\n<p><strong>Questions/Issues</strong></p>\n<ol>\n<li>As you can see, only the red border renders because the blue border fails to render due to the error (and several others just like it for the other anchors) shown above.</li>\n<li>Is this convention correct? And if not, is even possible the way I have implemented it? i.e. trying to match the margins of a subview of the root view in ViewController and a subview from a UIView subclass (LibraryView)</li>\n</ol>\n<p>Apologies if this is a misguided question. iOS development is a bit tricky conceptually, and I am trying to do it in Objective-C so online resources are more limited. Thanks in advance.</p>\n"^^ . . . . . . . . . "1"^^ . "xcode"^^ . "1"^^ . . "<p>I'm adding some new features to the audio player in my app KeyStage. One of the features that I wanna add is the transpose functionality. I found a real-time pitch shifter unit in AVAudioEngine, but it outputs the signals with approximately 0.1-second latency, which renders it useless.</p>\n<p>I don't know anything about digital signal processing (I hope to learn it at some point when I have time). Still, after some web search, I discovered that all the real-time pitch-shifting algorithms produce a similar amount of latency, so real-time pitch-shifting is out of the table for me.</p>\n<p>Therefore I need to change the pitch of the whole audio file or the buffer in non-real time in Swift or Objective-C. So I need a function that takes an AVAudioFile (or an AVAudioPCMBuffer) and a pitch shift amount in cents and outputs the pitch-shifted AVAudioFile (or AVAudioPCMBuffer), possibly through a completion handler or a message to delegate. I searched online for such a project or library but couldn't find any. I wish I could write such a function independently, but as I said, I don't know any DSP.</p>\n<p>I'd appreciate it if anyone can help me with this. Can third-party libraries do this in objective c (or Swift)? Or, if this is a simple algorithm, can someone guide me on how I can achieve this?

I even tried using chatGPT, but the codes it generates have tons of errors.</p>\n<p>Here is what chatGPT provided me:</p>\n<pre><code>import Foundation\nimport Accelerate\n\nfunc pitchShiftUsingFFT(audioFile: AVAudioFile, semitones: Float) -&gt; AVAudioPCMBuffer? {\n \n // Load input audio file\n guard let inputFormat = AVAudioFormat(commonFormat: .pcmFormatFloat32, sampleRate: audioFile.fileFormat.sampleRate, channels: 1, interleaved: false),\n let inputFile = try? AVAudioFile(forReading: audioFile.url, commonFormat: .pcmFormatFloat32, interleaved: false) else {\n print(&quot;Failed to load input audio file&quot;)\n return nil\n }\n \n // Calculate pitch shift factor and ratio\n let pitchShiftFactor = pow(2.0, semitones/12.0)\n let pitchShiftRatio = Float(inputFormat.sampleRate) / (pitchShiftFactor * Float(inputFormat.sampleRate))\n \n // Allocate memory for input and output audio buffers\n let inputBufferSize = AVAudioFrameCount(inputFile.length)\n let outputBufferSize = AVAudioFrameCount(Float(inputBufferSize) * pitchShiftFactor)\n let inputBuffer = AVAudioPCMBuffer(pcmFormat: inputFormat, frameCapacity: inputBufferSize)\n let outputBuffer = AVAudioPCMBuffer(pcmFormat: inputFormat, frameCapacity: outputBufferSize)\n \n // Read input audio file into input buffer\n guard let inputAudioBuffer = inputBuffer?.floatChannelData else {\n print(&quot;Failed to allocate memory for input buffer&quot;)\n return nil\n }\n do {\n try inputFile.read(into: inputBuffer!)\n } catch {\n print(&quot;Failed to read input audio file&quot;)\n return nil\n }\n \n // Allocate memory for FFT buffers\n let fftSize = vDSP_Length(ceil(log2(Float(inputBufferSize))))\n let fftSetup = vDSP_create_fftsetup(fftSize, Int32(kFFTRadix2))\n let fftInputBuffer = UnsafeMutablePointer&lt;Float&gt;(calloc(inputBufferSize, MemoryLayout&lt;Float&gt;.size))\n let fftOutputBuffer = UnsafeMutablePointer&lt;DSPComplex&gt;(calloc(inputBufferSize/2, MemoryLayout&lt;DSPComplex&gt;.size))\n \n // Apply pitch shift using FFT\n for channel in 0..&lt;inputFormat.channelCount {\n // Initialize variables\n var phase = DSPFloat()\n let phaseIncrement = 2.0 * Float.pi * pitchShiftRatio\n var fftOffset = vDSP_Length(0)\n \n // Copy input audio data into FFT input buffer\n vDSP_vflt32(inputAudioBuffer[channel], 1, fftInputBuffer, 1, inputBufferSize)\n \n // Perform FFT on input data\n vDSP_ctoz(UnsafePointer&lt;DSPFloat&gt;(fftInputBuffer), 2, fftOutputBuffer, 1, inputBufferSize/2)\n vDSP_fft_zrip(fftSetup, fftOutputBuffer, 1, fftSize, FFTDirection(FFT_FORWARD))\n vDSP_ztoc(fftOutputBuffer, 1, UnsafeMutablePointer&lt;DSPFloat&gt;(fftInputBuffer), 2, inputBufferSize/2)\n \n // Apply phase shift to FFT output\n let phaseShift = DSPFloat(phaseIncrement * Float(fftOffset))\n for i in 0..&lt;inputBufferSize/2 {\n let fftReal = fftInputBuffer[i*2]\n let fftImag = fftInputBuffer[i*2+1]\n let complex = DSPComplex(real: fftReal * cos(phase) - fftImag * sin(phase),\n imaginary: fftReal * sin(phase) + fftImag * cos(phase))\n fftOutputBuffer[i] = complex\n phase += phaseShift\n if phase &gt; Float.pi {\n phase -= 2.0 * Float.pi\n }\n }\n \n // Perform inverse FFT on phase shifted output\n vDSP_ctoz(fftOutputBuffer, 1, fftOutputBuffer, 1, inputBufferSize/2)\n vDSP_fft_zrip(fftSetup, fftOutputBuffer, 1, fftSize, FFTDirection(FFT_INVERSE))\n vDSP_ztoc(fftOutputBuffer, 1, UnsafeMutablePointer&lt;DSPFloat&gt;(fftInputBuffer), 2, inputBufferSize/2)\n \n // Overlap-add FFT output to output audio buffer\n var outputOffset = vDSP_Length(0)\n let hopSize = vDSP_Length(Float(grainSize) * pitchShiftRatio)\n let overlapSize = vDSP_Length(Float(overlap) * pitchShiftRatio)\n while outputOffset &lt; outputBufferSize {\n let outputRemaining = outputBufferSize - outputOffset\n let inputRemaining = inputBufferSize - fftOffset\n let frameCount = min(inputRemaining, outputRemaining)\n let overlapCount = min(frameCount, overlapSize)\n \n // Add overlapped frames to output audio buffer\n vDSP_vadd(inputAudioBuffer[channel]+fftOffset, 1,\n outputBuffer!.floatChannelData[channel]+outputOffset, 1,\n outputBuffer!.floatChannelData[channel]+outputOffset, 1,\n overlapCount)\n \n // Add remaining frames to output audio buffer\n vDSP_vadd(fftInputBuffer+fftOffset, 1,\n outputBuffer!.floatChannelData[channel]+outputOffset+overlapCount, 1,\n outputBuffer!.floatChannelData[channel]+outputOffset+overlapCount, 1,\n frameCount-overlapCount)\n \n // Update buffer offsets\n outputOffset += frameCount\n fftOffset += hopSize\n }\n }\n \n // Clean up FFT buffers and setup\n vDSP_destroy_fftsetup(fftSetup)\n free(fftInputBuffer)\n free(fftOutputBuffer)\n \n return outputBuffer\n}\n</code></pre>\n"^^ . . "0"^^ . . "tvos"^^ . . "1"^^ . "<p>I'm trying to blend a source texture with some snowflakes in Metal, but I can't find blending options that work for my use case.</p>\n<p><img src="https://i.sstatic.net/OwQn9.jpg" alt="This is the closest I've gotten to it" />.</p>\n<p>The blending options I'm currently using are:</p>\n<pre><code>descriptor.sourceRGBBlendFactor = MTLBlendFactorSourceAlpha;\ndescriptor.sourceAlphaBlendFactor = MTLBlendFactorOne;\ndescriptor.destinationRGBBlendFactor = MTLBlendFactorOne;\ndescriptor.destinationAlphaBlendFactor = MTLBlendFactorOne;\n</code></pre>\n<p>I've tried <a href="https://stackoverflow.com/a/52042114">these</a>.</p>\n<p>I expected the blue portion of the snowflakes to blend with the blue background, not with the underlying one.</p>\n<p>Can anyone explain to me what I'm getting wrong, what the correct formula should be and how we arrive to it?</p>\n"^^ . . . "0"^^ . . "0"^^ . "2"^^ . . "0"^^ . . . . . . "swiftui"^^ . "Already setted all neccessary steps. But no use."^^ . "endpoint"^^ . . "Did you resolve this, and could you use a piece of assembly code that does what dispcallfunc does, and use it in the vtable of a class by swapping the pointer. The source of dispcallfunc can probably be found on wine"^^ . . . . . . . . "@James `NSOperationQueue` API is much more flexible in this case, since custom operation classes can have any implementation under the hood. E.g. [here](https://gist.github.com/TheDreamsWind/49bc1d11817828d627d3968364b08d5e) you can find a custom queue implemented on top of a POSIX thread, so you can potentially use your worker thread instead and dispatch your tasks in the thread's run loop"^^ . . . "0"^^ . . "@Rob Because I already have a thread that manages everything network related. I have already just given up though and used the main thread, at the expense of having to add more (otherwise unnecessary) synchronisation primitives to my network system."^^ . . . . "See these threads for examples and relevant resources: https://stackoverflow.com/questions/75531993/github-sonarcloud-action-does-not-scan-any-file and https://stackoverflow.com/questions/75192071/sonarcloud-with-googletest-and-cmake-on-github-actions"^^ . . "swift"^^ . . . "1"^^ . "SwizzleHelper also has unit tests where you can see how the swizzling and forwarding is done with the package."^^ . "coreml"^^ . . "0"^^ . . . . . . . "0"^^ . . "0"^^ . . . "1"^^ . . . . "0"^^ . "0"^^ . "You should add error message what it say. Also i saw typo there: [[electorViewController alloc]. Missing an "s"?"^^ . . . . "Querying whether a mac is in the locked state using Objective-C"^^ . . . "<p>I am using cordova-ios 6.2.0. I am creating a webview browser in my project. I recently debugged that my project is creating UIWebView instance instead of WKWebView. I scanned the whole project but i did not find any reference to UIWebView.</p>\n<p>In the header file also my property is set to WKWebView:\n<code>@property (nonatomic, strong) IBOutlet WKWebView* webView;</code></p>\n<p><a href="https://i.sstatic.net/z4r7C.png" rel="nofollow noreferrer">UIWebView at runtime</a></p>\n<p>I tried to configure WKWebView. so that the instance will set WKWebView at runtime but end up creating both the views.</p>\n<pre><code>- (void)createViews\n{\n // We create the views in code for primarily for ease of upgrades and not requiring an external .xib to be included\n \n CGRect webViewBounds = self.view.bounds;\n WKUserContentController* userContentController = [[WKUserContentController alloc] init];\n \n WKWebViewConfiguration* configuration = [[WKWebViewConfiguration alloc] init];\n \n NSString *userAgent = configuration.applicationNameForUserAgent;\n\n configuration.applicationNameForUserAgent = userAgent;\n configuration.userContentController = userContentController;\n configuration.processPool = [[CDVWebViewProcessPoolFactory sharedFactory] sharedProcessPool];\n\n self.webView = [[WKWebView alloc] initWithFrame:webViewBounds configuration:configuration];\n [self.view addSubview:self.webView];\n [self.view sendSubviewToBack:self.webView];\n \n self.webView.navigationDelegate = self;\n self.webView.backgroundColor = [UIColor whiteColor];\n\n}\n</code></pre>\n<p><a href="https://i.sstatic.net/KEmaH.png" rel="nofollow noreferrer">WKWebView</a></p>\n<p><a href="https://i.sstatic.net/rNKPh.png" rel="nofollow noreferrer">Debug View Hierarchy</a></p>\n<p>Also when i tried to set webView simply like the below code the UIWebView was set at runtime:</p>\n<pre><code>- (void)setupWebView {\n self.webView = [[WKWebView alloc] initWithFrame: CGRectZero];\n self.webView.navigationDelegate = self;\n [self.view addSubview:self.webView];\n [self.view sendSubviewToBack:self.webView];\n}\n</code></pre>\n<p>Here is the config.xml I am using.</p>\n<pre><code> &lt;content src=&quot;index.html&quot; /&gt;\n &lt;plugin name=&quot;cordova-sqlite-storage&quot; spec=&quot;git+https://github.com/litehelpers/Cordova-sqlite-storage.git&quot; /&gt;\n &lt;plugin name=&quot;cordova-plugin-splashscreen&quot; spec=&quot;^6.0.0&quot; /&gt;\n &lt;plugin name=&quot;cordova-plugin-statusbar&quot; spec=&quot;^3.0.0&quot; /&gt;\n &lt;plugin name=&quot;cordova-plugin-keyboard&quot; spec=&quot;^1.2.0&quot; /&gt;\n &lt;plugin name=&quot;cordova-plugin-inappbrowser&quot; spec=&quot;^5.0.0&quot; /&gt;\n &lt;plugin name=&quot;cordova-plugin-ionic-webview&quot; /&gt;\n \n &lt;platform name=&quot;ios&quot;&gt;\n &lt;preference name=&quot;WKWebViewOnly&quot; value=&quot;true&quot; /&gt;\n\n &lt;feature name=&quot;CDVWKWebViewEngine&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVWKWebViewEngine&quot; /&gt;\n &lt;/feature&gt;\n\n &lt;preference name=&quot;CordovaWebViewEngine&quot; value=&quot;CDVWKWebViewEngine&quot; /&gt;\n &lt;/platform&gt;\n \n &lt;feature name=&quot;CDVWKWebViewEngine&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVWKWebViewEngine&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;NetworkStatus&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVConnection&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;LocalStorage&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVLocalStorage&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;SplashScreen&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVSplashScreen&quot; /&gt;\n &lt;param name=&quot;onload&quot; value=&quot;true&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;InAppBrowser&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVInAppBrowser&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;AppAvailability&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;AppAvailability&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;Battery&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVBattery&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;Camera&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVCamera&quot; /&gt;\n &lt;/feature&gt;\n &lt;preference name=&quot;CameraUsesGeolocation&quot; value=&quot;false&quot; /&gt;\n &lt;feature name=&quot;Console&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVLogger&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;Device&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVDevice&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;Accelerometer&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVAccelerometer&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;Compass&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVCompass&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;Notification&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVNotification&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;File&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVFile&quot; /&gt;\n &lt;param name=&quot;onload&quot; value=&quot;true&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;FileTransfer&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVFileTransfer&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;Geolocation&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVLocation&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;Media&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVSound&quot; /&gt;\n &lt;/feature&gt;\n &lt;feature name=&quot;Capture&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVCapture&quot; /&gt;\n &lt;/feature&gt;\n &lt;preference name=&quot;ScrollEnabled&quot; value=&quot;true&quot; /&gt;\n &lt;preference name=&quot;show-splash-screen-spinner&quot; value=&quot;true&quot; /&gt;\n &lt;preference name=&quot;AutoHideSplashScreen&quot; value=&quot;true&quot; /&gt;\n &lt;preference name=&quot;Splashscreen&quot; value=&quot;screen&quot; /&gt;\n &lt;preference name=&quot;SplashScreenDelay&quot; value=&quot;4000&quot; /&gt;\n &lt;preference name=&quot;AutoHideSplashScreen&quot; value=&quot;true&quot; /&gt;\n &lt;preference name=&quot;ShowSplashScreenSpinner&quot; value=&quot;true&quot; /&gt;\n &lt;preference name=&quot;fullscreen&quot; value=&quot;false&quot; /&gt;\n &lt;preference name=&quot;WebViewBounce&quot; value=&quot;false&quot; /&gt;\n &lt;preference name=&quot;Orientation&quot; value=&quot;portrait&quot; /&gt;\n &lt;preference name=&quot;AllowInlineMediaPlayback&quot; value=&quot;false&quot; /&gt;\n &lt;preference name=&quot;BackupWebStorage&quot; value=&quot;cloud&quot; /&gt;\n &lt;preference name=&quot;DisallowOverscroll&quot; value=&quot;true&quot; /&gt;\n &lt;preference name=&quot;EnableViewportScale&quot; value=&quot;false&quot; /&gt;\n &lt;preference name=&quot;KeyboardDisplayRequiresUserAction&quot; value=&quot;true&quot; /&gt;\n &lt;preference name=&quot;MediaTypesRequiringUserActionForPlayback&quot; value=&quot;false&quot; /&gt;\n &lt;preference name=&quot;SuppressesIncrementalRendering&quot; value=&quot;false&quot; /&gt;\n &lt;preference name=&quot;TopActivityIndicator&quot; value=&quot;gray&quot; /&gt;\n &lt;preference name=&quot;GapBetweenPages&quot; value=&quot;0&quot; /&gt;\n &lt;preference name=&quot;PageLength&quot; value=&quot;0&quot; /&gt;\n &lt;preference name=&quot;PaginationBreakingMode&quot; value=&quot;page&quot; /&gt;\n &lt;preference name=&quot;PaginationMode&quot; value=&quot;unpaginated&quot; /&gt;\n &lt;preference name=&quot;StatusBarOverlaysWebView&quot; value=&quot;false&quot; /&gt;\n &lt;preference name=&quot;StatusBarBackgroundColor&quot; value=&quot;black&quot; /&gt;\n &lt;preference name=&quot;android-minSdkVersion&quot; value=&quot;23&quot; /&gt;\n &lt;preference name=&quot;android-targetSdkVersion&quot; value=&quot;31&quot; /&gt;\n\n &lt;preference name=&quot;CordovaWebViewEngine&quot; value=&quot;CDVWKWebViewEngine&quot; /&gt;\n\n //IOS CORS\n &lt;preference name=&quot;NativeXHRLogging&quot; value=&quot;none&quot; /&gt;\n &lt;preference name=&quot;AllowUntrustedCerts&quot; value=&quot;true&quot; /&gt;\n &lt;preference name=&quot;InterceptRemoteRequests&quot; value=&quot;secureOnly&quot; /&gt;\n &lt;preference name=&quot;allowFileAccessFromFileURLs&quot; value=&quot;true&quot; /&gt;\n &lt;preference name=&quot;allowUniversalAccessFromFileURLs&quot; value=&quot;true&quot; /&gt;\n //Android CORS\n &lt;preference name=&quot;AndroidInsecureFileModeEnabled&quot; value=&quot;true&quot; /&gt;\n</code></pre>\n"^^ . . . "0"^^ . "usernotifications"^^ . "That part seems to be a part that needs to be improved.. but it is not the cause of the above problem.. :("^^ . "Why are you even bothering with a run loop for this dispatch queue? Just give these methods the queue, and you’re done. The whole point of taking a dispatch queue is to get you out of the legacy pattern (that we had to do in the pre-GCD days) of spinning up a thread ourself with its own run loop…"^^ . . "Does this answer your question? [Getting Window Number through OSX Accessibility API](https://stackoverflow.com/questions/6178860/getting-window-number-through-osx-accessibility-api)"^^ . . . . "gpu"^^ . . . . "The issue comes from some other part of your code, i believe. I.e. check view hierarchy of the "black screen" and inspect why `LoginViewController` ends up with that result (it could be that something is broken on the storyboard, or in the `LoginViewController` code)"^^ . . "<p>When debugging, viewDidLoad of LoginViewController is called, but the screen is black screen. I really don't know why..</p>\n<pre><code>@interface AppDelegate ()\n\n@property (nonatomic, strong) AppCoordinator *appCoordinator;\n\n@end\n\n@implementation AppDelegate\n\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n self.window = [[UIWindow alloc] initWithFrame: UIScreen.mainScreen.bounds];\n UIStoryboard *sb = [UIStoryboard storyboardWithName:@&quot;Main&quot; bundle:nil];\n LoginViewController *vc = [sb instantiateViewControllerWithIdentifier:@&quot;LoginView&quot;];\n \n //UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController: vc];\n self.window.rootViewController = vc;\n [self.window makeKeyAndVisible];\n \n return YES;\n}\n</code></pre>\n<p>LoginViewController.m</p>\n<pre><code>\n#import &quot;LoginViewController.h&quot;\n\n@implementation LoginViewController\n\n- (void)viewDidLoad {\n NSLog(@&quot;LoginViewController viewDidLoad&quot;);\n [super viewDidLoad];\n self.view.backgroundColor = [UIColor redColor];\n \n}\n\n\n@end\n</code></pre>\n"^^ . . "Post your config.xml"^^ . "Using C++ in Objective-C"^^ . . . . "<p>I am writing an application that needs to periodically obtain the PID, process name, window ID and window name of the active window. The program is written in Go, but the issues relate to any FFI into the Mac ecosystem. I have two approaches, via AppleScript and via Objective C.</p>\n<p>Both give a 75% solution; either missing the window ID or the window name. I would like to find a single unified solution that gives all four attributes rather than having to cobble together one that depends on both of the approaches that I have.</p>\n<p>AppleScript approach; does not provide WindowNumber for most cases.</p>\n<pre><code>global activeApp, activePID, activeName, windowName\nset windowName to &quot;&quot;\ntell application &quot;System Events&quot;\n set activeApp to first application process whose frontmost is true\n set activePID to unix id of activeApp\n set activeName to name of activeApp\n tell process activeName\n try\n tell (1st window whose value of attribute &quot;AXMain&quot; is true)\n set windowName to value of attribute &quot;AXTitle&quot;\n end tell\n end try\n end tell\nend tell\nreturn (&quot;{\\&quot;pid\\&quot;:&quot; &amp; activePID &amp; &quot;,\\&quot;name\\&quot;:\\&quot;&quot; &amp; activeName &amp; &quot;\\&quot;,\\&quot;window\\&quot;:\\&quot;&quot; &amp; windowName &amp; &quot;\\&quot;}&quot; as text)\n</code></pre>\n<p>Objective C approach; does not provide WindowName for most cases.</p>\n<pre><code>#include &lt;Cocoa/Cocoa.h&gt;\n#include &lt;CoreGraphics/CGWindow.h&gt;\n\nstruct details {\n int wid;\n int pid;\n const char* name;\n const char* window;\n};\n\nint activeWindow(struct details *d)\n{\n if (d == NULL) {\n return 0;\n }\n NSArray *windows = (NSArray *)CGWindowListCopyWindowInfo(kCGWindowListExcludeDesktopElements|kCGWindowListOptionOnScreenOnly,kCGNullWindowID);\n for(NSDictionary *window in windows){\n int WindowLayer = [[window objectForKey:(NSString *)kCGWindowLayer] intValue];\n if (WindowLayer == 0) {\n d-&gt;wid = [[window objectForKey:(NSString *)kCGWindowNumber] intValue];\n d-&gt;pid = [[window objectForKey:(NSString *)kCGWindowOwnerPID] intValue];\n d-&gt;name = [[window objectForKey:(NSString *)kCGWindowOwnerName] UTF8String];\n d-&gt;window = [[window objectForKey:(NSString *)kCGWindowName] UTF8String];\n return 1;\n }\n }\n return 0;\n}\n</code></pre>\n"^^ . "cordova"^^ . . . . "<p>I found out that in my custom plugin XIB file. I was using deprecated UIWebView component. I deleted it and added WKWebView instead and it solved the problem.</p>\n"^^ . "0"^^ . "core-data"^^ . . . "<p>Sending a pdf from the ipad via a native share(opened the file on device and sent it via teams), results in the same error that my app gets.</p>\n<p>Solution, wait for ios or teams to fix this issue</p>\n"^^ . . . . . . . . . . . "with your code it prints extra stuff"^^ . . . "<p>The problem is with your <code>initWithFrame</code> of <code>LibraryView</code>. You are attempting to set the library view's constraints to itself.</p>\n<p>Remove all of the constraint related code from <code>LibraryView</code>. You want to set the constraints in the <code>viewDidLoad</code> of the root view controller.</p>\n<p>After the line:</p>\n<pre><code>[self.view addSubview:library];\n</code></pre>\n<p>you can add code to setup the constraints of <code>library</code> against the same <code>margins</code> variable used to setup <code>l3</code>.</p>\n<hr />\n<p>Also, it's easier to active a bunch of constraints as follows:</p>\n<pre><code>[NSLayoutConstraint activateConstraints:@[\n [l3.trailingAnchor constraintEqualToAnchor:margins.trailingAnchor],\n [l3.leadingAnchor constraintEqualToAnchor:margins.leadingAnchor],\n [l3.topAnchor constraintEqualToAnchor:margins.topAnchor],\n [l3.bottomAnchor constraintEqualToAnchor:margins.bottomAnchor],\n]];\n</code></pre>\n"^^ . . . . . . "0"^^ . "0"^^ . . . . . . . . . "0"^^ . "<p>I have a WKWebView (discussed in this page - <a href="https://stackoverflow.com/questions/76095477/how-can-i-paginate-html-in-a-wkwebview">How can I paginate html in a wkwebview?</a>) and I'm trying a different approach to solving the problem discussed there.</p>\n<p>What I want to do is trap scroll events in the view for the entire window (<code>[self.window.contentView setAllowedTouchTypes:(NSTouchTypeMaskDirect | NSTouchTypeMaskIndirect)];</code>) and then ignore all touch events for WKWebView and WKWebView's enclosing scrollview.</p>\n<p>I can see that my <code>setAllowedTouchTypes</code> is working as follows…</p>\n<pre><code>@interface NSView ( TouchEvents )\n\n@end\n\n@implementation NSView ( TouchEvents )\n\n- (void)touchesBeganWithEvent:(NSEvent *)event {\n NSLog(@&quot;Touched&quot;); \n}\n\n@end\n\n</code></pre>\n<p>Even though I can see the 'touched' messages in the logs, the contents of my WKWebView still scrolls around when I swipe with my fingers. For this to work, I need it not to move at all!</p>\n<p>Try as I might, I can't work out how to stop the swipes working for my WKWebView - and there doesn't seem to be anything in Interface Builder to achieve this aim either.</p>\n"^^ . . "1"^^ . . "1"^^ . . "Note that your comparison between Objective-C and Swift is comparing completely different cases. In Swift, the `Float` and `Double` structs are handling the conversion from a string. The Objective-C code is asking the `NSString` class for a primitive numeric value. Those are essentially opposite approaches. A better comparison would be if `NSNumber` in Objective-C had an initializer that accepted an `NSString` (it doesn't though). Or if in Swift, `String` had a `floatValue` or `doubleValue` property (it doesn't though). So there simply isn't a fair comparison here."^^ . . . "Did you change anything? You should use `NSTableViewSelectionDidChangeNotification` instead of `@"NSTableViewSelectionDidChangeNotification"` but it should work. What is the class of `self`?"^^ . . . . . "0"^^ . "@GeoffHackworth\n\nThat cause was correct. Thank you."^^ . "0"^^ . . . . . "0"^^ . . . "1"^^ . "0"^^ . "1"^^ . "+[GMSx_GMPCClientVectorTileExtensionsRoot indoorBuildingMetadata]: unrecognized selector sent to class"^^ . "0"^^ . . . "2"^^ . . . "2"^^ . . . . . "The `private static swizzleCustomToolTipMethods()` method is where I do the actual swizzling. Methods like `mouseExited_CustomToolTip(with:)` show how I do the forwarding. I plan to eventually add a HOW-TO section in the SwizzleHelper README, but haven't made time for it so far. At the moment, it's mainly a support package for CustomToolTip, though a couple of other people have forked it. I don't know what they're using it for. I also intend to add support for swizzling class methods."^^ . "Urgh. Ah well, I guess I can't say I'm that surprised. Everything else about MacOS has been an underwhelming experience to date, so why should this be any different? :) Thanks."^^ . . . "0"^^ . . "0"^^ . . . . . . . . "4"^^ . "1"^^ . . . . "1"^^ . . . . . "0"^^ . "0"^^ . . "0"^^ . "0"^^ . . . ""Not working" means the Swift function `swizzledPullTypes` doesn't get called at all"^^ . . . . "No offense, for the sake of interacting with the Network framework, I think you’re just digging a deeper hole introducing operation queues…"^^ . "0"^^ . "1"^^ . "0"^^ . "How does the new method look when it's imported into Objective C? There's probably a subtle difference."^^ . "It occurs to me that I haven't asked an obvious question, what manner of "not working" are you seeing? Does it compile and run, but your swizzled method isn't called? Does it crash?"^^ . . . . . "1"^^ . "textcolor"^^ . . "Great analysis. I fully agree that returning `nil` on file creation failure was the most likely intent. Otherwise the return value is very misleading to the caller."^^ . . "@TheDreamsWind you’re right about my question. I’ve already fixed it"^^ . "Yes, but then you need to write your init in Objective-C (not Swift) and possibly mark it with `NS_SWIFT_UNAVAILABLE` 9depends on usage really - is it public, etc)"^^ . . . "1"^^ . "<p>I am learning to write EndpointSecurity Client for macOS.\nThe client is running and observes all the notifications from all the paths from &quot;/&quot; (root), as it runs as root. I have muted all the system-paths.</p>\n<p>What I need is to observe path for /Users/anoopvaidya for any file changes. But this never happens, what am I missing?</p>\n<p>What I learn is if there are several notifications it may get skipped in the Queue.</p>\n<p>So is there a way to mute-all but targeted ones?</p>\n<p>Any leads/guidance is much appreciated.</p>\n<p>Here is the full code:</p>\n<pre><code>static void handleEvent(es_client_t *client, const es_message_t *msg)\n{\n char const *filePath = msg-&gt;process-&gt;executable-&gt;path.data;\n NSString *filePathString = [[NSString alloc] initWithFormat:@&quot;%s&quot;, filePath];\n \n // TODO: need to check the user who logged in, is this possible?\n NSString *path = [NSString stringWithFormat:@&quot;/Users/%@/Documents&quot;, @&quot;anoopvaidya&quot;];\n\n os_log(OS_LOG_DEFAULT, &quot;filePathString = %@, path = %@&quot;, filePathString, path);\n \n // check if the events are from path\n if ([filePathString hasPrefix:path]) {\n os_log(OS_LOG_DEFAULT, &quot;Compare - filePathString = %@, path = %@&quot;, filePathString, path);\n os_log(OS_LOG_DEFAULT, &quot;proceeding...&quot;);\n }\n else {\n return;\n }\n \n switch (msg-&gt;event_type) {\n case ES_EVENT_TYPE_NOTIFY_EXEC:\n os_log(OS_LOG_DEFAULT, &quot;%{public}s (pid: %d) | EXEC: New image: %{public}s&quot;,\n msg-&gt;process-&gt;executable-&gt;path.data,\n audit_token_to_pid(msg-&gt;process-&gt;audit_token),\n msg-&gt;event.exec.target-&gt;executable-&gt;path.data);\n break;\n\n case ES_EVENT_TYPE_NOTIFY_FORK:\n os_log(OS_LOG_DEFAULT, &quot;%{public}s (pid: %d) | FORK: Child pid: %d&quot;,\n msg-&gt;process-&gt;executable-&gt;path.data,\n audit_token_to_pid(msg-&gt;process-&gt;audit_token),\n audit_token_to_pid(msg-&gt;event.fork.child-&gt;audit_token));\n break;\n\n case ES_EVENT_TYPE_NOTIFY_EXIT:\n os_log(OS_LOG_DEFAULT, &quot;%{public}s (pid: %d) | EXIT: status: %d&quot;,\n msg-&gt;process-&gt;executable-&gt;path.data,\n audit_token_to_pid(msg-&gt;process-&gt;audit_token),\n msg-&gt;event.exit.stat);\n break;\n\n case ES_EVENT_TYPE_NOTIFY_OPEN:\n os_log(OS_LOG_DEFAULT, &quot;Open event&quot;);\n break;\n case ES_EVENT_TYPE_NOTIFY_CLOSE:\n os_log(OS_LOG_DEFAULT, &quot;Close event&quot;);\n\n break;\n \n default:\n os_log_error(OS_LOG_DEFAULT, &quot;Unexpected event type encountered: %d\\n&quot;, msg-&gt;event_type);\n break;\n }\n}\n\nvoid mutePath(es_client_t *client) {\n NSArray&lt;NSString *&gt; *paths = @[\n @&quot;/bin/&quot;, @&quot;/private/&quot;, @&quot;/Applications/&quot;,\n @&quot;/var/&quot;, @&quot;/cores/&quot;, @&quot;/dev/&quot;, @&quot;/opt/&quot;, @&quot;/private/&quot;, @&quot;/System/&quot;, @&quot;/Library/&quot;,\n @&quot;/sbin/&quot;, @&quot;/usr/&quot;\n ];\n for (NSString *e in paths) {\n es_mute_path_prefix(client, [e UTF8String]);\n }\n}\n\nint main(int argc, char *argv[])\n{\n // Create the client\n es_client_t *client = NULL;\n es_new_client_result_t newClientResult = es_new_client(&amp;client, ^(es_client_t *c, const es_message_t *message) {\n handleEvent(client, message);\n });\n\n if (newClientResult != ES_NEW_CLIENT_RESULT_SUCCESS) {\n return 1;\n }\n \n mutePath(client);\n \n es_event_type_t events[] = {\n ES_EVENT_TYPE_NOTIFY_CREATE, //create file\n ES_EVENT_TYPE_NOTIFY_OPEN, // open file\n ES_EVENT_TYPE_NOTIFY_RENAME, // rename file\n ES_EVENT_TYPE_NOTIFY_CLOSE, // close file\n ES_EVENT_TYPE_NOTIFY_WRITE, // write to file\n ES_EVENT_TYPE_NOTIFY_UNLINK, // delete\n ES_EVENT_TYPE_NOTIFY_EXIT };\n\n if (es_subscribe(client, events, sizeof(events) / sizeof(events[0])) != ES_RETURN_SUCCESS) {\n os_log(OS_LOG_DEFAULT, &quot;Failed to subscribe to events&quot;);\n es_delete_client(client);\n return 1;\n }\n\n dispatch_main();\n}\n</code></pre>\n"^^ . . . . . . . . . . . . . "0"^^ . . . "0"^^ . . "Well I use first id myClass = objc_getClass( "myClass" ), which is not nil, and then I use var1 = [myClass doSomethingWith:...] (myClass as a literal)."^^ . . . "You would call `getaddrinfo` with your host name and then loop through the returned results looking for results were `ai_family` is `AF_INET` (which is IPv4) and `AF_INET6`. `ai_addr` will then contain the relevant address bytes. Take a look at this https://subscription.packtpub.com/book/general/9781849698085/1/ch01lvl1sec11/performing-a-network-address-resolution"^^ . "1"^^ . . . . . "1"^^ . "If this is a modern project it will use the scene lifecycle and your code for configuring the window should be in the scene delegate, not the app delegate."^^ . . "Please [edit] your question and add a [example] showing what you have already tried. See also [ask]."^^ . . . . . "And what's your problem? It's not a good way of using `printf()` — you would be safer using `printf("%s\\n", NSHomeDirectory())`, but it's unlikely to be your problem. Is the problem occurring when you compile the code, when you link the code, or when you run the code? You should probably mention that you're trying to work on macOS X, and presumably, you're using Xcode — but are you using the IDE or just the command-line tools?"^^ . "<p>I'm trying to use C++ with Objective-C. My tasks force me to use C++ only for crossplatform core. Goal is to reuse core on different platforms and rewrite only graphics interface. I know Objective-C pretty well, and also some C++. However, when I try to use them together, get a ton of errors.</p>\n<p><em>For example:</em></p>\n<p>CppFile.cpp</p>\n<pre class="lang-cpp prettyprint-override"><code>#include &quot;ObjCFile.h&quot;\n\nint main() {\n ObjCFile *objCFile;\n}\n</code></pre>\n<p>ObjCFile.h</p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\n@interface ObjCFile : UIViewController\n\n- (void)showInterface;\n...\n</code></pre>\n<p>With the two files above, I get errors about things that seems completely unrelated, such as <code>undefined NSString</code> and so on.</p>\n<p>I've tried to look for answers to this problem on Google, and here on StackOverflow and found one approach, but it's not very clear because same C++ class in this case uses 2 type of methods : 1.Implemented outside 2.Implemented inside. And inside methods will call outside methods (C++ class from internal logic must call it’s own methods that implements different logic). There’s no responsibility division (SOLID). You may check this approach link <a href="https://stackoverflow.com/questions/75516453/how-to-call-functions-in-c-and-objective-c-to-each-other">How to call functions in c++ and objective-c to each other</a></p>\n"^^ . . . . "2"^^ . . . "0"^^ . "0"^^ . "0"^^ . . . . . . "0"^^ . "<p>I have been doing method swizzling (Objective-C to Swift) for my unit tests and they're perfectly working, except when the time came I need to swizzle methods with parameters.</p>\n<p>Old method to be swizzled:</p>\n<pre><code>@interface FNServerApiRequests : NSObject\n+ (void) pullTypesFromServer:(void (^)(id responseJson))completionBlock error:(MKNKErrorBlock)errorBlock;\n@end\n</code></pre>\n<p>Then my new Swift function:</p>\n<pre><code>extension FNServerApiRequests {\n @objc\n class func swizzledPullTypes(fromServer completionBlock: @escaping (Any) -&gt; Void, error errorBlock: @escaping MKNKErrorBlock) {\n print(&quot;swizzledPullTypes&quot;)\n let dic = FNTestUtils.getJsonDictionaryFile(&quot;pull-types.json&quot;)\n completionBlock(dic!)\n }\n}\n</code></pre>\n<p>Then finally:</p>\n<pre><code> func setupSwizzling() {\n let originalMethod = class_getClassMethod(FNServerApiRequests.self, #selector(FNServerApiRequests.pullTypes(fromServer:error:)))\n let swizzledMethod = class_getClassMethod(FNServerApiRequests.self, #selector(FNServerApiRequests.swizzledPullTypes(fromServer:error:)))\n method_exchangeImplementations(originalMethod!, swizzledMethod!)\n }\n</code></pre>\n<p>I matched exactly how the two methods are declared in Swift (e.g. parameter names, placeholders, etc...)</p>\n"^^ . . "From seeing quickly the doc, it seems you can init the PTAnnotationVC with PTAnnotation Manager, and the PTAnnotationManager with a `PDFViewCtrl`. Might a clue to dig..."^^ . . "0"^^ . . "0"^^ . . . "I haven't added swizzling class methods so it may not be directly useful to you after all. But for swizzling instance methods, define an extension for the object type you want to swizzle a method of, define your swizzled method to do what you want to do, and to chain to the original implementation you call the appropriate `callReplacedMethod...` method specifying the original selector. Those `callReplacedMethod...` function are in `NSObject+Swizzling.swift`. I use its the CustomToolTip package linked in the README. In it, `NSView+CustomToolTip.swift` is the place to look."^^ . . . . . . . . . "0"^^ . . . . "0"^^ . . . . . . "0"^^ . "graphics"^^ . "uiview"^^ . . . . . "If you allow third-party apps or websites to record your screen, any information they collect is governed by their terms and privacy policies. It’s recommended that you learn about the privacy practices of those parties."^^ . "Can you give an example where AppleScript returns a name and Objective-C doesn't?"^^ . "Also, it's certainly not the case that "most C++ programmers write their programs on Windows..." C++ is used on a large variety of platforms, from embedded systems to supercomputers."^^ . "1"^^ . . . . . . "There's nothing wrong with using C++, but if you're able to add your own Objective-C header files to your C++ source, then presumably you're also able to choose to compile your C++ using an Objective-C++ compiler. You wouldn't expect a C++ compiler to work if you #included a bunch of Python code, right? It's the same with Objective-C -- if you include it in your C++ code, the compiler won't know what to do with it. Using the bridge file is one way to handle the problem, but it's extra work compared to just using a compiler that knows about Objective-C."^^ . . . . "0"^^ . . "0"^^ . . . . . "0"^^ . . "WKWebView requestMediaPlaybackState(WithCompletionHandler) returns WKMediaPlaybackStatePlaying when video is not playing?"^^ . "2"^^ . "<p>You need to send the <code>UTF8String</code> message to the <code>NSString</code> object returned by <code>NSHomeDirectory()</code> to obtain a C string. To do this in pure C (Tested):</p>\n<pre><code>#include &lt;objc/runtime.h&gt;\n#include &lt;objc/message.h&gt;\nvoid *NSHomeDirectory();\nvoid testFunc() {\n puts(((const char *(*)(void *, SEL))objc_msgSend)(NSHomeDirectory(), sel_getUid(&quot;UTF8String&quot;)));\n // Also use puts() instead of printf() here\n}\n</code></pre>\n<p><em><strong>Note:</strong> Compile using <code>-framework Cocoa</code></em></p>\n"^^ . "0"^^ . "So what is problem? I see duplicate explains everything. Translation unit which provides bridge must have `.mm` extension. Objective C interface nicely hides C++. C++ header is also easy to hide Objective C. I did something like this for 5 years (C++ cross platform library with bindings to Objective-C (MacOS/iOS), C# (Windows) and Java - (Android), C++ (Linux)) and bridge to Objective-C was the easiest thing. The Java was hard since JNI is a real pain."^^ . . "0"^^ . . "Non-realtime pitch shift function for swift or objective c"^^ . "0"^^ . . "pdftron"^^ . . . . "<p>Faults are a normal part of Core Data.</p>\n<p>When you execute a fetch request with <code>resultType</code> of <code>managedObjectResultType</code> (which is the default), objects are returned as faults, unless you <a href="https://developer.apple.com/documentation/coredata/nsfetchrequest/1506756-returnsobjectsasfaults" rel="nofollow noreferrer">explicitly request otherwise</a> by setting <code>returnObjectsAsFaults</code> to `false.</p>\n<p>The object properties are held in the row cache and faults are returned in the result set. When you access a property, the fault fires and the data is fetched from the row cache. This process is transparent and has a relatively low overhead.</p>\n<p>If you know that you are going to access the object properties, and you have a large result set, then you can set <code>returnsObjectsAsFaults</code> to <code>false</code> to avoid the fault process.</p>\n"^^ . . . "iphone"^^ . "1"^^ . "Figuring out what causing a Core Data fault"^^ . . . "0"^^ . "1"^^ . "1"^^ . . . . . . "2"^^ . "Does this answer your question? [Create directory/file in iOS using C++](https://stackoverflow.com/questions/38945963/create-directory-file-in-ios-using-c)"^^ . . . . "2"^^ . . . "2"^^ . "<p>I have google maps pod installed in my app and using third party SDK which is internally using google maps. Whenever i am trying to enter to load Maps screen, it immediately crashing with below exception.</p>\n<blockquote>\n<p>Terminating app due to uncaught exception\n'NSInvalidArgumentException', reason:\n'+[GMSx_GMPCClientVectorTileExtensionsRoot indoorBuildingMetadata]:\nunrecognized selector sent to class 0x100c90448'</p>\n</blockquote>\n<p>When I remove that custom SDK and loading maps, it is successfully loading without crash.</p>\n<p>Dont know what is the exact issue here. Suggestions would be helpful to solve this issue.</p>\n"^^ . . "0"^^ . . "<p>After navigating to a webpage using a WKWebView I'm polling every second to find out if there is any video media on the page and if it is playing. For many sites requestMediaPlaybackState (WithCompletionHandler) returns WKMediaPlaybackStatePlaying before the user has pressed Play on the video.</p>\n<pre><code>if (@available(iOS 15.0, *)) {\n [website requestMediaPlaybackStateWithCompletionHandler:^(WKMediaPlaybackState result) {\n if (result == WKMediaPlaybackStatePlaying) {\n</code></pre>\n<p>...</p>\n"^^ . "blending"^^ . . . . "@MarekR solution from answer above suppose that definitions in C++ class implemented in Objective-C++. It's not very clear because same C++ class in this case uses 2 type of methods : 1.Implemented outside 2.Implemented inside. And inside methods will call outside methods. There’s no responsibility division (SOLID). Using wrapper as a standalone Objective-C++ class gives us that division: C++ calls methods in Objective-C++ Wrapper class and Wrapper calls Objective-C ViewController class. And vice versa"^^ . "0"^^ . . . . "1"^^ . . "c"^^ . . "0"^^ . . . . "<p>I am trying to get the <code>NSHomeDirectory()</code> in pure C</p>\n<pre class="lang-c prettyprint-override"><code>#include &lt;CoreFoundation/CFBundle.h&gt;\n#include &lt;CoreFoundation/CoreFoundation.h&gt;\n\nvoid testFunc() {\n printf(NSHomeDirectory()); \n}\n</code></pre>\n"^^ . "c++"^^ . "You will need to use [getaddrinfo](https://man7.org/linux/man-pages/man3/getaddrinfo.3.html) and then look in the `results` array for `AF_INET6` results. 'gethostbyname` is not ipv6 aware"^^ . "1"^^ . "<p>I am trying to animate and resize a CAGradientLayer using a pan and tap gesture but it's lagging. I am animating other things along with this gradientLayer but speed of animation of gradientLayer slower than that of other UI animation. I have created a sample UIViewController in which I have a rectangle inside which I have my gradient layer. You can simply drag the rectangle to resize it or you can tap on it. You can see the timing difference in animation of rectangle's grey border and gradient layer.</p>\n<p>ViewController</p>\n<pre><code>class ViewController: UIViewController {\n \n var rectangle: UIView!\n var gradientLayer: CAGradientLayer?\n var widthConstraint:NSLayoutConstraint!\n var shouldExpand = false\n \n override func viewDidLoad() {\n super.viewDidLoad()\n \n rectangle = UIView()\n view.addSubview(rectangle)\n \n rectangle.translatesAutoresizingMaskIntoConstraints = false\n rectangle.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: view.frame.width * 0.05).isActive = true\n rectangle.heightAnchor.constraint(equalToConstant: 200).isActive = true\n widthConstraint = rectangle.widthAnchor.constraint(equalToConstant: 100)\n widthConstraint.isActive = true\n rectangle.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true\n \n rectangle.layer.cornerRadius = 15\n rectangle.layer.borderWidth = 5\n rectangle.layer.borderColor = UIColor.lightGray.cgColor\n \n setUpGesture()\n setUpGradient()\n }\n \n override func viewDidAppear(_ animated: Bool) {\n super.viewDidAppear(animated)\n if let layer = gradientLayer {\n layer.frame = rectangle.bounds\n }\n }\n \n func setUpGesture() {\n let panGesture = UIPanGestureRecognizer(target: self, action: #selector(handlePanGesture))\n rectangle.addGestureRecognizer(panGesture)\n \n let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTapGesture))\n rectangle.addGestureRecognizer(tapGesture)\n }\n \n func setUpGradient() {\n gradientLayer = CAGradientLayer()\n gradientLayer!.frame = rectangle.bounds\n gradientLayer!.startPoint = .init(x: -1, y: 0)\n gradientLayer!.endPoint = .init(x: 1, y: 0)\n gradientLayer!.colors = [UIColor.red.cgColor, UIColor.yellow.cgColor]\n gradientLayer!.cornerRadius = 15\n \n rectangle.layer.addSublayer(gradientLayer!)\n }\n \n @objc func handlePanGesture(gesture: UIPanGestureRecognizer) {\n \n guard !shouldExpand else { return }\n \n let translation = gesture.translation(in: gesture.view)\n \n switch gesture.state {\n case .began, .changed:\n \n if translation.x &lt; -65 || translation.x &gt; (view.frame.width - (100 + (view.frame.width * 0.1)) ) {\n gesture.state = .ended\n }\n \n widthConstraint.constant = 100 + translation.x\n if let layer = gradientLayer {\n layer.frame.size.width = 100 + translation.x\n }\n case .ended, .cancelled:\n UIView.animate(withDuration: 0.7, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 5, options: [.curveEaseOut, .allowUserInteraction]) {\n self.widthConstraint.constant = 100\n if let layer = self.gradientLayer {\n layer.frame.size.width = 100\n }\n self.view.layoutIfNeeded()\n }\n default:\n break\n }\n }\n \n @objc func handleTapGesture(gesture: UITapGestureRecognizer) {\n \n shouldExpand.toggle()\n \n if shouldExpand {\n UIView.animate(withDuration: 0.7, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 5, options: [.curveEaseOut, .allowUserInteraction]) {\n self.widthConstraint.constant = self.view.frame.width - (self.view.frame.width * 0.1)\n if let layer = self.gradientLayer {\n layer.frame.size.width = self.view.frame.width - (self.view.frame.width * 0.1)\n }\n self.view.layoutIfNeeded()\n }\n } else {\n UIView.animate(withDuration: 0.7, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 5, options: [.curveEaseOut, .allowUserInteraction]) {\n self.widthConstraint.constant = 100\n if let layer = self.gradientLayer {\n layer.frame.size.width = 100\n }\n self.view.layoutIfNeeded()\n }\n }\n }\n}\n</code></pre>\n<p><strong>Alternative approach using SwiftUI</strong></p>\n<p>I tried another approach using swiftUI's LinearGeadient. With this approach the drag is smooth, gesture follows rectangle's border as you drag but swiftUI's LinearGeadient does not animate. You can tap on the rectangle and see it not animating. Here's\ncode for other approach. Just remove setUpGradient() function call from viewDidLoad and put setUpSwiftUIGradient function in the view controller and call it in ViewDidLoad.</p>\n<p>SwiftUI View</p>\n<pre><code>struct SwiftUIGradientView: View {\n var uiColors: [UIColor]\n \n var body: some View {\n \n let colors = uiColors.map { Color(uiColor: $0) }\n \n GeometryReader { _ in\n LinearGradient(colors: colors, startPoint: .leading, endPoint: .trailing)\n .cornerRadius(15)\n }\n }\n}\n</code></pre>\n<p>setUpSwiftUIGradient</p>\n<pre><code>func setUpSwiftUIGradient() {\n let host = UIHostingController(rootView: SwiftUIGradientView(uiColors: [.red, .yellow]))\n let uiView = host.view!\n uiView.backgroundColor = .clear\n \n rectangle.addSubview(uiView)\n \n uiView.translatesAutoresizingMaskIntoConstraints = false\n uiView.topAnchor.constraint(equalTo: rectangle.topAnchor).isActive = true\n uiView.leadingAnchor.constraint(equalTo: rectangle.leadingAnchor).isActive = true\n uiView.trailingAnchor.constraint(equalTo: rectangle.trailingAnchor).isActive = true\n uiView.bottomAnchor.constraint(equalTo: rectangle.bottomAnchor).isActive = true\n }\n</code></pre>\n<p>Can anyone help me get this thing right ?</p>\n"^^ . "1"^^ . "0"^^ . "0"^^ . . . "2"^^ . "0"^^ . "Can a Swift init be made available only for ObjectiveC?"^^ . "And if you want to create a "nan" on Objective-c, just simple like double nan = NAN. There is a macro to represent it."^^ . . . . . . "<p>The problem is that <strong>layers</strong> have their own built-in animation effects when certain properties are changed - frame begin one of them.</p>\n<p>You can <em>disable</em> the built-in animation like this:</p>\n<pre><code> if let layer = gradientLayer {\n CATransaction.begin()\n CATransaction.setDisableActions(true)\n layer.frame.size.width = 100 + translation.x\n CATransaction.commit()\n }\n</code></pre>\n<p>Which works fine while you are dragging. Unfortunately, it won't match when you animate the view's frame size.</p>\n<p>You will probably be much better off using a custom <code>UIView</code> subclass, setting its &quot;base&quot; layer to be a gradient layer.</p>\n<p>Quick example:</p>\n<pre><code>class SomeGradientView: UIView {\n \n // this allows us to use the &quot;base&quot; layer as a gradient layer\n // instead of adding a sublayer\n lazy var gradLayer: CAGradientLayer = self.layer as! CAGradientLayer\n override class var layerClass: AnyClass {\n return CAGradientLayer.self\n }\n override init(frame: CGRect) {\n super.init(frame: frame)\n commonInit()\n }\n required init?(coder aDecoder: NSCoder) {\n super.init(coder:aDecoder)\n commonInit()\n }\n private func commonInit() {\n gradLayer.startPoint = .init(x: -1, y: 0)\n gradLayer.endPoint = .init(x: 1, y: 0)\n gradLayer.colors = [UIColor.red.cgColor, UIColor.yellow.cgColor]\n }\n \n}\n</code></pre>\n<p>With that class, you no longer need to add sublayers, and you don't need to deal with the gradient layer frame.</p>\n<p>Your example view controller, modified slightly:</p>\n<pre><code>class ViewController: UIViewController {\n \n var rectangle: SomeGradientView!\n var widthConstraint:NSLayoutConstraint!\n var shouldExpand = false\n \n override func viewDidLoad() {\n super.viewDidLoad()\n \n rectangle = SomeGradientView()\n view.addSubview(rectangle)\n \n rectangle.translatesAutoresizingMaskIntoConstraints = false\n rectangle.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: view.frame.width * 0.05).isActive = true\n rectangle.heightAnchor.constraint(equalToConstant: 200).isActive = true\n widthConstraint = rectangle.widthAnchor.constraint(equalToConstant: 100)\n widthConstraint.isActive = true\n rectangle.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true\n \n rectangle.layer.cornerRadius = 15\n rectangle.layer.borderWidth = 5\n rectangle.layer.borderColor = UIColor.lightGray.cgColor\n \n setUpGesture()\n \n }\n \n func setUpGesture() {\n let panGesture = UIPanGestureRecognizer(target: self, action: #selector(handlePanGesture))\n rectangle.addGestureRecognizer(panGesture)\n \n let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTapGesture))\n rectangle.addGestureRecognizer(tapGesture)\n }\n \n @objc func handlePanGesture(gesture: UIPanGestureRecognizer) {\n \n guard !shouldExpand else { return }\n \n let translation = gesture.translation(in: gesture.view)\n \n switch gesture.state {\n case .began, .changed:\n \n if translation.x &lt; -65 || translation.x &gt; (view.frame.width - (100 + (view.frame.width * 0.1)) ) {\n gesture.state = .ended\n }\n \n widthConstraint.constant = 100 + translation.x\n case .ended, .cancelled:\n UIView.animate(withDuration: 0.7, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 5, options: [.curveEaseOut, .allowUserInteraction]) {\n self.widthConstraint.constant = 100\n self.view.layoutIfNeeded()\n }\n default:\n break\n }\n }\n \n @objc func handleTapGesture(gesture: UITapGestureRecognizer) {\n \n shouldExpand.toggle()\n \n if shouldExpand {\n UIView.animate(withDuration: 0.7, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 5, options: [.curveEaseOut, .allowUserInteraction]) {\n self.widthConstraint.constant = self.view.frame.width - (self.view.frame.width * 0.1)\n self.view.layoutIfNeeded()\n }\n } else {\n UIView.animate(withDuration: 0.7, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 5, options: [.curveEaseOut, .allowUserInteraction]) {\n self.widthConstraint.constant = 100\n self.view.layoutIfNeeded()\n }\n }\n }\n}\n</code></pre>\n<p>If you want to change the gradient properties (colors, angle, etc), you can still do that like this:</p>\n<pre><code> func setUpGradient() {\n rectangle.gradLayer.startPoint = .init(x: 0, y: 0)\n rectangle.gradLayer.endPoint = .init(x: 1, y: 1)\n rectangle.gradLayer.colors = [UIColor.blue.cgColor, UIColor.green.cgColor]\n }\n \n</code></pre>\n"^^ . . . "<p>You are mixing different concepts here. Dispatch Queue is essentially a thread pool, the API of GCD doesn't give contract in regards to which thread it runs its tasks with (with exception to the &quot;main&quot; queue which runs in the &quot;main&quot; thread only), so each separate task of a GCD queue can potentially be executed in a new thread. On the other hand the run loops of Cocoa frameworks are bound to specific thread only (conventionally each thread has only one run loop it was created with).</p>\n<p>Long story short: you cannot &quot;connect&quot; a run loop to a dispatch queue, because queues operate in different threads (even if the queues are serial), while a run loop needs a specific thread to work in.</p>\n"^^ . . "2"^^ . . . . . . . . . . . "0"^^ . "drag-and-drop"^^ . . . "0"^^ . "1"^^ . . "<p>I have a textfield that accepts numbers and I am trying to replace the 8th character in the string with a &quot;.&quot;</p>\n<pre><code>if(self.txtQty.text.length &gt;= 8){\n NSRange range = NSMakeRange(8,1);\n self.txtQty.text = [self.txtQty.text stringByReplacingCharactersInRange:range withString:@&quot;.&quot;];\n}\n</code></pre>\n<p>-Example-<br />\n1234567.90</p>\n<blockquote>\n<p>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString replaceCharactersInRange:withString:]: Range or index out of bounds'\n*** First throw call stack:</p>\n</blockquote>\n<p>I keep receiving this error.</p>\n"^^ . . "1"^^ . . "2"^^ . "0"^^ . "How to connect a Dispatch Queue to a Run Loop?"^^ . . "Objective C: Sharing pdf files to Microsoft teams fails when using iPad"^^ . . "@freeflow hah no, That's Windows 32-bit only :P The trik's work is legendary though."^^ . . . . "0"^^ . "0"^^ . . . "0"^^ . . "<p>So I extended my workflow as follows. There are a few caveats:</p>\n<ul>\n<li><p>there is a nice Github Action 'SonarSource/sonarcloud-github-c-cpp@v1'. Is this sufficient to analyze Objective-C projects?</p>\n</li>\n<li><p>Git checkout will remove unnecessary directories. Hence you must install SonarQube AFTER having checkout out your source</p>\n</li>\n<li><p>The build wrapper just monitors the actual build, so you still have to run the Sonar Scanner afterwards</p>\n</li>\n</ul>\n<p>Here is the resulting code:</p>\n<pre><code>jobs:\n SonarQube:\n runs-on: ubuntu-latest\n env:\n BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory\n\n steps:\n - uses: actions/checkout@v3\n with:\n fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis\n submodules: recursive\n \n - name: Install sonar-scanner and build-wrapper\n uses: SonarSource/sonarcloud-github-c-cpp@v1\n\n - name: Run build-wrapper\n run: |\n build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make -f Makefile pkg-posix-nightly HOST_ARCH=$(uname -m)\n\n - name: Run sonar-scanner\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} # Put the name of your token here\n run: |\n sonar-scanner --define sonar.cfamily.build-wrapper-output=&quot;${{ env.BUILD_WRAPPER_OUT_DIR }}&quot;\n</code></pre>\n"^^ . "Your question prompted me add swizzling methods that take Objc-C blocks to SwizzleHelper, and I found it necessary to add `@convention(block)` in the signature for Swift-side methods that I'm swizzling. So in your case maybe `func swizzledPullTypes(fromServer completionBlock: @escaping @convention(block) (Any) -> Void, error errorBlock: @escaping MKNKErrorBlock)`. I don't know but I suspect that `MKNKErrorBlock` is already `@convention(block)`. I've also realized I should add support for swizzling class methods, which you are doing. I've only needed it for instance methods."^^ . "It doesn't solve the problem as asked, so I have to say that even though it would function, it doesn't work for me. The question, if treated as a spec, requires that there be a single unified approach. Perhaps I should have defined "single unified" more clearly. The code that I have at the moment makes an FFI call to Objective-C and then if there is no window name in the result, shells out to `osascript` to get that. What is here requires that I shell out to `osascript` and then the script may make another shell-out. "I don't care about your claims."? OK"^^ . "Objective C programmatically View ViewController But Black Screen"^^ . . "0"^^ . . . "nsviewcontroller"^^ . "PDFTron version 7 to version 10 migration is breaking existing functionality"^^ . . . . "<p>Unfortunately the fact that the key is not given under the official documentation page means nothing in the world of Cocoa framework. You can still access the key by specifying it as a raw string (rather than a constant), however be advised that while the screen is not locked, the corresponding value may not be present in the session dictionary. Here is how you may inspect current lock status in the form of a free function:</p>\n<pre class="lang-objc prettyprint-override"><code>BOOL isScreenLocked() {\n CFDictionaryRef session = CGSessionCopyCurrentDictionary();\n const void *value;\n if (CFDictionaryGetValueIfPresent(session, CFSTR(&quot;CGSSessionScreenIsLocked&quot;), &amp;value)) {\n if (((__bridge NSNumber *)value).boolValue) {\n return YES;\n }\n }\n return NO;\n}\n</code></pre>\n"^^ . . . "1"^^ . . . . . . "1"^^ . . "nsbatchdeleterequest"^^ . "1"^^ . . "I believe this is the case, as each item in my outline view is a unique object."^^ . . . "How to display at the top of a Smart banner for Universal Links in Safari"^^ . "0"^^ . "@Paulw11 Thank you! Looking at the following link, do you know how I could alter it to return the IPv4 & IPv6 addresses from a given URL? \nhttps://stackoverflow.com/a/15571849/10111607"^^ . . "0"^^ . "0"^^ . . . "0"^^ . . . . . . "microsoft-teams"^^ . . "1"^^ . "0"^^ . "It makes perfect sense that you need to `#import <UserNotifications/UserNotifications.h>` - you are exposing your AppDelegate from Swift to Objective C. That AppDelegate conforms to the notification delegate, so the objective C side of your code needs to know about that. It doesn't matter that A.mm has nothing to do with notifications. The Objective C compiler needs to be able to resolve all of the type references it sees in the header."^^ . "Cocoa methods are not called at all when using "do not embed" for library"^^ . . . . "1"^^ . "0"^^ . . . . . . "1"^^ . . "0"^^ . . . "0"^^ . . . "1"^^ . . . . "@ДенисСолодовник if you want we can discuss what the answer is missing in more details in [the SO chat](https://chat.stackoverflow.com/rooms/253370/objective-c-c-interoperability), to avoid extensive discussion in the comment section. (so it can be improved for future readers)"^^ . . . . . . . "<p>I have spent an awful amount of time on that problem (I am not very good at Objective-C I must admit) without success so I need your expertise.</p>\n<p>I am developing several plugins, which are just shared libraries in this case. One of them declares Cocoa classes for the others to use and I manage to have it loading first.</p>\n<p>For the other plugin, I chose to &quot;do not embed&quot; the library but to make it &quot;required&quot; in linking (in Xcode).</p>\n<p><strong>The problem:</strong></p>\n<p>In the <strong>other</strong> plugin, I try to use a class, let's call it <code>myArray</code>.</p>\n<p>I can get the <code>objc_class</code> for it (with <code>objc_getClass</code>), I can also get the library's path with <code>class_getImageName</code>, so everything tells me that the library is loaded and active. <strong>However</strong>, when I use any method like</p>\n<pre class="lang-objc prettyprint-override"><code>[myArray doSomethingWith:...];\n</code></pre>\n<p>no method is ever called and all calls return 0. No error. No exception.</p>\n<p>I don't get how that can happen.</p>\n<p>Can someone help me, please ?</p>\n<p>And thanks in advance.</p>\n"^^ . . "0"^^ . . . . . . "The item returned from `outlineView:child:ofItem:` must be unique, not `isEqual` to other items, and it must always be the same instance, not a copy or created every time. Otherwise `NSOutlineView` will get confused."^^ . . . . . "Why? at swift "NaN" is nan and at C# "NaN" is also double.NaN"^^ . . . . . "0"^^ . . "nsscrollview"^^ . . "applescript"^^ . "Thanks, that's very helpful. For other who may be interested, the details are explained in the WWDC19 [talk](https://developer.apple.com/videos/play/wwdc2019/701/) at 16:25 an onwards (transcript: "... CGWindowListCopyWindowInfo never triggers an authorization prompt, instead it filters the set of metadata that it returns to the caller.")"^^ . "@James It's definitely possible if you implement your own concurrent API, but not with GCD."^^ . . . "0"^^ . . . . "<p>I've a very similar issue to <a href="https://stackoverflow.com/questions/64077284/cannot-find-protocol-declaration-for-unusernotificationcenterdelegate">this question</a>, but I don't know how to fix it.</p>\n<p>I have a swift bridging header file to expose ObjC classes to swift and a swift interface header (automatically generated by Xcode during compile time) to expose swift classes to ObjC.</p>\n<p>I am using swift types in an ObjC file, say A.mm, so I've included the swift interface header in that file.</p>\n<p>Recently, I extended my AppDelegate to conform to UNUserNotificationCenterDelegate to handle notifications.</p>\n<pre><code>import UIKit\nimport UserNotifications\n\nextension AppDelegate: UNUserNotificationCenterDelegate {\n\n ....\n}\n</code></pre>\n<p>But this suddenly causes a compilation error in A.mm - 'Cannot find protocol declaration for 'UNUserNotificationCenterDelegate'. In the swift interface header file, I can see that UNUserNotificationCenterDelegate is referenced, so just adding this line before importing the swift interface header will work.</p>\n<pre><code>#import &lt;UserNotifications/UserNotifications.h&gt;\n</code></pre>\n<p>But it makes no sense to do so - since the code in A.mm has nothing to do with UserNotifications. I had to include swift interface header file here because I need to use some swift types, but none of that is related to UserNotifications. So, I'm not comfortable in importing UserNotifications.h as it just causes confusion. I think the swift interface header should somehow include UserNotifications.h, since that's where the problem originates.</p>\n<p>Following <a href="https://stackoverflow.com/a/62179311/12791298">this answer</a>, I ensured to include</p>\n<pre><code>import UserNotifications\n</code></pre>\n<p>in the AppDelegate file, as shown above... but it still fails to compile. So adding the swift include is not the solution.</p>\n<p>What am I missing to ensure that the swift interface header file includes the UserNotifications.h file? Is there no way but to include UserNotifications.h before including the swift interface header in A.mm? (I don't like this).</p>\n"^^ . "2"^^ . "0"^^ . . "Are you trying to reimplement the default user feedback because it's not working or does the default user feedback work and are you trying to implement a custom user feedback?"^^ . . . . . . . . . "1"^^ . . "What are the correct Metal blending options for additive blending?"^^ . "0"^^ . . "sonarqube"^^ . . . . "It's fine to answer your own question, but you still need to ask the question as though you don't already know the answer that you're about to give. That'll make it easier for people to figure out what you're asking. Also, you might find that people give you answers that you weren't expecting. I've rewritten your question from that perspective, but please edit if you feel that I've somehow missed the point of what you're trying to ask."^^ . "I just get "/Users/mohabhisham/Library/Developer/CoreSimulator/Devices/7B0A58B1-92DD-4C1E-9544-53BC319D6AB1/data/Containers/Data/Application/7F7BBF73-A6E2-410C-B83A-0DF29D152A05""^^ . . . . "0"^^ . . "0"^^ . "<p>Why i dont get NaN as result? 0 is wrong. Maybe compiler settings?</p>\n<pre><code>CGFloat fValue = [@&quot;NaN&quot; floatValue]; // fValue is 0\ndouble ddd = [@&quot;NaN&quot; doubleValue]; // also 0`\n</code></pre>\n<p>Edit: Strange, in swift this works and returns nan:</p>\n<pre><code>let fValue = Float (&quot;NaN&quot;)\nlet ddd = Double (&quot;NaN&quot;)\n</code></pre>\n"^^ . . . "0"^^ . . . . . "indexoutofboundsexception"^^ . "Thanks, @ChipJarred. So far, I can't understand how to use your package."^^ . . . . . . . "Any iTerm2 window shows the window name with the AppleScript approach but returns a null for the window name via Objective C."^^ . . . . . "2"^^ . . "0"^^ . . . . "1"^^ . . "0"^^ . "0"^^ . "Added code from `AASA` file. However, universal link is a function that uses xcode's Associate Domain. What I'm curious about is that the 'smart banner', which is automatically created by the 'AASA' file to connect the app and the web, is visible only by scrolling on the 'ipad', but I want to make it visible on the page without scrolling."^^ . . . "0"^^ . "<p>I have a split view window with an outline view on the left and a table view on the right. I want to be able to drag items from the table view and drop them onto items in the outline view. The dragging and dropping work fine, but the user feedback isn't quite visually what I want. Ideally, the behavior will be like the Finder, where folders become visually selected with white text as the dragged item passed over. In my implementation, however, the highlighting works as expected, but the text color remains black.</p>\n<p>I'm change the highlighting in my draggingUpdated call, and attempt to change the text color in dataCellForTableColumn. I actually <em>can</em> change the color of the text to white in that method... but not when a drag operation is in place, though the method <em>is</em> fired while dragging.</p>\n<p>The code:</p>\n<pre><code>- (NSDragOperation) draggingUpdated:(id&lt;NSDraggingInfo&gt;)sender {\n NSPoint windowLocation = [[self window] convertScreenToBase: [NSEvent mouseLocation]];\n NSPoint viewLocation = [self convertPoint: windowLocation fromView: nil];\n NSInteger mouseRow = [self rowAtPoint:viewLocation];\n\n // Get row at specified index\n if (highlightedRow != mouseRow) {\n NSTableCellView *row;\n // If the highlighted row changed, revert it to a normal background color\n if (highlightedRow &gt; -1) {\n row = [self viewAtColumn:0 row:highlightedRow makeIfNecessary:NO];\n row.wantsLayer = YES;\n row.layer.backgroundColor = [[NSColor controlBackgroundColor] CGColor];\n }\n // Make sure the mouse if pointing to an existing row\n if (mouseRow &lt; self.numberOfRows) {\n if ([[self itemAtRow:mouseRow] isKindOfClass:[ProjectTeamObject class]]) {\n row = [self viewAtColumn:0 row:mouseRow makeIfNecessary:NO];\n row.wantsLayer = YES;\n row.layer.backgroundColor = [[NSColor selectedContentBackgroundColor] CGColor];\n highlightedRow = mouseRow;\n }\n }\n else\n highlightedRow = -1;\n }\n return (NSDragOperationCopy);\n}\n\n- (NSCell *)outlineView:(NSTableView *)tableView dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item {\n NSCell *dataCell = [tableColumn dataCell];\n NSTextFieldCell *cell = [tableColumn dataCell];\n NSInteger row = [self rowForItem:item];\n \n cell = [tableColumn dataCell];\n if (dragging) {\n if ([item isKindOfClass:[ProjectTeamObject class]] &amp;&amp; row &lt;= self.numberOfRows)\n [cell setTextColor: [NSColor whiteColor]];\n else\n [cell setTextColor: [NSColor blackColor]];\n }\n return (dataCell);\n</code></pre>\n<p>highlightedRow and dragging are both globals and fairly straightforward.</p>\n<p>Is there a problem with changing the text color of an outline view item while dragging, or is there perhaps a better way to do this I may be missing?</p>\n<p>Thanks!</p>\n"^^ . . . "0"^^ . . "0"^^ . . . . . "0"^^ . "0"^^ . . "1"^^ . "0"^^ . . "1"^^ . "@Caleb sorry for my English it isn’t my native language \nThanks for fixing my errors"^^ . . "2"^^ . "layoutmargins"^^ . . "0"^^ . . . . "<p><a href="https://i.sstatic.net/XpdjG.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XpdjG.png" alt="enter image description here" /></a></p>\n<p>PDFtron version 7 to version 10 migration is producing the error mentioned above.</p>\n<p>How to resolve this error and how to retain existing functionality?</p>\n<p>Thanks in Advance</p>\n"^^ . . . . . . . . . . "objective-c-runtime"^^ . . . . "https://stackoverflow.com/questions/24670269/how-do-you-animate-the-sublayers-of-the-layer-of-a-uiview-during-a-uiview-animat might help you"^^ . "0"^^ . . . "The [`kCGWindowName` docs](https://developer.apple.com/documentation/coregraphics/kcgwindowname?language=objc) mention that "Note that few applications set the Quartz window name." — running your code on my machine confirms that pretty much no window fetched by this API has a window name accessible this way. AppleScript must be using a different API, possibly Accessibility, to access this information."^^ . "0"^^ . . . "ios-universal-links"^^ . . . . "metal"^^ . . "Sorry, since PDFTron has been bought by Apprise, I mistook it. Check there the change notes: https://docs.apryse.com/documentation/ios/changelog/v8-0-0-76251/ but the logic is the same, maybe it's stated there since it seems to be a big change. But maybe you could also check what are now the `init` method available for `PTAnnoticationViewCOntroller`..."^^ . . "MacOS EndpointSecurity, how to observe a specific path"^^ . . . . "1"^^ . "@Caleb you’re right about Windows I need to be more correct "most C++ programmers I questioned about my problem""^^ . "nstableview"^^ . . . . . "Remove hyperlink in PDFTron Objective C"^^ . . "Mac native function (ObjC / LibC) to call function with arguments"^^ . . . . . . "0"^^ . "0"^^ . . "0"^^ . . . . . "0"^^ . . "<p>You can expose the method to Objective-C runtime and make it <code>private</code> at the same time. This however requires you to introduce the private method's interface yourself (ideally by extending the auto-generated interface, rather than introducing a separate class declaration). Your swift class should look something like this:</p>\n<pre class="lang-swift prettyprint-override"><code>@objc(TDWSwiftObject)\nclass SwiftObject: NSObject {\n\n let range: ClosedRange&lt;Int&gt;\n\n init(range: ClosedRange&lt;Int&gt;) {\n self.range = range\n super.init()\n }\n\n @objc private convenience init(min: Int, max: Int) {\n self.init(range: min...max)\n }\n\n}\n</code></pre>\n<p>And then add the missing Objective-C parts as a class category:</p>\n<pre class="lang-objc prettyprint-override"><code>@interface TDWSwiftObject (Private)\n\n- (instancetype)initWithMin:(int)min max:(int)max;\n\n@end\n</code></pre>\n<p>Now your Swift code won't be able to refer to the constructor (because it has <code>private</code> access modifier), while the Objective-C code can use it just fine.</p>\n"^^ . "invalidargumentexception"^^ . "<p>You cannot hide it from autocomplete, if that was your goal.</p>\n<p>What you can do is:</p>\n<pre><code>@available(swift, obsoleted: 1.0)\nconvenience init ( min: Int, max: Int ) \n{\n</code></pre>\n<p>Now trying to call that method from Swift is a hard error and autocomplete will not suggest that init by default, but it's still in the list.</p>\n"^^ . . . "0"^^ . . . . . "1"^^ . "1"^^ . . "@HangarRash Ok, I have tried doing this, and it is still hit and miss...sometimes it works fine, other times it doesn't. I updated the OP with what I have tried now."^^ . . . "2"^^ . "Not sure what you mean by "For my tasks this approach is useless". The answer to the linked question explains why you get the errors and give possible solutions to it"^^ . . "<p>You can try <code>cpdf -remove-annotations in.pdf -o out.pdf</code>. This does remove all annotations, but if you only have link annotations, that would be ok.</p>\n"^^ . . "0"^^ . . . . "1"^^ . . "<p><a href="https://i.sstatic.net/1vS9t.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/1vS9t.png" alt="enter image description here" /></a></p>\n<p>How to remove entire hyperlink in pdf file.If anybody knows please answer this question.</p>\n<p>Library used in PDFTron and ObjectiveC language.\nThanks in advance</p>\n"^^ . . . "0"^^ . . . . "1"^^ . . . "0"^^ . "1"^^ . . "0"^^ . . . . . "ReplacingCharactersInRange out of bounds error"^^ . "nsstring"^^ . . . . . . "@Caleb the point to use C++ is crossplatform core that can be reused.\nOf course you can say that use of Kotlin or C# would be better, but my tasks force me to use C++"^^ . "0"^^ . . "0"^^ . . . "WHat is `PTAnnotationViewController`, I guess it inherits from some PDFTronSDK ViewController, right? Which one? PSPDFNoteAnnotationViewController"^^ . "0"^^ . "-1"^^ . . "@Greedo No I never did get any further unfortunately, but also I haven't really switched on my mac since raising this question to test anything either"^^ . . . . . . . . "<p>From a <a href="https://developer.apple.com/forums/thread/126860" rel="nofollow noreferrer">Developer forum topic</a>, your Objective-C approach should work if the application has been given Screen Recording permission.</p>\n<p>There are a few windows (such as those in menu items) that have weird names, and some just don't have them, but most application and document windows I've tried do have names. There doesn't appear to be an entitlement for Screen Recording, so you would need to direct the user to add the application to the privacy list.</p>\n<p>When testing with Xcode 14.1 in macOS Monterey 12.6.5, the <code>kCGWindowName</code> key in the window list dictionary is included when permission has been granted, otherwise it is left out.</p>\n"^^ . "1"^^ . . . "0"^^ . "@SteveSummit Thanks, thanks for both of these. Very interesting reads. I think resolving this will be a lot of experimentation with different approaches. ChatGPT suggested use of [`objc_msgSend`](https://developer.apple.com/documentation/objectivec/1456712-objc_msgsend) too"^^ . "1"^^ . . . . . . . "Cannot find protocol declaration for 'UNUserNotificationCenterDelegate' in swift interface header file"^^ . "In case you are casting "NaN" as a Float, it's valid because Float conforms LosslessStringConvertible protocol which allows you to convert kind of "inf" as infinity or "NaN" as nan. Check on Swift.Math.Floating Foundation."^^ . . . "nshomedirectory"^^ . "3"^^ . . . . . "Please don't add a separate "update" section to your question. It's too difficult to figure out what the question is _now_. Instead, _rewrite_ the question to be clear about what your code is and what the issue is. You don't need to call out the fact that the question has been edited."^^ . . . . . . . . "@Paulw11 That worked perfectly thank you. Do you know if there's any built in way to exclude reserved addresses from being returned in this?"^^ . . "Snapshot complex UIScrollview content view beyond screen bounds to speed up scrolling"^^ . . . . "@Caleb Indeed! Article would be better but there is 2 moments\nFirst of all when I've searched an answer for my question I haven’t found **any** article about this\nAnd second an article needs a reviewers it's a great chance that my info doesn’t reach those who need it. Notice I'm not professional not even a person who can clearly explain technical Information. I think 90% of people decide this information is lame. My purpose is 10% persons who don’t think that it obvious and there’re no one near who can teach them\nAnd I didn’t mark my answer as accepted\nThanks anyway"^^ . . "0"^^ . . . . . . "If you're sticking with strict C++ (no Objective-C++), then you do need to keep Objective-C code out of it, so the bridge solution is the right one. If that's the case, you should probably edit the question to make it clear that you have this restriction. As you asked it, and I restated it, the question suggests that your goal is to mix Obj-C and C++, not keep them separate."^^ . "Is there a reason that you need a separate bridge file instead of just renaming `CppFile.cpp` to `CppFile.mm` so that it gets compiled as Objective-C++? If you do that, you can access the Obj-C objects directly, although you'll need to do it using Obj-C syntax `(e.g. `[objcFile showInterface]` instead of `objcFile->showInterface()`). Objective-C++'s reason for existing is to allow you to easily use the two languages together -- why not use it?"^^ . . . . "<p>Your <em><strong>decodeObjectOfClasses:forKey:</strong></em> is being called with <em><strong>key1</strong></em></p>\n<p>However, it's the key in the dictionary that is being archived, not the key for the root object which is why it doesn't work.</p>\n<p>You can try this:</p>\n<pre><code>NSDictionary *unarchivedDict = [unarchiver decodeObjectOfClasses:[NSSet setWithObjects:[NSDictionary class], [NSString class], [NSNumber class], nil] forKey:NSKeyedArchiveRootObjectKey];\nif (!unarchivedDict) {\n NSLog(@&quot;Error decoding object: %@&quot;, [unarchiver error]);\n return 1;\n}\n[unarchiver finishDecoding];\n</code></pre>\n<p>I change</p>\n<pre><code>forKey:@&quot;key1&quot;\n</code></pre>\n<p>to</p>\n<pre><code>forKey:NSKeyedArchiveRootObjectKey\n</code></pre>\n<p>By doing this, the unarchiver will decode the root object of the archive.</p>\n<p>You should get this</p>\n<pre><code>key1 = value1;\nkey2 = 42;\n</code></pre>\n"^^ . . . "0"^^ . . . . . . "0"^^ . "1"^^ . . "1"^^ . "0"^^ . "SonarQube Github Action for Objective-C"^^ . . . "<p>I'm using TensorFlow Lite and I'm attempting to use a GPU processing delegate with the move net multi-pose model. The interpreter initialization fails with an ambiguous error. I'm attempting to use the Core ML GPU delegate but in the code below. I've tried TFLMetalDelegate as well and that fails as well. I'd be happy if ANY GPU processing would work with TFL.</p>\n<p>This is the link to the model:\n<a href="https://tfhub.dev/google/movenet/multipose/lightning/1" rel="nofollow noreferrer">https://tfhub.dev/google/movenet/multipose/lightning/1</a></p>\n<pre><code>NSError* error = nil;\nTFLInterpreterOptions* options = [[[TFLInterpreterOptions alloc] init] autorelease];\noptions.numberOfThreads = 4;\n \nTFLCoreMLDelegateOptions* mlOptions = [[[TFLCoreMLDelegateOptions alloc] init]autorelease];\nTFLCoreMLDelegate* coreMLDelegate = [[[TFLCoreMLDelegate alloc] initWithOptions:mlOptions] autorelease];\n \nNSArray* delegates = [NSArray arrayWithObject:coreMLDelegate];\n \n_interpreter = [[TFLInterpreter alloc] initWithModelPath:[NSBundle.mainBundle pathForResource:@&quot;movenet_lightning_multipose&quot; ofType:@&quot;tflite&quot;] options:options delegates:delegates error:&amp;error];\n</code></pre>\n<p>The error returned says:</p>\n<p>Error Domain=org.tensorflow.lite.interpreter Code=4 &quot;Failed to create the interpreter.&quot; UserInfo={NSLocalizedDescription=Failed to create the interpreter.}</p>\n<p>Using CPU processing is incredibly inefficient and very slow. Is there anyway to use GPU processing with the movenet model on the iPhone?</p>\n<p>Thanks for the help!!</p>\n"^^ . . . . . "1"^^ . . . "<pre><code>tell application &quot;System Events&quot;\n set frontProcess to 1st process whose frontmost is true\n set activePID to unix id of frontProcess\n set bundleID to bundle identifier of frontProcess\n set activeName to name of frontProcess\nend tell\n\ntell application id bundleID\n try\n set appName to name\n set windowID to id of front window\n set windowName to name of front window\n on error\n set windowID to my getFrontWindowID(appName)\n try\n tell application &quot;System Events&quot; to tell frontProcess to tell window 1 to set windowName to value of attribute &quot;AXTitle&quot;\n on error\n set windowName to &quot;&quot;\n end try\n end try\nend tell\n\nreturn {pid:activePID, processName:activeName, appName:appName, windowID:windowID, windowName:windowName}\n--&gt; {pid:9893, processName:&quot;Avidemux2.7&quot;, appName:&quot;Avidemux_2.7.8&quot;, windowID:5969, windowName:&quot;Avidemux&quot;}\n\n\non getFrontWindowID(appName)\n set JS to &quot;ObjC.import('CoreGraphics');\nRef.prototype.$ = function() {\n return ObjC.deepUnwrap(ObjC.castRefToObject(this));\n}\nApplication.prototype.getWindowList = function() {\n let pids = Application('com.apple.systemevents')\n .processes.whose({ 'bundleIdentifier':\n this.id() }).unixId();\n\n return $.CGWindowListCopyWindowInfo(\n $.kCGWindowListExcludeDesktopElements,\n $.kCGNullWindowID).$()\n .filter(x =&gt; pids.indexOf(x.kCGWindowOwnerPID) + 1\n &amp;&amp; x.kCGWindowLayer == 0\n &amp;&amp; x.kCGWindowStoreType == 1\n &amp;&amp; x.kCGWindowAlpha == 1\n ).map(x =&gt; [x.kCGWindowNumber]); \n}\nApplication('&quot; &amp; appName &amp; &quot;').getWindowList();&quot;\n return (word 1 of (do shell script &quot;osascript -l JavaScript -e &quot; &amp; quoted form of JS)) as integer\nend getFrontWindowID\n</code></pre>\n"^^ . . . "1"^^ . . "1"^^ . . . "0"^^ . . . . "<p>Unable to navigate to a controller using the UIPopoverPresentationController _passthroughViews method in iOS using Objective C.</p>\n<p>I am trying to navigate to the controller view using the UIPopoverPresentationController's passthroughView. But I can't able to set this navigation and get an error and the app gets crashed. How can I resolve this?</p>\n<p>Here I am additionally facing an error with the last item in the popover shows as a footer or not movable label and if I click this, there is no highlights,\nCode:</p>\n<pre><code>SelectorViewController* sv = [[SelectorViewController alloc] initWithStyle:UITableViewStylePlain];\nsv.delegate = self;\nsv.currentTopic = self.title;\nNSLog(@&quot; sv.currentTopic%@&quot;, sv.currentTopic);\nsv.preferredContentSize = CGSizeMake(300, 500);\nsv.modalPresentationStyle = UIModalPresentationPopover;\n \nUIPopoverPresentationController *popoverpresentationController = sv.popoverPresentationController;\npopoverpresentationController.delegate = self;\npopoverpresentationController.sourceView = sender.view;\n [self present view controller:sv animated: YES completion: nil]; \n popover.delegate = self;\n if ([popover respondsToSelector:@selector(setBackgroundColor:)])\n popover.backgroundColor = [UIColor whiteColor];\n [sv release];\n</code></pre>\n"^^ . . "I think you need both approaches but the AppleScipt approach can be translated to C using the Accessibility API."^^ . "2"^^ . . . "<p>It's written on the documentation. This is for float value, the same with double value.</p>\n<blockquote>\n<p><a href="https://developer.apple.com/documentation/foundation/nsstring/1412321-floatvalue" rel="nofollow noreferrer">https://developer.apple.com/documentation/foundation/nsstring/1412321-floatvalue</a></p>\n<blockquote>\n<p>This property doesn’t include whitespace at the beginning of the string. This property is HUGE_VAL or –HUGE_VAL on overflow, 0.0 on underflow. This property is 0.0 if the string doesn’t begin with a valid text representation of a floating-point number.</p>\n</blockquote>\n</blockquote>\n"^^ . "I tried your suggestions and remove everything with feature and the preferences you mentioned, but it's not working. Are there any other suggestions ?\nAlso I scanned the whole project but i did not find any reference to UIWebView."^^ . . . . . . . . . . "0"^^ . . . . . . . "<p>I'm currently in the process of porting my existing Network library to Apple platforms.</p>\n<p>The existing implementation uses a single worker thread to process all active connections (objects wrapping raw sockets). I would like to retain this aspect of the design on Apple platforms.</p>\n<p>Instead of using raw sockets, I am using Apple's Network framework. Connection objects (<code>nw_connection_t</code>, <code>nw_listener_t</code>, et al.) in this framework expect <code>dispatch_queue_t</code> objects - through which event notifications will be sent. So I have created one of these and pass it to all <code>nw_...</code> functions that require it.</p>\n<p>My worker thread has retrieved the associated <code>CFRunLoopRef</code> instance (or rather created one) by calling <code>CFRunLoopGetCurrent</code>, and I'm processing this in my thread's main loop with the following:</p>\n<pre><code>CFRunLoopRunInMode( kCFRunLoopDefaultMode, 0, true );\n</code></pre>\n<p>But what I don't understand, and have been unable to figure out, is how I get my dispatch queue to be processed by my thread's RunLoop object? I'm assuming I need to attach one to the other somehow so that notifications are called at the right time in my worker thread, right? So, how do I do this?</p>\n"^^ . . . . "0"^^ . . "Are you sure that in this case [myArray doSomethingWith:...]; myArray object is not nil?"^^ . . . . . . . . . . . . "You need to provide more context. How are you using it in your code? What ways have you tried to resolve it, and what was the outcome?"^^ . . . "2"^^ . . . . "0"^^ . . . . . . . . . "1"^^ . "@Mohab Whoops I mean try `puts(NSHomeDirectory().UTF8String)` from Objective-C"^^ . . . . "@Mohab Cannot reproduce. What system are you using? And what happens if you try `NSLog(NSHomeDirectory().UTF8String)` in Objective-C?"^^ . ""But I can't able to set this navigation and get an error and the app gets crashed" Could you share the full error message?"^^ . . "0"^^ . . . "I have controller and one of the two values are differ I think. Because it opens in a popup window. So while click on the title it not navigating to the app"^^ . . . . . . . . "2"^^ . . "<p>Under the hood, <code>NSString</code>s have three main possible representations:</p>\n<ol>\n<li>A &quot;typical&quot; <code>NSString</code> with UTF-16 backing</li>\n<li>An <code>NSString</code> with ASCII backing</li>\n<li>A tagged pointer string with encoded backing</li>\n</ol>\n<p>The specifics of these representations isn't terribly important here, except that when you ask for the <code>-UTF8String</code> representation of one, it may need to perform some sort of conversion to get you UTF-8 data. In the case of (2), because ASCII is a strict subset of UTF-8, the string is allowed to hand you a pointer to its already-existing underlying storage; but in (1) and (3), the string must allocate space for UTF-8 data, because it doesn't yet exist.</p>\n<p>Because the pointer returned to you from <code>-UTF8String</code> is a regular old C pointer, there isn't any lifetime information/management associated with it: the <code>NSString</code> can't know when you're &quot;done&quot; using it in order to free the memory. Because the string may also hand you a pointer to its direct underlying storage (and can't communicate to you via this API whether or not you are allowed to free the result or not), <code>NSString</code> has to hand you a pointer which you are <em>never</em> responsible for freeing.</p>\n<p>So there's a bit of a conundrum here:</p>\n<ul>\n<li><code>NSString</code> may need to allocate memory to store UTF-8 data</li>\n<li><code>NSString</code> must hand you a pointer to that data, which you are not responsible for freeing</li>\n<li><code>NSString</code> can't know when you might be done using the pointer, so it can't free it prematurely</li>\n<li><code>NSString</code> <em>shouldn't</em> just leak the memory</li>\n</ul>\n<p>The way this is handled is by allocating a block of memory which is then <a href="https://developer.apple.com/documentation/objectivec/1418956-nsobject/1571951-autorelease" rel="nofollow noreferrer"><code>-autorelease</code>d</a>. You can read more about autorelease pools in the old <a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/MemoryMgmt.html#//apple_ref/doc/uid/10000011i" rel="nofollow noreferrer">&quot;Advanced Memory Management Programming Guide&quot;</a> (or a briefer explanation in <a href="https://stackoverflow.com/questions/70050353/swift-risk-in-using-autoreleasepool-cpu-usage/70051512#70051512">another answer of mine</a>), but the gist:</p>\n<ul>\n<li>An object which is autoreleased is placed in an &quot;autorelease pool&quot; for later</li>\n<li>When the pool is &quot;drained&quot;, all contained objects are released, and their memory is freed</li>\n<li>Unless you create an autorelease pool yourself, or are in a context which has created a local autorelease pool, there is a global autorelease pool for your process</li>\n<li>The global autorelease pool may only be freed at the end of process execution, so unless you put in extra work, you may see autoreleased objects get &quot;leaked&quot; until then</li>\n</ul>\n<hr />\n<p>The solution, in your case, comes in two parts.</p>\n<ol>\n<li><p>From the &quot;Discussion&quot; section of the <code>-UTF8String</code> docs:</p>\n<blockquote>\n<p>This C string is a pointer to a structure inside the string object, which may have a lifetime shorter than the string object and will certainly not have a longer lifetime. Therefore, you should copy the C string if it needs to be stored outside of the memory context in which you use this property.</p>\n</blockquote>\n<p>If you're grabbing the <code>-UTF8String</code> and attempting to store it, you must create a copy of it which you can later free yourself; otherwise, if the underlying <code>NSString</code> <em>is</em> released, you'll be holding on to a dangling pointer</p>\n</li>\n<li><p>If you want to ensure that autoreleased objects get cleaned up sooner, you can create a local autorelease pool which will clean them up; in your case, you can do this once per loop</p>\n</li>\n</ol>\n<p>For example:</p>\n<pre class="lang-objectivec prettyprint-override"><code>// This will create an autorelease pool local to this scope.\n// At the end of the scope, all autoreleased objects will be cleaned up.\n@autoreleasepool {\n d-&gt;wid = [[window objectForKey:(NSString *)kCGWindowNumber] intValue];\n d-&gt;pid = [[window objectForKey:(NSString *)kCGWindowOwnerPID] intValue];\n\n const char *ownerName = [[window objectForKey:(NSString *)kCGWindowOwnerName] UTF8String];\n d-&gt;name = strdup(ownerName); // Or copy however you'd prefer\n\n const char *windowName = [[window objectForKey:(NSString *)kCGWindowName] UTF8String];\n d-&gt;window = strdup(windowName);\n return 1;\n}\n</code></pre>\n<p>Later, you will need to make sure you <code>free(d-&gt;name)</code> and <code>free(d-&gt;window)</code> or else you'll really be leaking memory.</p>\n"^^ . "<p>The keys used in archiving/unarchiving represent entire objects in the archive. You need to unarchive the whole dictionary since you archived a whole dictionary. Once you have the dictionary, you can then access values like you would any other dictionary. In other words, what you are trying to do can't be done. You are sort of mixing unarchiving and key-value coding which makes no sense.</p>\n<p>Also note that you did not use any keys when archiving so you have no keys to use when unarchiving. You need to use:</p>\n<pre><code>+ (id)unarchivedObjectOfClasses:(NSSet&lt;Class&gt; *)classes \n fromData:(NSData *)data \n error:(NSError * _Nullable *)error;\n</code></pre>\n<p>to unarchive the dictionary since you used <code>archivedDataWithRootObject:requiringSecureCoding:error:</code> to archive it.</p>\n<hr />\n<p>Apple really wants everyone to use secure coding. So passing <code>NO</code> when archiving is frowned upon. Pretty much all of the non-secure unarchiving methods are deprecated.</p>\n"^^ . . . "0"^^ . "0"^^ . . "0"^^ . "it prints the same "211" thing"^^ . . . . "-1"^^ . "0"^^ . "1"^^ . . "0"^^ . . . . . . "1"^^ . . "Read each migration guide to see where it's stated: https://pspdfkit.com/guides/ios/upgrade/"^^ . . . "1"^^ . . . "<p><a href="https://i.sstatic.net/l3Rr3.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/l3Rr3.jpg" alt="I get a success if i don't include the pdf so i assume that the pdf is the cause of the issue.\nI can share via onedrive, mail, and air drop in the app. Microsoft Teams returns this window after it tries to send:" /></a></p>\n<p>The code i use to present the action to the user after the share button is tapped, is as follows:</p>\n<pre><code>UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];\n\nif ( [activityVC respondsToSelector:@selector(popoverPresentationController)] ) {\n // iOS8\n [activityVC.popoverPresentationController setPermittedArrowDirections:UIPopoverArrowDirectionRight];\n activityVC.popoverPresentationController.sourceView = [self.myUiBarButtonItem valueForKey:@&quot;view&quot;];\n }\n\n[self presentViewController:activityVC animated:TRUE completion:nil];\n</code></pre>\n<p>Sharing files has worked in the past but now has stopped working on iPad when sending pdf content to Microsoft Teams. I get the expected behaviour on iPhone though.</p>\n<p>Both devices have IOS version of 16.4.1</p>\n<p>The file size is the same on both devices so it is very mysterious why this only fails on one of the devices.</p>\n<p>I know that the popover presentation controller must not be nil on iPad's and i have verified that not to be the case.</p>\n<p>I tried adding a completion handler to my UIActivityViewController but this returned no errors.</p>\n<p>tl;dr:\nWorks on iPhone, not iPad\nfile size is same\nI don't get errors returned from the activity controller\nI get error above when sending pdf to Microsoft Teams</p>\n<p>I tried putting a pdf file into the bundle because i thought it might have something to do with memory(Busted).</p>\n<p>I tried saving the file when didFinishNavigation gets called and then loading it when the share button is tapped because i thought it might have something to do with completion and or asynchronous issues(Busted).</p>\n<p>I tried setting the modal presentation style and setting the preferred content size(Was not the issue).</p>\n<p>I tried sending my url as data instead.</p>\n<p>I tried using a UIDocumentInteractionController instead, same error.</p>\n"^^ . . . "1"^^ . . . . "<p>Implemented Universal link of IOS with iPhone and iPad. My app runs the app by accessing a specific URL in the safari browser. When accessing a specific URL, a Smart banner appears at the top of the web page. This Smart Banner is a smart banner automatically created by AASA (apple-app-site-association).<br />\n<strong>AASA</strong></p>\n<pre><code>\n{\n &quot;applinks&quot;: {\n &quot;apps&quot;: [],\n &quot;details&quot;: [\n {\n &quot;appID&quot;: &quot;&lt;Team_ID&gt;.&lt;Bundle_ID&gt;&quot;,\n &quot;paths&quot;: [ &quot;/path/test.asp&quot; ]\n }\n ]\n },\n &quot;webcredentials&quot;: {\n &quot;apps&quot;: [ &quot;&lt;Team_ID&gt;.&lt;Bundle_ID&gt;&quot; ]\n },\n &quot;related_applications&quot;: [\n {\n &quot;platform&quot;: &quot;ios&quot;,\n &quot;url&quot;: &quot;https://example.co.kr/path/test.asp&quot;,\n &quot;appID&quot;: &lt;Bundle_ID&gt;,\n &quot;appName&quot;: name\n }\n ],\n &quot;prefer_related_applications&quot;: true\n}\n</code></pre>\n<p><strong>Get Url Data</strong></p>\n<pre><code>- (BOOL)application:(UIApplication *)application\n openURL:(NSURL *)url\n options:(NSDictionary&lt;UIApplicationOpenURLOptionsKey, id&gt; *)options {\n self.latestLink = [url absoluteString];\n return YES;\n}\n\n- (BOOL)application:(UIApplication *)application\n continueUserActivity:(NSUserActivity *)userActivity\n restorationHandler:(void (^)(NSArray *_Nullable))restorationHandler {\n if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {\n self.latestLink = [userActivity.webpageURL absoluteString];\n if (!_eventSink) {\n self.initialLink = self.latestLink;\n }\n return YES;\n }\n return NO;\n}\n</code></pre>\n<p>On the iPhone, when you access a specific web page, a Smart Banner is created at the top so you can launch the app through the Open button.\nHowever, on the iPad, you have to access a specific web page and scroll down to see the Smart Banner. This creates a Smart Banner, but it seems to be initially hidden.</p>\n<p>Is there a way to make the Smart Banner visible on the Ipade as it is on the Iphone, without scrolling?</p>\n"^^ . . "0"^^ . . . . "0"^^ . . "<p>I maintain a 'modern' VBA library on github <a href="https://github.com/sancarn/stdVBA" rel="nofollow noreferrer">stdVBA</a>. The library provides a high level wrapper on top of many low level functions in Windows OS. Mac compatibility is desired and the main obstruction is entry to the ObjC API.</p>\n<p>We can get classes using <code>objc_lookUpClass</code> and get pointers to methods with <code>class_getMethodImplementation</code>:</p>\n<pre class="lang-vb prettyprint-override"><code>Private Declare Function objc_lookUpClass Lib &quot;/usr/lib/libobjc.A.dylib&quot; (ByVal sClassName As String) As LongPtr\nPrivate Declare Function class_getMethodImplementation Lib &quot;/usr/lib/libobjc.A.dylib&quot; (ByVal klass as LongPtr, ByVal sClassName As String) As LongPtr\n\nSub main()\n Dim lKlass as LongPtr: lKlass = objc_lookUpClass(&quot;NSRegularExpression&quot;)\n Dim lMethod as LongPtr: lMethod = class_getMethodImplementation(lKlass, &quot;regularExpressionWithPattern&quot;)\n Dim lRegex as LongPtr: lRegex = SOMEHOW_CALL_METHOD(lKlass, &quot;options&quot;, 0, &quot;error&quot;, AddressOf MyFunction)\nEnd Sub\n</code></pre>\n<p>However we have no method of calling the method pointer we obtain? Unfortunately VBA doesn't supply a method to do so... On windows OS we use <a href="https://learn.microsoft.com/en-us/windows/win32/api/oleauto/nf-oleauto-dispcallfunc" rel="nofollow noreferrer"><code>DispCallFunc</code></a>. See <a href="https://github.com/sancarn/stdVBA/blob/master/src/WIP/STD_Automation_DLL.cls#L217-L218" rel="nofollow noreferrer">example</a>.</p>\n<p>Is there an alternative to <code>DispCallFunc</code> defined in <code>libobjc</code>, <code>libc</code> or any other library we have access to natively on Mac?</p>\n"^^ . "0"^^ . . . . "objective-c"^^ . "UINavigationBar decoded as unlocked for UINavigationController, or navigationBar delegate set up incorrectly. Inconsistent configuration may cause problems."^^ . . . . "I'm trying to reimplement the default feedback because I get no UI feedback at all when dragging items over the targets. All of the NSGragOperation methods (draggingEntered, draggingUpdated, etc) do get called, I just get no feedback. I imagine that may have something to do with how the UI elements are defined in the storyboard?"^^ . . . "0"^^ . "0"^^ . . "See also [C late binding with unknown arguments](https://stackoverflow.com/questions/34885868)."^^ . "@Eric I have added the config.xml file."^^ . . "0"^^ . "0"^^ . . . . . "1"^^ . "cgfloat"^^ . . "0"^^ . "It does, yes; it returns an NSWrapperCellView which in turn includes an NSView. Setting the background color in draggingUpdated works as expected, but the setTextColor methods in dataCellForTableColumn don't have any effect while a drag is in progress. The text color remains black. My first choice is to get it working as is, but if I have to I'll move to a view based outline view. My fear, though, is that I may encounter the same behavior while dragging."^^ . "Can you add more details like what you are looking to achieve or a sample app which can reproduce the issue ? Didn't understand what is the value of _passthroughViews and why you are presenting twice in your code"^^ . . . . . "<p>It seems you're trying to present a popover from a view controller and setting passthroughViews to the navigation controller's delegate. The <code>passthroughViews</code> property of <code>UIPopoverPresentationController</code> is an array of views.</p>\n<p>The correct usage should be:</p>\n<pre><code>// Assuming `view1` and `view2` are views that you want the user to interact with while the popover is visible\npopoverpresentationController.passthroughViews = @[view1, view2];\n</code></pre>\n<p>If you want to navigate to another controller when the popover is presented, you can do that in the popover's delegate method, <code>popoverPresentationControllerDidDismissPopover</code>.</p>\n<p>As for the issue where you're not able to interact with the content, make sure that the popover's <code>preferredContentSize</code> is big enough to display the tableview and its cells fully. Also, check the tableview's <code>contentSize</code>.</p>\n"^^ . "2"^^ . "1"^^ . . . . . "0"^^ . "0"^^ . . "0"^^ . . "2"^^ . . "0"^^ . . . . . . . "pdf"^^ . . . . . "How can I ignore all touch events in WKWebView and its enclosingScrolllView"^^ . . . . . "1"^^ . . . . "obj-c iOS TensorFlow Lite using GPU delegate with MoveNet Lightning model failure"^^ . "NStableView does not react to notification @"NSTableViewSelectionDidChangeNotification" call on Ventura"^^ . . . "1"^^ . "@RobertKniazidis - Exactly. I don’t know how many actually wade though all those developer videos (I certainly don’t), but I think it would be easy to miss a small detail (from 4 years ago) that unlike many of the privacy settings, `CGWindowListCopyWindowInfo` never triggers an authorization prompt, and expects the app to be preapproved for screen recording in order to to read the names of windows (other than its own)."^^ . "alphablending"^^ . "1"^^ . . . "0"^^ . . . . "-2"^^ . . . . . . . "uipopoverpresentationcontroller"^^ . "0"^^ . "0"^^ . "1"^^ . . "dns"^^ . "0"^^ . . "I tried adding a gesture recogniser to the the WKWebView - but it didn't seem to be detected reliably. Which is why I ask about removing the recognisers from the enclosing scrollview."^^ . . . . . . . . . "0"^^ . "0"^^ . . . . . . "apple-app-site-association"^^ . "@DonMag, yes, that was one of the first things I tried - did not affect things perceivably. My question was mainly about snapshotting, as that's one way you could go and yet it did not work at all for me. In the end I avoided all layer shadows, UILabel shadows work well and for images I am just applying a shadow directly to the image instead, so it's now fast. Still curious though about if snapshotting is possible and I just did not figure it out..."^^ . . "0"^^ . "2"^^ . . . . "1"^^ . . . . . . . "1"^^ . . "0"^^ . . "1"^^ . "<p>If you have too many errors when combining two languages you need to look at <code>#include</code> in your C++ files. You can't <code>include</code> UIKit or other specific libraries in C++ files! XCode goes insane and shows a hundreds errors.</p>\n<p>To solve this problem you need a <strong>bridge</strong> using Objective-C++. Notice the details!</p>\n<p>Bridge.hh (<strong>don't include ObjCFile.h!</strong>)</p>\n<pre><code>class Bridge {\n public:\n ...\n void showInterface();\n}\n</code></pre>\n<p>Bridge.mm (<strong>include your Objective-C header here</strong>)</p>\n<pre><code>#import &quot;ObjCFile.h&quot;\n\nvoid Bridge::showInterface() {\n ObjCFile *objCFile;\n [objcFile showInterface];\n}\n</code></pre>\n<p>New CppFile.cpp</p>\n<pre><code>#include &quot;Bridge.hh&quot;\n\nint main() {\n Bridge *bridge;\n bridge-&gt;showInterface();\n}\n</code></pre>\n<p>That's it!</p>\n<p>Many articles I've seen that was <em>similar</em> to my article but they <em>omit</em> info about XCode libraries.\nThat confused me.</p>\n"^^ . "0"^^ . . "Setting text color of cells in outline view while dragging"^^ . "3"^^ . "Animate and resize a linear gradient (CAGradientLayer) using drag and pan gesture"^^ . "<p><a href="https://i.sstatic.net/o6Jmc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/o6Jmc.png" alt="enter image description here" /></a></p>\n<p>I am trying to disable this feature in default PDFtron library.</p>\n<p>I tried a lot and not at all disable this item. If anyone knows how to disable it.</p>\n<p>Thanks in advance</p>\n"^^ . "endpointsecurity"^^ . "0"^^ . . . . "Твой английский лучше моего русского. (Your English is better than my Russian.)"^^ . . . . "0"^^ . "0"^^ . "uikit"^^ . . "Do you want to detect a swipe or do you want to prevent scrolling? Have you tried a gesture recognizer?"^^ . "0"^^ . . "Cordova-ios is creating both UIWebView and WKWebView Components. How to switch to only WKWebView?"^^ . "You can just write: `double ddd = NAN;`"^^ . . . "0"^^ . . . "2"^^ . . . "OK, i understand that i have to check a string for "NaN" before converting to float."^^ . "0"^^ . . "0"^^ . . . . . . "@HangarRash, both devices are on 16.4.1. I am able to use mail, air drop and one drive without problems."^^ . . . . "0"^^ . . . . . . . . . . . "1"^^ . . "2"^^ . . . . . . "2"^^ . . "You don’t assert on nil vc"^^ . "0"^^ . "0"^^ . . . . . "cordova-ios"^^ . . . "0"^^ . . "0"^^ . . . "0"^^ . . "<p>I would like to be able detect whether a mac is in the locked or asleep state via Objective-C. <a href="https://stackoverflow.com/q/11505255/1502538">This question from 2012</a> provides half of the answer using the <code>kCGSessionOnConsoleKey</code> key into the dictionary provided by <a href="https://developer.apple.com/documentation/coregraphics/1454780-cgsessioncopycurrentdictionary" rel="nofollow noreferrer"><code>CGSessionCopyCurrentDictionary()</code></a>.</p>\n<pre><code>CFDictionaryRef session = CGSessionCopyCurrentDictionary();\nif (session != NULL) {\n d-&gt;locked = ![[(id)session objectForKey:(NSString *)kCGSessionOnConsoleKey] boolValue]; // d's locked field name is not yet correct.\n CFRelease(session);\n}\n</code></pre>\n<p>The obvious next step of using a <code>CGSSessionScreenIsLocked</code> key fails because it is not part of the <a href="https://developer.apple.com/documentation/coregraphics/quartz_display_services/window_server_session_properties" rel="nofollow noreferrer">dictionary's entries</a>; TBH it's unclear how the linked answer worked given this, but I've seen many variations on the theme, so I guess it must have at some point.</p>\n<p>Was <code>CGSSessionScreenIsLocked</code> deprecated or does it live somewhere else? Is there an alternative approach to achieve this?</p>\n"^^ . "0"^^ . . . . . . . . . . . . . . . "Same problem here. The state does not change until I navigate to a page on another domain."^^ . . . "1"^^ . . "Thanks. That has lead me the right direction (nice answer). I found that I also need to `CFRelease(windows);` before return."^^ . . . . . . . . "1"^^ . "0"^^ . . . . "0"^^ . "decodeObjectOfClasses is returning nil. Why?"^^ . . "On the iPad, can you share the file to other apps/activities without issue? Is the problem only when sharing to Teams? Is the same version the Teams app installed on the iPhone and iPad? Is the same version of iOS on both devices?"^^ . . "<p>Why do you need to look up the object by ID? Is <code>entity</code> from a different context than <code>context</code>? If so, <code>-objectWithID:</code> will return a fault, so that’s probably the answer to your question. The fault is probably not a big deal because with <code>entity</code> already in memory (in the other context) the data will be in the row cache so the fault will not need to fetch from the store.</p>\n<p>If you have only one context, <code>-objectWithID:</code> should return the exact same object as <code>entity</code>, which you said was not initially a fault, so the cause of the fault must be elsewhere. (Plus, you could just pass <code>entity</code> directly to <code>-deleteObject:</code>.)</p>\n"^^ . "How to hide PDFTron popup in Objective C"^^ . . . . . "SHooting at the moon, would this be of interest, https://github.com/thetrik/VBCDeclFix"^^ . . . "0"^^ . . . "objective-c++"^^ . . "1"^^ . . "0"^^ . "0"^^ . "wkwebview"^^ . . . . "1"^^ . . . "<p>You can control the behavior of the popup menu with the following <code>PTToolManagerDelegate</code> method: <a href="https://docs.apryse.com/api/ios/Protocols/PTToolManagerDelegate.html#/c:objc(pl)PTToolManagerDelegate(im)toolManager:shouldShowMenu:forAnnotation:onPageNumber:" rel="nofollow noreferrer">toolManager(_:, shouldShowMenu:, forAnnotation:, onPageNumber:)</a>. You would want to return <code>false</code> from the method to disable the menu from appearing.</p>\n<p>Note that if you are using a <code>PTDocumentController</code> to show the document, then you will need to create a subclass and override that method:</p>\n<pre class="lang-swift prettyprint-override"><code>class CustomDocumentController : PTDocumentController {\n \n override func toolManager(_ toolManager: PTToolManager,\n shouldShowMenu menuController: UIMenuController,\n forAnnotation annotation: PTAnnot?,\n onPageNumber pageNumber: UInt) -&gt; Bool {\n // Uncomment to disable popup menu in all scenarios.\n // return false\n \n if annotation == nil {\n // No annotation is selected.\n if toolManager.tool as? PTPanTool != nil {\n // This is the long-press menu over blank space in the document.\n \n // Uncomment to disable long-press menu.\n // return false\n } else if toolManager.tool as? PTTextSelectTool != nil {\n // This is the text-selection menu shown for selected text.\n \n // Disable text-selection menu.\n return false\n }\n }\n \n // Use default menu behavior from superclass.\n return super.toolManager(toolManager,\n shouldShowMenu: menuController,\n forAnnotation: annotation,\n onPageNumber: pageNumber)\n }\n \n}\n</code></pre>\n<p>The code above will disable the text-selection menu, but leave the long-press (over blank space) and annotation-selection menus enabled. You can uncomment the commented-out lines to control those menus as well if you want.</p>\n"^^ . . "0"^^ . . . . . . . . "0"^^ . "1"^^ . "0"^^ . . . . "1"^^ . . . . "0"^^ . "Have you accidentally set the background color to black? I guess its view controller background color or the view controller's view is covered by its subView, which is black. Try to debug UI."^^ . "The window number issue is essentially solved since it's obtained by the Objective C aproach. Would you be able to point to docs for the Accessibility API for this? I have ~0 experience in dev on MacOS."^^ . . "<p>For <a href="https://docs.apryse.com/api/ios/Classes/PTLink.html" rel="nofollow noreferrer">link annotations</a> in the document, you can edit and delete them with the link creation tool (<a href="https://docs.apryse.com/api/ios/Classes/PTLinkCreate.html" rel="nofollow noreferrer"><code>PTLinkCreate</code></a> class). While the link-create tool is active, existing link annotations will be selected when you tapped. From the annotation-selection popup menu you can tap &quot;Delete&quot; (the last menu option - you may need to scroll or tap the arrow in the menu to see it) to delete the link annotation.</p>\n"^^ . "<p>I am trying to setup SonarQube for a project hosted on Github. The settings offered in the SonarQube UI are good, despite the fact that the project uses the Objective-C programming language. The Github Action I am using is</p>\n<pre><code>jobs:\n sonarcloud:\n name: SonarCloud\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v3\n with:\n fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis\n - name: SonarCloud Scan\n uses: SonarSource/sonarcloud-github-action@master\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any\n SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n</code></pre>\n<p>and it fails with</p>\n<pre><code>ERROR: Error during SonarScanner execution\njava.lang.UnsupportedOperationException: \n\nThe only way to get an accurate analysis of C/C++/Objective-C files is by using the\nSonarSource build-wrapper and setting the property &quot;sonar.cfamily.build-wrapper-output&quot; \nor by using Clang Compilation Database and setting the property \n&quot;sonar.cfamily.compile-commands&quot;. None of these two options were specified.\n</code></pre>\n<p>Is there some Github Action that will run the SonarSource build-wrapper, or what would be the best next step?</p>\n"^^ . . . . . "Agh... More trouble than its worth, I'm afraid. Wish there was a simpler way."^^ . . . . "??? What type is `myClass`? You've marked it here as `id`. Is it really `Class`? Is `doSomethingWith:` an instance method or a class method? (If "nothing happens", it is very, very likely that `myClass` is nil. You really want to be 100% certain that this is not true, because that's almost always the cause of "nothing happens.") You likely need to edit this question to post some real code (ideally a minimal, reproducible example, but at as minimum real code with precisely what is true at each line). I suspect you're not doing what you think you're doing."^^ . . "2"^^ . "<p><code>nil;</code> as a statement does nothing: it references a <code>nil</code> value, and then doesn't use it. <code>else { nil; }</code> is meaningless, and the code as written would be the same without it:</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSString *tmpPath = [self temporaryFilePath:suffix];\nif ([[NSFileManager defaultManager] createFileAtPath:tmpPath contents:data attributes:nil]) {\n return tmpPath;\n}\n\nreturn tmpPath;\n</code></pre>\n<p>Because in both code paths here the code ends up returning <code>tmpPath</code>, this is equivalent to</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSString *tmpPath = [self temporaryFilePath:suffix];\n[[NSFileManager defaultManager] createFileAtPath:tmpPath contents:data attributes:nil]);\nreturn tmpPath;\n</code></pre>\n<p>It seems unlikely that the original author intended to return <code>tmpPath</code> unconditionally this way. Instead, it seems the code here likely meant to <code>return nil;</code> on failure to create a temporary file:</p>\n<pre class="lang-objectivec prettyprint-override"><code>+ (NSString *)createFile:(NSData *)data suffix:(NSString *)suffix {\n NSString *tmpPath = [self temporaryFilePath:suffix];\n if ([[NSFileManager defaultManager] createFileAtPath:tmpPath contents:data attributes:nil]) {\n return tmpPath;\n } else {\n return nil;\n }\n}\n</code></pre>\n<p>An alternative way to express this would be</p>\n<pre class="lang-objectivec prettyprint-override"><code>+ (NSString *)createFile:(NSData *)data suffix:(NSString *)suffix {\n NSString *tmpPath = [self temporaryFilePath:suffix];\n if (![[NSFileManager defaultManager] createFileAtPath:tmpPath contents:data attributes:nil]) {\n tmpPath = nil;\n }\n return tmpPath;\n}\n</code></pre>\n<p>which returns <code>tmpPath</code> unconditionally (but assigns it a <code>nil</code> value on failure). The original snippet appears to be halfway between these two versions, either by accident, or because of a merge conflict, or otherwise.</p>\n"^^ . "3"^^ . "0"^^ . . "0"^^ . "0"^^ . . . . "But the very existence of dispatch_get_main_queue suggests it should be possible to execute a dispatch queue on a specific thread. I.e., on my thread. Maybe that's not with a RunLoop, but unless Apple really managed to screw this up too it should be possible, no?"^^ . . "0"^^ . . . . "macos"^^ . "0"^^ . . . . . . "Thank you for your reply! This makes sense, but as a follow-up to the original question, if I initialize the LibraryView with the frame of the root view, why are the margins different within the LibraryView anyways? Shouldn't they be the same? Regardless, your implementation does solve the original issue."^^ . . . . . "Your config.xml is very outdated, there are probably more stuff to remove / update. Just try with a new empty project and you'll see it works. You also have obsolete plugins."^^ . . "I would rather see this as a beautiful example of being multilingual than "cobbled together". Nicely done, @RobertKniazidis, much appreciated"^^ . . . "Although exchanging implementations should work with parameters (assuming the parameter types are the same), it's actually subtly problematic. [This article](https://newrelic.com/blog/best-practices/right-way-to-swizzle) explains why. I have a GItHub repo for swizzling Obj-C methods from Swift called [SwizzleHelper](https://github.com/chipjarred/SwizzleHelper) that can help make it easier. I don't have any forwarding functions for methods that take closures (Obj-C blocks) though. I swizzle use it in another package to swizzle methods that take `NSEvent` though."^^ . "0"^^ . . "0"^^ . . . . "0"^^ . . . "0"^^ . . . . "I think this falls into the realms of cobbled together. Not to diminish the effort, I would rather do an FFI call to the Objective C from Go and if the name is not present, then shell out of `osascript`. This would be a less than or equal to single shell-out rather than less than or equal to two for each query."^^ . . "The meaning of the conditional nil"^^ . . . . . "Does `[self viewAtColumn:0 row:highlightedRow makeIfNecessary:NO]` return a view? Is converting to a view based table view an option?"^^ . . . "2"^^ . "0"^^ . "0"^^ . . "0"^^ . . "`CFCopyHomeDirectoryURL()`?"^^ . "In your example, you don't call the original implementation, so the problem with the exchange methods approach doesn't apply. If that's the case in your real code, as opposed to just a simplified example for SO, it may just be a matter of using `@convention(block)` in what you're already doing, as in `class func swizzledPullTypes(fromServer completionBlock: @escaping @convention(block) (Any) -> Void, error errorBlock: @escaping MKNKErrorBlock)`"^^ . . "<p>Suppose I have a Swift class</p>\n<pre><code>@objcMembers class C: NSObject {\n let range: ClosedRange&lt;Int&gt;\n\n init(range: ClosedRange&lt;Int&gt;) {\n self.range = range\n super.init()\n }\n\n convenience init(min: Int, max: Int) {\n self.init(range: min...max)\n }\n}\n</code></pre>\n<p>Is there a way to make the <code>convenience init</code> available only from Objective-C, so that the API will be smaller?</p>\n"^^ . "2"^^ . . . . . . . . . . "0"^^ . . . "0"^^ . . . "1"^^ . . "0"^^ . . "0"^^ . . "0"^^ . . . "Why NSString floatvalue return 0 for "NaN"?"^^ . . . . . . . "Well... if you're on a 2x screen-scale device, you're generating a `16,000 x 1,000` pixel image... on a 3x device, a `24,000 x 1,500` pixel image. Those are pretty big, and likely why you get nothing when trying to use `UIGraphicsImageRenderer`."^^ . "core-graphics"^^ . "0"^^ . . . "<p>UPDATE:\nAt a suggestion, I tried implementing a NSURLSession to download and then draw the file. I have this now in my code, and it mostly works, but I've found if it is more than 1MB, it simply won't draw. I've also found if there are multiple pages, it skips to the second page for some reason to start off with. Do y'all see anything wrong?:</p>\n<pre><code> NSString *theURL = [self.entry[@&quot;SermonPDF&quot;] url];\n /*sermonPDFURL = [NSURL fileURLWithPath:_sermonString];\n self.arrayOfVerses = @[@&quot;allverses&quot;];\n \n CGPDFDocumentRef pdfDocument = [self openPDF:sermonPDFURL];\n [self drawDocument:pdfDocument];*/\n NSURLSessionConfiguration *defaultConfigObject = [NSURLSessionConfiguration defaultSessionConfiguration];\n\n NSURLSession *delegateFreeSession = [NSURLSession sessionWithConfiguration: defaultConfigObject delegate: nil delegateQueue: [NSOperationQueue mainQueue]];\n\n [[delegateFreeSession dataTaskWithURL: [NSURL URLWithString: theURL]\n completionHandler:^(NSData *data, NSURLResponse *response,\n NSError *error) {\n NSLog(@&quot;Sermon error %@&quot;, error.description);\n NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);\n NSString *documentsDirectory = [paths objectAtIndex:0];\n NSString *pdfPath = [[documentsDirectory stringByAppendingPathComponent:[self.entry valueForKey:@&quot;DateOfService&quot;]] stringByAppendingString:@&quot;.pdf&quot;];\n [data writeToFile:pdfPath atomically:YES];\n [self drawingSermonFinally];\n\n \n }] resume];\n\n-(void)drawingSermonFinally {\n NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);\n NSString *documentsDirectory = [paths objectAtIndex:0];\n NSString *pdfPath = [[documentsDirectory stringByAppendingPathComponent:[self.entry valueForKey:@&quot;DateOfService&quot;]] stringByAppendingString:@&quot;.pdf&quot;];\n self.arrayOfVerses = @[@&quot;allverses&quot;];\n \n CGPDFDocumentRef pdfDocument = [self openPDFLocal:pdfPath];\n [self drawDocument:pdfDocument];\n \n}\n</code></pre>\n<p>My app uses the following code to display a PDF in tvOS app:</p>\n<pre><code> CGPDFDocumentRef pdfDocument2 = [self openPDF:[NSURL URLWithString:@&quot;https://pdfislistedhere&quot;]];\n [self drawDocument:pdfDocument2];\n</code></pre>\n<p>However, it seems it tries to draw too quickly. Is there a way to be able to add a completion handler to my code listed below for the CGPDFDocumentRef? This was code that I was helped with and can't figure out if there is a good method to go about having it wait to run drawDocument:pdfDocument until after the PDF has actually been downloaded? as of now, it will simply do nothing, but run all checks and logs as though it was successful.</p>\n<pre><code>- (CGPDFDocumentRef)openPDF:(NSURL*)NSUrl {\n CFURLRef url = (CFURLRef)CFBridgingRetain(NSUrl);\n \n CGPDFDocumentRef myDocument;\n myDocument = CGPDFDocumentCreateWithURL(url);\n if (myDocument == NULL) {\n NSLog(@&quot;can't open %@&quot;, NSUrl);\n CFRelease (url);\n return nil;\n }\n CFRelease (url);\n \n if (CGPDFDocumentGetNumberOfPages(myDocument) == 0) {\n CGPDFDocumentRelease(myDocument);\n return nil;\n }\n \n return myDocument;\n}\n- (void)drawDocument:(CGPDFDocumentRef)pdfDocument\n{ NSLog(@&quot;draw document&quot;);\n theImageView.hidden = YES;\n // Get the total number of pages for the whole PDF document\n int totalPages= (int)CGPDFDocumentGetNumberOfPages(pdfDocument);\n\n if ([[self.arrayOfVerses firstObject] isEqualToString:@&quot;allverses&quot;]) {\n NSLog(@&quot;draw document all verses %d&quot;, totalPages);\n self.pages = totalPages;\n self.subtractingPages = totalPages - 1;\n\n NSMutableArray *pageImages = [[NSMutableArray alloc] init];\n \n // Iterate through the pages and add each page image to an array\n for (int i = 1; i &lt;= totalPages; i++) {\n // Get the first page of the PDF document\n CGPDFPageRef page = CGPDFDocumentGetPage(pdfDocument, i);\n CGRect pageRect = CGPDFPageGetBoxRect(page, kCGPDFMediaBox);\n \n // Begin the image context with the page size\n // Also get the grapgics context that we will draw to\n UIGraphicsBeginImageContext(pageRect.size);\n CGContextRef context = UIGraphicsGetCurrentContext();\n \n // Rotate the page, so it displays correctly\n CGContextTranslateCTM(context, 0.0, pageRect.size.height);\n CGContextScaleCTM(context, 1.0, -1.0);\n CGContextConcatCTM(context, CGPDFPageGetDrawingTransform(page, kCGPDFMediaBox, pageRect, 0, true));\n \n // Draw to the graphics context\n CGContextDrawPDFPage(context, page);\n \n // Get an image of the graphics context\n UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n UIGraphicsEndImageContext();\n [pageImages addObject:image];\n }\n // Set the image of the PDF to the current view\n [self addImagesToScrollView:pageImages];\n }\n else {\n self.pages = [self.arrayOfVerses count];\n self.subtractingPages = self.pages - 1;\n\n NSLog (@&quot;total pages %ld&quot;, (long)self.pages);\n NSMutableArray *pageImages = [[NSMutableArray alloc] init];\n \n \n [pageImages removeAllObjects];\n \n //Getting slide numbers to be used\n NSString *text = self.selectedCountry;\n NSString *substring = nil;\n \n NSRange parenRng = [text rangeOfString: @&quot;(?&lt;=\\\\().*?(?=\\\\))&quot; options: NSRegularExpressionSearch];\n \n if ( parenRng.location != NSNotFound ) {\n substring = [text substringWithRange:parenRng];\n NSLog(@&quot;Substring %@&quot;, substring);\n }\n \n \n // Iterate through the pages and add each page image to an array\n for (int i = 1; i &lt;= totalPages; i++) {\n // Get the first page of the PDF document\n \n \n NSPredicate *valuePredicate=[NSPredicate predicateWithFormat:@&quot;self.intValue == %d&quot;,i];\n \n if ([[self.arrayOfVerses filteredArrayUsingPredicate:valuePredicate] count]!=0) {\n // FOUND\n CGPDFPageRef page = CGPDFDocumentGetPage(pdfDocument, i);\n CGRect pageRect = CGPDFPageGetBoxRect(page, kCGPDFMediaBox);\n \n // Begin the image context with the page size\n // Also get the grapgics context that we will draw to\n UIGraphicsBeginImageContext(pageRect.size);\n CGContextRef context = UIGraphicsGetCurrentContext();\n \n // Rotate the page, so it displays correctly\n CGContextTranslateCTM(context, 0.0, pageRect.size.height);\n CGContextScaleCTM(context, 1.0, -1.0);\n CGContextConcatCTM(context, CGPDFPageGetDrawingTransform(page, kCGPDFMediaBox, pageRect, 0, true));\n \n // Draw to the graphics context\n CGContextDrawPDFPage(context, page);\n \n // Get an image of the graphics context\n UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n UIGraphicsEndImageContext();\n \n \n [pageImages addObject:image];\n }\n \n else {\n //NOT FOUND\n }\n \n }\n // Set the image of the PDF to the current view\n [self addImagesToScrollView:pageImages];\n }\n}\n</code></pre>\n"^^ . . . "0"^^ . "0"^^ . . . "Re: @kortschak, Good luck finding a "unified solution" as you understand it. It doesn't seem to use one of the 2 (AppleScript, which retrieves the window's name, or C code, which retrieves its ID), but magically extracts both. Also, I wish you to learn the magic word "thanks" for the user's attempt to provide help."^^ . "Is the outline view view based or cell based?"^^ . . . "0"^^ . . "0"^^ . . . . . "0"^^ . "What are you trying to accomplish? Which problem do you want to solve?"^^ . . . . . "@MarekR I need to use pure C++ for multiplatform core"^^ . . . "<p>I keep hitting Core Data faults when updating and deleting objects and Id like to understand why. The logic essentially fetches the entities, updates a few fields and saves. No faults are hit. The entities are then consumed for some business logic and when thats done, the entities are deleted one by one using the following code:\n[context deleteObject:[context objectWithID:entity.objectID]];\nperformed within the context block. Why does the line of code trigger fault?</p>\n<p>I did end up moving this to use NSBatchDeleteRequest where I passed it an array of object IDs and that got rid of the faults but just would like to understand why the faults got triggered in the first place.</p>\n"^^ . . "unified approach to getting PID, window ID, process name and window name from active window on mac"^^ . . "network-programming"^^ . . . . "<p>I have the following code:</p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n\nint main(int argc, const char * argv[]) {\n @autoreleasepool {\n // Create a dictionary to be archived\n NSDictionary *dict = @{@&quot;key1&quot;: @&quot;value1&quot;, @&quot;key2&quot;: @(42)};\n \n // Archive the dictionary to a data object\n NSError *archiveError = nil;\n NSData *data = [NSKeyedArchiver archivedDataWithRootObject:dict requiringSecureCoding:NO error:&amp;archiveError];\n if (archiveError) {\n NSLog(@&quot;Error archiving data: %@&quot;, archiveError);\n return 1;\n }\n \n // Unarchive the data object to a dictionary\n NSError *unarchiveError = nil;\n NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:data error:&amp;unarchiveError];\n if (unarchiveError) {\n NSLog(@&quot;Error creating unarchiver: %@&quot;, unarchiveError);\n return 1;\n }\n NSString *unarchivedDict = [unarchiver decodeObjectOfClasses:[NSSet setWithObjects:[NSDictionary class], [NSString class], [NSNumber class], nil] forKey:@&quot;key1&quot;];\n if (!unarchivedDict) {\n NSLog(@&quot;Error decoding object: %@&quot;, [unarchiver error]);\n return 1;\n }\n [unarchiver finishDecoding];\n \n // Print the unarchived dictionary\n NSLog(@&quot;%@&quot;, unarchivedDict);\n }\n return 0;\n}\n</code></pre>\n<p>But unarchivedDict is returning nil. Why isn't returning value1? Do I have to use decodeObjectForKey?</p>\n<p>I know you can use forKey:@&quot;root&quot; to get the whole dict, but what other values can you use in forKey:?</p>\n"^^ . . . "memory leak from NSString→const char* conversion in Objective C"^^ . "Hard to say what you might do to optimize it without seeing example code of what you're doing. But... have you set `shouldRasterize` to true for your shadows?"^^ . . . . "0"^^ . . "<p>There is a way to do this, with the es_invert_muting() function (available in MacOS 13.0 and later).</p>\n<p>You can do something like this:</p>\n<pre><code>es_unmute_all_target_paths(client)\nes_invert_muting(client, ES_MUTE_INVERSION_TYPE_TARGET_PATH)\nes_mute_path(client, path, ES_MUTE_PATH_TYPE_TARGET_PREFIX)\n</code></pre>\n<p>This removes the default mute list, &quot;inverts&quot; the mute logic, so only muted paths are selected, then selects one path p[refix to monitor.</p>\n<p>Note that there is a difference between ES_MUTE_PATH_TYPE_PREFIX and ES_MUTE_PATH_TYPE_TARGET_PREFIX. The former refers to the path of the executable that triggered the event, and the latter is the path of the file that was accessed.</p>\n"^^ . . "Did you make any progress?"^^ . . . . "1"^^ . . "When you see `NSTableView (macOS 10.0+)`, that means that the `NSTableView` class can be used starting with macOS 10.0 and later. That is up-to-date."^^ . . . . . . . "0"^^ . . . . "<p>In <a href="https://stackoverflow.com/q/76140643/1502538">another question</a> I asked as an aside, for confirmation that my use of <code>NSString</code>→<code>const char*</code> in the code below is correct. I was asked to remove this as two questions were being asked in a single post.</p>\n<p>The code that I have below works, but I can see that memory consumption grows monotonically, so I am concerned about a memory leak. Attempting to <code>free</code> the strings results in &quot;pointer being freed was not allocated&quot;; no experience in Objective C, but this segfault seems like the correct behaviour, so where is the leak?</p>\n<pre><code>#include &lt;Cocoa/Cocoa.h&gt;\n#include &lt;CoreGraphics/CGWindow.h&gt;\n\nstruct details {\n int wid;\n int pid;\n const char* name;\n const char* window;\n};\n\nint activeWindow(struct details *d)\n{\n if (d == NULL) {\n return 0;\n }\n NSArray *windows = (NSArray *)CGWindowListCopyWindowInfo(kCGWindowListExcludeDesktopElements|kCGWindowListOptionOnScreenOnly,kCGNullWindowID);\n for(NSDictionary *window in windows){\n int WindowLayer = [[window objectForKey:(NSString *)kCGWindowLayer] intValue];\n if (WindowLayer == 0) {\n d-&gt;wid = [[window objectForKey:(NSString *)kCGWindowNumber] intValue];\n d-&gt;pid = [[window objectForKey:(NSString *)kCGWindowOwnerPID] intValue];\n d-&gt;name = [[window objectForKey:(NSString *)kCGWindowOwnerName] UTF8String];\n d-&gt;window = [[window objectForKey:(NSString *)kCGWindowName] UTF8String];\n return 1;\n }\n }\n return 0;\n}\n</code></pre>\n"^^ . "flutter"^^ . "-1"^^ . "1"^^ . "0"^^ . . "0"^^ . "<p>I am trying to get both the IPv4 and IPv6 value of a URL, say 'stackoverflow.com' for example.</p>\n<p>Ideally returning the same results as <code>dig stackoverflow.com A stackoverflow.com AAAA +short</code></p>\n<p>I currently have the following, but for me it is only returning the IPv4 address</p>\n<pre><code>struct hostent *host_entry = gethostbyname(&quot;stackoverflow.com&quot;);\n char *buff;\n buff = inet_ntoa(*((struct in_addr *)host_entry-&gt;h_addr_list));\n</code></pre>\n"^^ . . "A view's frame in `viewDidLoad` should never be relied on. Always use constraints to deal with view size adjustments caused by any number of reasons."^^ . . . . "2"^^ . . . "0"^^ . "0"^^ . "nsoutlineview"^^ . . . . . "tensorflow-lite"^^ . . . "0"^^ . "vba"^^ . . "0"^^ . . . "github-actions"^^ . . . "Just rename source file so it has `.mm` extension and you are done."^^ . . "0"^^ . . . . "1"^^ . "pitch-shifting"^^ . . . "0"^^ . . "cocoa"^^ . . . . . . . . "Okay, I think this just works. Turned out that a function that calls this `pullTypes` missed a condition during tests. I just didn't check it fully until @ChipJarred asked about the manner of not working. I appreciate your time here, Jarred."^^ . "0"^^ . . . "0"^^ . . "1"^^ . "<p>You code is missing something. I think you need an <code>add</code> blend operation for both <code>rgbBlendOperation</code> and <code>alphaBlendOperation</code>. If you just want to add a snowflake on top, I think the factors you have should be enough.</p>\n<p>If you take a look at <a href="https://developer.apple.com/documentation/metal/mtlblendoperation/add" rel="nofollow noreferrer">https://developer.apple.com/documentation/metal/mtlblendoperation/add</a>, it lists some formulas</p>\n<pre><code>RGB = Source.rgb * SBF + Dest.rgb * DBF\nA = Source.a * SBF + Dest.a * DBF\n</code></pre>\n<p>where <code>SBF</code> is source blend factor, and <code>DBF</code> is destination blend factor.</p>\n<p>So, basically, to expand in your case,</p>\n<pre><code>RGB = Source.rgb * Source.a + Dest.rgb\nA = Source.a * SBF + Dest.a\n</code></pre>\n<p>Seems like it should do the trick.</p>\n"^^ . "0"^^ . . . . . . . . "How to get IPv4 & IPv6 values on iOS"^^ . . . . . "0"^^ . "cgpdfdocument"^^ . . . . . . "Screen conversion using the coordinator pattern is a basic step to implement with code."^^ . "Besides my answer below — I'm assuming this code is using automatic reference counting (ARC), but if for some reason not: `CGWindowListCopyWindowInfo` returns an allocated array which you would also need to `-release`"^^ . . "1"^^ . . . . . "0"^^ . . . . "<p>I am working on an old app (so Obj-C, but that should not make a difference for what I am asking).</p>\n<p>It uses a big UIScrollView whose contents are made of several dozen of small views that are either icons or UILabels with text - this helps with the layout. In any case it has been working fine for years, except that with some added background information and color coding, it started making more and more sense to apply a shadow to the text and the icons.</p>\n<p>As you know, applying non-fixed shadow like I wanted (around text, or icons with transparency) is a performance hog, so scrolling became jerky. I said, hey, I only need to draw once, I could just snapshot and replace with an image.</p>\n<p>My problem is that the only method I found that actually works at getting a UIImage out of this huge (8000x500 points) UIView with its subviews:</p>\n<pre><code> UIGraphicsBeginImageContext(scrollView.contentSize);\n CGRect savedFrame = scrollView.frame;\n scrollView.contentOffset = CGPointZero;\n scrollView.frame = CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height);\n\n [scrollView.layer renderInContext: UIGraphicsGetCurrentContext()];\n UIImage *img = UIGraphicsGetImageFromCurrentImageContext();\n\n scrollView.frame = savedFrame;\n UIGraphicsEndImageContext();\n</code></pre>\n<p>is <strong>crazy</strong> slow. Trying on the slowest device I have, an iPad Air 2, it takes over a minute to do the <code>renderInContext</code> step!</p>\n<p>I tried what are more &quot;modern&quot; methods, e.g. :</p>\n<pre><code> UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:scrollView.contentSize];\n UIImage *img = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) {\n [scrollView drawViewHierarchyInRect: CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height) afterScreenUpdates:YES];\n }];\n</code></pre>\n<p>This gives me a blank (transparent) image, and so does specifying the first subview of the ScrollView which is a container for all the subviews I want. Doing the same with the parent view of the scrollview, gives me an image of just the visible part of the scrollview. The same thing (visible part) is what I get with this as well:</p>\n<pre><code>UIView *view = [scrollView snapshotViewAfterScreenUpdates:YES];\n</code></pre>\n<p>So, I am not sure what else to try, as I want to avoid redoing everything to draw directly on a single UIView, instead of the current model. Any ideas?</p>\n<p>TIA</p>\n<p>Update: One good idea I had is that for UILabels I replaced the layer shadows with the - not soft but fast - UILabel shadows. OK result in look, good increase in scroll speed. So maybe I should try to increase scroll performance with things like that rather than going the snapshot route...</p>\n"^^ . . "1"^^ . . . . . . . . "0"^^ . "<p>Make sure you add the <code>-ObjC</code> linker flag to the 'Build Settings' of your both the <strong>project</strong> and the <strong>target</strong>.</p>\n"^^ . "ios"^^ . "0"^^ . . . . "2"^^ . . . . . . . "0"^^ . . . "It is cell based."^^ . "0"^^ . "0"^^ . . . . . . "Thank you very much, I left my if check the same and adjusted the range to {7,1} it works now."^^ . . . "Add Completion Handler for when PDF has been downloaded"^^ . "1"^^ . "0"^^ . "signal-processing"^^ . . . "0"^^ . . . . "<p>You have multiple problems. Lots of deprecated stuff to remove :</p>\n<pre><code>&lt;feature name=&quot;CDVWKWebViewEngine&quot;&gt;\n&lt;preference name=&quot;WKWebViewOnly&quot; value=&quot;true&quot; /&gt;\n&lt;feature name=&quot;CDVWKWebViewEngine&quot;&gt;\n &lt;param name=&quot;ios-package&quot; value=&quot;CDVWKWebViewEngine&quot; /&gt;\n&lt;/feature&gt;\n&lt;preference name=&quot;CordovaWebViewEngine&quot; value=&quot;CDVWKWebViewEngine&quot; /&gt;\n</code></pre>\n<p>You don't need to set any of this anymore with cordova-ios 6.2.0 as it all defaults to WKWebViewEngine.</p>\n<p>Also everything with <code>feature</code> is also deprecated.</p>\n"^^ . "0"^^ . . "0"^^ . "0"^^ . "Why are the margins of the root view and a subview with the same frame different?"^^ . "You can write: `double ddd = atof("NaN");`"^^ . . . "2"^^ . . "<p>The range <code>{8,1}</code> means you are trying to access the 9th character. But your <code>if</code> check only verifies if the string has 8 or more characters. So if the string is exactly 8 characters long then you will get that error.</p>\n<p>Update your <code>if</code> check to:</p>\n<pre><code>if (self.txtQty.text.length &gt; 8) {\n</code></pre>\n<p>Or possibly your <code>if</code> check is correct and the range should be changed from <code>{8,1}</code>, to <code>{7,1}</code> to replace the 8th character.</p>\n<p>Which of those two changes you make depends on your goal (to change the 8th or 9th character).</p>\n<hr />\n<p>To help visualize the range, I'll attempt a bit of a drawing:</p>\n<p>Some string, its indexes, and range <code>{8,1}</code>:</p>\n<pre><code> 1 2 3 4 5 6 7 8 9 0 &lt;-- The string\n| | | | | | | | | | |\n0 1 2 3 4 5 6 7 8 9 1 &lt;-- Its indexes\n 0\n *** &lt;-- Area for {8,1}\n</code></pre>\n<p>Here you can see that the range <code>{8,1}</code> is getting the 9th character.</p>\n"^^ . "I suggest using NSURLSession to download the remote PDF first, save it locally, then use your code with a local URL."^^ . . . . . . . "1"^^ . "I hesitate to even suggest this, but you could replace the convenience initialiser with a static factory function that has an unpleasant name (e.g. `makeObjectiveCInstance`) and returns a new `C`. That doesn’t hide it from Swift, but makes it much harder to use accidentally and less likely to appear in autocomplete suggestions."^^ . "0"^^ . . "completionhandler"^^ . "0"^^ . "storyboard"^^ . "3"^^ . . "interop"^^ . . . . . . "4"^^ . . . . "FYI - Don't define your own constant for `PI`. Foundation already provides `M_PI` which is a lot more accurate."^^ . "1"^^ . . . . . . "How would the user dismiss it then?"^^ . . "0"^^ . "0"^^ . . "0"^^ . . . . . . . . . . "0"^^ . . . "<p>If you use an application scene, the window you create manually in the application delegate is ignored (<em>to be precise it remains the key window for very short period of time, until the scene makes its own window the key one</em>). So you either should attach the window you created in the scene delegate's <a href="https://developer.apple.com/documentation/uikit/uiscenedelegate/3197914-scene?language=objc" rel="nofollow noreferrer"><code>-[UISceneDelegate scene:willConnectToSession:options:]</code></a> method:</p>\n<pre class="lang-objc prettyprint-override"><code>- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {\n UIWindow *window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene];\n\n UIView *view = [[UIView alloc] initWithFrame:CGRectMake(160, 240, 100, 150)];\n view.backgroundColor = UIColor.redColor;\n [window addSubview:view];\n\n window.backgroundColor = UIColor.whiteColor;\n [window makeKeyAndVisible];\n self.window = window;\n}\n</code></pre>\n<p>..OR get rid of the scene delegate in your application (you may refer to the discussion under <a href="https://stackoverflow.com/questions/59006550/how-to-remove-scene-delegate-from-ios-application">this question</a> for more details on how to do it) and make it work with the old good application delegate's window. Be advised that in this case you won't be able to use the window without having the <a href="https://developer.apple.com/documentation/uikit/uiwindow/1621581-rootviewcontroller?language=objc" rel="nofollow noreferrer"><code>rootViewController</code></a> specified, so you at least need to set a dummy controller:</p>\n<pre class="lang-objc prettyprint-override"><code>_window.rootViewController = [UIViewController new];\n</code></pre>\n"^^ . "0"^^ . . "avfoundation"^^ . . . . . . "@BerryBlue I had a smilar issue to you. This fix/workaound helped me to prevent this error: https://github.com/facebook/react-native/issues/43319#issuecomment-2061251131"^^ . . . . . . "0"^^ . "what is the alternative solution to get the carrier country code ?"^^ . . "Not really. The problem is likely with the code that either sends the string to the database or retrieves the string from the database. If your Objective-C iOS app is sending a normal `NSString` then your Objective-C iOS code should receive a normal `NSString`. No encoding should be needed."^^ . "<p>I have scenario where I need to display an alert without any button. Is it possible to remove the buttons from the default <code>Alert</code> in <code>SwiftUI</code>?</p>\n<p>I know how to create a custom view as <code>Alert</code>. But I would love to use the default one instead of creating a custom one.</p>\n<pre><code>struct ContentView: View {\n @State private var showingAlert = false\n\n var body: some View {\n Button(&quot;Show Alert&quot;) {\n showingAlert = true\n }\n .alert(isPresented: $showingAlert) {\n Alert(title: Text(&quot;Important message&quot;), message: Text(&quot;Wear sunscreen&quot;), dismissButton: .default(Text(&quot;Got it!&quot;)))\n }\n }\n}\n</code></pre>\n<p><a href="https://i.sstatic.net/5d7ts.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5d7ts.png" alt="enter image description here" /></a></p>\n"^^ . . . "markdown"^^ . . . "Ok, I think I got it. Further research is required. Thanks"^^ . . . . . . "0"^^ . "0"^^ . . . . . "<p>I'm facing an issue while connecting to socket on my local server, Where i am getting an error of connection time out (1001) shown in attached screen shots.</p>\n<p>Is there any default SRT socket address and port using which i can test my code on connection socket?</p>\n<p>Here is my code</p>\n<pre><code>- (IBAction)onSender:(id)sender {\n int yes = 1;\n\n const char ipAddress [] = &quot;192.168.112.45:8000&quot;;\n \n printf(&quot;srt startup\\n&quot;);\n srt_startup();\n \n printf(&quot;srt create socket\\n&quot;);\n srtSocket = srt_create_socket();\n if (srtSocket == SRT_ERROR)\n {\n // fprintf(stderr, &quot;srt_socket: %s\\n&quot;, srt_getlasterror_str());\n [NSException raise:[@(srt_getlasterror(nil)) stringValue] format:@&quot;%s&quot;, srt_getlasterror_str()];\n }\n\n printf(&quot;srt bind address\\n&quot;);\n struct sockaddr_in socketAddrIN;\n memset(&amp;socketAddrIN, 0, sizeof(socketAddrIN));\n socketAddrIN.sin_family = AF_INET;\n socketAddrIN.sin_port = htons(1234);\n inet_pton(AF_INET, ipAddress, &amp;socketAddrIN.sin_addr);\n \n printf(&quot;srt set socket flag\\n&quot;);\n srt_setsockflag(srtSocket, SRTO_SENDER, &amp;yes, sizeof(yes));\n \n printf(&quot;srt connect\\n&quot;);\n int result = srt_connect(srtSocket, (struct sockaddr *)&amp;socketAddrIN, sizeof(socketAddrIN));\n \n if (result == SRT_ERROR) {\n // fprintf(stderr, &quot;srt_connect: %s\\n&quot;, srt_getlasterror_str());\n [NSException raise:[@(srt_getlasterror(nil)) stringValue] format:@&quot;%s&quot;, srt_getlasterror_str()];\n }\n \n srt_close(srtSocket);\n \n srt_cleanup();\n}\n</code></pre>\n<p>Error log\n<a href="https://i.sstatic.net/jfUHa.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jfUHa.png" alt="enter image description here" /></a></p>\n"^^ . "Why don't you resize the original Image?"^^ . . . "0"^^ . . "@Willeke, i'm glad you guys can resolve any issue by discussing it in the comments section, but would you be so kind to leave an answer instead so we have less unanswered questions on SO. Alternatively we may vote to mark it a duplicate if the linked question has answers that help here"^^ . "swift-protocols"^^ . "Post how you create the toolbar in the question please."^^ . "Obj-C - Display emoji in UILabel?"^^ . . "0"^^ . . "1"^^ . "0"^^ . . "<p>In the first column of my view-based <code>NSTableView</code>, I have a custom <code>NSView</code> subclass. In the second column, there's an <code>NSTextField</code>.</p>\n<p>Now I would like to adjust the drawing of the view in the first column based on when I start editing one of the text fields of the second column. I've tried setting a property on the custom view in <code>tableView:viewForTableColumn:row:</code>, but this doesn't work, as the table cells are only updated when I call <code>reloadData</code> on the table view, which in turn ends editing. To make this even more complicated, I'd like to adjust the drawing of the custom view not only in the row I'm currently editing, but for all the rows.</p>\n<p>Any ideas how to achieve this?</p>\n"^^ . . . . "0"^^ . . "*If a function declares that it doesn't accept any parameters, then it will never read any values passed to it, so you can safely pass whatever you want and it will ignore it.* I don't know that's guaranteed to be true, although the C standard's definition of `printf()` accepting more arguments than format specifiers in the format string does strongly imply it must be true."^^ . . "2"^^ . "See updated question :) Hope that provides more context! @HangarRash"^^ . . . "done. Please see https://stackoverflow.com/questions/76359216/convert-stdvector-to-nsarray. Thx."^^ . . . "<p>I am currently working on an iOS project and I'm utilizing the XCDYouTubeKit library (<a href="https://github.com/iOSDev-Auction/XCDYouTubeKit" rel="nofollow noreferrer">https://github.com/iOSDev-Auction/XCDYouTubeKit</a>) to handle YouTube video playback. The library was initially compiled successfully in Xcode 14.2. However, upon upgrading to Xcode 14.3, I encountered an error stating &quot;Mixing declarations and code is incompatible with standards before C99&quot; during the compilation process.</p>\n<p>I have thoroughly researched the issue but haven't found any specific solutions or workarounds related to this library and Xcode version combination. I suspect that this error might be due to some changes in the compiler settings or language standards in Xcode 14.3.</p>\n<p>Already checked below solutions:\n1st mention in the thread <a href="https://developer.apple.com/forums/thread/729290" rel="nofollow noreferrer">https://developer.apple.com/forums/thread/729290</a>\nby adding detail WARNING_CFLAGS = -Wno-declaration-after-statement under User-Defined in build setting</p>\n<p>2nd by setting C Language Dialect to C99.\nboth not working.</p>\n"^^ . . . . . . "<h1>Converting image sequences to h264 encoded mp4 file with objective-c.</h1>\n<p>My code works well for one image file.\nBut if there are more images ,images are the screen captured and png formatted images, I face this error.\n<em>Video writing failed: Error Domain=AVFoundationErrorDomain Code=-11800 &quot;The operation could not be completed&quot; UserInfo={NSLocalizedFailureReason=An unknown error occurred (-16364), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x600000c78150 {Error Domain=NSOSStatusErrorDomain Code=-16364 &quot;(null)&quot;}}</em>\nHow to fix it?</p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n#import &lt;AVFoundation/AVFoundation.h&gt;\n#import &lt;AppKit/AppKit.h&gt;\n#import &lt;CoreImage/CoreImage.h&gt; // Import CoreImage framework explicitly\n\n@interface VideoCreator : NSObject\n\n- (void)createH264VideoFromPNGImages;\n\n@end\n\n@implementation VideoCreator\n\n- (void)createH264VideoFromPNGImages {\n // Specify the folder path containing the PNG images\n NSString *imageFolderPath = @&quot;/var/folders/example/path/&quot;;\n\n // Specify the output file path and name for the H.264 video\n NSString *outputPath = @&quot;/var/folders/example/result.mp4&quot;;\n\n // Get a list of files in the image folder\n NSArray *imageFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:imageFolderPath error:nil];\n\n // Create an AVAssetWriter to write the video file\n NSError *error = nil;\n AVAssetWriter *videoWriter = [[AVAssetWriter alloc] initWithURL:[NSURL fileURLWithPath:outputPath]\n fileType:AVFileTypeMPEG4\n error:&amp;error];\n if (error) {\n NSLog(@&quot;Failed to create AVAssetWriter: %@&quot;, error);\n return;\n }\n\n // Define the video settings\n NSDictionary *videoSettings = @{\n AVVideoCodecKey: AVVideoCodecTypeH264,\n AVVideoWidthKey: @2880, // Specify the desired video width\n AVVideoHeightKey: @1800, // Specify the desired video height\n };\n\n // Create an AVAssetWriterInput with the video settings\n AVAssetWriterInput *videoWriterInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo\n outputSettings:videoSettings];\n videoWriterInput.expectsMediaDataInRealTime = YES;\n\n // Create a pixel buffer attributes dictionary\n NSDictionary *pixelBufferAttributes = @{\n (id)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32ARGB),\n (id)kCVPixelBufferWidthKey: @2880, // Specify the same width as video settings\n (id)kCVPixelBufferHeightKey: @1800, // Specify the same height as video settings\n };\n\n // Create an AVAssetWriterInputPixelBufferAdaptor with the pixel buffer attributes\n AVAssetWriterInputPixelBufferAdaptor *pixelBufferAdaptor = [AVAssetWriterInputPixelBufferAdaptor assetWriterInputPixelBufferAdaptorWithAssetWriterInput:videoWriterInput sourcePixelBufferAttributes:pixelBufferAttributes];\n\n // Add the video input to the asset writer\n [videoWriter addInput:videoWriterInput];\n\n // Start writing the video\n [videoWriter startWriting];\n [videoWriter startSessionAtSourceTime:kCMTimeZero];\n\n // Iterate through the image files and append them to the video\n for (NSString *imageFile in imageFiles) {\n NSString *imageFilePath = [imageFolderPath stringByAppendingPathComponent:imageFile];\n NSImage *image = [[NSImage alloc] initWithContentsOfFile:imageFilePath];\n CIImage *ciImage = [[CIImage alloc] initWithData:[image TIFFRepresentation]];\n CVPixelBufferRef pixelBuffer = [self pixelBufferFromCIImage:ciImage];\n \n // Append the pixel buffer to the asset writer input\n [pixelBufferAdaptor appendPixelBuffer:pixelBuffer withPresentationTime:CMTimeMake(1, 30)];\n \n // Release the pixel buffer\n CVPixelBufferRelease(pixelBuffer);\n \n }\n\n // Finish writing the video\n [videoWriterInput markAsFinished];\n [videoWriter endSessionAtSourceTime:CMTimeMake(imageFiles.count, 30)];\n [videoWriter finishWritingWithCompletionHandler:^{\n // Handle the completion of video writing\n if (videoWriter.status == AVAssetWriterStatusCompleted) {\n NSLog(@&quot;Video writing completed successfully!&quot;);\n } else if (videoWriter.status == AVAssetWriterStatusFailed) {\n NSLog(@&quot;Video writing failed: %@&quot;, videoWriter.error);\n } else if (videoWriter.status == AVAssetWriterStatusCancelled) {\n NSLog(@&quot;Video writing cancelled.&quot;);\n } else {\n NSLog(@&quot;Video writing encountered an unknown error.&quot;);\n }\n }];\n}\n\n- (CVPixelBufferRef)pixelBufferFromCIImage:(CIImage *)image {\n // Create a pixel buffer pool\n CVPixelBufferPoolRef pixelBufferPool;\n NSDictionary *pixelBufferAttributes = @{\n (id)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32ARGB),\n (id)kCVPixelBufferWidthKey: @2880, // Specify the desired width\n (id)kCVPixelBufferHeightKey: @1800, // Specify the desired height\n (id)kCVPixelBufferCGImageCompatibilityKey: @YES,\n (id)kCVPixelBufferCGBitmapContextCompatibilityKey: @YES\n };\n CVPixelBufferPoolCreate(nil, nil, (__bridge CFDictionaryRef)pixelBufferAttributes, &amp;pixelBufferPool);\n\n // Create a pixel buffer\n CVPixelBufferRef pixelBuffer;\n CVPixelBufferPoolCreatePixelBuffer(nil, pixelBufferPool, &amp;pixelBuffer);\n\n // Lock the pixel buffer\n CVPixelBufferLockBaseAddress(pixelBuffer, 0);\n\n // Get the pixel buffer data\n void *pixelData = CVPixelBufferGetBaseAddress(pixelBuffer);\n\n // Create a Core Graphics context\n size_t bytesPerRow = CVPixelBufferGetBytesPerRow(pixelBuffer);\n size_t width = CVPixelBufferGetWidth(pixelBuffer);\n size_t height = CVPixelBufferGetHeight(pixelBuffer);\n CGContextRef context = CGBitmapContextCreate(pixelData, width, height, 8, bytesPerRow, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaNoneSkipFirst);\n\n // Render the CIImage into the pixel buffer\n NSGraphicsContext *nsGraphicsContext = [NSGraphicsContext graphicsContextWithCGContext:context flipped:NO];\n [NSGraphicsContext setCurrentContext:nsGraphicsContext];\n CIContext *ciContext = [CIContext contextWithCGContext:context options:nil];\n [ciContext drawImage:image inRect:CGRectMake(0, 0, width, height) fromRect:[image extent]];\n\n // Unlock the pixel buffer and release the Core Graphics context\n CVPixelBufferUnlockBaseAddress(pixelBuffer, 0);\n CGContextRelease(context);\n\n return pixelBuffer;\n}\n\n@end\n\nint main(int argc, const char * argv[]) {\n @autoreleasepool {\n VideoCreator *videoCreator = [[VideoCreator alloc] init];\n [videoCreator createH264VideoFromPNGImages];\n }\n return 0;\n}\n\n</code></pre>\n<p>After convert one image to mp4 file, I 'd checked the mp4 file with QuickTime Player.\nIf there are only even 2 images , code does not work.</p>\n"^^ . . . . . "video"^^ . "0"^^ . . . "I changed those 2 and now it compiles. But when I run it the customization panel is empty. I looked thru the delegate methods and I don't see anything related to customization. I use png/xpm/svg images in the toolbar. Could you provide some simple code to make the customization panel work? TIA!!"^^ . "1"^^ . . "FLUTTER: Lexical or Preprocessor Issue (Xcode): 'TensorFlowLiteC.h' file not found"^^ . . . "Maybe your port is wrong!8000 and 1234 need the same!"^^ . . "0"^^ . . . . . "xcode"^^ . . . "0"^^ . . . . "1"^^ . . "In your case you should use an overlay."^^ . "Sorry, Updated my code `DongleWrapper.hpp` doesn't include itself. Will include more examples."^^ . . . . . . "<p>Capture must be prevented due to copyright. Through stackovetflow and search I have succeeded in getting a black blank screen to be captured.<br />\nNow, when capturing, I want the text to be centered on the white screen instead of the black blank screen.</p>\n<pre><code>@interface UIWindow (Secure)\n\n- (void)makeSecure;\n\n@end\n\n@implementation UIWindow (Secure)\n\n- (void)makeSecure {\n UITextField *field = [[UITextField alloc] init];\n field.secureTextEntry = YES;\n\n field.backgroundColor = [UIColor whiteColor];\n field.textColor = [UIColor blackColor];\n field.textAlignment = NSTextAlignmentCenter;\n field.text = @&quot;Prevent Capture&quot;;\n field.userInteractionEnabled = NO;\n \n [self addSubview:field];\n [field.centerYAnchor constraintEqualToAnchor:self.centerYAnchor].active = YES;\n [field.centerXAnchor constraintEqualToAnchor:self.centerXAnchor].active = YES;\n [self.layer.superlayer addSublayer:field.layer];\n [field.layer.sublayers.firstObject addSublayer:self.layer];\n}\n\n@end\n\n- (void)handleScreenshotNotification:(NSNotification *)notification {\n \n UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@&quot;Alert&quot;\n message:@&quot;prevent Capture&quot;\n preferredStyle:UIAlertControllerStyleAlert];\n UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:@&quot;OK&quot;\n style:UIAlertActionStyleDefault\n handler:nil];\n [alertController addAction:dismissAction];\n [self.window.rootViewController presentViewController:alertController animated:YES completion:nil];\n}\n\n\n- (BOOL)application:(UIApplication *)application\n didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n...\n[[NSNotificationCenter defaultCenter] addObserver:self\n selector:@selector(handleScreenshotNotification:)\n name:UIApplicationUserDidTakeScreenshotNotification\n object:nil];\n[self.window makeSecure];\n...\n}\n</code></pre>\n<p>I wrote the code as above but it still captures a black blank screen.</p>\n<p>I want to add text to the center of the screenshot on a white background. Is there a way?</p>\n"^^ . . . "2"^^ . . . . "swiftui"^^ . "1"^^ . "0"^^ . . . . . . . . . "1"^^ . "0"^^ . "swift"^^ . "@Willeke could you please turn you comment into an answer so OP can accept and upvote it for future readers?"^^ . . . . "<p>Don't create a new pixelBufferPool in pixelBufferFromCIImage function. Let's try using pixelBufferPool in pixelBufferAdaptor which you created in createH264VideoFromPNGImages function.</p>\n<p><a href="https://developer.apple.com/documentation/avfoundation/avassetwriterinputpixelbufferadaptor/1389662-pixelbufferpool" rel="nofollow noreferrer">https://developer.apple.com/documentation/avfoundation/avassetwriterinputpixelbufferadaptor/1389662-pixelbufferpool</a></p>\n<p>Beside that, why don't you use Core Image to convert CIImage to CVPixelBuffer by CIContext directly? I think using Core graphics to convert is bad performnace</p>\n<p><a href="https://developer.apple.com/documentation/coreimage/cicontext/1437853-render" rel="nofollow noreferrer">https://developer.apple.com/documentation/coreimage/cicontext/1437853-render</a></p>\n"^^ . "Maybe this helps: https://stackoverflow.com/questions/5094928/detecting-whether-or-not-device-support-phone-calls"^^ . . "0"^^ . "1"^^ . "So you're trying to store an Objective-C block as a value in a dictionary? That raises some memory management questions..."^^ . "How to remove alert view button in SwiftUI"^^ . . . . . . . . "0"^^ . . . "1"^^ . "2"^^ . . . . . "Update custom views in one column of NSTableView based on editing a cell in another"^^ . . "`NSLog(@"Area is %d", area);` -> `NSLog(@"Area is %f", area);`"^^ . "have you find any solution yet ? what about country code from operator are you able to get it ? i have same issue"^^ . . . . . "0"^^ . . . "0"^^ . . . "gcc supports obj-c & obj-c++;"^^ . . . "0"^^ . . . "<p>I have a Safenet 5110 dongle. I am using MacOS ventura 13.2.1 (with Swift 5.7 and Xcode 14.2). I have downloaded the driver to authenticate with the dongle (Safenet Authentication Token - SAC). There, I have found <code>libeTPkcs11.dylib</code> which can be used to communicate with their dongle.</p>\n<p>Here is my code:</p>\n<pre><code>import Foundation\n\nlet pkcs11LibPath = &quot;/usr/local/lib/libeTPkcs11.dylib&quot;\nlet pkcs11LibHandle = dlopen(pkcs11LibPath, RTLD_NOW)\n\nif pkcs11LibHandle == nil {\n let errorMsg = String(cString: dlerror())\n print(&quot;Failed to load PKCS#11 library: \\(errorMsg)&quot;)\n exit(1)\n}\n\n// Get a pointer to the C_GetInfo function\nlet cGetInfoPtr = dlsym(pkcs11LibHandle, &quot;C_GetInfo&quot;)\ntypealias C_GetInfo_Type = @convention(c) (UnsafeMutableRawPointer?, UnsafeMutablePointer&lt;CK_INFO&gt;?) -&gt; CK_RV\nlet cGetInfo = unsafeBitCast(cGetInfoPtr, to: C_GetInfo_Type.self)\n\n// Call the C_GetInfo function to get information about the token\nvar info = CK_INFO()\nlet rv = cGetInfo(nil, &amp;info)\n\nif rv != CKR_OK {\n print(&quot;Failed to get token info: \\(rv)&quot;)\n exit(1)\n}\n\nprint(&quot;Manufacturer ID: \\(String(cString: &amp;info.manufacturerID))&quot;)\nprint(&quot;Model: \\(String(cString: &amp;info.model))&quot;)\nprint(&quot;Serial number: \\(String(cString: &amp;info.serialNumber))&quot;)\n</code></pre>\n<p>I am getting the following errors when I try to compile the code:</p>\n<ul>\n<li>Cannot find type 'CK_RV' in scope</li>\n<li>Cannot find type 'CK_INFO' in scope</li>\n</ul>\n<p>I think that, these come from the <a href="http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html" rel="nofollow noreferrer">pkcs11.h</a> header files from OASIS specifications.</p>\n<p>I have created a bridging header <code>caclient-Bridging-Header.h</code>. There I have included the file <code>pkcs11.h</code>. But I think xcode is recognizing the header file as a objective-c header (not c99 header).</p>\n<p><a href="https://i.sstatic.net/9CczC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9CczC.png" alt="XCode errors" /></a></p>\n"^^ . "2"^^ . . . . . "nstoolbar"^^ . "1"^^ . . "0"^^ . . . "<p>The warning is caused by <a href="https://clang.llvm.org/docs/DiagnosticsReference.html#wobjc-messaging-id" rel="nofollow noreferrer"><code>-Wobjc-messaging-id</code></a> in your project. The flag is pretty much optional (and for all of my projects it is disabled by default), so you can just disable it if you need an <code>id</code> object being invocable without compiler analysis.</p>\n<p>If for whatever reason you cannot afford disabling the flag, you are supposed to make the object interface apparent to the compiler (so it can see the method of the object you invoke it with). Since <a href="https://developer.apple.com/documentation/objectivec/1418956-nsobject/1418511-iskindofclass?language=objc" rel="nofollow noreferrer"><code>isKindOfClass:</code></a> belongs to <code>NSObject</code> protocol it's the minimal typing you are required to introduce for your <code>authenticationData</code> parameter to get rid of the warning:</p>\n<pre class="lang-objc prettyprint-override"><code>+ (void)myMethod:(id&lt;NSObject&gt;)authenticationData\n</code></pre>\n"^^ . . . "1"^^ . . . "mobile-country-code"^^ . . . "<p>This is probably what you want: <a href="https://developer.apple.com/documentation/carplay/cpinterfacecontroller/3578118-cartraitcollection" rel="nofollow noreferrer">https://developer.apple.com/documentation/carplay/cpinterfacecontroller/3578118-cartraitcollection</a></p>\n<p>Other than that, I don't think it's possible to read the actual screen size/resolution of the display</p>\n"^^ . . . . . . "<p>The simulator is running iPad Pro (12.9-inch) 6th Generation iOS 16.4. A colleague is running the same iOS version on an unknown device also simulated with the same issue.</p>\n<p>The same iPad Pro (12.9-inch) 6th Generation simulator but iOS 13.7 <strong>does</strong> work.</p>\n<p>I am getting <code>Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)</code> on the line where I attempt to draw an image when I run it on the emulator, but it runs as expected when I run it on a hardware iPhone 12 Pro on the same iOS version (16.4). It also runs on a hardware iPad mini 5.</p>\n<p>I have tried:</p>\n<ul>\n<li><p><code>CGContextDrawImage(context, rect, image)</code></p>\n</li>\n<li><p><code>[image drawAtPoint:CGPointMake(x, y)];</code></p>\n</li>\n<li><p>variations such as <code>[image drawInRect</code>...</p>\n</li>\n</ul>\n<p>Image, context/currentContext, and rect are all valid, no values are decimal, the sizes fit inside of each other correctly, and it's being ran on the UI thread as it should. This is confirmed by the fact it runs fine on hardware 16.4 and simulator 13.7.</p>\n"^^ . . "1"^^ . . "Not sure if this is really the same issue. In the alleged duplicate question, it's already the redo action/name that's broken. For me, both undo and redo work once, but the action name is wrong after the first redo. Also, I don't get how to "set the action name again during the undo". Where would I do this in my code?"^^ . . . . . "podio"^^ . . . "1"^^ . . "2"^^ . . . . "`method_getTypeEncoding` and you will need to think how to decode returned result."^^ . "0"^^ . . . . . "0"^^ . "documentation"^^ . . . "1"^^ . . . . . . . . "modulemap in framework or headers in umbrella header are not being imported"^^ . . . . . . . "So you want to copy and paste code into the comments? I'm not sure what you are trying to do"^^ . "<p>I have a swift protocol Fruit, a swift class Pear, and a method in an Objc-c file returning a pointer to Pear.</p>\n<pre><code>protocol Fruit: NSObjectProtocol {\n}\n\n@objcMembers\nclass Pear: NSObject, Fruit {\n init()\n}\n</code></pre>\n<p>In an Obj-C file, I have</p>\n<pre><code>@protocol Fruit;\n\n- (NSObject&lt;Fruit&gt; *)getFavoriteFruit {\n return [[Pear alloc] init]; // &lt;- Error here\n}\n</code></pre>\n<p>The error I'm getting is:</p>\n<blockquote>\n<p>Incompatible pointer types returning 'Pear *' from a function with result type 'NSObject&lt;Fruit&gt; * _Nonnull'</p>\n</blockquote>\n<p>How are these different?</p>\n"^^ . . . . "0"^^ . "0"^^ . "<p>One possible solution would be to create extension(s) to handle properties that don't exist on Swift types based on the Objective-C equivalents.</p>\n<p>In your tests include a .swift extension:</p>\n<pre><code>// URL+QueryParams.swift\n\nimport Foundation\n\nextension URL {\n var queryParams: [String: String] {\n var urlDict = [String: String]()\n guard let query = self.query else { return urlDict }\n let subArray = query.components(separatedBy: &quot;&amp;&quot;)\n for element in subArray {\n let urlArray = element.components(separatedBy: &quot;=&quot;)\n if urlArray.count &lt; 2 { continue }\n urlDict[urlArray[0]] = urlArray[1]\n }\n return urlDict\n }\n}\n</code></pre>\n"^^ . . . "0"^^ . . . . "0"^^ . "0"^^ . "@klangfarb apps"^^ . . "ios11"^^ . "0"^^ . . "New compile error in Xcode 14.3: "Mixing declarations and code is incompatible with standards before C99""^^ . "The join redo sets the action name to "Add Region(s)". Don't do this or set the action name to "Join Regions" again."^^ . . . "clang"^^ . . . . "1"^^ . . . "Why don't you use NSFileManager APIs to get the list of existing files? For example, `contentsOfDirectoryAtPath:error:`. But it's tough to offer good advice since you don't show how you saved the file. That makes it difficult to help with the code to load the file."^^ . . . . . "<p>By chance, this code will crash:</p>\n<pre><code>-(void)addCallbackOfFileType:(SendFileType)fileType\n callback:(sendProcess)callback\n target:(id)target{\n \n [_hashTable addObject:target];\n\n NSString * targetKeyStr = NSStringFromClass([target class]);\n if (callback &amp;&amp; targetKeyStr) {\n NSString * fid = [NSString stringWithFormat:@&quot;%d&quot;,(int)fileType+KBigFileAdded];\n NSMutableDictionary * targetMdic = [[NSMutableDictionary alloc]init];\n if ([_callbacks valueForKey:targetKeyStr]) {\n targetMdic = [_callbacks valueForKey:targetKeyStr];\n }\n [targetMdic setValue:callback forKey:fid];\n [_callbacks setValue:targetMdic forKey:targetKeyStr];\n }\n \n}\n</code></pre>\n<p>It crashes on this line:</p>\n<pre><code>[targetMdic setValue:callback forKey:fid];\n</code></pre>\n<p>This is a screenshot of the crash:</p>\n<p><img src="https://i.sstatic.net/HdYho.png" alt="enter image description here" /></p>\n<p>How to fix this crash?</p>\n"^^ . "-1"^^ . . . "customization"^^ . . . . . . . . . "0"^^ . . . "0"^^ . . "It can be done using `UIAlertController`."^^ . . . . "0"^^ . "0"^^ . . . "`VStack` expects `Views`. While from the name of `showDevicePicker()`, that's an action. You can't do it like that as said. You need to understand that SwiftUI is a framework for UI, and if you want to trigger action on button, on view appearing, there are specific methods for that (like `onAppear()` as said previously)."^^ . . "return-type"^^ . "1"^^ . . "0"^^ . . "reflection"^^ . "Specifically, `id` means that you might receive an object which does not inherit from _`NSObject`_, and thus may not respond to the `-isKindOfClass:` method (defined by `NSObject` itself)."^^ . . . . . . . . "0"^^ . . . . . . "0"^^ . "1"^^ . . . "How to generate Apple-style /// for code comments in Xcode?"^^ . . "0"^^ . . . . "<p>i am trying to get mobileCountryCode from device sim operator.</p>\n<p>the results i am getting from mobileCountryCode is <code>6553565535</code> which should be <code>US</code> or <code>FR</code></p>\n<p>here is my objective-C code</p>\n<pre><code> CTTelephonyNetworkInfo *networkInfo = [[CTTelephonyNetworkInfo alloc] init];\n CTCarrier *carrier = nil;\n // The CTTelephonyNetworkInfo.serviceSubscriberCellularProviders method crash because of an issue in iOS 12.0\n // It was fixed in iOS 12.1\n if (@available(iOS 12, *)) {\n NSDictionary&lt;NSString *, CTCarrier *&gt; *carriers = nil;\n if (@available(iOS 12.1, *)) {\n carriers = [networkInfo serviceSubscriberCellularProviders];\n } else {\n carriers = [networkInfo valueForKey:@&quot;serviceSubscriberCellularProvider&quot;];\n }\n if (carriers != nil) {\n for (NSString *key in carriers) {\n carrier = carriers[key];\n NSLog(@&quot;isoCountryCode : %@&quot;, carrier.isoCountryCode.description);\n }\n }\n } else {\n carrier = [networkInfo subscriberCellularProvider];\n }\n\n NSString *codeInfo = @&quot;&quot;;\n if (carrier != nil &amp;&amp; carrier.mobileCountryCode != nil) {\n codeInfo = [carrier.mobileCountryCode stringByAppendingString:carrier.mobileNetworkCode];\n }\n\n NSLog(@&quot;countryCode: %@&quot;, codeInfo.description);\n</code></pre>\n<p>Print our result :</p>\n<pre><code>Carrier name: [--]\nMobile Country Code: [65535]\nMobile Network Code:[65535]\nISO Country Code:[--]\nAllows VOIP? [YES]\n</code></pre>\n<p>did i miss something ?</p>\n<p>i am using <strong>xCode 14.3</strong></p>\n"^^ . . "0"^^ . . . . . . "0"^^ . . . "1"^^ . . . . "0"^^ . "1"^^ . "2"^^ . . . . "sockets"^^ . "No one can help if you don't show relevant code in your question."^^ . . "0"^^ . . . . "<p><a href="https://stackoverflow.com/questions/19366134/what-does-objective-c-is-a-superset-of-c-more-strictly-than-c-mean-exactly">Objective-C is a superset of C.</a> It has no trouble importing C headers (because C headers <strong>are</strong> ObjC headers). The problem is the <a href="http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html#_Toc416959684" rel="nofollow noreferrer"><code>CK_PTR</code> macro</a> is defined in a header not included in your bridging header. You're probably supposed to import some other &quot;umbrella&quot; header instead of <code>pkcs11.h</code>, or some platform-configuration header before <code>pkcs11.h</code>. Without knowing exactly what library you're using, and the documentation for it, it's difficult to know how this particular code expects to be used.</p>\n"^^ . . . . "0"^^ . . "2"^^ . . . . . . "<p>I am trying to get the user carrier name using this code:</p>\n<pre><code>CTTelephonyNetworkInfo* info = [[CTTelephonyNetworkInfo alloc] init];\nCTCarrier* carrier = info.subscriberCellularProvider;\nNSString *mobileCountryCode = carrier.mobileCountryCode;\nNSString *carrierName = carrier.carrierName;\nNSString *isoCountryCode = carrier.isoCountryCode;\nNSString *mobileNetworkCode = carrier.mobileNetworkCode;\n</code></pre>\n<p>But when I try to log, the result is like this:</p>\n<pre><code>2023-05-22 16:47:39.831078+0700 MotionTrade[7686:985518] carrier name = --\n2023-05-22 16:47:39.831260+0700 MotionTrade[7686:985518] mobileCountryCode = 65535\n2023-05-22 16:47:39.831342+0700 MotionTrade[7686:985518] mobileNetworkCode = 65535\n</code></pre>\n<p>Basically I've tried every stack overflow answer but I still get the same results,</p>\n<p>I debug this on my iPhone and not using WiFi, and I only use physical sim, not e-sim.</p>\n<p>Can anyone tell me why I keep getting that &quot;--&quot;?</p>\n<p>And after I browse a bit, country code &quot;65535&quot; is this could be an indication of removed SIM card, or in general inability to make a call at the moment.</p>\n<p>Can anyone help me? Why is this happening and how to get a proper cellular provider name?</p>\n<p>I even try to do it on my new blank project with this code:</p>\n<pre><code>override func viewDidLoad() {\n super.viewDidLoad()\n\n let networkInfo = CTTelephonyNetworkInfo()\n let carrierName = networkInfo.serviceSubscriberCellularProviders\n \n dump(carrierName)\n}\n</code></pre>\n<p>but I still get the same result in my log:</p>\n<pre><code>Optional([&quot;0000000100000001&quot;: CTCarrier (0x281275d10) {\nCarrier name: [--]\nMobile Country Code: [65535]\nMobile Network Code:[65535]\nISO Country Code:[--]\nAllows VOIP? [YES]\n}\n, &quot;0000000100000002&quot;: CTCarrier (0x28126ca20) {\nCarrier name: [--]\nMobile Country Code: [65535]\nMobile Network Code:[65535]\nISO Country Code:[--]\nAllows VOIP? [YES]\n }\n ] )\n</code></pre>\n<p>Please help me. Why do I keep getting &quot;--&quot; and 65535? Is there any way to get carrier name? Or is getting carrier name in iOS 16 not possible?</p>\n"^^ . "0"^^ . . . . . . . . . "<p>My flutter project has <code>tflite:</code> dependency for running tflite model, But when I'm trying to build the iOS application it gives the above error.</p>\n<p>It's working fine on android.</p>\n<p>Following is my <code>Podfile</code> code</p>\n<pre><code>platform :ios, '11.0'\n\n# CocoaPods analytics sends network stats synchronously affecting flutter build latency.\nENV['COCOAPODS_DISABLE_STATS'] = 'true'\n\nproject 'Runner', {\n 'Debug' =&gt; :debug,\n 'Profile' =&gt; :release,\n 'Release' =&gt; :release,\n}\n\ndef flutter_root\n generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)\n unless File.exist?(generated_xcode_build_settings_path)\n raise &quot;#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first&quot;\n end\n\n File.foreach(generated_xcode_build_settings_path) do |line|\n matches = line.match(/FLUTTER_ROOT\\=(.*)/)\n return matches[1].strip if matches\n end\n raise &quot;FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get&quot;\nend\n\nrequire File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)\n\nflutter_ios_podfile_setup\n\ntarget 'Runner' do\n # use_frameworks! #add here\n use_frameworks! :linkage =&gt; :static\n flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))\nend\n\npost_install do |installer|\n installer.pods_project.targets.each do |target|\n flutter_additional_ios_build_settings(target)\n end\nend\n</code></pre>\n<p>When I execute the command <code>flutter build ios</code> it gives the error like</p>\n<pre><code>Automatically signing iOS for device deployment using specified development team in Xcode project: 937S4T5D4R\nRunning pod install... 6.3s\nRunning Xcode build... \nXcode build done. 17.3s\nFailed to build iOS app\nLexical or Preprocessor Issue (Xcode): 'TensorFlowLiteC.h' file not found\n/Users/amventuresprivatelimited/.pub-cache/hosted/pub.dev/tflite-1.1.2/ios/Classes/TflitePlugin.mm:19:8\n\n\nEncountered error while building for device.\n</code></pre>\n"^^ . . "so if I want to initially display item 1,3 and 4 and items 3, 5 and 6 to be allowed but not initially displayed - what do I do? No custom configuration here."^^ . "<p>There appear to be two questions here:</p>\n<ol>\n<li>Does casting a function pointer to another function pointer type and calling the result trigger undefined behavior?</li>\n<li>How can you write <code>objc_msgSend()</code> such that you can pass it any number of arguments and expect the correct return type, arbitrarily?</li>\n</ol>\n<h3>Undefined Behavior</h3>\n<p>For the first: I started fleshing out this part of the answer by referencing the <a href="https://open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf" rel="nofollow noreferrer">C11 draft standard</a> (the finalized C standard documents are behind a paywall, but the published draft docs are functionally identical), but as I'm not a <kbd>language-lawyer</kbd>, I'm not entirely confident in answering this part of the question to your satisfaction.</p>\n<p>The relevant parts of the standards doc to reference:</p>\n<ul>\n<li><p>§6.3.2.3¶8</p>\n<blockquote>\n<p>A pointer to a function of one type may be converted to a pointer to a function of another type and back again; the result shall compare equal to the original pointer. If a converted pointer is used to call a function whose type <strong>is not compatible with</strong> the referenced type, the behavior is undefined.</p>\n</blockquote>\n<p>(Emphasis mine)</p>\n<p>If you cast between two &quot;compatible&quot; function pointer types, it's valid to call the cast function. So when are two functions &quot;compatible&quot;?</p>\n</li>\n<li><p>§6.7.6.3¶15</p>\n<blockquote>\n<p>15 <strong>For two function types to be compatible, both shall specify compatible return types.</strong> Moreover, the parameter type lists, if both are present, shall agree in the number of parameters and in use of the ellipsis terminator; corresponding parameters shall have compatible types. <strong>If one type has a parameter type list and the other type is specified by a function declarator that is not part of a function definition and that contains an empty identifier list, the parameter list shall not have an ellipsis terminator and the type of each parameter shall be compatible with the type that results from the application of the default argument promotions.</strong> If one type has a parameter type list and the other type is specified by a function definition that contains a (possibly empty) identifier list, both shall agree in the number of parameters, and the type of each prototype parameter shall be compatible with the type that results from the application of the default argument promotions to the type of the corresponding identifier. (In the determination of type compatibility and of a composite type, each parameter declared with function or array type is taken as having the adjusted type and each parameter declared with qualified type is taken as having the unqualified version of its declared type.)</p>\n</blockquote>\n</li>\n<li><p>§6.7.6.3¶10</p>\n<blockquote>\n<p>The special case of an unnamed parameter of type <code>void</code> as the only item in the list specifies that the function has no parameters.</p>\n</blockquote>\n</li>\n</ul>\n<p>If you squint just right, you might be able to read &quot;that the function has no parameters&quot; as equivalent to having &quot;an empty parameter list&quot; in some sense, in which case, it can be safely passed any number of arguments since it doesn't specify any. (Somewhat intuitively: the risk in casting between incompatible function pointer types is that you read memory for an argument as if it were of another type, which is invalid. If a function declares that it doesn't accept <em>any</em> parameters, then it claims that it will never read any values passed to it, so the compiler can safely assume that it can pass in any arguments it wants because they'll never be used. In practice, of course, the function can do whatever it wants.)</p>\n<p>The return value aspect is a bit tougher to explain, hence my hesitance. §6.2.7 describes compatibility between types, but it doesn't mention <code>void</code> in any way, and is otherwise pretty vague. From elsewhere</p>\n<ul>\n<li><p>§6.2.5¶1</p>\n<blockquote>\n<p>At various points within a translation unit an object type may be incomplete (lacking sufficient information to determine the size of objects of that type)</p>\n</blockquote>\n</li>\n<li><p>§6.2.5¶15</p>\n<blockquote>\n<p>The <code>void</code> type comprises an empty set of values; it is an incomplete object type that cannot be completed.</p>\n</blockquote>\n</li>\n</ul>\n<p>So <code>void</code> is an &quot;incomplete&quot; type, which may just have arbitrary size and alignment (and can never be known) — but it doesn't appear to be <em>explicitly</em> stated anywhere that incomplete types and complete types (or <code>void</code>) are incompatible. (For the most part, &quot;incomplete&quot; types largely just mean that the compiler just isn't aware of their definition, and can't help you prevent invalid casts or alignments; I'm not aware of stricter requirements on such types.)</p>\n<p>The C standard is full of holes like this, where behavior can be somewhat sneakily gleaned not by what is said, but by what is left out. Someone with more experience than me in this area may be able to point to something in the standard which refutes this explicitly, but effectively, it appears that the standard implicitly leaves some leeway in expected behavior to allow this to be valid.</p>\n<h3>Writing <code>objc_msgSend()</code></h3>\n<blockquote>\n<p>How could a C … function be written …?</p>\n</blockquote>\n<p>Here's the trick: <code>objc_msgSend</code> is <em>necessarily</em> written in assembly because it cannot possibly be written in C. It's not even really a function in the way that you might expect.</p>\n<p>The purpose of <code>objc_msgSend</code> is to take the arbitrary arguments it's given, find the pointer to the method with the given selector name for the receiver, and pass those arguments along <em>exactly</em>. In C, you can't do this, because C functions set up stack frames, and have to preserve certain registers and stack values; setting up a stack frame also means that the method you call has to return back to <code>objc_msgSend</code> itself when it <code>return</code>s, and the stack frame has to be torn down. This is both a lot of wasted work, and it means that your stack trace is littered with <code>objc_msgSend</code> references all over the place, which is wasteful. Directly writing this in assembly allows these limitations to be bypassed.</p>\n<p>Mike Ash goes into <code>objc_msgSend</code> in significantly more detail in several articles on his blog<a href="https://mikeash.com/pyblog/friday-qa-2017-06-30-dissecting-objc_msgsend-on-arm64.html" rel="nofollow noreferrer">[1]</a><a href="https://mikeash.com/pyblog/friday-qa-2012-11-16-lets-build-objc_msgsend.html" rel="nofollow noreferrer">[2]</a>, but the gist:</p>\n<ol>\n<li><code>objc_msgSend</code> is <em>exposed</em> as a C function, but its implementation is in assembly</li>\n<li>When called from C, the stack and registers are set up by the caller exactly how the recipient method expects to receive them, because it <em>appears</em> to have a regular C calling convention</li>\n<li><code>objc_msgSend</code> itself doesn't touch any of the registers or the stack, and doesn't set up a stack frame or modify the return address; it simply finds the correct function pointer to pass exection off to itself based on the recipient object and the method name</li>\n<li>When the method is then called, because <code>objc_msgSend</code> hasn't touched any registers or the stack, it appears that the method was called <em>directly</em>, without <code>objc_msgSend</code> ever having been there. And because <code>objc_msgSend</code> hasn't modified the return pointer for the method, execution returns back <em>directly</em> to the caller of <code>objc_msgSend</code>, who can then safely read the return values off the stack because they received them <em>directly</em> from the called method</li>\n</ol>\n<p>Because you have to cast <code>objc_msgSend</code>'s type to actually call it from C, if you've got the types right, the compiler will correctly set up the arguments to the method and also read the return value for you, all correctly.</p>\n"^^ . . . . "0"^^ . . "Add C header files to Swift project for PKCS11 interfacing with Safenet 5110"^^ . "<p>There is an <a href="https://github.com/facebook/react-native/issues/36185" rel="nofollow noreferrer">open issue on GitHub that discusses a similar problem where YogaKit</a> is not installed when Flipper is disabled. In the meantime - Try clearing your derived data and reinstalling your pods.</p>\n<pre><code>rm -rf ~/Library/Developer/Xcode/DerivedData\ncd ios\nrm -rf Pods\npod install\n</code></pre>\n"^^ . . . "pkcs#11"^^ . "0"^^ . . . . . . . . . . . "dart"^^ . "Does this answer your question? [double problem in xcode or me doing something wrong](https://stackoverflow.com/questions/3717038/double-problem-in-xcode-or-me-doing-something-wrong)"^^ . . . . . . "0"^^ . . . "Try to use dependency managers, for example Cocoapods or SPM. Don't need to do this work manually."^^ . . . "did you manage to solve?"^^ . "Building ObjC code on Windows is not always trivial. It highly depends on what the ObjC relies on. For example, it may be GNUstep code, in which case you'll need the GNUstep libraries. Or it may require CoreFoundation, in which case you'll need those. If it requires Darwin's Foundation (i.e. macOS), it may not be portable to Windows at all. We'd need more information about the specifics of this code. Do you believe it is supposed to run on Windows? For info on setting up a compiler, see https://stackoverflow.com/questions/63914108/using-clang-in-windows-10-for-c-c"^^ . "Incompatible pointer types returning swift class from Obj-C function"^^ . . "0"^^ . . . . "The header file seems to be picked up but it's not finding my Swift class. `Unknown type name 'SwiftCalculator'; did you mean 'RTNCalculator'?`"^^ . "0"^^ . "1"^^ . . "0"^^ . . "<p>I want to retrieve all classes that conform specific protocol</p>\n<p><code>protocol Service: NSObject {}</code></p>\n<p>and then build a dictionary</p>\n<p><code>[ClassName: [String array of property types]]</code>.</p>\n<p>I managed to retrieve all classes using Objective-C reflection:</p>\n<pre class="lang-swift prettyprint-override"><code>private static func allClasses&lt;R&gt;() -&gt; [R] {\n var count: UInt32 = 0\n let classListPtr = objc_copyClassList(&amp;count)\n defer {\n free(UnsafeMutableRawPointer(classListPtr))\n }\n let classListBuffer = UnsafeBufferPointer(start: classListPtr, count: Int(count))\n return classListBuffer.compactMap { $0 as? R }\n}\n</code></pre>\n<p>But I have problems with retrieving property types of services. From what I see Swift API requires object to get that info</p>\n<p><code>Mirror(reflecting: obj).children</code></p>\n<p>and even tho my protocol requires <code>NSOject</code> I don't want to create an object just to retrieve properties. Is there any other way to achieve it? From what I saw there is obj-c method <code>class_copyPropertyList</code> but you can only retrieve names and attributes with that, and you still need the object to get property types.</p>\n"^^ . . . . . . . . . . "0"^^ . "0"^^ . "0"^^ . . . . . . . . "c"^^ . . . . "0"^^ . . "You cannot put procedural code like that in the view hierarchy. Use `onAppear` or `task`. You may want to check out a SwiftUI tutorial (Apple or Hacking with Swift) to get the basics of the framework."^^ . "c++"^^ . "0"^^ . . "Thanks for sharing solution in objective c"^^ . . . "0"^^ . . . . . . "I was able to solve it. I wasn't including the **dylib** files that was required."^^ . . . "2"^^ . "0"^^ . "Tes, that's right."^^ . "How do I prevent EXC_BAD_INSTRUCTION crashing the XCode simulator 16.4 when attempting to draw an image on a PDF but works on hardware?"^^ . . "0"^^ . . "Ok, I think I figured out how to do it: in `addRegions:`, I changed `if (![self.undoManager isUndoing])` to `if (![self.undoManager isUndoing] && ![self.undoManager isRedoing])`"^^ . . . "Please show a [mre], the errors don't seem related to your code. Does `DongleWrapper.hpp` really include itself?"^^ . "0"^^ . . . "<p>Can we directly get a refrence textview.text and use it as a objC's NSString .If yes ,do we need to handle memory dellocation or is it taken care by ARC?</p>\n<p>If we cann't directly take a refrence ,do we have another option than making a copy of textview.text and use it as a ObjC's NSString?</p>\n<p>I want to use UITextView.text string in objectiveC whenever character changes.</p>\n"^^ . . "Is the bridging header correctly defined in the target ?"^^ . "<p>You need two changes in your code.</p>\n<p>One: Change the line:</p>\n<pre class="lang-swift prettyprint-override"><code>protocol Fruit: NSObjectProtocol {\n</code></pre>\n<p>to:</p>\n<pre class="lang-swift prettyprint-override"><code>@objc\nprotocol Fruit: NSObjectProtocol {\n</code></pre>\n<p>Two: Remove the line:</p>\n<pre class="lang-objectivec prettyprint-override"><code>@protocol Fruit;\n</code></pre>\n<p>As your code is now, you are not using the Swift protocol in your Objective-C code. You are defining (via forward declaration) a different Objective-C protocol named <code>Fruit</code>. Since <code>Pear</code> conforms to the Swift <code>Fruit</code> protocol, your Objective-C code fails because the Swift <code>Pear</code> instance isn't an <code>NSObject</code> conforming to the different Objective-C <code>Fuit</code> protocol.</p>\n"^^ . . "0"^^ . "1"^^ . . "<p>The <code>text</code> property of <code>UITextView</code> is has already has <code>copy</code> as it's attribute - <a href="https://developer.apple.com/documentation/uikit/uitextview/1618623-text?language=objc" rel="nofollow noreferrer">Apple Doc</a>; which means whenever you try to access <code>textView.text</code> into your local <code>NSString</code> property/variable, a copy of <code>text</code> will be created and stored.</p>\n<p>You will have it's ownership and depending on the scope of the your property, ARC will decide to release it.</p>\n"^^ . . "0"^^ . . . . . "3"^^ . "*"It should still work even if it's out of date right?"* - not necessarily. New apps under iOS 13 or newer do not setup the window in the app delegate. It's done in the scene delegate. What year did the 4th edition of that book come out? What version of iOS was current back then? When it comes to programming, books get out-of-date before you even buy them. Find an up-to-date tutorial online."^^ . "Could not build Objective-C module 'YogaKit'"^^ . "I had a feeling I was doing something weird interfacing between swift and Obj-C, thanks! Perfect explanation :)"^^ . "SPM library with Objective-C NSURL category not imported into Swift URL?"^^ . . . . . "This is an unrelated question about `NSArray`, post a new question please."^^ . . "0"^^ . "0"^^ . "1"^^ . "0"^^ . "Yes, the name is "rtn-calculator"."^^ . . . . . "one more related question - it gives me error like this: `error: use of undeclared identifier 'getIdentifier'`. How do I fix it? I should be able to use getIdentifier() call right?"^^ . . "0"^^ . . . "0"^^ . . . "0"^^ . . "1"^^ . "1"^^ . "IIRC objc_msgSend is written *in assembly* so it just leaves all the argument registers alone until it gets to the actual function you are calling, and then that function gets the arguments. It also doesn't call the function, but jumps to it, so the stack isn't affected either."^^ . . . "I'm also getting this error about my Swift file so I think I still need to add a configuration somewhere. `RTNCalculatorSpec.h:15:2 This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.`"^^ . "0"^^ . . . "<p>I am displaying an image in the docs like this.</p>\n<pre><code>![](screenshot.png)\n</code></pre>\n<p>But the image is too big.</p>\n<p>I would like to resize it. Any suggestion?</p>\n<p>The image is located in the <code>Resources</code> directory of the documentation.</p>\n"^^ . "0"^^ . . "And as a follow-on to the comment by @Larme, see the [String Format Specifiers](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFStrings/formatSpecifiers.html#//apple_ref/doc/uid/TP40004265) documentation. You'll need to know those for things like `NSLog` and `NSString stringWithFormat:`."^^ . . . . "0"^^ . . . . . "0"^^ . . . . . "1"^^ . . "0"^^ . "1"^^ . "<p><a href="https://developer.apple.com/forums/thread/714876" rel="noreferrer">CTCarrier is deprecated with no replacement in iOS 16.</a> This information is no longer available, and I would not expect it to become available again. I'm somewhat surprised it was ever available. (Apple generally avoids making information available that can be used to fingerprint the user without a very clear use case, and usually an entitlement.)</p>\n<p>You can find the announcement about returning static values in the <a href="https://developer.apple.com/documentation/ios-ipados-release-notes/ios-ipados-16_4-release-notes#Core-Telephony" rel="noreferrer">iOS 16.4 Release Notes</a>.</p>\n"^^ . . "1"^^ . "<p>No, the <code>alert</code> view modifier cannot create alerts without any buttons. The descriptions of the initialisers for <a href="https://developer.apple.com/documentation/swiftui/alert" rel="nofollow noreferrer"><code>Alert</code></a> are:</p>\n<blockquote>\n<p>Creates an alert with one button.</p>\n</blockquote>\n<blockquote>\n<p>Creates an alert with two buttons.</p>\n</blockquote>\n<blockquote>\n<p>Creates a side by side button alert.</p>\n</blockquote>\n<p>All of these create alerts with buttons.</p>\n<p>Note that <code>Alert</code> is deprecated since iOS 16.4. Now you should use one of the new <code>alert</code> modifiers like <a href="https://developer.apple.com/documentation/swiftui/view/alert(_:ispresented:actions:message:)-3rabc" rel="nofollow noreferrer">this one</a>.</p>\n<p>However, the new <code>alert</code> modifiers cannot create alerts without buttons either. All of their documentation mentions that:</p>\n<blockquote>\n<p>If no actions are present, the system includes a standard “OK” action.</p>\n</blockquote>\n"^^ . "will you please provide a sample code related to SRT connection. that would be more better"^^ . . . . "I just re-read you last comment and I think I got it. The default array will be a displayed items and allowed array will have displayed and potentially displayed."^^ . "<p>HI Please add the below code in Appdelegate did finish launch</p>\n<pre><code>if (@available(iOS 13.0, *)) {\n\n UIView *statusBar = [[UIView alloc]initWithFrame:[UIApplication sharedApplication].keyWindow.windowScene.statusBarManager.statusBarFrame];\n\n if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {\n\n statusBar.backgroundColor = [UIColor whiteColor];\n\n }\n\n [[UIApplication sharedApplication].keyWindow addSubview:statusBar];\n\n\n\n } else {\n UIView *statusBar = [[UIView alloc]initWithFrame:[UIApplication sharedApplication].keyWindow.frame];\n\n if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {\n\n statusBar.backgroundColor = [UIColor whiteColor];\n\n }\n\n }\n</code></pre>\n"^^ . . . . . "0"^^ . . . . . . "0"^^ . . "You're using a bad library. Switch to https://github.com/alexeichhorn/YouTubeKit"^^ . . "unicode"^^ . "0"^^ . . . . . . . . . "0"^^ . . . "0"^^ . "1"^^ . . . "1"^^ . . "0"^^ . . "<p>I have multiple Objective-C source files. But I don't know where I can compile them. I'm not familiar with Objective-C either. So is there any platform to compile all the source files of Objective-C?\n(Help me with VSCode too, if I can achieve it with VSCode simply)</p>\n"^^ . "0"^^ . . . . "Unfortunately, I don't think it's possible. According to [Swift.org](https://swiftdoc.org/v5.1/type/mirror/) `Mirror`'s definition is "A representation of the substructure and display style of an **instance** of any type.""^^ . . . . . . "3"^^ . "1"^^ . "How to use Swift in React Native Turbo Modules"^^ . . "2"^^ . . . . . . . "2"^^ . . . . . . . . . "1"^^ . . . . "Using `reloadDataForRowIndexes:columnIndexes:` to only reload the first column seems to do the trick, thanks!"^^ . . "SRT socket connection time out"^^ . . . . "<p>I am using FFmpeg to process some videos using Obj-C. I am canceling the process using the below code :</p>\n<pre><code>-(void) cancelFFmpegProcessing {\n [MobileFFmpegConfig setStatisticsDelegate:self]; \n [MobileFFmpegConfig setLogDelegate:self];\n [MobileFFmpeg cancel];\n}\n</code></pre>\n<p>But if I cancel using this code , the process still exist in thread and runs untill the process is complete. Now my question is how to terminate all the task/process with a proper code/steps.</p>\n<p>I want to cancel the ffmpeg process properly.</p>\n"^^ . "0"^^ . "mirror"^^ . . . "0"^^ . . . "ahhh okay thanks alot mate for your answer, i can take this to explain my head manager. Cheers"^^ . . "<p>I want to store an image file to a persistent storage path in an ios app. I hope that I could also upload the image file to my server using this persistent storage path after the app restarted. I wrote the below code, but this can't work well for me. Could anyone help me?</p>\n<pre><code>- (NSString*)persistFilePath:(NSString*)extension\n{\n NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];\n NSFileManager* fileMgr = [[NSFileManager alloc] init]; // recommended by Apple (vs [NSFileManager defaultManager]) to be threadsafe\n NSString* filePath;\n\n // unique file name\n NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];\n NSNumber *timeStampObj = [NSNumber numberWithDouble: timeStamp];\n do {\n filePath = [NSString stringWithFormat:@&quot;%@/%@%ld.%@&quot;, docsPath, @&quot;cdv_photo&quot;, [timeStampObj longValue], extension];\n } while ([fileMgr fileExistsAtPath:filePath]);\n\n return filePath;\n}\n</code></pre>\n<p>I tried the below code, but it doesn't work well too.</p>\n<pre><code>- (NSString*)persistFilePath:(NSString*)extension\n{\n NSString* docsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];\n NSFileManager* fileMgr = [[NSFileManager alloc] init]; // recommended by Apple (vs [NSFileManager defaultManager]) to be threadsafe\n NSString* filePath;\n\n // unique file name\n NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];\n NSNumber *timeStampObj = [NSNumber numberWithDouble: timeStamp];\n do {\n filePath = [NSString stringWithFormat:@&quot;%@/%@%ld.%@&quot;, docsPath, @&quot;cdv_photo&quot;, [timeStampObj longValue], extension];\n } while ([fileMgr fileExistsAtPath:filePath]);\n\n return filePath;\n}\n</code></pre>\n"^^ . . "0"^^ . "Is it possible?"^^ . "<p>I'm trying to find a more efficient way to generate the Apple-style /// code comments in Xcode.</p>\n<p>Although I can use Cmd + Option + Enter to automatically generate ///, it's not as convenient when copying(press option to select specific area) and pasting code. Is there a more streamlined approach to generate these comments, especially when pasting existing code?</p>\n<p><a href="https://i.sstatic.net/RfGdK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RfGdK.png" alt="Apple Style Code Comment Documetation" /></a></p>\n<p>It's convenient to generate doc with old /** */</p>\n<p><a href="https://i.sstatic.net/ATN37.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ATN37.png" alt="Old Style" /></a></p>\n"^^ . "0"^^ . "<p>For your example, you shouldn't need a bridging header at all. That allows you to import ObjC into Swift, not Swift into ObjC. Did you try just removing the <code>SWIFT_OBJC_BRIDGING_HEADER</code> bit?</p>\n<p>The <code>RTNCalculator-Swift.h</code> header is what lets you import Swift into ObjC, and that part of of your code looks ok. What specific error do you receive if you take out the bridging header?</p>\n"^^ . . . . . . . "0"^^ . . . "Is `callback` an Objective-C object?"^^ . "5"^^ . "Duplicate of [Nested redo group with NSUndoManager](https://stackoverflow.com/questions/13704535/nested-redo-group-with-nsundomanager). You can group the invocations but not the action names."^^ . "0"^^ . "<p>You're looking at non-linked data. You need to be aware of dynamic linking operations in order to meaningfully parse this.</p>\n<blockquote>\n<p>So, my question is: how does Objective-C/clang encode MD entity pointers in Mach-O files?</p>\n</blockquote>\n<p>It depends. Specifically, it depends on what runtime linking format for binds and rebases your binary uses. Broadly speaking, there are two formats:</p>\n<ol>\n<li><p>Dyld opcodes.<br />\nThis is the &quot;old&quot; format and has been used since macOS 10.6. In this format, all metadata is stored separately from the data it applies to, which is why you get clean pointers in your x86_64 binary, surrounded by zeroes. As its name suggests, it's an opcode-based sequence of instructions, which is stored somewhere in <code>__LINKEDIT</code> and is pointed to by the <code>LC_DYLD_INFO</code>/<code>LC_DYLD_INFO_ONLY</code> in the Mach-O header. You can dump this info specifically with <code>xcrun dyld_info -opcodes</code>:</p>\n<pre><code>% xcrun dyld_info -opcodes test.macos\ntest.macos [x86_64]:\n -opcodes:\n rebase opcodes:\n 0x0000 REBASE_OPCODE_DO_REBASE_IMM_TIMES\n 0x0018 REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB\n 0x0050 REBASE_OPCODE_DO_REBASE_IMM_TIMES\n 0x0058 REBASE_OPCODE_DO_REBASE_IMM_TIMES\n 0x0060 REBASE_OPCODE_DO_REBASE_IMM_TIMES\n 0x0080 REBASE_OPCODE_DO_REBASE_IMM_TIMES\n 0x0088 REBASE_OPCODE_DO_REBASE_IMM_TIMES\n 0x00D0 REBASE_OPCODE_DO_REBASE_IMM_TIMES\n 0x00D8 REBASE_OPCODE_DO_REBASE_IMM_TIMES\n 0x00F8 REBASE_OPCODE_DO_REBASE_IMM_TIMES\n regular bind opcodes:\n 0x00E0 BIND_OPCODE_DO_BIND\n 0x00B0 BIND_OPCODE_DO_BIND\n 0x00B8 BIND_OPCODE_DO_BIND\n 0x00C0 BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED\n 0x00E8 BIND_OPCODE_DO_BIND\n no lazy bind opcodes\n no weak bind opcodes\n</code></pre>\n<p>The load command and dyld opcodes are defined in <a href="https://github.com/apple-oss-distributions/xnu/blob/xnu-8792.81.2/EXTERNAL_HEADERS/mach-o/loader.h#L1302-L1470" rel="nofollow noreferrer"><code>mach-o/loader.h</code></a>. Use of the opcodes has been somewhat detailed <a href="http://www.newosxbook.com/articles/DYLD.html" rel="nofollow noreferrer">by Jonathan Levin</a>, though for the actual implementation, see <a href="https://github.com/apple-oss-distributions/dyld/blob/dyld-1042.1/common/MachOAnalyzer.cpp" rel="nofollow noreferrer"><code>MachOAnalyzer.cpp</code></a> and <a href="https://github.com/apple-oss-distributions/dyld/blob/dyld-1042.1/common/MachOLayout.cpp" rel="nofollow noreferrer"><code>MachOLayout.cpp</code></a> in dyld source.</p>\n</li>\n<li><p>Chained fixups.\nThis is the &quot;new&quot; format first introduced in iOS 12 on arm64e. In this format, some metadata is stored alongside the target data it applies to, which is what you're seeing in your arm64 binary.<br />\nThis format was initially only used for arm64e binaries, and whether this is used depends on the target architecture and minimum OS version, but iOS 16 and macOS 13 targets now seem to use it for all architectures (I'm guessing your default macOS target is 12.x or lower).<br />\nThe way this works is by first segmenting the binary into pages (which may or may not match the hardware page size), and recording the offset of the first value that needs to be operated on in each page. The data at that offset then encodes the information needed to construct a valid pointer at load-time, as well as the offset to the next such value, thereby forming the &quot;fixup chain&quot;. Cramming all of this into a 64-bit (or sometimes even 32-bit) value is of course no small feat, so there are many subtly different formats that can be picked from, each optimised for a special use case (see <a href="https://github.com/apple-oss-distributions/xnu/blob/xnu-8792.81.2/EXTERNAL_HEADERS/mach-o/fixup-chains.h" rel="nofollow noreferrer"><code>mach-o/fixup-chains.h</code></a>), but generally you have the top bit telling you whether it's a bind or rebase, you have N amount of bits in the middle that encode distance to the next pointer, pointer authentication stuff, etc., and then you have the rest of the bits which encode the offset from the base of the image (for rebases) or the index into the import symbol table (for binds). Also, only one format can be chosen for the entire binary, so you will likely only have to implement two or three, and will never encounter the rest.<br />\nAt that point you're left with the list of page offsets that lead to the first value on each page. If chained fixups are used in conjunction with dyld opcodes, then this is encoded <em>somehow</em> (I never looked at it) in the dyld opcode sequence with <code>BIND_OPCODE_THREADED</code>. If this is used stand-alone, then there is a <code>LC_DYLD_CHAINED_FIXUPS</code> load command in the Mach-O header, which points to a <code>struct dyld_chained_fixups_header</code>, which points to a few more structs, encoded as offsets from itself. One of those holds the page starts, another holds the list of imported symbols, etc. See <code>mach-o/fixup-chains.h</code> again for those.<br />\nYou can use <code>xcrun dyld_info -fixup_chains</code> and <code>xcrun dyld_info -fixup_chain_details</code> to examine this:</p>\n<pre><code>% xcrun dyld_info -fixup_chains test.ios\ntest.ios [arm64]:\n -fixup_chains:\nseg[2]:\n page_size: 0x4000\n pointer_format: 6 (generic 64-bit, 4-byte stride, target vmoffset )\n segment_offset: 0x00008000\n max_pointer: 0x00000000\n pages: 1\n start[ 0]: 0x0000\nseg[3]:\n page_size: 0x4000\n pointer_format: 6 (generic 64-bit, 4-byte stride, target vmoffset )\n segment_offset: 0x0000C000\n max_pointer: 0x00000000\n pages: 1\n start[ 0]: 0x0018\n</code></pre>\n<pre><code>% xcrun dyld_info -fixup_chain_details test.ios\ntest.ios [arm64]:\n -fixup_chain_details:\n 0x00008000: raw: 0x000000000000C0C0 rebase: (next: 000, target: 0x0000000C0C0, high8: 0x00)\n 0x0000C018: raw: 0x0090000000007F9C rebase: (next: 018, target: 0x00000007F9C, high8: 0x00)\n 0x0000C060: raw: 0x0010000000007F9C rebase: (next: 002, target: 0x00000007F9C, high8: 0x00)\n 0x0000C068: raw: 0x0050000000007F88 rebase: (next: 010, target: 0x00000007F88, high8: 0x00)\n 0x0000C090: raw: 0x0010000000007FA3 rebase: (next: 002, target: 0x00000007FA3, high8: 0x00)\n 0x0000C098: raw: 0x8010000000000001 bind: (next: 002, ordinal: 000001, addend: 0)\n 0x0000C0A0: raw: 0x8010000000000001 bind: (next: 002, ordinal: 000001, addend: 0)\n 0x0000C0A8: raw: 0x8020000000000000 bind: (next: 004, ordinal: 000000, addend: 0)\n 0x0000C0B8: raw: 0x001000000000C000 rebase: (next: 002, target: 0x0000000C000, high8: 0x00)\n 0x0000C0C0: raw: 0x001000000000C098 rebase: (next: 002, target: 0x0000000C098, high8: 0x00)\n 0x0000C0C8: raw: 0x8010000000000002 bind: (next: 002, ordinal: 000002, addend: 0)\n 0x0000C0D0: raw: 0x8020000000000000 bind: (next: 004, ordinal: 000000, addend: 0)\n 0x0000C0E0: raw: 0x000000000000C048 rebase: (next: 000, target: 0x0000000C048, high8: 0x00)\n</code></pre>\n</li>\n</ol>\n<p>In the more general case, you could also use <code>xcrun dyld_info -fixups</code> to display any sort of bind or rebase target, no matter whether it uses dyld opcodes or fixup chains under the hood. But I suppose that won't help you much for the purpose of writing a parser.</p>\n"^^ . . . . . "<p>I am converting my framework into an xcframework. Got &quot;Using bridging headers with module interfaces is unsupported&quot;, moved the imported headers from the bridging header into my umbrella header and deleted the bridging header. I have my modulemap pointing to an umbrella header.</p>\n<pre><code>framework module MySDK {\n umbrella header &quot;MySDK.h&quot;\n \n export *\n module * { export * }\n}\n</code></pre>\n<p>The umbrella header has all the objc header files I need in Swift files imported. Other Swift files in my framework claim they can't see the files imported in &quot;MySDK.h&quot;. &quot;Jump to Definition&quot; on the errors takes me exactly where it should. I have been trying to fix this for weeks with no luck.</p>\n<p>Please can anyone help me?</p>\n"^^ . "0"^^ . . "0"^^ . . "@koen nah the device has active sim and e-sim but i think its ios deprecation issue"^^ . "0"^^ . . "0"^^ . "0"^^ . . . "It would likely help if you stepped back and started with the code you use to store the string containing the emoji in the database and the code to read it back out. It seems odd that you end up with a need to decode HTML entities. That indicates to me that there is an issue with the code that stores and/or retrieves the data to/from the database."^^ . "0"^^ . . . . . . . "1"^^ . . . "nstableview"^^ . "<p>I'm getting the following compiler warning when trying to determine the type of an object passed in:</p>\n<blockquote>\n<p>Messaging unqualified id</p>\n</blockquote>\n<p>This is a simplification of a situation in a large prod codebase:</p>\n<pre class="lang-objc prettyprint-override"><code>@implementation ViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n \n [ViewController myMethod:@&quot;MyString&quot;];\n \n [ViewController myMethod:@[@(1), @(2), @(3)]];\n \n [ViewController myMethod:@(13)];\n}\n\n+ (void)myMethod:(id)authenticationData {\n if ([authenticationData isKindOfClass:[NSArray class]]) { // ERROR: Messaging unqualified id\n NSLog(@&quot;NSArray&quot;);\n } else if ([authenticationData isKindOfClass:[NSString class]]) { // No error here because the compiler stops checking after the first one. If above statement is commented out --&gt; same error here\n NSLog(@&quot;NSString&quot;);\n } else {\n NSLog(@&quot;Unknown&quot;);\n }\n}\n\n@end\n</code></pre>\n"^^ . "2"^^ . . "<p>I've configured app to support Notch Screen devices Running my App in the iPhone X Simulator.</p>\n<p>the App is working fine in Normal views but does not use the full screen space if I have NAVIGATION CONTROLLERS</p>\n<p>a strange Transparent Black Shade is appearing over the Navigation bar</p>\n<p>Does anybody help me on this what is happening here and how to resolve this? I can't find any new settings in Interface Builder.</p>\n"^^ . . . "0"^^ . . "1"^^ . "0"^^ . "0"^^ . "@HangarRash it still stays blank white. It should still work even if its out of date right?"^^ . . "0"^^ . . "0"^^ . . "Better use `NSMutableDictionary` methods `setObject:forKey:` and `objectForKey:` instead of `NSKeyValueCoding` methods `setValue:forKey:` and `valueforKey:`."^^ . . "0"^^ . . "1"^^ . . . . "1"^^ . "2"^^ . . . "1"^^ . . . "Get properties types of Class.Type in Swift"^^ . . . "serviceSubscriberCellularProviders and CTCarrier are deprecated with no replacement. \n\nhttps://developer.apple.com/forums/thread/714876?answerId=728276022#728276022\n\nhttps://developer.apple.com/forums/thread/714876?answerId=728276022#728276022"^^ . . "2"^^ . . . . . . . . . "How can I use my Objective-C enum from Swift?"^^ . . . . . . "How to cancel/terminate an ongoing process of FFmpeg"^^ . "1"^^ . "1"^^ . . "<p>serviceSubscriberCellularProvider is deprecated in iOS 16 and XCode 14.3 comes with iOS 16.\n<a href="https://developer.apple.com/documentation/coretelephony/cttelephonynetworkinfo/3024511-servicesubscribercellularprovide" rel="nofollow noreferrer">https://developer.apple.com/documentation/coretelephony/cttelephonynetworkinfo/3024511-servicesubscribercellularprovide</a></p>\n"^^ . "0"^^ . "11"^^ . . . "<p>I have created a SPM package with a bunch of old Objective-C code (I want to convert some old code <em>&quot;Objective-C code with a big bridging header&quot;</em> into <em>&quot;Objective-C in some SPM packages&quot;</em>) For most of the cases it works OK except for Objective-C categories like:</p>\n<pre class="lang-objectivec prettyprint-override"><code>@import Foundation;\n\n@interface NSURL (Additions)\n\n@property (copy, readonly) NSDictionary&lt;NSString *, NSString *&gt; *queryParams;\n\n@end\n</code></pre>\n<p><strong>Problem:</strong> Property <code>queryParams</code> is NOT available in Swift on <code>URL</code> types but only on <code>NSURL</code> types. This looks odd to me because when declaring the same category in an App and using the bridging header file, then <code>queryParams</code> is also usable from <code>URL</code> type too.</p>\n<pre><code>Tests/URLUtilsTests/URLUtilsTestsSwift.swift:18:31: error: value of type 'URL' has no member 'queryParams'\n let queryParams = url.queryParams\n ~~~ ^~~~~~~~~~~\nerror: fatalError\n</code></pre>\n<p><strong>Question:</strong> What do I need to have <code>queryParams</code> in both NSURL and URL while using SPM?</p>\n<p>I have created a <a href="https://github.com/nacho4d/spm-objc-category" rel="nofollow noreferrer">repo in GitHub with reproducing problem</a></p>\n<p>This is a screenshot of my entire package:</p>\n<p><a href="https://i.sstatic.net/qcEWa.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qcEWa.jpg" alt="enter image description here" /></a></p>\n"^^ . . "<p>How can I find the current screen scale of my CarPlay screen?</p>\n<p>I'm interested in how to understand the current scale for the screen. In a lot of cases it is 2, but on high resolution screens it turns on scale 3. We need to understand what specific scale is currently used in the application</p>\n"^^ . . . . "0"^^ . "multithreading"^^ . . . "1"^^ . "0"^^ . "Why does my objective-c code output an incorrect area?"^^ . "0"^^ . . . . "<p>Change <code>addRegions:</code> to the following:</p>\n<pre><code>- (void)addRegions:(NSArray *)regions\n{\n [[self.undoManager prepareWithInvocationTarget:self] removeRegions:regions];\n \n // ... &lt;code to actually add the regions&gt; ...\n \n if (![self.undoManager isUndoing] &amp;&amp; ![self.undoManager isRedoing]) {\n [self.undoManager setActionName:@&quot;Add Region(s)&quot;];\n }\n}\n</code></pre>\n<p>(I.e. add check to avoid setting the action name when the undo manager is redoing as well.)</p>\n"^^ . . . . . . . . . "How to use functions of Xcode projects in workspace?"^^ . . . . . . "0"^^ . . . . . . . . . "0"^^ . "0"^^ . . "1"^^ . . "Maybe try renaming `screenshot.png` to `screenshot@1x.png` which might resize the image accordingly."^^ . "0"^^ . . "What does not work? The first way is pointless anyway because – as the name implies – a *temporary* directory is certainly not the right place for persistent data. And the `while` loops make no sense either because nothing is changing in their body. Apart from this you get **always** a unique value with `timeIntervalSince1970` relative to the current date."^^ . "0"^^ . . . "0"^^ . . . . "0"^^ . . "0"^^ . . . . "one hopefully last question. Please see the edit to the OP. Thx."^^ . . "0"^^ . . . "This is all code in the same framework. My Obj-C classes in MySDK aren't being seen by my Swift files in MySDK."^^ . . "3"^^ . . "0"^^ . . . "5"^^ . . . . . "0"^^ . . . "How does Mach-O store pointers to Objective-C Metadata entities?"^^ . "<p>I asked the same question in <a href="https://forums.swift.org/t/why-spm-library-with-objective-c-nsurl-category-is-not-available-in-swift-url-type/65005" rel="nofollow noreferrer">Swift forums</a> and I got the reason why this is not working.</p>\n<blockquote>\n<p>NSURL and URL are not the same type. The first is a class, the second a struct. ObjC categories or Swift extensions to one do not apply to the other.</p>\n<p>There's a runtime &quot;magic&quot; that ties them together, though. It is the URL conformance to ReferenceConvertible 5, and much probably some non-public tricks. But this does not make them the same type.</p>\n</blockquote>\n<p>So the only solution is to have <a href="https://github.com/nacho4d/spm-objc-category/pull/2" rel="nofollow noreferrer">a special target for swift code</a>.</p>\n<pre><code>import URLUtils\nextension URL {\n var queryParams: [String: String] {\n (self as NSURL).queryParams\n }\n}\n</code></pre>\n<p>I have updated my <a href="https://github.com/nacho4d/spm-objc-category" rel="nofollow noreferrer">original repository source code</a> to and it works ok now!.</p>\n"^^ . . . . . . . . . . . . . "xcframework"^^ . "0"^^ . . . . . "1"^^ . . . "1"^^ . "0"^^ . "@GeoffHackworth the company i'm going to work for has their codebase still in Objective-C and the project I'll be working on will still be using it. They recommended me this book to read on before I start. Thanks for the recommendation though."^^ . "0"^^ . "<p>Setting a property in Objective-C:</p>\n<pre><code>self.allowsUserCustomization = YES;\n</code></pre>\n<p>Using the setter method:</p>\n<pre><code>[self setAllowsUserCustomization:YES];\n</code></pre>\n"^^ . . . "0"^^ . . . "0"^^ . . . . . . . "3"^^ . . . "0"^^ . "undefined-behavior"^^ . . . . "android"^^ . . . . . "0"^^ . . . "0"^^ . . . . "Using Objective-C framework in SwiftUi application"^^ . . . . . . . "docc"^^ . . "Post real Objective-C and real Swift code that properly demonstrates your issue. There are too many issues with the code you posted to determine the cause of your issue."^^ . . . "<p>Use <code>reloadDataForRowIndexes:columnIndexes:</code> to limit reloading to the first column.</p>\n"^^ . . "0"^^ . . . . . . . . . "Yes, I want to paste some existing example code into /// comment to generate DocC documentation."^^ . . "1"^^ . . . "1"^^ . . . "0"^^ . "0"^^ . "0"^^ . . "1"^^ . . . "1"^^ . "I don't know, it doesn't make any sense. Usually `allowsUserCustomization` is set when the toolbar is created."^^ . . "<p>Try to set status bar background color with the same color of navigation controller, add this extension:</p>\n<pre><code>extension UINavigationController {\n\nfunc setStatusBar(backgroundColor: UIColor) {\n let statusBarFrame: CGRect\n if #available(iOS 13.0, *) {\n statusBarFrame = view.window?.windowScene?.statusBarManager?.statusBarFrame ?? CGRect.zero\n } else {\n statusBarFrame = UIApplication.shared.statusBarFrame\n }\n let statusBarView = UIView(frame: statusBarFrame)\n statusBarView.backgroundColor = backgroundColor\n view.addSubview(statusBarView)\n }\n}\n</code></pre>\n<p>Now in viewDidLoad call:</p>\n<pre><code>navigationController?.setStatusBar(backgroundColor: .yourColor)\n</code></pre>\n"^^ . . . "How do I check that it's generating the header properly?"^^ . "1"^^ . . . . "<p>int network_socket = socket(AF_INET, SOCK_STREAM, 0);</p>\n<pre><code> struct sockaddr_in socketAddr;\n socketAddr.sin_family = AF_INET;\n socketAddr.sin_port = kSocketPort;\n socketAddr.sin_addr.s_addr = INADDR_ANY;\n \n int result = connect(network_socket, (struct sockaddr *)&amp;socketAddr, sizeof(socketAddr));\n \n if (result == -1) {\n NSLog(@&quot;Connection failed&quot;);\n return;\n }\n \n close(network_socket);\n</code></pre>\n"^^ . "0"^^ . . . . . . . "@BerryBlue I had a smilar issue to you. This fix/workaound helped me to prevent this error: https://github.com/facebook/react-native/issues/43319#issuecomment-2061251131"^^ . . "0"^^ . . . . . "<p>The situation that you are describing should work. There are quite a few incorrect pieces in your code though.</p>\n<p>The Objective-C class is usually defined by interface in a header and you need to use <code>NSString</code> to represent a <code>String</code> for Swift.</p>\n<pre><code>@interface ClassA : NSObject\n@property (nonatomic, retain) NSString *str;\n@end\n</code></pre>\n<p>Next your protocol is missing some pieces. It should look like</p>\n<pre><code>protocol ProtocolDelegate: AnyObject {\n var str: String { get }\n}\n</code></pre>\n<p>And now I can easily declare a class such as</p>\n<pre><code>class ClassB: ClassA { }\n\nextension ClassB: ProtocolDelegate { }\n</code></pre>\n<p>And this works as expected.</p>\n"^^ . "0"^^ . "windows"^^ . . . . . . "1"^^ . . . . . "NSMutableDictionary ,setValue:forKey: crash"^^ . . . . "0"^^ . "objective-c"^^ . . "0"^^ . . . . "0"^^ . . . "0"^^ . . . "0"^^ . . . . . "1"^^ . . . "0"^^ . . "0"^^ . . . . . . . . . . . . "0"^^ . . . "No, I don't think you got it. See [Toolbar Programming Topics for Cocoa](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Toolbars/Toolbars.html#//apple_ref/doc/uid/10000109i)."^^ . . "The fact that the book uses Objective-C is an indication that it was published a long time ago (2014 according to Amazon). @HangarRash is absolutely correct, the window is created in the scene delegate since iOS 13. It is possible to revert back to the app delegate workflow but I think you would be wasting time and effort fighting more and more incompatibilities between the book and current behaviour. Learning Objective-C as a beginner is almost certainly not a good use of your time. Start with SwiftUI using a course such as https://www.hackingwithswift.com/100/swiftui"^^ . "@AndrewHenle I've updated the text to hopefully clarify my intention a little bit: in the contract between the function and the compiler, the function claims that it won't read any arguments, so the _compiler_ is safe to assume that it can pass in any arguments with any alignment."^^ . . . . . . . . "0"^^ . . "11"^^ . "I read all articles from the link, but still have a question. There is an available and default toolbar items. My understanding is that available items are the ones that currently displayed in the toolbar and the defaut are the ones that are currently displayed + the ones that could potentialy be displayed in the toolbar. Am I right? If not - how the Kit differ between currently displayed and potentially displayed?"^^ . . . "0"^^ . "<p>To resolve the issue for your Cocoa Pod (Turbo Module) you should make the following:</p>\n<ol>\n<li>Mark <code>@objc</code> and <code>public</code> all needed classes, method, properties etc. in your swift code because all of them are <code>internal</code> by default and are not visible outside.</li>\n</ol>\n<pre class="lang-swift prettyprint-override"><code>@objc\npublic class SwiftCalculator: NSObject {\n @objc\n public func add(a: Double, b: Double) -&gt; Double {\n a + b\n }\n}\n</code></pre>\n<ol start="2">\n<li>Import the pod's swift/objc generated header into your obj files in the format: &quot;&lt;MyPodName&gt;+Swift.h&quot;. In your case the pod name is &quot;rtn_calculator&quot;.</li>\n</ol>\n<pre><code>...\n#import &quot;rtn_calculator-Swift.h&quot;\n...\nRCT_REMAP_BLOCKING_SYNCHRONOUS_METHOD(add, NSNumber*, addA:(NSInteger)a andB:(NSInteger)b)\n{\n SwiftCalculator* calculator = [SwiftCalculator new];\n double value = [calculator addWithA:a b:b];\n return @(value);\n}\n</code></pre>\n"^^ . . . . . "0"^^ . . . "There is allowed and default items. The allowed items "Include all of your toolbar’s items" and the default items "when user settings don’t contain any custom configuration data for the toolbar". The currently displayed items are in the `items` property of the toolbar. Initially, at default, before the user customizes the toolbar, `items` is the default items. The default items are also present in the customization palette as default set."^^ . "NSUndoManager action name broken for grouped action after undo-redo cycle"^^ . . "Doesn't matter. Dependency manager will configure framework for you."^^ . "How to compile Objective-C files on Windows"^^ . . . "0"^^ . . . . . . "For properties you will need Swift's Reflection if they are not marked with `@objc`"^^ . "<p>Found a super simple solution to my question. Posting it here incase anyone else runs into it. My original data string that was returned:</p>\n<pre><code>Birthday emoji &amp;amp;#x1F388;\n</code></pre>\n<p>Here's the code I ended up using to make the emoji appear in my UILabel.</p>\n<p><strong>ViewController.m</strong></p>\n<pre><code> NSString *htmlEntity = [self.finalTimes valueForKey:@&quot;notes&quot;][indexPath.row];\n NSString *replacementString = [htmlEntity stringByReplacingOccurrencesOfString:@&quot;amp;&quot; withString:@&quot;&quot;];\n\n dispatch_async(dispatch_get_main_queue(), ^{\n \n \n NSData *data = [replacementString dataUsingEncoding:NSUTF8StringEncoding];\n NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:data options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} documentAttributes:nil error:nil];\n \n UIFont *font = [UIFont fontWithName:@&quot;Avenir-Oblique&quot; size:11.0];\n UIColor *textColor = [UIColor darkGrayColor]; // Set the correct font name and size\n NSDictionary *attributes = @{NSFontAttributeName: font, NSForegroundColorAttributeName: textColor};\n NSMutableAttributedString *styledAttributedString = [[NSMutableAttributedString alloc] initWithAttributedString:attributedString];\n [styledAttributedString addAttributes:attributes range:NSMakeRange(0, styledAttributedString.length)];\n\n cell.notes.attributedText = styledAttributedString;\n \n \n });\n</code></pre>\n"^^ . "<p>I have the following, rather simple code for adding, removing and joining MP3 audio regions in the MP3 editing app I am currently writing:</p>\n<pre><code>- (void)addRegions:(NSArray *)regions\n{\n [[self.undoManager prepareWithInvocationTarget:self] removeRegions:regions];\n \n // ... &lt;code to actually add the regions&gt; ...\n \n if (![self.undoManager isUndoing]) {\n [self.undoManager setActionName:@&quot;Add Region(s)&quot;];\n }\n}\n\n\n- (void)removeRegions:(NSArray *)regions\n{\n [[self.undoManager prepareWithInvocationTarget:self] addRegions:regions];\n \n // ... &lt;code to actually remove the regions&gt; ...\n \n if (![self.undoManager isUndoing]) {\n [self.undoManager setActionName:@&quot;Remove Region(s)&quot;];\n }\n}\n\n\n- (void)joinRegions:(NSArray *)regions\n{\n [self.undoManager beginUndoGrouping];\n \n MP3Region *joinedRegion = [[MP3Region alloc] init];\n \n // ... &lt;code to set the parameters of the joined region accordingly&gt; ...\n \n [self removeRegions:regions];\n [self addRegions:@[joinedRegion]];\n \n [self.undoManager setActionName:@&quot;Join Regions&quot;];\n \n [self.undoManager endUndoGrouping];\n}\n</code></pre>\n<p>Undo and redo for adding and removing regions is working just fine. Now what's weird is that undo and redo work fine for the join regions functionality as well, but after undoing and redoing once, the menu item now wrongly reads &quot;Undo Add Region(s)&quot; instead of the expected &quot;Undo Join Regions&quot;. Clicking this wrongly labeled menu item actually undoes the join action, and clicking the subsequently appearing &quot;Redo Add Region(s)&quot; menu item repeats the join action again. So the undo/redo functionality actually does the thing it was supposed to. It's just the action name that somehow gets messed up.</p>\n<p>I tried guarding <code>[self.undoManager setActionName:@&quot;Join Regions&quot;];</code> with <code>if (![self.undoManager isUndoing]) {}</code>, but this doesn't change anything at all. (And I didn't see why it should have in the first place, anyway, but that was my only idea as to what might be wrong.)</p>\n<p>Any ideas on what's causing this issue and how to fix it?</p>\n"^^ . "0"^^ . "0"^^ . . . . . . . . . "0"^^ . . . . . "Getting "--" when try to get carrier name"^^ . . . "0"^^ . . . "Separately, `printf` & co. are a very different case, because they take a _variable_ number of arguments — for a function which takes varargs, _any_ number of arguments of _any_ type are valid. It's up to the function to figure out how to accept them safely."^^ . . . "0"^^ . . "0"^^ . . . . . "h.264"^^ . . . "Because this answer is very likely sufficient. Without seeing the code, I don't know the name of the header to import, but the answer is "import the header that defines `CK_PTR`." I don't believe this should be closed or the OP needs to edit the question if that's enough."^^ . "react-native"^^ . "1"^^ . . "Query params don't always have anything to the right of `=`, which would make this crash"^^ . . . "1"^^ . . . . . . . "2"^^ . . "1"^^ . "0"^^ . . "3"^^ . . . . . . "0"^^ . . . . . "NSToolbar customization not available"^^ . . "1"^^ . "I don't use CarPlay, but I guess it's the same logic as for iDevices: https://developer.apple.com/documentation/uikit/uiscreen/1617836-scale Apple called them "Retina", but the logic is how do you divide a "point": is it 1 px, 4, 9, etc.?"^^ . "0"^^ . "If I try that I'm getting this error. It goes away if I delete the Swift file. `RTNCalculatorSpec.h:15:2 This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.`"^^ . "0"^^ . . . . . "Yes it will work, if you use older versions of Xcode (the ones which supported iOS SDK 12 and below). Answer mentioned below by `The Dreams World` is the most suited answer in my view for your question:\nUse this inside sceneDelegate on iOS 13 and above.\n\n`self.window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene];\n self.window.backgroundColor = [UIColor redColor];\n [self.window makeKeyAndVisible];\n \n UIView *view = [[UIView alloc] initWithFrame: CGRectMake(160, 240, 100, 150)];\n view.backgroundColor = UIColor.whiteColor;\n [self.window addSubview:view];`"^^ . "react-native-turbomodule"^^ . . . "Converting image sequences to h264 video in objective-c results in AVFoundationErrorDomain"^^ . . "objective-c-swift-bridge"^^ . "2"^^ . . "0"^^ . "0"^^ . "Since it's impossible to give a precise answer to the question, why not ask for extra details or even close the question with "needs debugging details" resolution?"^^ . . . . . "1"^^ . "0"^^ . "Transparent Black Shade over the Navigation Bar in iPhone-X Later Notch Screen Devices in iOS App"^^ . . . . . . . . . . . "1"^^ . "1"^^ . "1"^^ . "objc-message-send"^^ . . . "@Larme could you please turn your comment into an answer?"^^ . . "1"^^ . "how to get a persist storage path in an ios app"^^ . . "1"^^ . . "1"^^ . "protocols"^^ . . "<p>In Chapter 4 of the <strong>Big Nerd Ranch: iOS Programming 4th Edition</strong> textbook where we're supposed to create a red rectangle appear in the middle of the view in the <strong>AppDelegate.m</strong> file and have it appear in the simulator.</p>\n<p>I've copied the code word for word and when I run the simulator I get a blank screen like this:</p>\n<p><img src="https://i.sstatic.net/my8z4l.png" alt="Xcode Simulation" /></p>\n<p>I'm not sure why this is happening. I've already put the property for <code>window</code> in the <strong>AppDelegate.h</strong> file so I know that's not why.</p>\n<p>This is the code in the <strong>AppDelegate.m</strong> file:</p>\n<pre><code>//\n// AppDelegate.m\n// Hypnosister\n//\n//\n//\n\n#import &quot;AppDelegate.h&quot;\n#import &quot;BNRHypnosisView.h&quot;\n\n@interface AppDelegate ()\n\n@end\n\n@implementation AppDelegate\n\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n // Override point for customization after application launch.\n \n self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];\n CGRect firstFrame = CGRectMake(160, 240, 100, 150);\n \n BNRHypnosisView *firstView = [[BNRHypnosisView alloc]initWithFrame:firstFrame];\n firstView.backgroundColor = [UIColor redColor];\n [self.window addSubview:firstView];\n \n self.window.backgroundColor = [UIColor whiteColor];\n [self.window makeKeyAndVisible];\n return YES;\n}\n\n\n#pragma mark - UISceneSession lifecycle\n\n\n- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {\n // Called when a new scene session is being created.\n // Use this method to select a configuration to create the new scene with.\n return [[UISceneConfiguration alloc] initWithName:@&quot;Default Configuration&quot; sessionRole:connectingSceneSession.role];\n}\n\n\n- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet&lt;UISceneSession *&gt; *)sceneSessions {\n // Called when the user discards a scene session.\n // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.\n // Use this method to release any resources that were specific to the discarded scenes, as they will not return.\n}\n\n\n@end\n\n</code></pre>\n"^^ . "1"^^ . . . . . "0"^^ . "How does casting and calling obj_msgSend() not invoke undefined behavior?"^^ . . . . . "2"^^ . "<p>i have an issue bridging my Objective-C enums over to my Swift class and i someone could look at it, i'd be most grateful.</p>\n<p>For example, lets say i have an enum like this defined in a MyClass.h file:</p>\n<pre><code>@interface MyClass : NSObject\n\ntypedef NS_ENUM(NSUInteger, PopupType){\n INFO = 0, QUESTION = 1, WARN = 2\n};\n\n.... tons of other stuff\n@end\n</code></pre>\n<p>i then put that in my bridging header:</p>\n<pre><code>#import &quot;MyClass.h&quot;\n</code></pre>\n<p>but when i try to use it in Swift, either by declaring a variable:</p>\n<pre><code>let banana : PopupType = .INFO\n</code></pre>\n<p>or as a method parameter:</p>\n<pre><code>func doThingAt(minutes: Int32, popup: PopupType) {\n</code></pre>\n<p>i get the error message <strong>Cannot find PopupType in scope.</strong></p>\n<p>another thing it doesn't find in MyClass.h is for example</p>\n<pre><code>extern int const COLOR_GREEN;\n</code></pre>\n<p>What am I missing? Thanks in advance.</p>\n"^^ . "0"^^ . . . . . . "0"^^ . "0"^^ . . "2"^^ . "0"^^ . . "1"^^ . . . . . . . . . . "iOS Simulator showing Blank White Screen When Trying to Create Frame"^^ . . . . . . "0"^^ . "1"^^ . "Can we directly get a refrence to UITextView's textview.text or do we need to make a copy of it to use it as a NSString from objC?"^^ . . "<p>I had the same issue using <a href="https://pub.dev/packages/tflite_flutter" rel="nofollow noreferrer">tflite_flutter</a>.\nTry to follow the steps listed <a href="https://github.com/am15h/tflite_flutter_plugin#ios" rel="nofollow noreferrer">here</a> for iOS.\nBasically, you need to add a compiled version of Tensorflow in the plugin pub cache folder. If you need to use the GPU Delegate you can follow the <a href="https://www.tensorflow.org/lite/guide/build_ios#build_tensorflowlitec_dynamic_framework_recommended" rel="nofollow noreferrer">official docs</a> of Tensorflow.</p>\n"^^ . "0"^^ . . . . . . . "Maybe this helps: [objc_msgSend's New Prototype](https://www.mikeash.com/pyblog/objc_msgsends-new-prototype.html) by Mike Ash"^^ . "uialertcontroller"^^ . . "1"^^ . "macos"^^ . "nsundomanager"^^ . . . . . . "What happens if you change `self.window.backgroundColor = [UIColor whiteColor];` to `self.window.backgroundColor = [UIColor blueColor];`. Does the white screen change to blue? I suspect the book you are using is out-of-date and doesn't cover the fact that iOS apps use scenes now and most of the code they have you put in the app delegate belongs in the scene delegate."^^ . . . . . . "1"^^ . . . . . "1"^^ . "<p>I ran the code below, it ouput area to be 1 instead of 12.568 Can someone please check what is wrong with the code</p>\n<pre><code> #import &lt;Foundation/Foundation.h&gt;\n\n int main(int argc, const char * argv[])\n {\n NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];\n \n // constant\n #define PI 3.142fat\n float area;\n int r=2;\n area = PI * (r*r);\n NSLog(@&quot;Area is %d&quot;, area);\n \n [pool drain];\n return 0;\n }\n</code></pre>\n<p>2023-05-26 12:36:48.839 main[16:16] Area is 1</p>\n"^^ . . . . "1"^^ . . . "0"^^ . . "0"^^ . "1"^^ . . "2"^^ . . "mach-o"^^ . "4"^^ . "Maybe update the WARNING_CFLAGS settings, with the found flag "-Wno-declaration-after-statement". In the XCDYouTubeKit/XCDYouTubeKit.xcodeproj/project.pbxproj file, around line 604. Good Luck."^^ . "0"^^ . . "xcode14.3"^^ . . "1"^^ . "Cannot reproduce, your code compiles without problems for me. Does the problem occur in a fresh new project, with only that code present and nothing else?"^^ . "2"^^ . . "no it's a super old project :) so it has tons of stuff that potentially could be wrong. But I do use other swift/objective-c stuff back and forth that works, so it's not the bridging header I think."^^ . . "On macOS the easiest way is Xcode. Or you could use clang or gcc directly. But, to be honest, have you tried googling your question before posting here? Providing info about the platform that you're using could be also a good start."^^ . "0"^^ . . "<p>I have an Objective-C ClassA:</p>\n<pre class="lang-objectivec prettyprint-override"><code>@class ClassA;\n \n@property (nonatomic, retain) String *str;\n \n@end\n</code></pre>\n<p>Which then is inherited by a Swift class ClassB:</p>\n<pre class="lang-swift prettyprint-override"><code>class ClassB: ClassA {\n \n}\n</code></pre>\n<p>Separately, I will have a protocol:</p>\n<pre class="lang-swift prettyprint-override"><code>protocolDelegate: AnyObject {\n var str: String\n}\n</code></pre>\n<p>I will then try to extend ClassB to adhere to the protocolDelegate:</p>\n<pre class="lang-swift prettyprint-override"><code>extension ClassB: protocolDelegate {\n}\n</code></pre>\n<p>I have tried many ways of doing this but I can't get it to work. Is there a way to use the inherited property to conform to the protocol?</p>\n"^^ . . . "<p>I followed the guide here to create a turbo module. This was fine.</p>\n<p><a href="https://reactnative.dev/docs/the-new-architecture/pillars-turbomodules" rel="noreferrer">https://reactnative.dev/docs/the-new-architecture/pillars-turbomodules</a></p>\n<p>I want to use Swift code in this turbo module. I tried adding a Swift file with this code and modifying the <code>RTNCalculator.mm</code> so that the number addition happens in Swift called from Objective-C.</p>\n<p>SwiftCalculator.swift</p>\n<pre><code>import Foundation\n\n@objc class SwiftCalculator: NSObject {\n @objc func add(a: Double, b: Double) -&gt; Double {\n return a + b\n }\n}\n</code></pre>\n<p>RTNCalculator.mm</p>\n<pre><code>#import &quot;RTNCalculatorSpec.h&quot;\n#import &quot;RTNCalculator.h&quot;\n#import &quot;RTNCalculator-Swift.h&quot;\n\n@implementation RTNCalculator\n\nRCT_EXPORT_MODULE()\n\n- (void)add:(double)a b:(double)b resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {\n SwiftCalculator *calculator = [SwiftCalculator new];\n double value = [calculator addWithA:a b:b];\n NSNumber *result = [[NSNumber alloc] initWithDouble:value];\n resolve(result);\n}\n\n- (std::shared_ptr&lt;facebook::react::TurboModule&gt;)getTurboModule:\n (const facebook::react::ObjCTurboModule::InitParams &amp;)params\n{\n return std::make_shared&lt;facebook::react::NativeCalculatorSpecJSI&gt;(params);\n}\n\n@end\n</code></pre>\n<p>I also modified the pod spec file to use a bridging header file.</p>\n<pre><code> s.pod_target_xcconfig = { \n 'SWIFT_OBJC_BRIDGING_HEADER' =&gt; '../../node_modules/rtn-calculator/ios/RTNCalculator-Bridging-Header.h'\n }\n</code></pre>\n<p>This doesn't work. I get this error in the project.</p>\n<pre><code>Using bridging headers with framework targets is unsupported\n</code></pre>\n<p>How do I use Swift in a Turbo Module?</p>\n"^^ . "As I said, I cannot reproduce the problem in a fresh project. I would suggest that you try that as well."^^ . "0"^^ . "0"^^ . . "0"^^ . "1"^^ . . "0"^^ . . . . . . "<p>A somewhat lengthy question so please bear with me.</p>\n<p>I am writing <strong>a parser to extract Objective-C metadata</strong> entities from input Mach-O binaries. And I want to better understand how pointers to metadata entities are stored/encoded in Mach-Os.</p>\n<h4>For example, using this Obj-C code:</h4>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n\n@interface Person : NSObject\n\n- (void) someMethod;\n\n@end\n\n@implementation Person\n\n- (void) someMethod {}\n\n@end\n\nint main() {\n return 0;\n}\n</code></pre>\n<h4>I compile it twice:</h4>\n<h5>1. First using the following command:</h5>\n<pre><code>clang++ -target arm64-apple-ios16 -isysroot /path/to/iphoneos_sdk \\\n -framework Foundation -o test test.m\n</code></pre>\n<p>Output from <code>objdump -s test</code></p>\n<pre><code>...\nContents of section __DATA_CONST.__objc_classlist:\n 100008000 c0c00000 00000000 ........ \n...\nContents of section __DATA.__objc_data:\n 10000c098 01000000 00001080 01000000 00001080 ................\n 10000c0a8 00000000 00002080 00000000 00000000 ...... .........\n 10000c0b8 00c00000 00001000 98c00000 00001000 ................\n 10000c0c8 02000000 00001080 00000000 00002080 .............. .\n 10000c0d8 00000000 00000000 48c00000 00000000 ........H.......\n</code></pre>\n<p><strong>Note that</strong> the class pointer is stored as <code>0xc0c0</code> in the <code>__objc_classlist</code> section. The class is actually located at pointer: <code>0x0001 0000 c0c0</code> in the <code>__objc_data</code> section.</p>\n<h5>2. Then I compile the same input again using the following command (note that I have an Intel machine so the target here is x86_64 by default):</h5>\n<pre><code>clang++ -framework Foundation -o test test.m\n</code></pre>\n<p>Output from <code>objdump -s test</code></p>\n<pre><code>...\nContents of section __DATA_CONST.__objc_classlist:\n 100004000 d8800000 01000000 ........ \n...\nContents of section __DATA.__objc_data:\n 1000080b0 00000000 00000000 00000000 00000000 ................\n 1000080c0 00000000 00000000 00000000 00000000 ................\n 1000080d0 00800000 01000000 b0800000 01000000 ................\n 1000080e0 00000000 00000000 00000000 00000000 ................\n 1000080f0 00000000 00000000 68800000 01000000 ........h.......\n</code></pre>\n<p>In this case, the class pointer is stored as <code>0x0001 0000 80d8</code> in the <code>__objc_classlist</code> section and we can use that address to go to where the class is actually stored in the <code>__objc_data</code> section.</p>\n<hr />\n<p>I also noticed other ways in which pointers are encoded. For example, I came across a case for ARM64 targets where a pointer to a metadata entity was stored as: <code>0x0000 9000 0000 3faf</code> while the actual location is <code>0x0001 0000 3faf</code>.</p>\n<hr />\n<p><strong>So, my question is: how does Objective-C/clang encode MD entity pointers in Mach-O files?</strong></p>\n"^^ . . "1"^^ . . "I think you can use cygwin or it's analogs."^^ . . "5"^^ . . . . "function-pointers"^^ . . . . . "0"^^ . . . . "0"^^ . . . . . . "<p>There's no way to share code directly between 2 apps in 2 projects. But you can:</p>\n<ol>\n<li>Isolate whatever code you want to share (e.g. <code>FirstFunc</code>) into a separate project</li>\n<li>Include it into both apps, like explained <a href="https://medium.com/kinandcartacreated/modular-ios-splitting-a-workspace-into-modules-331293f1090" rel="nofollow noreferrer">here</a> for example, or by making a common code an <code>xcframework</code> and consuming via cocoapods or package, as explained <a href="https://www.appcoda.com/xcframework/" rel="nofollow noreferrer">here</a></li>\n</ol>\n<p>This is the most suitable solution for most cases. But if both of your apps share <em>most</em> of the code (and most differences are in configuration or assets), then you can also do this:</p>\n<ol>\n<li>Combine both apps into 1 project,</li>\n<li>Create a separate <em>target</em> for each app. Each target will include common code, and bits specific to the particular app.</li>\n</ol>\n<p>But like I said, this is only suitable if most of the code is shared, otherwise it becomes a mess.</p>\n"^^ . . "<p>I have a swift project and I am trying to call C++ libraries from it. I have several <strong>.h</strong> files that I have included in project (added them in Project &gt; Build Settings &gt; Header Search Paths). Then created a build header:</p>\n<p><code>client-Bridging-header</code></p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &quot;DongleWrapper.hpp&quot;\n</code></pre>\n<p>Created a wrapper <code>DongleWrapper.hpp</code></p>\n<pre class="lang-objectivec prettyprint-override"><code>\n#import &quot;Dongle.hpp&quot;\n@implementation DongleWrapper\n\n- (DongleWrapper*) init {\n dong = (void*)new Dongle; // create c++ class instance\n return self; // return objc++ instance\n}\n\n- (void) generateKeyPair {\n Dongle* d = (Dongle*)dong;\n d-&gt;generateKeyPair(); // call c++ method\n}\n\n@end\n</code></pre>\n<p>Created a C++ header <code>Dongle.hpp</code></p>\n<pre class="lang-cpp prettyprint-override"><code>#ifndef Dongle_hpp\n#define Dongle_hpp\n\n#include &lt;stdio.h&gt;\n\n#endif /* Dongle_hpp */\n\nclass Dongle {\n public:\n void generateKeyPair();\n};\n</code></pre>\n<p>And then finally created the C++ file <code>Dongle.cpp</code></p>\n<pre class="lang-cpp prettyprint-override"><code>#include &quot;Include/pkcs.h&quot;\n\nvoid Dongle::generateKeyPair() {\n ...\n}\n</code></pre>\n<p>Note that, I have included a header file here. But I am getting an error:</p>\n<p><a href="https://pastebin.ubuntu.com/p/CCrsHKzmSz/" rel="nofollow noreferrer">Full Log</a></p>\n<pre class="lang-none prettyprint-override"><code>Undefined symbols for architecture arm64:\n &quot;_C_GenerateKeyPair&quot;, referenced from:\n Dongle::generateKeyPair() in Dongle.o\n &quot;_C_Login&quot;, referenced from:\n Dongle::generateKeyPair() in Dongle.o\n &quot;_C_Logout&quot;, referenced from:\n Dongle::generateKeyPair() in Dongle.o\n &quot;_fl&quot;, referenced from:\n FindObjects(unsigned long, CK_ATTRIBUTE*, unsigned long) in Dongle.o\n (maybe you meant: _CNIOBoringSSL_EVP_CIPHER_flags, _CNIOBoringSSL_X509_VERIFY_PARAM_set_flags , _c_nio_llhttp__internal__c_or_flags_15 , _CNIOBoringSSL_EC_GROUP_get_asn1_flag , _c_nio_llhttp__internal__c_test_flags_2 , _CNIOBoringSSL_BIO_flush , _CNIOBoringSSL_X509_VERIFY_PARAM_get_flags , _CNIOBoringSSL_X509_VERIFY_PARAM_clear_flags , _c_nio_llhttp__internal__c_test_lenient_flags , _CNIOBoringSSL_X509_STORE_CTX_set_flags , _c_nio_llhttp__internal__c_or_flags_3 , _c_nio_llhttp__internal__c_or_flags_6 , _CNIOBoringSSL_X509_STORE_set_flags , _$s7NIOCore15EventLoopFutureC8_flatMapyACyqd__GAExYbclF , _CNIOBoringSSL_BIO_clear_flags , _c_nio_llhttp__internal__c_test_lenient_flags_2 , _c_nio_llhttp__internal__c_or_flags_5 , _CNIOBoringSSL_EVP_CIPHER_CTX_flags , _CNIOBoringSSL_CBB_flush , _c_nio_llhttp__internal__c_test_flags_3 , _CNIOBoringSSL_BIO_get_retry_flags , _$s7NIOCore9EventLoopPAAE17_flatScheduleTask2in4file4line_AA9ScheduledVyqd__GAA10TimeAmountV_s12StaticStringVSuAA0bC6FutureCyqd__GyYbKctlF , _CNIOBoringSSL_SSL_CTX_flush_sessions , _c_nio_llhttp__internal__c_test_lenient_flags_7 , _$s7NIOCore9EventLoopPAAE11_flatSubmityAA0bC6FutureCyqd__GAGyYbclF , _CNIOBoringSSL_BIO_clear_retry_flags , _$s7NIOCore15EventLoopFutureC16_flatMapBlocking4onto_ACyqd__GSo17OS_dispatch_queueC_qd__xYbKctlF , _CNIOBoringSSL_EC_KEY_set_enc_flags , _CNIOBoringSSL_RSA_test_flags , _c_nio_llhttp__internal__c_or_flags_18 , _CNIOBoringSSL_CBB_flush_asn1_set_of , _CNIOBoringSSL_EC_GROUP_set_asn1_flag , _$s7NIOCore9EventLoopPAAE17_flatScheduleTask8deadline4file4line_AA9ScheduledVyqd__GAA11NIODeadlineV_s12StaticStringVSuAA0bC6FutureCyqd__GyYbKctlF , _c_nio_llhttp__internal__c_and_flags , _CNIOBoringSSL_EVP_MD_meth_get_flags , bssl::CNIOBoringSSL::dtls1_flush_flight(CNIOBoringSSL_ssl_st*) , _c_nio_llhttp__internal__c_test_flags , _CNIOBoringSSL_SSL_quic_max_handshake_flight_len , _CNIOBoringSSL_X509_get_extension_flags , _CNIOBoringSSL_EC_KEY_get_enc_flags , _$s7NIOCore15EventLoopFutureC21_flatMapErrorThrowingyACyxGxs0G0_pYbKcF , _CNIOBoringSSL_EVP_MD_CTX_set_flags , bssl::CNIOBoringSSL::tls_flush_pending_hs_data(CNIOBoringSSL_ssl_st*) , _c_nio_llhttp__internal__c_or_flags_16 , _CNIOBoringSSL_EVP_CIPHER_CTX_set_flags , _CNIOBoringSSL_EVP_MD_flags , _c_nio_llhttp__internal__c_test_flags_1 , _c_nio_llhttp__internal__c_test_lenient_flags_1 , _CNIOBoringSSL_EC_KEY_set_asn1_flag , _CNIOBoringSSL_X509_TRUST_get_flags , _$s7NIOCore15EventLoopFutureC13_flatMapErroryACyxGAEs0G0_pYbcF , _c_nio_llhttp__internal__c_test_lenient_flags_5 , _CNIOBoringSSL_BIO_set_flags , _c_nio_llhttp__internal__c_or_flags_4 , _c_nio_llhttp__internal__c_or_flags_1 , _CNIOBoringSSL_BIO_test_flags , bssl::CNIOBoringSSL::ssl_write_buffer_flush(CNIOBoringSSL_ssl_st*) , bssl::CNIOBoringSSL::tls_flush_flight(CNIOBoringSSL_ssl_st*) , _c_nio_llhttp__internal__c_or_flags , _CNIOBoringSSL_RSA_flags , _$s7NIOCore15EventLoopFutureC16_flatMapThrowingyACyqd__Gqd__xYbKclF , _$s7NIOCore15EventLoopFutureC14_flatMapResultyACyqd__Gs0G0Oyqd__qd_0_GxYbcs5ErrorRd_0_r0_lF )\nld: symbol(s) not found for architecture arm64\n</code></pre>\n<p>I am using and M1 Pro with Mac OS Ventura 13.3.1, Xcode 14.3 (14E222b) and Apple clang version 14.0.3 (Target: arm64-apple-darwin22.4.0).</p>\n"^^ . . . "0"^^ . . . "ffmpeg"^^ . . "0"^^ . . . "DocC (Apple documentation compiler) resize image"^^ . . . "2"^^ . "1"^^ . . "0"^^ . . . . . . . . . "@Cy-4AH Can you explain more on what you are suggesting? It seems like massive overkill to create a separate framework just for my objective-c code."^^ . . . "Xcode 14+ serviceSubscriberCellularProviders mobileCountryCode return numbers instead of string?"^^ . "flutter"^^ . . . "2"^^ . . . . . . . . . "0"^^ . "0"^^ . . "0"^^ . "0"^^ . . . . "0"^^ . . "@BerryBlue The Header file name must contain the name of your pod in a podspec file: s.name = "rtn-calculator" and a name of your class must be the same."^^ . "0"^^ . . . . . . . "<p>ALL,</p>\n<p>According to the <a href="https://developer.apple.com/documentation/appkit/nstoolbar/1516962-allowsusercustomization?language=objc" rel="nofollow noreferrer">documentation</a> the property is available since macOS 10.4.</p>\n<p>I'm on High Sierra 10.13 and getting an error:</p>\n<pre><code>../src/osx/cocoa/toolbar.mm:465:15: warning: instance method '-allowsUserCustomization:' not found (return type defaults to 'id')\n [-Wobjc-method-access]\n [self allowsUserCustomization:YES];\n ^~~~~~~~~~~~~~~~~~~~~~~\n../src/osx/cocoa/toolbar.mm:339:12: note: receiver is instance of class declared here\n@interface wxNSToolbar : NSToolbar\n ^\n../src/osx/cocoa/toolbar.mm:466:15: warning: instance method '-autosaveConfiguration:' not found (return type defaults to 'id')\n [-Wobjc-method-access]\n [self autosaveConfiguration:YES];\n ^~~~~~~~~~~~~~~~~~~~~\n../src/osx/cocoa/toolbar.mm:339:12: note: receiver is instance of class declared here\n@interface wxNSToolbar : NSToolbar\n ^\n</code></pre>\n<p>Could someone please explain what is going on?</p>\n<p>TIA!!</p>\n<p>[EDIT]</p>\n<p>I made a following implementation:</p>\n<pre><code>- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar\n{\n auto array = [NSArray arrayWithObjects:&amp;m_default[0] count:m_default.size()];;\n return [NSArray arrayWithObjects:&amp;m_default[0] count:m_default.size()];;\n}\n\n- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar\n{\n auto array = [NSArray arrayWithObjects:&amp;m_allowed[0] count:m_allowed.size()];;\n return [NSArray arrayWithObjects:&amp;m_allowed[0] count:m_allowed.size()];;\n}\n</code></pre>\n<p>However, after executing the line <code>auto array = ...</code>, program crashes.</p>\n<p>The variables m_allowed and m_default are of the type std::vector.</p>\n<p>The vectors do have elements in them. Running under lldb I can see their content.</p>\n<p>What am I doing wrong?</p>\n"^^ . . "1"^^ . . "<p>This is my first Swift project. I did some Objective-C in the past, but I'm only just starting with Swift. I want to use the ConnectSDK within this SwiftUI project. I've created a bridging header and add some imports for a few of the headers in the SDK. With only these changes, the project builds. I'm stuck on how to make calls to the SDK from SwiftUI. Here's what I have so far:</p>\n<pre><code>import SwiftUI\nimport ConnectSDK\n\nstruct ContentView: View {\n \n class ConnectSDKHelper {\n func showDevicePicker () {\n let dm = DiscoveryManager.shared()\n dm?.startDiscovery()\n dm?.devicePicker()\n }\n }\n\n var body: some View {\n VStack {\n \n \n }\n }\n}\n\n\nstruct ContentView_Previews: PreviewProvider {\n static var previews: some View {\n ContentView()\n }\n}\n</code></pre>\n<p>Through some googling, I found that I might need a helper class, hence ConnectSDKHelper, but I don't know if this even correct, or how to apply it if it is. If I try to initialize a ConnectSDK object,</p>\n<pre><code> var body: some View {\n let helper = ConnectSDKHelper()\n VStack {\n helper.showDevicePicker()\n \n }\n }\n\n</code></pre>\n<p>I get this error:</p>\n<pre><code>Type '()' cannot conform to 'View'\n</code></pre>\n<p>I could use a little help here, and if there is some tutorial on how to use ObjC frameworks in SwiftUI, please point me to them. The examples I've found are just a bit too trivial.</p>\n<p>Any help greatly appreciated.</p>\n"^^ . . . "cocoa"^^ . . "Objective-C "Messaging unqualified id" when trying to determine type of class from id"^^ . . . "0"^^ . . "How to use Inherited property for protocol compliance"^^ . . . . . . "AuthenticationData may be nil, or it may not be an object."^^ . "1"^^ . "0"^^ . "0"^^ . . "1"^^ . "I think I get it. All I need to do is override the NSToolbar delegate' function `toolbarAllowedItemIdentifiers`, whee I will get a toolbar pointer, call its `items()` method and then in the loop add each item identifier into the array that will be returned. Now the question is - how do I ge the toolbar from the delegate?"^^ . . . "<p>I have an Objective-C function <code>FirstFunc</code> in my project 'A' in Xcode.\nI have a Swift function <code>SecondFunc</code> in my project 'B' in Xcode.\nProjects 'A' and 'B' are in the Xcode workspace.\nHow I can call <code>SecondFunc</code> of project 'B' with my <code>FirstFunc</code> of project 'A'?</p>\n<p>Any ideas?</p>\n<p>I'm beginner of iOS development and don't have ideas about that.</p>\n"^^ . . . "How can i install gcc Or clang.It shows a whole big process invloving configuration and all. And i have windows"^^ . "0"^^ . . "Why do you want to override `runCustomizationPalette:?"^^ . "1"^^ . "3"^^ . . "2"^^ . . . . "1"^^ . . "1"^^ . "1"^^ . "carplay"^^ . "0"^^ . "Interfacing with C++ code in XCode (Swift) Project causing Linker error"^^ . "i tried this but did not get any success."^^ . . "core-telephony"^^ . "Not quite understand"^^ . "2"^^ . "What do those projects produce? frameworks? apps?"^^ . "2"^^ . . "1"^^ . . . . . . . "Got it. Can I override this: https://developer.apple.com/documentation/appkit/nstoolbar/1516979-runcustomizationpalette?language=objc, to run my code there?"^^ . "nsmutabledictionary"^^ . . . "ios"^^ . "swift-package-manager"^^ . . . . . . "@The Dreams Wind: Well, it's not like Willeke has ready-made answers for me. He just points me in the right direction with his questions so that I can figure out the rest on my own. Apparently, my questions are so badly formulated that it's not possible to provide an actual answer :( … but I can write up what I did to resolve my issues and put that in an answer."^^ . . "-2"^^ . . . . . . "callback is a block"^^ . "0"^^ . . . "<pre><code>require_relative '../node_modules/react-native/scripts/react_native_pods'\nrequire_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'\n\nplatform: ios, '12.4'\nprepare_react_native_project!\n pod 'mailcore2-ios'\npod 'GTMOAuth2',: modular_headers =&gt; true\npod 'GTMAppAuth',: modular_headers =&gt; true\npod 'YogaKit'\n\nflipper_config = ENV['NO_FLIPPER'] == &quot;1&quot; ? FlipperConfiguration.disabled : FlipperConfiguration.enabled\nuse_react_native!(: flipper_configuration =&gt; ENV['CI'] ?\n FlipperConfiguration.disabled :\n FlipperConfiguration.enabled,\n # Note: you also can pass extra params #FlipperConfiguration.enabled(['Debug', 'Staging.Debug'], {\n 'Flipper': '0.174.0'\n })\n)\nlinkage = ENV['USE_FRAMEWORKS]\nif linkage != nil\nPod::UI.puts &quot;Configuring Pod with #{linkage}ally linked Frameworks&quot;.green use_frameworks!: linkage =&gt; linkage.to_sym\nend\n\ntarget 'Mailcore'\ndo\n config = use_native_modules!\n use_frameworks!: linkage =&gt;: static\n\n$static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',\n 'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion',\n 'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',\n 'CocoaLibEvent', 'openssl-ios-bitcode', 'boost-for-react-native'\n]\n# Flags change depending on the env values.\nflags = get_default_flags()\n\nuse_react_native!(: path =&gt; config[: reactNativePath],\n # Hermes is now enabled by\n default.Disable by setting this flag to false.# Upcoming versions of React Native may rely on get_default_flags(), but # we make it explicit here to aid in the React Native upgrade process.: hermes_enabled =&gt; flags[: hermes_enabled],: fabric_enabled =&gt; flags[: fabric_enabled],\n # Enables Flipper.# # Note that\n if you have use_frameworks!enabled, Flipper will not work and # you should disable the next line.#: flipper_configuration =&gt; FlipperConfiguration.disabled,\n # An absolute path to your application root.: app_path =&gt; &quot;#{Pod::Config.instance.installation_root}/..&quot;\n)\n\ntarget 'MailcoreTests'\ndo\n inherit!: complete\n# Pods\nfor testing\nend\n\npost_install do | installer |\n react_native_post_install(\n installer,\n # Set `mac_catalyst_enabled`\n to `true` in order to apply patches # necessary\n for Mac Catalyst builds: mac_catalyst_enabled =&gt; false\n )\ninstaller.pods_project.build_configurations.each do | config |\n config.build_settings[&quot;EXCLUDED_ARCHS[sdk=iphonesimulator*]&quot;] = &quot;arm64&quot;\n __apply_Xcode_12_5_M1_post_install_workaround(installer)\nend\nend\nend\n</code></pre>\n<p>Here is my pod file, I am Stuck on <em>Could not build Objective-C module 'YogaKit'</em> was trying to do bridging for macos tried removing pod lock file , clean rebuild doesn't work.</p>\n<p>i am using use_frameworks!, so i disabled flipper that resolved Flipper issues but after that this issue occured.</p>\n"^^ . "1"^^ . . . "0"^^ . . "0"^^ . . . . "It's requirement. Is it possible to remove button ?"^^ . "Have you tried setting `needsDisplay` or `reloadDataForRowIndexes:columnIndexes:`?"^^ . "How to prevent capture with Objective-C on iOS"^^ . "0"^^ . "emoji"^^ . . . "ok, so looking at the actual build log rather than your summary it makes more sense, the code (which you've omitted) inside `Dongle::generateKeyPair` is referencing some other code which you've not provided a definition for"^^ . "<p>I've configured MySQL tables to store emojis with the following:</p>\n<pre><code>ALTER TABLE field_data_field_notes MODIFY field_notes_value \nVARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\n</code></pre>\n<p>That said, when I return strings to my app and try to display them in a UILabel, they appear like this:</p>\n<pre><code>Birthday emoji &amp;amp;#x1F388;\n</code></pre>\n<p>The emoji is a balloon. I've tried the below code to decode it and display the actual emoji, but it doesn't seem to work (e.g. the UILabel still displays the emoji &amp;amp text)? <strong>Note</strong>, I'm using Drupal and I have the 'Unicode' module enabled, so I imagine this is why the encoded format is &amp;#x1F388.</p>\n<pre><code>- (UITableViewCell *)tableView:(UITableView*)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {\n \n TimeTableViewCell *cell = (TimeTableViewCell *)[self.subtableView dequeueReusableCellWithIdentifier:WeeklyTableIdentifier];\n \n \n if (cell == nil)\n {\n NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@&quot;TimeTableViewCell&quot; owner:self options:nil];\n cell = [nib objectAtIndex:0];\n \n }\n \n NSString *encodedString =[self.sortedByTime valueForKey:@&quot;notes&quot;][indexPath.row];\n \n NSString *decodedString = [self decodeString:encodedString];\n \n \n cell.notes.text = decodedString;\n \n }\n\n\n- (NSString *)decodeString:(NSString *)string {\n // Decode HTML entities\n NSDictionary *entities = @{\n @&quot;&amp;amp;&quot; : @&quot;&amp;&quot;,\n @&quot;&amp;quot;&quot; : @&quot;\\&quot;&quot;,\n @&quot;&amp;apos;&quot; : @&quot;'&quot;,\n @&quot;&amp;lt;&quot; : @&quot;&lt;&quot;,\n @&quot;&amp;gt;&quot; : @&quot;&gt;&quot;,\n // Add more entity mappings as needed\n };\n\n NSMutableString *decodedString = [NSMutableString stringWithString:string];\n \n for (NSString *entity in entities) {\n NSString *replacement = [entities objectForKey:entity];\n [decodedString replaceOccurrencesOfString:entity withString:replacement options:NSLiteralSearch range:NSMakeRange(0, [decodedString length])];\n }\n \n // Decode Unicode escape sequences\n NSString *decodedUnicodeString = [decodedString stringByReplacingOccurrencesOfString:@&quot;&amp;#x&quot; withString:@&quot;\\\\U0000&quot;];\n NSData *data = [decodedUnicodeString dataUsingEncoding:NSUTF8StringEncoding];\n NSString *decodedEmojiString = [[NSString alloc] initWithData:data encoding:NSNonLossyASCIIStringEncoding];\n \n return decodedEmojiString ?: decodedString;\n}\n</code></pre>\n<p>Here is the code I'm using to save the string to my database:</p>\n<pre><code>NSDictionary *notesField = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:self.notesField.text, nil] forKeys:[NSArray arrayWithObjects:@&quot;value&quot;, nil]];\n NSDictionary *notesFieldcontent = [NSDictionary dictionaryWithObject:[NSArray arrayWithObject:notesField] forKey:@&quot;und&quot;];\n \n [self.nodeData setObject:notesFieldcontent forKey:@&quot;field_notes&quot;];\n \n [DIOSNode nodeSave:self.nodeData success:^(AFHTTPRequestOperation *operation, id responseObject) {\n \n \n } failure:^(AFHTTPRequestOperation *operation, NSError *error) {\n \n \n \n }];\n</code></pre>\n"^^ . . "How can I find the current screen scale of my CarPlay screen?"^^ . "0"^^ . . . "0"^^ . . . "visual-studio-code"^^ . "<p>I observed the usage of <a href="https://developer.apple.com/documentation/objectivec/1456712-objc_msgsend" rel="nofollow noreferrer"><code>objc_msgSend</code></a> to send messages to Objective-C IDs from pure C. The usage is not well documented but I found an example <a href="https://stackoverflow.com/a/72973624/16217248">here</a>.</p>\n<p>What I am confused by is the function pointer is casted to a different type with different arguments and/or return values and then called, given the macros in the linked answer:</p>\n<pre><code>#define msg ((id (*)(id, SEL))objc_msgSend)\n#define msg_int ((id (*)(id, SEL, int))objc_msgSend)\n#define msg_id ((id (*)(id, SEL, id))objc_msgSend)\n#define msg_ptr ((id (*)(id, SEL, void*))objc_msgSend)\n#define msg_cls ((id (*)(Class, SEL))objc_msgSend)\n#define msg_cls_chr ((id (*)(Class, SEL, char*))objc_msgSend)\n</code></pre>\n<p>However, I thought <a href="https://stackoverflow.com/q/188839/16217248">casting and calling a function pointer through a different signature was undefined behavior</a>. How could a C or even a C-callable function such as <code>objc_msgSend()</code> even be implemented as to be capable of dynamically expecting different argument lists and/or return types? How does that work out, and how does doing so evidently <strong>not</strong> invoke undefined behavior?</p>\n"^^ . . . "<p>A workaround I found is to first draw the image using a format that is opaque and uses a standard color range and then draw that new image in the PDF context.</p>\n<pre class="lang-swift prettyprint-override"><code>let image = ...\n\n// Re-draw image to adjust color range etc.\nlet format = UIGraphicsImageRendererFormat.default()\nformat.preferredRange = .standard\nformat.opaque = true\nformat.scale = 1 // non-retina\nlet newImage = UIGraphicsImageRenderer(size: image.size, format: format).image { _ in\n image.draw(in: CGRect(origin: .zero, size: image.size))\n}\n\n// Draw in PDF context\nnewImage.draw(in: CGRect(origin: .zero, size: newImage.size))\n</code></pre>\n"^^ . "0"^^ . . "5"^^ . . . "objective-c-category"^^ . "How strange - see updated again. This time I've included the code I'm using to save my string to the database (the string I use for testing is just the word Birthday with a balloon emoji in the self.notesField.text field). @HangarRash"^^ . . . . "I am using an external device farm. Its on a website and it will reproduce the same result. I am not sure how do I share the website with you? Can you try any iOS 14 device on aws? it will also give same result."^^ . "0"^^ . . . . "-1"^^ . . . . . . "1"^^ . . . . . . "0"^^ . . . . . . . . "0"^^ . . . . . . "0"^^ . "<p>I'm trying to understand why this crashes when I use <code>self.propName</code> notation but not when I use <code>_ivarName</code> notation. Happy to learn about another part of Objective-C. Thanks for the help!</p>\n<pre><code>// .h\n\n#import &lt;Foundation/Foundation.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface FOOMySpecialClass : NSObject\n\n@property (nonatomic, readonly, assign) BOOL isFoo;\n\n- (void)setIsFoo:(BOOL)isFoo;\n\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<pre><code>// .m\n\n#import &quot;FOOMySpecialClass.h&quot;\n\n@interface FOOMySpecialClass()\n@property (nonatomic, readwrite, assign) BOOL isFoo;\n@end\n\n@implementation FOOMySpecialClass\n\n- (void)setIsFoo:(BOOL)isFoo {\n self.isFoo = isFoo; // &lt;-- Crash here\n}\n\n@end\n</code></pre>\n<p>But, if I change the bool to the ivar, things work fine. I'm trying to understand why.</p>\n<pre><code>// .m\n\n#import &quot;FOOMySpecialClass.h&quot;\n\n@interface FOOMySpecialClass()\n@property (nonatomic, readwrite, assign) BOOL isFoo;\n@end\n\n@implementation FOOMySpecialClass\n\n- (void)setIsFoo:(BOOL)isFoo {\n _isFoo = isFoo; // &lt;-- Change here and no crash\n}\n\n@end\n</code></pre>\n<pre><code>// main.m\n\n#import &lt;Foundation/Foundation.h&gt;\n#import &quot;FOOMySpecialClass.h&quot;\n\nint main(int argc, const char * argv[]) {\n @autoreleasepool {\n FOOMySpecialClass *mySpecialClass = [[FOOMySpecialClass alloc] init];\n [mySpecialClass setIsFoo:YES];\n \n NSLog(@&quot;%@&quot;, mySpecialClass.isFoo ? @&quot;YES&quot; : @&quot;NO&quot;); // &lt;-- boom.\n }\n return 0;\n}\n</code></pre>\n"^^ . . . . "Cool!! Happy to hear that your issue got resolved. To make this helpful for others I added it as answer. Please accept & upvote the answer so It will be helpful for others"^^ . . . . . . "<p>I am trying to obtain the UUID of <code>/usr/lib/dyld</code> (dynamic linker) of an iOS device, but none of the methods I have tried seem to work. The dynamic linker image (MH_DYLINKER) is not even loaded in _dyld_get_image. I have attempted the following code:</p>\n<pre><code>- (NSString *) getDynamicLinkerUUID {\n const struct mach_header *dyldHeader = NULL;\n for (uint32_t i = 0; i &lt; _dyld_image_count(); i++) {\n const struct mach_header *header = _dyld_get_image_header(i);\n if (header-&gt;filetype == MH_DYLINKER) {\n dyldHeader = header;\n break;\n }\n }\n \n if (!dyldHeader)\n return @&quot;Cannot found header: MH_DYLINKER&quot;;\n \n BOOL is64bit = dyldHeader-&gt;magic == MH_MAGIC_64 || dyldHeader-&gt;magic == MH_CIGAM_64;\n uintptr_t cursor = (uintptr_t)dyldHeader + (is64bit ? sizeof(struct mach_header_64) : sizeof(struct mach_header));\n const struct segment_command *segmentCommand = NULL;\n for (uint32_t i = 0; i &lt; dyldHeader-&gt;ncmds; i++, cursor += segmentCommand-&gt;cmdsize) {\n segmentCommand = (struct segment_command *)cursor;\n if (segmentCommand-&gt;cmd == LC_UUID) {\n const struct uuid_command *uuidCommand = (const struct uuid_command *)segmentCommand;\n const uint8_t *uuid = uuidCommand-&gt;uuid;\n NSString* uuidString = [NSString stringWithFormat:@&quot;%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X&quot;,\n uuid[0], uuid[1], uuid[2], uuid[3],\n uuid[4], uuid[5], uuid[6], uuid[7],\n uuid[8], uuid[9], uuid[10], uuid[11],\n uuid[12], uuid[13], uuid[14], uuid[15]];\n NSLog(@&quot;UUID: %@&quot;, uuidString);\n return [uuidString lowercaseString];\n }\n }\n return @&quot;&quot;;\n}\n</code></pre>\n<p>This always return &quot;Cannot found header: MH_DYLINKER&quot;</p>\n<p>Please let me know how can I get it.</p>\n"^^ . "Sorry I don't have access to aws device farm. And I don't understand how them launching apps actually differs. Other than giving one last try with x19 I don't have anything else to recommend."^^ . . . . "<p>ALL,</p>\n<p>I'm trying to add the toolbar customization functionality to my program.</p>\n<p>Everything works when the toolbar is horizontal on on top.</p>\n<p>When the toolbar is vertical on and the left, calling <a href="https://developer.apple.com/documentation/appkit/nstoolbar/1516979-runcustomizationpalette?language=objc" rel="nofollow noreferrer">https://developer.apple.com/documentation/appkit/nstoolbar/1516979-runcustomizationpalette?language=objc</a> doesn't have any effect.</p>\n<p>Is there a way to mitigate it?</p>\n"^^ . "Post a [mre] please."^^ . . . . "async-await"^^ . . . "<p>I'm trying to add a QR code scanner to my <code>iOS</code> project written using <code>Qt Quick</code>.</p>\n<p>I've found <a href="https://github.com/yannickl/QRCodeReaderViewController" rel="nofollow noreferrer">this example</a> on how to achieve it using native APIs.</p>\n<p>I've added QRCodeReaderViewController/* files to my project and trying to build it. Getting weird compilation errors. I suspect some Xcode build settings are required to be enabled, but I don't know how to do it using <code>qmake</code>.</p>\n<pre><code>../ios/QRCodeReaderViewController/QRCodeReaderViewController.m:46:1: error: cannot synthesize weak property in file using manual reference counting\n @implementation QRCodeReaderViewController\n\n../ios/QRCodeReaderViewController/QRCodeReaderViewController.m:107:5: error: cannot create __weak reference in file using manual reference counting\n __weak __typeof__(self) weakSelf = self;\n</code></pre>\n"^^ . "crashlytics"^^ . "3"^^ . . . . "0"^^ . . "0"^^ . . "CAEmitterLayer works for a while, then stops diplaying. Objective C"^^ . . . . . "0"^^ . . . . "As per his/her requirement he/she needs to fire the button action of other ViewController which was getting added only as a subview, so the answer I have given will work to fire the childController's action. I did not mention "didMoveToParentVC" method and framing/constraints of childVC, etc. As the answer is specific to fire the other controller's action. Please don't be judgemental brother"^^ . . . . . . . . . . . . "4"^^ . "2"^^ . "<p>I am doing a project in Objective-C so when I create a custom xib and connect a couple of outlets, it gives me the error:</p>\n<blockquote>\n<p>2023-06-07 22:50:32.194106-0700 ProturisApp[91070:2437111] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[&lt;InputCollectionViewCell 0x10403ee78&gt; setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key brickWall.'</p>\n</blockquote>\n<p>These are my classes and my extension:</p>\n<pre><code>@implementation UIView (NIBLoader)\n+ (instancetype)fromNib {\n return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:self options:nil] objectAtIndex:0];\n}\n\n@end\n</code></pre>\n<pre><code>#import &quot;InputCollectionViewCell.h&quot;\n#define IDENTIFFIER @&quot;InputCollectionViewCell&quot;\n\n@implementation InputCollectionViewCell\n\n-(instancetype)initWithFrame:(CGRect)frame\n{\n self = [super initWithFrame:frame];\n if (self) {\n [self loadFromNib];\n \n }\n return self;\n}\n- (instancetype)initWithCoder:(NSCoder *)coder\n{\n self = [super initWithCoder:coder];\n if (self) {\n [self loadFromNib];\n self.userInteractionEnabled = YES;\n \n // Initialize what is needed\n }\n return self;\n}\n\n+ (NSString *) identifier {\n return IDENTIFFIER;\n}\n\n\n- (void)loadFromNib {\n UIView *nibView = [[self class] fromNib];\n if (nibView) {\n nibView.frame = self.bounds;\n nibView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;\n [self addSubview:nibView];\n nibView.backgroundColor = [UIColor redColor];\n }\n}\n\n\n@end\n</code></pre>\n<pre><code>#import &quot;MainViewController.h&quot;\n\n@interface MainViewController ()\n\n@end\n\n@implementation MainViewController\n@synthesize menuCollectionView;\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n \n [self.menuCollectionView registerClass:[InputCollectionViewCell class] forCellWithReuseIdentifier:[InputCollectionViewCell identifier]];\n\n menuCollectionView.delegate = self;\n menuCollectionView.dataSource = self;\n}\n- (void)viewWillDisappear:(BOOL)animated\n{\n [super viewWillDisappear:animated];\n [InputCollectionViewCell dealloc];\n}\n\n\n- (nonnull __kindof UICollectionViewCell *)collectionView:(nonnull UICollectionView *)collectionView cellForItemAtIndexPath:(nonnull NSIndexPath *)indexPath {\n // Dequeue a reusable cell from the collection view.\n InputCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:[InputCollectionViewCell identifier] forIndexPath:indexPath];\n [cell addBorderAndShadow];\n\n // Configure the cell with data for the index path.\n // MyData *data = self.myDataArray[indexPath.item];\n // [cell configureWithData:data];\n\n // Return the configured cell.\n return cell;\n}\n</code></pre>\n<p><img src="https://i.sstatic.net/zYlJS.png" alt="enter image description here" /></p>\n"^^ . . "0"^^ . "1"^^ . "0"^^ . . . "<p>Yes, you've got the right principles.</p>\n<p>You don't need the <code>strong</code>, since that's an attribute used for a synthesized setter telling it that it should retain a strong reference to anything passed into the setter. In this case it's not doing anything since class properties are never synthesized automatically, and it's marked as <code>readonly</code> so <code>strong</code> wouldn't have any effect anyways.</p>\n<p>Your code looks good. <code>dispatch_once</code> is the preferred way of instantiating a singleton.</p>\n<p>As far as any improvements, you can add a message to the unavailable attribute: <code>__attribute__((unavailable(&quot;Use FOOMyManager.defaultManager&quot;)))</code>. I wouldn't say it's necessary or adds much since it's clear from the header file what to do, but I'm including it here as an option.</p>\n"^^ . "0"^^ . . . "<p>A <code>WKWebView</code> is not as simple as a scroll view holding processed html. If you use <code>Debug View Hierarchy</code> you'll see how complex it can be.</p>\n<p>I would suggest:</p>\n<ul>\n<li>add the &quot;bottomView&quot; to the web view (<strong>not</strong> to its scroll view)</li>\n<li>constrain the bottom of the bottomView to the bottom of the web view's frame</li>\n<li>implement <code>scrollViewDidScroll</code> and update the <code>.constant</code> to position the bottomView</li>\n</ul>\n<p>You'll want to keep bottomView hidden until the page has loaded, set <code>clipsToBounds</code> on the web view so the bottomView is not visible outside the frame, and set the web view's <code>.scrollView.contentInset</code> to allow for the extra space to show the bottomView.</p>\n<p>Here's a quick example, using this page as the web view's url:</p>\n<p><strong>ViewController.h</strong></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\n@interface ViewController : UIViewController\n@end\n</code></pre>\n<p><strong>ViewController.m</strong></p>\n<pre><code>#import &lt;WebKit/WebKit.h&gt;\n#import &quot;ViewController.h&quot;\n\n@interface ViewController () &lt;UIScrollViewDelegate, WKNavigationDelegate&gt;\n{\n WKWebView *webView;\n UILabel *bottomView;\n NSLayoutConstraint *bottomC;\n CGFloat bottomViewHeight;\n}\n@end\n\n@implementation ViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n \n webView = [WKWebView new];\n\n webView.translatesAutoresizingMaskIntoConstraints = NO;\n [self.view addSubview:webView];\n\n bottomView = [UILabel new];\n bottomView.text = @&quot;Bottom View&quot;;\n bottomView.textAlignment = NSTextAlignmentCenter;\n bottomView.backgroundColor = UIColor.greenColor;\n\n bottomView.translatesAutoresizingMaskIntoConstraints = NO;\n [webView addSubview:bottomView];\n \n bottomViewHeight = 60.0;\n \n UILayoutGuide *g = self.view.safeAreaLayoutGuide;\n \n [NSLayoutConstraint activateConstraints:@[\n \n [webView.topAnchor constraintEqualToAnchor:g.topAnchor constant:40.0],\n [webView.leadingAnchor constraintEqualToAnchor:g.leadingAnchor constant:8.0],\n [webView.trailingAnchor constraintEqualToAnchor:g.trailingAnchor constant:-8.0],\n [webView.bottomAnchor constraintEqualToAnchor:g.bottomAnchor constant:-40.0],\n \n [bottomView.leadingAnchor constraintEqualToAnchor:webView.leadingAnchor constant:0.0],\n [bottomView.trailingAnchor constraintEqualToAnchor:webView.trailingAnchor constant:0.0],\n [bottomView.heightAnchor constraintEqualToConstant:bottomViewHeight],\n\n ]];\n \n // this will be changed when the webView scrolls\n bottomC = [bottomView.bottomAnchor constraintEqualToAnchor:webView.bottomAnchor constant:0.0];\n bottomC.active = YES;\n\n // we need to allow the web view to scroll up enough to &quot;add&quot; the bottom view at the bottom\n webView.scrollView.contentInset = UIEdgeInsetsMake(0, 0, bottomViewHeight, 0);\n\n // delegates\n webView.scrollView.delegate = self;\n webView.navigationDelegate = self;\n\n // we don't want bottom view showing outside the bounds of the web view\n webView.clipsToBounds = YES;\n\n // start with bottom view hidden\n bottomView.hidden = YES;\n \n NSURL *url = [[NSURL alloc] initWithString: @&quot;https://stackoverflow.com/questions/76536415/constraints-a-view-to-the-bottom-of-wkwebview-scollview&quot;];\n NSURLRequest *request = [[NSURLRequest alloc] initWithURL: url\n cachePolicy: NSURLRequestUseProtocolCachePolicy\n timeoutInterval: 5];\n [webView loadRequest: request];\n \n}\n\n- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {\n // webview has &quot;finished loading&quot;\n bottomC.constant = webView.scrollView.contentSize.height - webView.scrollView.contentOffset.y - webView.frame.size.height + 60.0;\n bottomView.hidden = NO;\n}\n- (void)scrollViewDidScroll:(UIScrollView *)scrollView {\n // change the bottomView's bottom constraint constant so it moves with the\n // bottom of the web view's content\n bottomC.constant = scrollView.contentSize.height - scrollView.contentOffset.y - webView.frame.size.height + 60.0;\n}\n\n@end\n</code></pre>\n<p>It will be a pretty tall page, but once you scroll all the way to the bottom you will see the green label:</p>\n<p><a href="https://i.sstatic.net/s1u6S.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/s1u6S.png" alt="enter image description here" /></a></p>\n<p>Note: as I'm sure you know, web pages can be very dynamic, doing things like adding more content as you scroll. So, this may or may not be suitable -- or may need some additional logic to handle dynamic content.</p>\n"^^ . "How to discover already connected devices using the ExternalAccessoryFramework on iOS for a non-MFI Bluetooth device?"^^ . . . . . . "- UPDATE: The original premain function code you gave works on iOS 12, iOS 11 as well. It only gives uuid for libdyld.dylib in iOS 13 & 14 only."^^ . . "So, where is `brickWall` outlet?"^^ . . "0"^^ . . . . "Bottom line, if v2 of this API is using asynchronous API, then you really should refactor your Objective-C code to follow completion handler patterns, as painful as that seems at this point (or start to refactor that code to Swift using Swift concurrency, which is likely even more painful). ☹️ That having been said, if (and only if) that Objective-C code is off the main thread, you can entertain semaphores within that Objective-C code (though that has its own risks), but it's impossible to advise you without a more complete example."^^ . . . . "xcode"^^ . . . "3"^^ . . "@lazarevzubov I did look through those. Unfortunately, none of them use @ property for this. I'd like to know if the pattern I'm using with @ property has any downfalls."^^ . . "Add a `NSLog(@"Calling setIsFoo:");` at the first line of the method, you'll see: infinite loop, you're calling yourself each time."^^ . . "Wow, that solved it, thank you. Why is it that that worked? Does assigning a subView automatically change ownership or where events are routed?\n\nTwo days into iOS development here so pardon my ignorance lol"^^ . . . "0"^^ . . . . . "file-not-found"^^ . . . "swiftui"^^ . . "0"^^ . "<p>I add some Objective-C libraries to my SwiftUI project using bridging header, Now am facing an error:</p>\n<p><em>Build input file cannot be found: '/Users/.../../QPos-iOS/QPos-iOS-Bridging-Header'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?</em></p>\n<p><strong>Steps That I have tried:</strong></p>\n<ul>\n<li>Create a Bridging Header File and (Import Objective-C files in Bridging Header File.)</li>\n<li>Target -&gt; Build Settings -&gt; Swift Compiler - General -&gt; Ojbective-C Bridging Header (Put Bridging Header Path here)</li>\n<li>Precompile Bridging Header: Yes</li>\n<li>Clean Project.</li>\n<li>Delete Derived Data</li>\n<li>Restart Xcode</li>\n<li>Restart Machine.</li>\n</ul>\n<p>but no luck, any help would be greatly appreciated.</p>\n"^^ . "If you rename `- (void)setIsFoo:(BOOL)isFoo;` with `- (void)setIsFoo2:(BOOL)isFoo;`, and do `[mySpecialClass setIsFoo2:YES];`, there won't be a loop anymore. But `self.isFoo = someValue` is equal to `[self setIsFoo:someValue]`."^^ . "<p>The <a href="https://developer.apple.com/documentation/localauthentication/lacontext/2867583-biometrytype?language=objc" rel="nofollow noreferrer"><code>biometryType</code></a> property of the <code>LAContext</code> object tells you what type of biometric authentication is available on the current device:</p>\n<pre><code>LAContext *myContext = [[LAContext alloc] init];\nswitch (myContext.biometryType) {\n case LABiometryTypeFaceID:\n // Do something with Face ID\n break;\n\n case LABiometryTypeTouchId:\n // Do something with Touch ID\n break;\n\n case LABiometryTypeNone:\n // Biometrics are not available\n}\n</code></pre>\n"^^ . . . . . "You need to use `registerNib:` and remove all that `fromNib`, `loadFromNib` garbage."^^ . "swift"^^ . . . "Now I've updated all the code and create ```CGError error;``` and passed it to ```OSStatus errorCode = SecTrustEvaluateWithError(serverTrust, *error);\n``` but getting this ```Indirection requires pointer operand ('int32_t' (aka 'int') invalid)```"^^ . "2"^^ . "0"^^ . . "<p>Not able to understand the issue. Any help is appreciated</p>\n<pre><code> Fatal Exception: NSInvalidArgumentException\n0 CoreFoundation 0x9e88 __exceptionPreprocess\n1 libobjc.A.dylib 0x178d8 objc_exception_throw\n2 CoreData 0xd988 _PFRetainedObjectIDCore\n3 CoreData 0x600fc -[NSManagedObjectContext objectWithID:]\n4 CoreData 0x5a4c -[NSFetchedResultsController _preprocessDeletedObjects:deletesInfo:sectionsWithDeletes:]\n5 CoreData 0x5ec08 __82-[NSFetchedResultsController(PrivateMethods) _core_managedObjectContextDidChange:]_block_invoke\n6 CoreData 0x837e8 developerSubmittedBlockToNSManagedObjectContextPerform\n7 CoreData 0x83338 -[NSManagedObjectContext performBlockAndWait:]\n8 CoreData 0x61c98 -[NSFetchedResultsController _core_managedObjectContextDidChange:]\n9 CoreFoundation 0x37404 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__\n10 CoreFoundation 0xde474 ___CFXRegistrationPost_block_invoke\n11 CoreFoundation 0xc1724 _CFXRegistrationPost\n12 CoreFoundation 0x4ba08 _CFXNotificationPost\n13 Foundation 0x5cffc -[NSNotificationCenter postNotificationName:object:userInfo:]\n14 CoreData 0x4cae4 -[NSManagedObjectContext _postObjectsDidChangeNotificationWithUserInfo:]\n15 CoreData 0x11f470 -[NSManagedObjectContext(_NSInternalNotificationHandling) _processChangedStoreConfigurationNotification:]\n16 CoreData 0x11d3d4 __95-[NSManagedObjectContext(_NSInternalNotificationHandling) _sendOrEnqueueNotification:selector:]_block_invoke\n17 CoreData 0x837e8 developerSubmittedBlockToNSManagedObjectContextPerform\n18 CoreData 0x83338 -[NSManagedObjectContext performBlockAndWait:]\n19 CoreData 0x8ed24 -[NSManagedObjectContext(_NSInternalNotificationHandling) _storeConfigurationChanged:]\n20 CoreFoundation 0x37404 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__\n21 CoreFoundation 0xde474 ___CFXRegistrationPost_block_invoke\n22 CoreFoundation 0xc1724 _CFXRegistrationPost\n23 CoreFoundation 0x4ba08 _CFXNotificationPost\n24 Foundation 0x5cffc -[NSNotificationCenter postNotificationName:object:userInfo:]\n25 CoreData 0x10f3b8 -[NSPersistentStoreCoordinator _postStoresChangedNotificationsForStores:changeKey:options:]\n26 CoreData 0x12ae38 __61-[NSPersistentStoreCoordinator _removePersistentStore:error:]_block_invoke\n27 CoreData 0xdf840 gutsOfBlockToNSPersistentStoreCoordinatorPerform\n28 CoreData 0x1935b4 _perform\n29 CoreData 0x122360 -[NSPersistentStoreCoordinator _removePersistentStore:error:]\n30 CoreData 0x10d914 __129-[NSPersistentStoreCoordinator(_NSPersistentStoreCoordinatorPrivateMethods) _destroyPersistentStoreAtURL:withType:options:error:]_block_invoke\n31 CoreData 0xdf840 gutsOfBlockToNSPersistentStoreCoordinatorPerform\n32 libdispatch.dylib 0x3fdc _dispatch_client_callout\n33 libdispatch.dylib 0x13574 _dispatch_lane_barrier_sync_invoke_and_complete\n34 CoreData 0x1935a0 _perform\n35 CoreData 0x129cc8 -[NSPersistentStoreCoordinator(_NSPersistentStoreCoordinatorPrivateMethods) _destroyPersistentStoreAtURL:withType:options:error:]\n36 ProjectName 0x4741dc -[CoreDataAccessBase destroyPersistentAndResetCoreDataObjects] + 234 (CoreDataAccessBase.m:234)\n37 libdispatch.dylib 0x3fdc _dispatch_client_callout\n38 libdispatch.dylib 0x1364c _dispatch_async_and_wait_invoke\n39 libdispatch.dylib 0x3fdc _dispatch_client_callout\n40 libdispatch.dylib 0x127f4 _dispatch_main_queue_drain\n41 libdispatch.dylib 0x12444 _dispatch_main_queue_callback_4CF\n42 CoreFoundation 0x9a6f8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__\n43 CoreFoundation 0x7c058 __CFRunLoopRun\n44 CoreFoundation 0x80ed4 CFRunLoopRunSpecific\n45 GraphicsServices 0x1368 GSEventRunModal\n46 UIKitCore 0x3a23d0 -[UIApplication _run]\n47 UIKitCore 0x3a2034 UIApplicationMain\n48 ProjectName 0x3aecc main + 14 (main.m:14)\n49 ??? 0x1e6344960 (Missing)\n</code></pre>\n<pre><code>- (void) destroyPersistentAndResetCoreDataObjects\n{\n @synchronized(self)\n {\n NSArray *stores = [__persistentStoreCoordinator persistentStores];\n for(NSPersistentStore *store in stores) {\n @try {\n [self.persistentStoreCoordinator destroyPersistentStoreAtURL:store.URL withType:NSSQLiteStoreType options:self.options error:nil];\n } @catch (NSException *exception) {\n VLogDebug(@&quot;destroyPersistentAndResetCoreDataObjects%@&quot;,[exception debugDescription]);\n }\n [[NSFileManager defaultManager] removeItemAtPath:store.URL.path error:nil];\n }\n [self resetAllCoreDataObjects];\n }\n}\n</code></pre>\n"^^ . "Subclass `NSToolBarItem` and override `toolTip`?"^^ . . "0"^^ . . "3"^^ . . "2"^^ . "1"^^ . . "0"^^ . . . . "@KMehta what about this: https://stackoverflow.com/questions/12631705/singleton-property-access-in-objective-c ? does it help?"^^ . "That's annoying. Thanks for your help."^^ . . . "2"^^ . . . . "0"^^ . . . . "https://developer.apple.com/documentation/localauthentication/lacontext/2867583-biometrytype"^^ . . "0"^^ . . . . . . "nstoolbar"^^ . . . . . . . "0"^^ . . . "Sorry, I added the viewDidLoad that calls the setup of the emitterlayer and cells. the two other functions, Start & StopFW are conntected to a button to trigger each function start and stop. Hope this helps. Let me know if you need anything else."^^ . . "mac-catalyst"^^ . "2"^^ . . . . . . . . "<p>So for anyone who's looking for such kind of implementation to be used:</p>\n<h3>1. Write code in Objective-C that provides a functionality you want (in my case, creating a window in macOS):</h3>\n<h4>WindowBuilderObjC.h</h4>\n<pre><code>#ifndef WindowBuilderObjC_h\n#define WindowBuilderObjC_h\n\n#import &lt;Cocoa/Cocoa.h&gt;\n\n@interface WindowBuilderObjC : NSObject\n\n- (void)buildWindowWithWidth:(int)width height:(int)height;\n\n@end\n\n@interface WindowDelegate : NSObject &lt;NSWindowDelegate&gt;\n@end\n\n#endif /* WindowBuilderObjC_h */\n</code></pre>\n<h4>WindowBuilderObjC.mm</h4>\n<pre><code>#import &quot;WindowBuilderObjC.h&quot;\n\n@implementation WindowBuilderObjC\n\n- (void)buildWindowWithWidth:(int)width height:(int)height\n{\n @autoreleasepool \n {\n [NSApplication sharedApplication];\n [[NSApplication sharedApplication] activateIgnoringOtherApps:YES];\n\n NSRect frame = NSMakeRect(0, 0, 800, 600);\n NSUInteger style = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable;\n NSWindow *window = [[NSWindow alloc] initWithContentRect:frame styleMask:style backing:NSBackingStoreBuffered defer:NO];\n [window setTitle:@&quot;My Window&quot;];\n [window center];\n \n WindowDelegate *delegate = [[WindowDelegate alloc] init];\n [window setDelegate:delegate];\n \n [window makeKeyWindow];\n [window orderFrontRegardless];\n\n [NSApp run];\n }\n}\n\n@end\n\n@implementation WindowDelegate\n\n- (BOOL)windowShouldClose:(id)sender\n{\n [NSApp terminate:nil];\n return YES;\n}\n\n@end\n</code></pre>\n<h3>2. Create a file (still in Objective-C) with C++ headers using keyword <em>extern &quot;C&quot;</em> (so they can be used in C++ code):</h3>\n<h4>WindowBuilderObjCWrapper.mm</h4>\n<pre><code>extern &quot;C&quot;\n{\n#import &quot;WindowBuilderObjC.h&quot;\n}\n\nextern &quot;C&quot; WindowBuilderObjC *createWindowBuilder()\n{\n WindowBuilderObjC* builder = [[WindowBuilderObjC alloc] init];\n\n return builder;\n}\n\nextern &quot;C&quot; void deleteWindowBuilder(WindowBuilderObjC *builder)\n{\n [builder dealloc];\n}\n\nextern &quot;C&quot; void buildWindow(WindowBuilderObjC *builder, int* width, int* height)\n{ \n [builder buildWindowWithWidth:*width height:*height];\n}\n</code></pre>\n<h3>3. Modify CMakeLists.txt to create a module library from your Objective-C files:</h3>\n<h4>CMakeLists.txt</h4>\n<pre><code>add_library(WindowBuilderObjCLib MODULE\n src/Utils/WindowBuilder/macOS/Objective-C/WindowBuilderObjCWrapper.mm\n)\n\ntarget_sources(WindowBuilderObjCLib\n PRIVATE\n src/Utils/WindowBuilder/macOS/Objective-C/WindowBuilderObjC.h\n src/Utils/WindowBuilder/macOS/Objective-C/WindowBuilderObjC.mm\n)\n\ntarget_link_libraries(WindowBuilderObjCLib\n PRIVATE &quot;-framework Cocoa&quot;\n PRIVATE &quot;-framework Foundation&quot;\n PRIVATE &quot;-framework AppKit&quot;\n)\n\n# Set the language for the library to Objective-C++\nset_target_properties(WindowBuilderObjCLib PROPERTIES\n LINKER_LANGUAGE &quot;CXX&quot;\n XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES\n XCODE_ATTRIBUTE_CLANG_ENABLE_MODULES YES\n XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_WEAK YES\n)\n</code></pre>\n<h3>4. In C++ follow these steps:</h3>\n<h3>4.1. Open the library using <em>dlfcn.h</em> lib:</h3>\n<pre><code>// Open the library.\nlib_handle = dlopen(&quot;./build/libWindowBuilderObjCLib.so&quot;, RTLD_LOCAL);\nif (!lib_handle)\n{\n exit(EXIT_FAILURE);\n}\n</code></pre>\n<h3>4.2. (Optional) Use <em>boost</em> lib to check if the opened library contains the required function signatures:</h3>\n<pre><code>// Boost for lib info\n#include &lt;boost/dll/library_info.hpp&gt;\n\nstatic void PrintSymbols(std::string libPath)\n{\n // Class `library_info` can extract information from a library\n boost::dll::library_info inf(libPath);\n\n // Getting exported symbols\n std::vector&lt;std::string&gt; exports = inf.symbols();\n\n // Printing symbols\n for (std::size_t j = 0; j &lt; exports.size(); ++j)\n {\n std::cout &lt;&lt; exports[j] &lt;&lt; std::endl;\n }\n}\n</code></pre>\n<h3>4.3. (Optional) Create method signatures in the C++ class that is going to use the library's functions (you can also build up your own implementation based on the signatures):</h3>\n<pre><code>// Objective-C wrapper signatures\ntypedef void (*buildWindowObjC)(void *builder, int *width, int *height);\ntypedef void *(*createWindowBuilderObjC)();\ntypedef void *(*deleteWindowBuilderObjC)(void *builder);\n\n// Objective-C handlers\ncreateWindowBuilderObjC createWindowBuilderObjCHandler;\nbuildWindowObjC buildWindowObjCHandler;\ndeleteWindowBuilderObjC deleteWindowBuilderObjCHandler;\n\n// Objective-C Window Builder Instance\nvoid *windowBuilderObjC;\n</code></pre>\n<h3>4.4. Get functions from the library and cast it to the suitable signature:</h3>\n<pre><code>// Load functions\ncreateWindowBuilderObjCHandler = reinterpret_cast&lt;createWindowBuilderObjC&gt;(dlsym(lib_handle, &quot;createWindowBuilder&quot;));\nif (!createWindowBuilderObjCHandler)\n{\n exit(EXIT_FAILURE);\n}\n\nbuildWindowObjCHandler = reinterpret_cast&lt;buildWindowObjC&gt;(dlsym(lib_handle, &quot;buildWindow&quot;));\nif (!buildWindowObjCHandler)\n{\n exit(EXIT_FAILURE);\n}\n\ndeleteWindowBuilderObjCHandler = reinterpret_cast&lt;deleteWindowBuilderObjC&gt;(dlsym(lib_handle, &quot;deleteWindowBuilder&quot;));\nif (!deleteWindowBuilderObjCHandler)\n{\n exit(EXIT_FAILURE);\n}\n</code></pre>\n<h3>4.5. Use the Objective-C functions (via C++ headers) from the imported library:</h3>\n<pre><code>windowBuilderObjC = createWindowBuilderObjCHandler();\n\nint width = size.GetWidth();\nint height = size.GetHeight();\nbuildWindowObjCHandler(windowBuilderObjC, &amp;width, &amp;height);\n\n// ...\n\ndeleteWindowBuilderObjCHandler(windowBuilderObjC);\n\n// ...\n</code></pre>\n<p>Thats it. Hope it can be useful for someone.</p>\n"^^ . "Build input file cannot be found: After Creating Bridging Header"^^ . . . . . . "Is there no other way? Would be grateful if you could find a way."^^ . . . "0"^^ . "0"^^ . "1"^^ . . . "Also, apart from `init` don't forget to make `new` `NS_UNAVAILABLE`, too."^^ . . . . . "0"^^ . "firebase"^^ . "Only iOS 14 devices i am testing are returnning /usr/lib/system/libdyld.dylib. I ran on one iPhone 12 ios 14.8 and it didnt return /usr/lib/dyld either."^^ . . "3"^^ . . "0"^^ . . "file"^^ . . "0"^^ . . . "7"^^ . "@Andrey neither of those answer the question. They're both about calling a property on a singleton, which is different from accessing the singleton instance as a class property of an interface."^^ . . "The minimal reproducible example is the above code. The functions "setupEmitter" and "setupFireWorkEmitterCells" setup the animation. The other two snippets of code "StartFW" and "StopFW" start and stop the animation."^^ . . "<p>As it's stated in the <a href="https://developer.apple.com/library/archive/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011226-CH1-SW15" rel="nofollow noreferrer">documentation</a> (unfortunately it's in &quot;Documentation Archive&quot;, but I hope it still works), you can try this in your <strong>.pro</strong> file:</p>\n<pre><code>ios {\n QMAKE_OBJECTIVE_CFLAGS += -fobjc-arc\n}\n</code></pre>\n<p>If this doesn't work, you may also try to set <code>QMAKE_IOS_DEPLOYMENT_TARGET</code> to something like <code>11.0</code> or higher, because there might be <a href="https://developer.apple.com/forums/thread/725300" rel="nofollow noreferrer">issues</a> with newer compiler versions.</p>\n"^^ . "caemittercell"^^ . "Thanks all. I ended up using modified version of this code https://gist.github.com/sainecy/4366a1b99c7317fac63bfeb19d1cfab2 that has been posted https://stackoverflow.com/questions/70962534/swift-await-async-how-to-wait-synchronously-for-an-async-task-to-complete. That was enough to test the framework"^^ . "I haven't found anything yet. There is `CGSOrderWindow` and `CGSOrderFrontConditionally` but if these functions worked at some point in earlier macOS releases, I sadly cannot figure out how to get them to work now."^^ . . "0"^^ . "0"^^ . . . "0"^^ . . "The animation displays fine for a short time, then it does not display at all. This behavior only seems to happen when I combine both subcell1_1 AND subcell1_2 in the emitterCells array. If I use only one of the subcells, then the animation displays all the time as it is supposed to when it is called. I am not sure why the odd behavior is occurring when both subcell1_1 AND subcell1_2 are combined."^^ . . . . . . "2"^^ . "1"^^ . . "0"^^ . . . "1"^^ . "<p>The solution turned out to be quite simple:</p>\n<pre><code>NSURL *url = = [NSURL fileURLWithPath:@&quot;/private/var/mobile/Containers/Shared/AppGroup/61894F8B-0001-40C2-856E-F30D4663F7A7/File Provider Storage/Downloads/Instrukcja_Welcome_to.pdf&quot;];\nBOOL isAccessGranted = [url startAccessingSecurityScopedResource]; \nif (isAccessGranted) {\n NSDictionary *fileAttributes = [fileManager attributesOfItemAtPath:url.relativePath error:&amp;error];\n NSNumber *fileSize = fileAttributes[NSFileSize];\n}\n[url stopAccessingSecurityScopedResource];\n</code></pre>\n<p>The key thing is to use <code>startAccessingSecurityScopedResource</code> method on <code>NSURL *url</code> before using file and after finishing to use <code>stopAccessingSecurityScopedResource</code></p>\n"^^ . "0"^^ . "3"^^ . . . . . . . "0"^^ . . . . . . . "<p>Search for '<strong>iconv.2.4.0</strong>' globally and replace it with '<strong>iconv.2</strong>' , then I compiled successfully. Because I did not search for 'iconv.2.4.0' in xcode 15 beta 3, it should be renamed to 'iconv.2'.</p>\n"^^ . . . . . . "0"^^ . "1"^^ . "caemitterlayer"^^ . "On all versions on my real phones, the x21 register works but on all online device farms, it returns 44E7E59A17333D2E90E3473269A3DAEA. Do the cloud change the register for dyld maybe?"^^ . . . "3"^^ . . "0"^^ . . . . "<p>You don't need to hack <code>NSToolbarItem</code>. Use the <code>NSUndoManagerCheckpointNotification</code> notification on your undo manager. Every time it is called you can update the tooltip of the two toolbar bar items.</p>\n<pre><code>[NSNotificationCenter.defaultCenter addObserverForName:NSUndoManagerCheckpointNotification object:self.undoManager queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull note) {\n NSString *undoTitle = self.undoManager.undoMenuItemTitle;\n NSString *redoTitle = self.undoManager.redoMenuItemTitle;\n // Update the toolbar items' tooltips\n}];\n</code></pre>\n<p>You can also access the relevant undo manager via <code>note.object</code> in the block.</p>\n"^^ . "I see. Without a way to reproduce the problem from your device farm, I'm really powerless to help."^^ . "1"^^ . "firebase-ios-sdk/Crashlytics/run: No such file or directory"^^ . . "On my own phones running versions lower than 15 does return correct uuid of dyld but when I run the ipa on real device farms, it doesn't. The premain function doesn't work in these devices? They are real devices tho."^^ . "0"^^ . "0"^^ . . . . . "0"^^ . . . . . . . "0"^^ . "Like this `#import <os/log.h>\nos_log_with_type(OS_LOG_DEFAULT, OS_LOG_TYPE_ERROR, "This is a debug message.");`"^^ . . . . . "0"^^ . "stripe-payments"^^ . . . "0"^^ . "1"^^ . . . . . . . . . . "0"^^ . . . "Is there solution available to create a SMB/CIFS "server" on iOS/tvOS/watcOS using swift or objective C"^^ . . "0"^^ . . . "0"^^ . . "0"^^ . . "0"^^ . . . . "1"^^ . . . . . "0"^^ . "0"^^ . "just reading through your answer. It seems to be the only one that comprehensively deals with this issue. I', trying to follow the steps you've outlined but there's a few questions I had and I'm wondering if I could send you a message. Thanks"^^ . . . "0"^^ . "0"^^ . "Were you able to figure out how to fix this issue? Currently experiencing the same thing."^^ . . "@Willeke, you just set the position/size of the toolbar..."^^ . "0"^^ . . . . . . . . . . . "<p>So I'm attempting to call an IBAction that is associated with the FileOwner of a subview instantiated from an xib file</p>\n<p>I am running into a strange issue, basically I have a base class that all views inherit from:</p>\n<p>ViewController.h</p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n#import &quot;CsoundManager.h&quot;\n\n@interface ViewController : UIViewController\n-(IBAction) testActionBase:(id)sender;\n\n@end\n</code></pre>\n<p>ViewController.m</p>\n<pre><code>#import &quot;ViewController.h&quot;\n\n@implementation ViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n // Do any additional setup after loading the view.\n}\n\n-(IBAction) testActionBase:(id)sender\n{\n NSLog(@&quot;Test Action Fired&quot;);\n}\n\n@end\n</code></pre>\n<p>and then I have two other view classes which inherit from this. One is the main view that instantiates subviews.</p>\n<p>Main View Files:\nMainViewController.h</p>\n<pre><code>#import &quot;ViewController.h&quot;\n\n@interface MainViewController : ViewController\n-(IBAction) testFireDerived:(id)sender;\n@end\n</code></pre>\n<p>MainViewController.m</p>\n<pre><code>#import &quot;MainViewController.h&quot;\n#import &quot;GlobalSequencerControlView.h&quot;\n\n@implementation MainViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n // Do any additional setup after loading the view.\n \n \n GlobalSequencerControlView *globalControlView = [[GlobalSequencerControlView alloc] initWithNibName:@&quot;GlobalSequencerControls&quot; bundle:nil];\n //self.view.userInteractionEnabled = false;\n [self.view addSubview:globalControlView.view];\n \n}\n\n-(IBAction) testFireDerived:(id)sender\n{\n NSLog(@&quot;Main View Fire Derived&quot;);\n}\n\n@end\n</code></pre>\n<p>And below are the instantiated subclass files:</p>\n<p>GlobalSequencerControlView.h</p>\n<pre><code>#import &quot;ViewController.h&quot;\n\n@interface GlobalSequencerControlView : ViewController {\n \n}\n-(IBAction) testFireDerived:(id)sender;\n@end\n</code></pre>\n<p>GlobalSequencerControlView.m</p>\n<pre><code>#import &quot;GlobalSequencerControlView.h&quot;\n\n@implementation GlobalSequencerControlView\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n // Do any additional setup after loading the view.\n}\n\n-(IBAction) testFireDerived:(id)sender\n{\n NSLog(@&quot;Global Sequencer Fire Derived&quot;);\n}\n@end\n</code></pre>\n<p>When I wire up a button within the subview loaded from the xib, I am unable to get the testFireDerived IBAction found in GlobalSequencerViewController.m to execute. The buttons are receiving the touch events as I am able to get the testActionBase method from the inherited class to fire when linked to the button.</p>\n<p>Any thoughts/ideas as to why this is would be greatly appreciated. The buttons seem to be receiving events but for some reason the derived actions are not being triggered even though I am wiring up the buttons to the actions in the exact same manner.</p>\n"^^ . "actually we calling destroyPersistentAndResetCoreDataObjects() at the time of logout.."^^ . . . "0"^^ . "2"^^ . "0"^^ . . "Without knowing how you're going to _use_ those bytes, it's hard to give a good recommendation here."^^ . "iphone"^^ . . "1"^^ . "0"^^ . . "<p>I need to use NSXPCService to communicate between 2 applications which is in user account it has no admin privilege, so can i use NSXPCService for this case?</p>\n<p>I tried this service between daemon application and user application. so its worked but another case which i mentioned above is not working</p>\n"^^ . . . . . . "0"^^ . "0"^^ . "0"^^ . "0"^^ . . . . "2"^^ . . "0"^^ . . "1"^^ . . . "1"^^ . "<p>self.isFoo = isFoo; calls the same setter recursively. So you have an infinite recursion, and that crashes.</p>\n<p>Look at the stack in Xcode and you’ll see a gazillion of nested calls to setIsFoo.</p>\n"^^ . "- I ran it on iPhone 6s 14.7.1 as well and it returned uuid of /usr/lib/system/libdyld.dylib too."^^ . . . "Load xib and put outlets in Objective-C"^^ . . "Please provide a [mcve] and also explain what "they will not work" means."^^ . "The question was different and the answer was specific to make the button enable to fire the childVC's button action."^^ . "0"^^ . "NSInvalidArgumentException peristent store is not rechable from NSmanagerobjectcontext coordinator"^^ . . . . . . "c++"^^ . . . . . . . . "how to determine whether the ios device is a face or a touch?"^^ . "0"^^ . "0"^^ . . "@Willeke, it looks like only top horizontal NSToolbar can be customizable - see https://stackoverflow.com/questions/3977343/nstoolbar-on-bottom-of-window."^^ . "UIDatePicker is not working on macOS Catalina"^^ . "You haven't provided nearly enough information for us to be able to help you. You should probably create a minimal reproducible example, upload it to GitHub, and add a link in your question. (I've never heard of Qt Quick or QML, so I've got nothing to draw from to help you. I googled Qt Quick but it sounds like a pretty complex framework.)"^^ . . . "qt"^^ . . "Good idea, but it seems that `toolTip` is not called when the toolTip should show, but only once when the toolbar item is added to the toolbar."^^ . . . . "I recently moved from android to iOS 2 weeks ago so very less knowledge. Can you please add a log code in your answer and I will send these logs to an external URL. The farms don't let us use debugger, we just upload IPA and it works as a real phone."^^ . "okay, i removed that tag"^^ . . . "0"^^ . . "1"^^ . . "1"^^ . "0"^^ . "0"^^ . . "0"^^ . . . . "I noticed that if I take out either subcell1_1 or subcell1_2 from the emitterCells Array, the problem goes away. I only encounter the problem where the emitter stops working when both subcell1_1 and subcell1_2 are in the emitterCells Array. Anyone have any ideas?"^^ . . "0"^^ . "I checked 3 different device farms with 30+ devices each. All of them gave uuid of /usr/lib/system/libdyld.dylib for iOS versions below 15. My real device with 14.x returns correct dyld uuid but device farms won't. Maybe the premain function is shifted to main? -- the devices on farms are loaded into cloud but act as real devices."^^ . . "0"^^ . . . . . . . . . . . . "How do I make a `NSToolbar` vertical?"^^ . . . . . "0"^^ . . . . . . . . . . . "0"^^ . "0"^^ . "You know, unless the OP acknowledges that they know it’s a really bad idea and understand the risks and problems it entails, I think it is very good to outline the problems/risks and why the practice is discouraged."^^ . "0"^^ . . . . . "4"^^ . . . . . . . . . . . "1"^^ . . . ""Considering all we need now is just to check the v2 of the framework work as expected" For just that purpose, you can put a `DispatchSemaphore` before each callback-based API, `.wait()` it after calling registering the callback. It'll wait until you `.signal()` from inside the callback. Note: this will bring everything to a slow, synchronous grinding halt, which you probably expect"^^ . . "1"^^ . "0"^^ . . . . . . "face-id"^^ . . . . . "Ok fair enough, but does the farm provide you a way to see the console or stdout output the device generates in the web page somehow?"^^ . . . . . . "Have a look at this question: https://stackoverflow.com/questions/13760760/how-to-get-windows-of-nsrunningapplication. It should be possible to get all windows of a running application, but I'm not sure whether there is API to move a specific window into the foreground. Probably you have to examine the CoreGraphics APIs for methods that are not exposed on NSApplication etc."^^ . . . . . . . "0"^^ . "Sad. Both the new methods crashes app on the iPhone 11 iOS 14 at the device farm but works on real phone"^^ . "<h1>The Idea</h1>\n<p>I'm trying to implement a game engine in C++.</p>\n<p>I'm using macOS for development (arm-64 architecture). I want to create a window using Foundation framework.</p>\n<p>CMakeLists.txt utilizes C++ and Objective-C languages, and I want to build a library containing only Objective-C code and then use this library in my C++ code (probably including the header). The end result should be a C++ executable.</p>\n<h1>The Project Structure</h1>\n<pre><code>[src]\n ├── [Draw]\n ├── Window.cpp\n ├── Window.h\n └── [WindowBuilder]\n ├── WindowBuilder.cpp\n ├── WindowBuilder.h\n └── [macOS]\n ├── WindowBuilderObjC.h\n └── WindowBuilderObjC.mm\n ├── [Utils]\n └── Size.h\n ├── main.cpp\n└── CMakeLists.txt\n</code></pre>\n<h1>The Source Code</h1>\n<p><strong>src/Draw/Window.h</strong></p>\n<pre><code>#include &lt;iostream&gt;\n\n#include &lt;Utils/Size.h&gt;\n#include &quot;WindowBuilder/WindowBuilder.h&quot;\n\n#pragma once\n\nnamespace Draw\n{\n\n class Window\n {\n private:\n bool _isPresented;\n Utils::Size _size = Utils::Size(0, 0);\n\n WindowBuilder::WindowBuilder *_builder;\n\n Window();\n ~Window() = default;\n\n public:\n // Public static member function to access the singleton instance\n static Window &amp;Instance()\n {\n // Guaranteed to be initialized once\n static Window instance;\n return instance;\n }\n\n // Delete the copy constructor and assignment operator\n Window(const Window &amp;) = delete;\n Window &amp;operator=(const Window &amp;) = delete;\n\n void SetSize(Utils::Size size);\n void DrawWindow();\n };\n}\n</code></pre>\n<p><strong>src/Draw/Window.cpp</strong></p>\n<pre><code>#include &quot;Window.h&quot;\n\nnamespace Draw\n{\n Window::Window()\n {\n _builder = &amp;WindowBuilder::WindowBuilder::Instance();\n }\n\n void Window::SetSize(Utils::Size size)\n {\n _size = size;\n }\n\n void Window::DrawWindow()\n {\n std::cout &lt;&lt; &quot;Draw window with size: [&quot; &lt;&lt; _size.GetWidth() &lt;&lt; &quot;:&quot; &lt;&lt; _size.GetHeight() &lt;&lt; &quot;]&quot; &lt;&lt; std::endl;\n\n _builder-&gt;BuildWindow(_size);\n }\n}\n</code></pre>\n<p><strong>src/WindowBuilder/WindowBuilder.h</strong></p>\n<pre><code>// General\n#include &lt;iostream&gt;\n\n// Internal\n#include &lt;Utils/Size.h&gt;\n#include &lt;Draw/WindowBuilder/macOS/WindowBuilderObjC.h&gt;\n\n#pragma once\n\nnamespace WindowBuilder\n{\n class WindowBuilder\n {\n private:\n bool _isPresented;\n\n WindowBuilder() = default;\n ~WindowBuilder() = default;\n\n public:\n static WindowBuilder &amp;Instance()\n {\n // Guaranteed to be initialized once\n static WindowBuilder instance;\n return instance;\n }\n\n // Delete the copy constructor and assignment operator\n WindowBuilder(const WindowBuilder &amp;) = delete;\n WindowBuilder &amp;operator=(const WindowBuilder &amp;) = delete;\n\n void BuildWindow(Utils::Size size);\n };\n}\n\n</code></pre>\n<p><strong>src/WindowBuilder/WindowBuilder.cpp</strong></p>\n<pre><code>#include &quot;WindowBuilder.h&quot;\n\nnamespace WindowBuilder\n{\n void WindowBuilder::BuildWindow(Utils::Size size)\n {\n buildWindowWithSize(size);\n }\n}\n</code></pre>\n<p><strong>src/Draw/WindowBuilder/macOS/WindowBuilderObjC.h</strong></p>\n<pre><code>#import &lt;Cocoa/Cocoa.h&gt;\n\n#import &quot;Utils/Size.h&quot;\n\n@interface WindowBuilderObjC : NSObject\n\n- (void)buildWindowWithSize:(Utils::Size)size;\n\n@end\n\n@interface WindowDelegate : NSObject &lt;NSWindowDelegate&gt;\n@end\n\n@implementation WindowDelegate\n\n- (BOOL)windowShouldClose:(id)sender\n{\n [NSApp terminate:nil];\n return YES;\n}\n\n@end\n</code></pre>\n<p><strong>src/Draw/WindowBuilder/macOS/WindowBuilderObjC.mm</strong></p>\n<pre><code>#import &quot;WindowBuilderObjC.h&quot;\n\n@implementation WindowBuilderObjC\n\n- (void)buildWindowWithSize:(Utils::Size)size\n{\n @autoreleasepool \n {\n [NSApplication sharedApplication];\n \n NSRect frame = NSMakeRect(0, 0, 800, 600);\n NSUInteger style = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable;\n NSWindow *window = [[NSWindow alloc] initWithContentRect:frame styleMask:style backing:NSBackingStoreBuffered defer:NO];\n [window setTitle:@&quot;My Window&quot;];\n [window center];\n \n WindowDelegate *delegate = [[WindowDelegate alloc] init];\n [window setDelegate:delegate];\n \n [window makeKeyAndOrderFront:nil];\n \n [NSApp run];\n }\n}\n\n@end\n</code></pre>\n<p><strong>src/main.cpp</strong></p>\n<pre><code>#include &lt;iostream&gt;\n\n#include &lt;Draw/Window.h&gt;\n\n#include &lt;Utils/Size.h&gt;\n\nint main()\n{\n std::cout &lt;&lt; &quot;Hello World&quot; &lt;&lt; std::endl;\n\n Utils::Size size(600, 800);\n\n auto &amp;window = Draw::Window::Instance();\n window.SetSize(size);\n\n window.DrawWindow();\n}\n</code></pre>\n<h1>CMakeLists.txt</h1>\n<pre><code>cmake_minimum_required(VERSION 3.16)\nproject(GameEngine LANGUAGES CXX OBJC OBJCXX)\n\nset(CMAKE_CXX_STANDARD 11)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\nset(CMAKE_CXX_EXTENSIONS OFF)\n# enable_language(OBJC)\n# enable_language(OBJCXX)\n\nadd_executable(Engine src/main.cpp)\n\nadd_library(UtilsLib SHARED\n src/Utils/Size.h\n)\n\nset_target_properties(UtilsLib PROPERTIES LINKER_LANGUAGE CXX)\n\nadd_library(WindowBuilderObjCLib SHARED\n src/Draw/WindowBuilder/macOS/WindowBuilderObjC.h\n src/Draw/WindowBuilder/macOS/WindowBuilderObjC.mm\n)\n\ntarget_include_directories(WindowBuilderObjCLib\n PRIVATE\n ${CMAKE_CURRENT_SOURCE_DIR}/src/Draw/WindowBuilder/macOS\n)\n\ntarget_link_libraries(WindowBuilderObjCLib\n PRIVATE &quot;-framework Cocoa&quot;\n PRIVATE &quot;-framework Foundation&quot;\n PRIVATE &quot;-framework AppKit&quot;\n)\n\n# Set the language for the library to Objective-C++\nset_target_properties(WindowBuilderObjCLib PROPERTIES\n LINKER_LANGUAGE &quot;OBJCXX&quot;\n XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES\n XCODE_ATTRIBUTE_CLANG_ENABLE_MODULES YES\n XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_WEAK YES\n)\n\nadd_library(DrawLib STATIC\n src/Draw/Window.h\n src/Draw/Window.cpp\n)\n\ntarget_sources(DrawLib\n PRIVATE\n src/Draw/WindowBuilder/WindowBuilder.h\n src/Draw/WindowBuilder/WindowBuilder.cpp\n)\n\ntarget_sources(DrawLib\n PUBLIC\n src/Draw/Window.h\n src/Draw/Window.cpp\n)\n\nset_target_properties(DrawLib PROPERTIES LINKER_LANGUAGE CXX)\n\nfind_library(FOUNDATION_FRAMEWORK Foundation)\n\n# Link against required frameworks and libraries\ntarget_link_libraries(DrawLib\n PRIVATE ${FOUNDATION_FRAMEWORK}\n &quot;-framework AppKit&quot;\n &quot;-framework CoreGraphics&quot;\n &quot;-lobjc&quot;\n)\n\nfind_package(OpenGL REQUIRED COMPONENTS OpenGL)\n\ninclude_directories(${CMAKE_SOURCE_DIR}/src)\n\nadd_subdirectory(src/Draw/WindowBuilder/macOS)\n\n# Link the DrawLib and UtilsLib targets to the Engine target\ntarget_link_libraries(Engine PRIVATE\n WindowBuilderObjCLib\n DrawLib\n UtilsLib\n OpenGL::GL\n ${FOUNDATION_FRAMEWORK}\n)\n</code></pre>\n<h1>The Error</h1>\n<p>Seems like when I include <strong>Window.h</strong> into <strong>main.cpp</strong>, the compiler looks for symbols in <strong>Cocoa/Cocoa.h</strong> file and finds <em>Objective-C</em> symbols instead of <em>C++</em>.</p>\n<p>The error is following:</p>\n<pre><code>[build] In file included from /Users/user/MySource/GameEngine_Vulkan/src/Draw/Window.cpp:1:\n[build] In file included from /Users/user/MySource/GameEngine_Vulkan/src/Draw/Window.h:4:\n[build] In file included from /Users/user/MySource/GameEngine_Vulkan/src/Draw/WindowBuilder/WindowBuilder.h:6:\n[build] In file included from /Users/user/MySource/GameEngine_Vulkan/src/Draw/WindowBuilder/macOS/WindowBuilderObjC.h:1:\n[build] In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:\n[build] In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:8:\n[build] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:601:1: error: expected unqualified-id\n[build] @class NSString, Protocol;\n[build] In file included from /Users/user/MySource/GameEngine_Vulkan/src/Draw/WindowBuilder/WindowBuilder.cpp:1:\n[build] In file included from /Users/user/MySource/GameEngine_Vulkan/src/Draw/WindowBuilder/WindowBuilder.h:6:\n[build] ^\n[build] In file included from /Users/user/MySource/GameEngine_Vulkan/src/Draw/WindowBuilder/macOS/WindowBuilderObjC.h:1:\n[build] In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:\n[build] In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:8:\n[build] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:601:1: error: expected unqualified-id\n[build] @class NSString, Protocol;\n[build] ^\n[build] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:603:9: error: unknown type name 'NSString'\n[build] typedef NSString * NSExceptionName NS_TYPED_EXTENSIBLE_ENUM;\n[build] ^\n[build] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:603:9: error: unknown type name 'NSString'\n[build] typedef NSString * NSExceptionName NS_TYPED_EXTENSIBLE_ENUM;\n[build] ^\n[build] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:604:9: error: unknown type name 'NSString'\n[build] typedef NSString * NSRunLoopMode NS_TYPED_EXTENSIBLE_ENUM;\n[build] ^\n[build] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:604:9: error: unknown type name 'NSString'\n[build] typedef NSString * NSRunLoopMode NS_TYPED_EXTENSIBLE_ENUM;\n[build] ^\n[build] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:606:19: error: unknown type name 'NSString'\n[build] FOUNDATION_EXPORT NSString *NSStringFromSelector(SEL aSelector);\n[build] ^\n[build] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:606:19: error: unknown type name 'NSString'\n[build] FOUNDATION_EXPORT NSString *NSStringFromSelector(SEL aSelector);\n[build] ^\n\n...\n\n</code></pre>\n<h1>The Question</h1>\n<p>Can I build a standalone library using Objective-C with Cocoa lib included (probably) and that it will have a public interface, so that I can use it in C++ project?</p>\n"^^ . . . . . . "0"^^ . . . . "@Willeke I'm afraid not. I know how to create a property, as is the case in my attempt so far. I just don't know if I'm creating the property correctly when implementing the singleton pattern. The fact that I haven't been able to find examples of this and yet Apple seems to be moving in this direction is why I want to double check my approach."^^ . . . . . "Incompatible pointer types passing retainable parameter of type 'SecTrustResultType *'"^^ . . "0"^^ . . "0"^^ . "0"^^ . . "Is there anyway I can identify in the device if its a device farm or a real device? Just a check would be okay, i collected 13-14 all dyld uuids, will return 32 0 zero if it uses a device farm and is on 13-14 ios version but for real devices can use the original method."^^ . . . . . . "<p>I'm working on a macOS app that needs to manipulate the windows of other applications, namely bringing another app's window to the front. Note that it's not enough to simply bring an application to the front (which is easily accomplished with <code>NSRunningApplication</code>) -- it needs to be a specific window.</p>\n<p>Normally I would use the Accessibility API to do this, but unfortunately it's not reliable. Some applications do not respond to API requests in a timely manner or will return bogus or broken information, which can break my app. Consequently, I'm looking for alternative methods of doing this.</p>\n<p>I'm open to using unofficial macOS APIs, which, while I know they are not recommended, I've found can often be a lot faster and more reliable. For example, I needed a method to figure out which window occupied a certain point on screen. While it is possible and supported to do this with the Accessibility API, it would often be very slow, or just break completely with apps that don't support Accessibility features correctly. But using the undocumented function <code>CGSFindWindowAndOwner</code> is much faster and more reliable, as it just queries the window server directly. I'm hoping I can find a similar method for raising a window too.</p>\n<p>That said, if there is another supported method I'll certainly go for that, but I'm not aware of any other way of doing this without resorting to unofficial / undocumented APIs. (Maybe Apple Events can do it?)</p>\n<p>Do I have any options other than trying to work around the bugs and failings of the Accessibility API?</p>\n"^^ . . . . . . . . . . . . . . "0"^^ . . . . "First you call `_destroyPersistentStoreAtURL:withType:options:error` and then via a notification you get a crash in a `NSFetchedResultsController`. So maybe don't destroy the store when you have an active NSFetchedResultsController"^^ . "0"^^ . "Add a tooltip rectangle to NSToolBarItem's default view"^^ . "inheritance"^^ . "0"^^ . . . "@Lucilfer new day , new hack to try out."^^ . . . . "Constraints a view to the bottom of WKWebView.scollView"^^ . . . "1"^^ . . . "Will NSXPCService work between user account processes without admin privilege in swift language?"^^ . "2"^^ . "0"^^ . "0"^^ . . "A mouse down event might work but has two serious downsides: it has side effects, even if you have it click something like the window's titlebar, and it only works if the window is not obscured."^^ . "0"^^ . "0"^^ . "1"^^ . . "0"^^ . . "0"^^ . "pointers"^^ . . "0"^^ . . . . . "Make swift async API synchronous"^^ . . . . . . . . . . . . . . . . "0"^^ . . . . "The x19 gives uuid BA11554B5E683A00A765CCFE296A796B. This is not the correct one either. Is there any other approach to get it? I rely on external device farms so I have no other way to do it. Would be grateful if you can find any other way."^^ . . "0"^^ . "share"^^ . . . "Is there a way to bring a window of another macOS application to the front without using the Accessibility API?"^^ . . . . . . . . . . . "<p>If you want to trigger GlobalSequencerViewController's action, then add the &quot;GlobalSequencerViewController&quot; as a child view controller of MainViewController. instead of adding it as subView of MainViewController</p>\n<p>Difference between both is as follows</p>\n<blockquote>\n<p>addChildViewController associates a view controller with a parent container view controller, while addSubview adds a view to the view hierarchy of the view it is being added to.</p>\n</blockquote>\n<p>So add below mentinoed line after adding the child VC's view as subView of parent view</p>\n<pre><code>[self addChildViewController:globalControlView];\n</code></pre>\n<p>So the <code>viewDidLoad</code> code of MainViewController will be as below</p>\n<pre><code>- (void)viewDidLoad {\n [super viewDidLoad];\n // Do any additional setup after loading the view.\n\n\n GlobalSequencerControlView *globalControlView = [[GlobalSequencerControlView alloc] initWithNibName:@&quot;GlobalSequencerControls&quot; bundle:nil];\n //self.view.userInteractionEnabled = false;\n [self.view addSubview:globalControlView.view];\n [self addChildViewController:globalControlView];\n globalControlView.view.frame = self.view.bounds;\n [globalControlView didMoveToParentViewController:self];\n}\n</code></pre>\n"^^ . "Didn't have laptop with me for few days. I tried the new hacks but the app crashed sadly. The farms don't give console for the users so can't test it there."^^ . "0"^^ . "download xcode15beta and build errror"^^ . "<p>I downloaded xcode15 beta, and then run the project and reported an error, but I did not report an error when I ran it with xcode14.3.</p>\n<p>the error info is:</p>\n<blockquote>\n<p>Library 'iconv.2.4.0' not found\nLinker command failed with exit code 1 (use -v to see invocation)</p>\n</blockquote>\n"^^ . . . "0"^^ . . "0"^^ . . . . "Objective-C to Swift conversion question for bytes"^^ . . . "This new hack also gave uuid of /usr/lib/system/libdyld.dylib :(("^^ . "Thanks. The app didn't crash but this time it gave uuid of /usr/lib/system/libsystem_c.dylib"^^ . "0"^^ . . "0"^^ . . . "properties"^^ . . . "0"^^ . . "0"^^ . . . . "SwiftUI - Objc @protocol delgate function usage"^^ . . . . . . . . . . "autolayout"^^ . "Getting compilation errors when trying to add QR code scanner to a Qt project"^^ . "byte"^^ . . . . "In any case if you declare a class as *source of truth* in a SwiftUI view you have to mark it as `@StateObject`. And a SwiftUI view is not a controller. A better way to handle the delegate is a view model (another class conforming to `@ObservableObject`) and `@Publish` the changes. It can be even a subclass of `NSObject`."^^ . "0"^^ . "<p>I have a very old Objective-C app that I am trying to convert to Swift. I am not well versed in Objective-C and even less so in pointers.<br />\nI have this code here that I can not figure out what to do with:</p>\n<pre><code>NSData *ucTimeData=[self getUcTime];\nByte *ucTimeByte = (Byte *)[ucTimeData bytes];\n</code></pre>\n<p>The <code>NSData</code> looks like this when printing the description:</p>\n<pre><code>Printing description of data:\n&lt;9ea49c1d&gt;\n</code></pre>\n<p>What would be the Swift equivalent of the <code>Byte</code> conversion? <code>ucTimeData.bytes</code> returns an unsafe pointer so something like:</p>\n<pre><code>let ucTimeByte: UInt8 = UInt8(ucTimeData.bytes)\n</code></pre>\n<p>which I guess would be the literal translation but it does not work.</p>\n"^^ . . "0"^^ . . "General rule is it's a bad idea to convert from ObjC to Swift line by line. It's not always beneficial to even convert a single function. In many cases you need to look at a bigger picture: which inputs you need to handle, which outputs you expect, and are there Swift libraries that already handle what previously was done by hand. This especially applies to pointers - there's almost no reasons to use them in Swift. So please provide more context on what you are converting, and what are the inputs, and expected outputs"^^ . . "0"^^ . . "0"^^ . "So if your app running on the farm would display text or an alert would you see it somehow?"^^ . . "Did you try a mouse-down event?"^^ . . "0"^^ . "pch"^^ . . . "Ok, coming up with meaningful debug data will take some effort I'll think of something else. In the meantime I've edited the answer with new hack you can try."^^ . . . . . . . "`NSToolbar` doesn't have a `position` or `size` property. Post a [mre] please."^^ . . . . . . . "Is there any other way? Really depending on you haha"^^ . "No, my class is in the owner files, and the iboutlets that I connect don't work"^^ . "0"^^ . "0"^^ . "0"^^ . . . . . ""The minimal reproducible example is the above code" So you claim that the code you've provided is sufficient for me to run the app and see the issue, without having to make any further guesses as to what you are doing in your app to summon the animation? Because I claim that it isn't."^^ . . "cmake"^^ . . . . . . "0"^^ . "5"^^ . . "0"^^ . . "0"^^ . . . . "Seems that that your data contains an array of bytes. utcTimeBute is a pointer to an array of uint8 aka bytes. Look at [this](https://stackoverflow.com/questions/31821709/nsdata-to-uint8-in-swift)"^^ . . . . "@Willeke the question is about implementing the singleton pattern where the singleton reference is exposed as a class property."^^ . . . "It returns a uuid but its not of dyld or dylib"^^ . . . . "0"^^ . . "1"^^ . . "On iPhone12,1 (14.2) & iPhone12,3 (14.2, 14.3) it always returns uuid of /usr/lib/system/libdyld.dylib.\n\niPhone12,1 (14.2) id returned: BA60CB9E95C53646BEEDD313E15586CF\niPhone12,3 (14.2) id returned: BA60CB9E95C53646BEEDD313E15586CF\niPhone12,3 (14.3) id returned: 785BEE7FAC2C388D865C36279D1B3DD1\n\nPlease let me know how to fix it."^^ . . "```https://github.com/swisspol/GCDWebServer``` would be a better solution for Http as it is well documented and maintained until the start of this year."^^ . . . . "0"^^ . . "0"^^ . . . "0"^^ . . . "0"^^ . "<p>Pentaloop has an SMB server/client for iOS</p>\n"^^ . . . . . "0"^^ . "<p>Thanks to the Vadian comments I figured out how to do\nYou have to declare and use your function in a specific class\nThis way the objc callback are well called</p>\n<p>Declare your class that implements you objc library code and delegate</p>\n<pre><code>class MyClassModel: ObservableObject{\n\n var myclass = Myclass()\n \n func start(){\n myclass.setDelegate(self)\n ...\n }\n \n @objc func endEvent(done:Bool) {\n print(&quot;endEvent \\(done)&quot;)\n }\n\n}\n</code></pre>\n<p>Another way with NSObject</p>\n<pre><code>class MyClassModel2 : NSObject\n{\n var myclass = Myclass()\n \n func start(){\n myclass.setDelegate(self)\n ...\n }\n \n @objc func endEvent(done:Bool) {\n print(&quot;endEvent \\(done)&quot;)\n }\n}\n</code></pre>\n<p>Use it in your view</p>\n<pre><code>struct ContentView: View {\n \n @ObservedObject var myClassModel = MyClassModel()\n @State var myClassModel2 = MyClassModel2()\n\n myClassModel.start()\n myClassModel2.start()\n}\n</code></pre>\n"^^ . "I don't have access to that many physical iOS14.x . An iOS14.5 simulator yields same results as my physical iOS 14.2 so the `premain` works. I also tried launching without lldb (from an icon) and get the same results. Also with a release build. Your device farm seems to have a specific way of launching the apps, but I don't have a way to replicate the problem."^^ . "0"^^ . "1"^^ . . . "touch-id"^^ . "0"^^ . . "0"^^ . . . . . . "If you are refering to ```https://github.com/Pentaloop/PLWebServer``` then it does not mention SMB... Also it is HTTP which is not what I am looking for..."^^ . "<p>I'm using <code>react-native-payments</code> library for ApplePay and getting below error I don't know what to do, any help please?</p>\n<pre><code>iOS: 16.4\nXcode: 14.3\nreact-native: 0.71.4\nreact-native-payments: 0.8.4\nDeployment target: 14.0 in Xcode\n</code></pre>\n<p><strong>PPOTSimpleURLConnection.m file</strong></p>\n<pre><code> NSString *domain = challenge.protectionSpace.host;\n SecTrustRef serverTrust = [[challenge protectionSpace] serverTrust];\n\n NSArray *policies = @[(__bridge_transfer id)SecPolicyCreateSSL(true, (__bridge CFStringRef)domain)];\n SecTrustSetPolicies(serverTrust, (__bridge CFArrayRef)policies);\n SecTrustSetAnchorCertificates(serverTrust, (__bridge CFArrayRef)self.pinnedCertificateData);\n SecTrustResultType result;\n\n// OSStatus errorCode = SecTrustEvaluate(serverTrust, &amp;result);\n OSStatus errorCode = SecTrustEvaluateWithError(serverTrust, &amp;result);\n\n BOOL evaluatesAsTrusted = (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed);\n if (errorCode == errSecSuccess &amp;&amp; evaluatesAsTrusted) {\n NSURLCredential *credential = [NSURLCredential credentialForTrust:serverTrust];\n completionHandler(NSURLSessionAuthChallengeUseCredential, credential);\n } else {\n completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, NULL);\n }\n }\n</code></pre>\n"^^ . . "1"^^ . . . "0"^^ . "0"^^ . . . . . "0"^^ . "1"^^ . . . . . . "<p>I am writing an app that seeks to discover if the user is already connected to a specialized Bluetooth keyboard that I produce. My peripheral is running Bluetooth Classic, version 3.0, and uses HID to communicate with the iOS device. I cannot use Apple's CoreBluetooth Framework as I am not using BluetoothLE or GATT. I must use Apple's ExternalAccessory framework. As per Apple's rules, I DO NOT need to register with MFI because I use &quot;standard Bluetooth profiles supported by iOS&quot; (see <a href="https://support.apple.com/en-us/HT204387" rel="nofollow noreferrer">here</a>).</p>\n<p>I tried to find the connected Bluetooth peripheral by the following objective-c snippet:</p>\n<p><code>NSArray&lt;EAAccessory *&gt; *accessories = [[EAAccessoryManager sharedAccessoryManager] connectedAccessories];</code></p>\n<p>However, even when my Bluetooth peripheral is connected to the iOS device, I cannot obtain any connectedAccessories when I run this command. Do I need to include a <code>UISupportedExternalAccessoryProtocols</code> field in my info.plist file despite not using MFI? See <a href="https://stackoverflow.com/questions/17236701/what-is-externalaccessory-protocol-used-ios">this related stackoverflow post</a> for the <code>UISupportedExternalAccessoryProtocols</code> field.\nDo I need to programatically connect with my peripheral in objective-c before it returns as a connected device (even though the iOS device is already connected to the peripheral via Bluetooth)? I am really stuck, and don't know how to proceed. Any help would be much appreciated.</p>\n"^^ . . "0"^^ . . "Its printing this only.\nJun 30 16:46:49 SHC[14579] <Error>: <private>\nJun 30 16:46:49 SHC[14579] <Error>: <private>\nJun 30 16:46:49 SHC[14579] <Error>: This is a debug message."^^ . "<p>I cannot figure how to implement an ObjC library delegate/protocol function in a SwifUI view/app.</p>\n<p>It works well in an ObjC or swift application</p>\n<p>Here is the code and explanation (I simplified so there may be some typo)</p>\n<p>In the ObC library it is implemented like this</p>\n<p>MyClass.h from ObjC library</p>\n<pre><code> @protocol CustomDelegate &lt;NSObject&gt;\n\n - (void)endEvent:(BOOL) done;\n\n @end\n</code></pre>\n<p>MyClass.h is imported in bridging.h declared in ObjectiveC-bridging-header settings</p>\n<p>In a swift application we do this and it works.\nThe delegate ObjC library function endEvent is well called</p>\n<p>ViewController.swift</p>\n<pre><code>class ViewController: UIViewController {\n\n var myclass = Myclass()\n\n override func viewDidLoad() {\n super.viewDidLoad()\n myclass.setDelegate(self)\n }\n\n\n //Delegate methods\n override func endEvent(done:Bool) {\n print(&quot;done \\(done)&quot;)\n }\n\n}\n</code></pre>\n<p>Internally in the Objc library we store the caller and check that the protocol function is implemented in it</p>\n<pre><code> -(void) SetDelegate:(id)delegate\n {\n myDelegate = delegate;\n }\n\n\n -(void)notifyEndEvent\n {\n if (myDelegate == nil)\n return;\n \n // check caller implemented the delegate function and if so call it\n if (([myDelegate respondsToSelector:@selector(endEvent: done:)]) {\n [myDelegate endEvent:done];\n } else {\n printf(&quot;endEvent not implemented by the caller\\n&quot;); \n }\n } \n}\n</code></pre>\n<p>How can I do the same in Switfui view ?\nIf I do as shown below it doesn't work because in the ObjC library the respondsToSelector function shown above return false</p>\n<pre><code>struct ContentView: View {\n \n \n @State var myclass = Myclass()\n\n private func start() {\n myclass.setDelegate(self)\n }\n\n func endEvent(sender: Myclass , endEvent done:Bool) {\n print(&quot;endEvent \\(done)&quot;)\n }\n\n \n}\n</code></pre>\n<p>Thanks in advance</p>\n"^^ . "3"^^ . . . "0"^^ . . . . . "1"^^ . "There is an inspect option named Console but it doesn't print NSLog there. I basically install the ipa and work on it."^^ . "<p>In my case, I seemed to be linking against an older version of libiconv that was no longer available.</p>\n<p>I was able to fix this by going into <strong>Build Phases</strong> &gt; <strong>Link Binary With Libraries</strong>, removing the old versions of libiconv (in my case I was seeing <code>libiconv.2.4.0.tbd</code> and <code>libiconv.2.4.0.dylib</code>), and adding <code>libiconv.tbd</code> back using the <code>+</code> button.</p>\n"^^ . "Thanks, but I believe that the updates to CoreBluetooth in 2019 only made GATT Bluetooth Classic devices compatible. I'm using HID, so I don't think this would work."^^ . . "I've checked their docs https://docs.aws.amazon.com/sdk-for-swift/latest/developer-guide/using-logging.html It's a little bit of a pain that it's dedicated for Swift. There is a wrapper https://github.com/srinikhil-07/swift-log-objc but that's extra setup"^^ . . . . "bridging-header"^^ . . . . . . . . . "-- on my real phone manually iPhone 11 pro 14.7.1 x21 returns correct dyld uuid."^^ . "0"^^ . "objective-c"^^ . "2"^^ . . "2"^^ . . "0"^^ . "7"^^ . . "2"^^ . . . "Apple just changed the interfaces from a getter to a property. `NSFileManager.defaultManager` exists since OS X 10.0. Is the question about the declaration of the property or about the implementation of the singleton?"^^ . "0"^^ . . "0"^^ . . . . . . "0"^^ . . . "I am not sure this is the project, as I believe the SMB library product is not an open-source solution."^^ . . "@Lucilfer I've added an edit with more stuff to test. Fingers crossed."^^ . . . . "0"^^ . . . . . "In Objective-C, why does setter lead to crash when I user self.propName notation but not when I use _ivarName"^^ . . "0"^^ . "Thanks Paul. How might I go about accessing my Bluetooth peripheral through software? There must be some way to access it programatically, no?"^^ . . . "<p>I have added some fireworks to an app. The emitters work a few times, then stops displaying.</p>\n<p>Here is the Objective C code</p>\n<p>in the .m</p>\n<pre><code>- (void) viewDidLoad {\n \n [super viewDidLoad];\n\n\n [self setupEmitter];\n [self setupFireWorkEmitterCells];\n\n }\n\n\n\n-(void) setupEmitter{\nemitterLayer = [CAEmitterLayer layer];\nemitterLayer.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-100);\nemitterLayer.position = CGPointMake(self.view.frame.size.width/2, self.view.frame.size.height/2);\n\nemitterLayer.emitterShape = kCAEmitterLayerPoint;\n\nemitterLayer.backgroundColor = [[UIColor colorWithRed:0.0 green:0.2 blue:0.2 alpha:0.500] CGColor];\n\nemitterLayer.emitterPosition = CGPointMake(self.view.frame.size.width/2, self.view.frame.size.height);\n\nemitterLayer.emitterSize = CGSizeMake(30, 30);\n\nemitterLayer.emitterMode = kCAEmitterLayerOutline;\nemitterLayer.renderMode = kCAEmitterLayerAdditive;\n\nemitterLayer.needsDisplayOnBoundsChange = YES;\nemitterLayer.delegate = self;\n\n[self.view.layer insertSublayer:emitterLayer below:BottomBar.layer];\n\n}\n\n\n\n-(void) setupFireWorkEmitterCells{\n\n\n NSLog(@&quot;setupFirework cellls&quot;);\n\n //============== EMITTER CELL 1 - Parent ==============\n\n // emitter = [NSKeyedUnarchiver unarchiveObjectWithFile:[[NSBundle mainBundle] pathForResource:@&quot;Sparks&quot; ofType:@&quot;sks&quot;]];\n\n//Create Cell\n CAEmitterCell *cell1 = [CAEmitterCell emitterCell];\n\n cell1.name = @&quot;Parent&quot;;\n\n cell1.birthRate = 0.0;\n cell1.lifetime = 2.5;\n cell1.lifetimeRange = 0.0;\n cell1.beginTime = CACurrentMediaTime();\n cell1.velocity = 300.0;\n cell1.velocityRange = 100.0;\n cell1.xAcceleration = 0;\n cell1.yAcceleration = -100.0;\n cell1.emissionLatitude = 0.0 * (M_PI / 180.0);\n cell1.emissionLongitude = -90.0 * (M_PI / 180.0);\n cell1.emissionRange = 45.0 * (M_PI / 180.0);\n\n cell1.spin = 0.0 * (M_PI / 180.0);\n cell1.spinRange = 0.0 * (M_PI / 180.0);\n\n cell1.scale = 0.0;\n\n cell1.scaleRange = 0.0;\n cell1.scaleSpeed = 0.0;\n cell1.alphaRange = 0.0;\n cell1.alphaSpeed = 0.0;\n cell1.color = [UIColor colorWithRed:255.0/255.0 green: 255.0/255.0 blue: 255.0/255.0 alpha: 1.0].CGColor;\n cell1.redRange = 0.9;\n cell1.greenRange = 0.9;\n cell1.blueRange = 0.9;\n\n\n\n\n\n //============== EMITTER subCELL 1 - Trail ==============\n\n // UIImage *image1_1 = [UIImage imageNamed:@&quot;Spark&quot;];//.CGImage;\n\n CAEmitterCell *subcell1_1 = [CAEmitterCell emitterCell];\n\nsubcell1_1.contents = (id) [[UIImage imageNamed:@&quot;FW-white.png&quot;] CGImage];\nsubcell1_1.name = @&quot;Trail&quot;;\nsubcell1_1.birthRate = 145.0;\nsubcell1_1.lifetime = 0.5;\nsubcell1_1.beginTime = 0.01;\nsubcell1_1.duration = 1.7;\nsubcell1_1.velocity = 80.0;\nsubcell1_1.velocityRange = 100.0;\nsubcell1_1.xAcceleration = 100.0;\nsubcell1_1.yAcceleration = 350.0;\nsubcell1_1.emissionLatitude = 0.0 * (M_PI / 180.0);\nsubcell1_1.emissionLongitude = -360.0 * (M_PI / 180.0);\nsubcell1_1.emissionRange = 22.5 * (M_PI / 180.0);\nsubcell1_1.spin = 0.0 * (M_PI/ 180.0);\nsubcell1_1.spinRange = 0.0 * (M_PI / 180.0);\nsubcell1_1.scale = 0.5;\nsubcell1_1.scaleRange = 0.0;\n\nsubcell1_1.scaleSpeed = 0.13;\nsubcell1_1.alphaRange = 0.0;\nsubcell1_1.alphaSpeed = -0.7;\nsubcell1_1.color = [UIColor colorWithRed:255.0/255.0 green: 255.0/255.0 blue: 255.0/255.0 alpha: 1.0].CGColor;\nsubcell1_1.redRange = 0.0;\nsubcell1_1.blueRange = 0.0;\nsubcell1_1.greenRange = 0.0;\n\n \n//============== EMITTER sebCELL 2 - Fire Work ==============\n\nCAEmitterCell *subcell1_2 = [CAEmitterCell emitterCell];\n\n\nsubcell1_2.contents = (id) [[UIImage imageNamed:@&quot;FW-white.png&quot;] CGImage];\nsubcell1_2.name = @&quot;Firework&quot;;\nsubcell1_2.birthRate = 20000.0;\nsubcell1_2.lifetime = 15.0;\nsubcell1_2.lifetimeRange = 0.0;\nsubcell1_2.beginTime = 1.6;\nsubcell1_2.duration = 0.1;\nsubcell1_2.velocity = 190.0;\nsubcell1_2.velocityRange = 0.0;\nsubcell1_2.xAcceleration = 0.0;\nsubcell1_2.yAcceleration = 80.0;\nsubcell1_2.emissionLatitude = 0.0 * (M_PI / 180.0);\nsubcell1_2.emissionLongitude = 0.0 * (M_PI / 180.0);\nsubcell1_2.emissionRange = 360.0 * (M_PI / 180.0);\nsubcell1_2.spin = 114.6 * (M_PI / 180.0);\nsubcell1_2.spinRange = 0.0 * (M_PI / 180.0);\nsubcell1_2.scale = 0.1;\nsubcell1_2.scaleRange = 0.0;\nsubcell1_2.scaleSpeed = 0.12;// was.09\nsubcell1_2.alphaRange = 0.40;\nsubcell1_2.alphaSpeed = -0.7;\nsubcell1_2.color = [UIColor colorWithRed:255.0/255.0 green: 255.0/255.0 blue: 255.0/255.0 alpha: 1.0].CGColor;\nsubcell1_2.redRange = 0.0;\nsubcell1_2.greenRange = 0.0;\nsubcell1_2.blueRange = 0.0;\n\n cell1.emitterCells = [NSArray arrayWithObjects:subcell1_1, subcell1_2, nil];\n\nemitterLayer.emitterCells = [NSArray arrayWithObject:cell1];\n\n\n}\n</code></pre>\n<p>The code I use to trigger the effect is</p>\n<p>I connect the action below to a button:</p>\n<pre><code> -(IBAction)StartFW {\n\n [emitterLayer setValue:[NSNumber numberWithInt:1] forKeyPath:@&quot;emitterCells.Parent.birthRate&quot;];\n\n }\n</code></pre>\n<p>To code I use to stop the effect is</p>\n<p>I connect the action below to a button:</p>\n<pre><code> -(IBAction)StopFW {\n\n [emitterLayer setValue:[NSNumber numberWithInt:0] forKeyPath:@&quot;emitterCells.Parent.birthRate&quot;];\n\n }\n</code></pre>\n<p>When I trigger the code, by pressing a button, the fireworks work fine, but after a little bit, they will not work. What can I try to solve this?</p>\n"^^ . . . . . . . . . "external-accessory"^^ . . . . . "1"^^ . . . "1"^^ . . . . "2"^^ . . . . . . . "<p>I need to check size with Objective-C of external file which is shared to my react native app.</p>\n<p>I got url which works fine without getting file attributes:</p>\n<pre><code>file:///private/var/mobile/Containers/Shared/AppGroup/61894F8B-0001-40C2-856E-F30D4663F7A7/File%20Provider%20Storage/Instrukcja_Welcome_to.pdf\n</code></pre>\n<p>and</p>\n<pre><code>NSDictionary *fileAttributes = [fileManager attributesOfItemAtPath:url.relativePath error:&amp;error];\nNSNumber *fileSize = fileAttributes[NSFileSize];\n</code></pre>\n<p>works perfectly on simulator but when I use physical device I got error:</p>\n<blockquote>\n<p>Error Domain=NSCocoaErrorDomain Code=257 &quot;The file\n“Instrukcja_Welcome_to.pdf” couldn’t be opened because you don’t have\npermission to view it.&quot;\nUserInfo={NSFilePath=/private/var/mobile/Containers/Shared/AppGroup/61894F8B-0001-40C2-856E-F30D4663F7A7/File\nProvider Storage/Instrukcja_Welcome_to.pdf,\nNSUnderlyingError=0x280eeb240 {Error Domain=NSPOSIXErrorDomain Code=1\n&quot;Operation not permitted&quot;}}</p>\n</blockquote>\n<p>I tried:</p>\n<pre><code> NSFileCoordinator *fileCoordinator = [[NSFileCoordinator alloc] initWithFilePresenter:nil];\n [fileCoordinator coordinateReadingItemAtURL:url options:NSFileCoordinatorReadingWithoutChanges error:&amp;error byAccessor:^(NSURL *newURL) {\n fileAccessGranted = YES;\n }];\n</code></pre>\n<p>and added</p>\n<pre><code>&lt;key&gt;NSFileUsageDescription&lt;/key&gt;\n&lt;string&gt;This app requires access to files.&lt;/string&gt;\n</code></pre>\n<p>to info.plist</p>\n"^^ . . . . "1"^^ . "1"^^ . . "0"^^ . . . . "Does this answer your question? [Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?](https://stackoverflow.com/questions/3088059/xcode-how-to-fix-nsunknownkeyexception-reason-this-class-is-not-key-valu)"^^ . "Does it matter if this notification is sent more often than needed? It still lets you correctly update the tooltips. No need to dig into the private subview structure of the toolbar item."^^ . "0"^^ . . . "3"^^ . "@Lucilfer at this point I'm blind coding against your farm setup but please check the new hack."^^ . "<p>I need to create a LAN server on iOS device and give write access to the client device. Is there any library or resource available to create SMB server on any iOS/macOS/tvOS/watchOS but using swift that i can use or work on to create a working SMB server on any of iOS/tvOS/watchOS. I have tried to create an http server but for reasons(Apple) I am not able to give write access and i can only give read access for files. I also know that there are SMB client libraries out there like AMSMB2 &amp; TOSMBClient. But i need a server on a non macOS device. I am trying to do that using SMB right now if possible. Any help would be appreciated.</p>\n"^^ . "0"^^ . "0"^^ . . . "0"^^ . . . "Does this answer your question? [How do I declare class-level properties in Objective-C?](https://stackoverflow.com/questions/695980/how-do-i-declare-class-level-properties-in-objective-c) Skip the answers before 2016."^^ . . . "Welcome to SO. Please take a [tour] and read [ask] for tips how to write a good question. You can [edit] your question with additional information. This will help others answering your question."^^ . "<p>Here is the code for UIDatePicker:</p>\n<pre><code>_datePicker = [[UIDatePicker alloc] init];\n_datePicker.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;\n_datePicker.datePickerMode = UIDatePickerModeDate;\n_datePicker.preferredDatePickerStyle = UIDatePickerStyleWheels;\n_datePicker.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;\n_datePicker.backgroundColor = [UIColor whiteColor];\n</code></pre>\n<p>It is working on macOS Ventura, but not working on macOS Catalina. It shows nothing:</p>\n<p><img src="https://i.sstatic.net/kaQeh.png" alt="image error" /></p>\n<p>I have tried the other options of preferredDatePickerStyle, but it's still not working.</p>\n"^^ . . "Does this answer your question? [Objective-C Property Getter/Setter crash EXC\\_BAD\\_ACCESS](https://stackoverflow.com/questions/28637799/objective-c-property-getter-setter-crash-exc-bad-access)"^^ . . "Mix C++ and Objective-C code using CMake and get C++ executable"^^ . "0"^^ . . "0"^^ . . . . . . "0"^^ . . "So if you want to trigger GlobalSequencerViewController's action, then add the "GlobalSequencerViewController" as a child view controller of MainViewController.\ninstead of adding it as subView of MainViewController"^^ . . "uidatepicker"^^ . . "0"^^ . . . . . . "0"^^ . "react-native"^^ . . . . . . . "Toolbar customization works only on horizontal toolbars"^^ . . . . . "You still have an active NSFetchedResultsController apparently..."^^ . . . . "uikit"^^ . "So I essentially just have two view controllers, the main one and one that is added as a subview. The subviews button is wired up to its respective derived test action appropriately. For some reason when I click buttons within the subview that are wired to its assigned view controller, it cannot trigger the derived actions, only the actions within the base class. I'm wondering if maybe it has something to do with the main window being a storyboard and the subview being an xib. Maybe the xibs File's Owner custom class is being overwritten when it's loaded by the Main View."^^ . . . "3"^^ . . "0"^^ . . "The app is crashing on my farm devices for iOS versions below 15. It works on iOS 15 & 16. I used x4 register."^^ . "0"^^ . "0"^^ . "Please see [Creating a custom container view controller](https://developer.apple.com/documentation/uikit/view_controllers/creating_a_custom_container_view_controller?language=objc) for the correct way to add a child view controller to a container view controller."^^ . . . . "0"^^ . . . "@Lucilfer Can you use a debugger or at least print logs on this aws farm? Without that I essentially keep guessing. And the last result you provided to the best of my knowledge should technically not happen, so I'm really confused now. If we could run some diagnostic code on the farm and at least log stuff that could help finding a solution."^^ . "1"^^ . . "0"^^ . . . "1"^^ . . . . . . "Singleton pattern in Objective-C using a class property"^^ . . "1"^^ . . . . . "This does return a uuid but its not /usr/lib/dyld uuid. Please let me know how to return its uuid."^^ . . . . . "ios-bluetooth"^^ . . "@Lucilfer I've added a new hack, but I'm skeptical I can guess the solution without knowing what's going on."^^ . . . "0"^^ . . "1"^^ . . . . "0"^^ . . "<p>I am trying to put a view at the bottom of the contentView of my WkWebView.scrollView, but it seems like the view always end up at the origin Y of 5000 or 8000 which is the random value of bound inside the WkWebView.</p>\n<p>I tried setting frame, but resulted the same thing.</p>\n<p>I wonder if you can actually put a view exactly after the contentView of the webView ended while still making the scrolling works?</p>\n<pre><code>self.webView.frame = self.view.bounds;\n[self.webView.scrollView addSubview:self.myView];\nself.myView.translateAutoresizingMaskIntoConstraints = false;\n[self.myView.topAnchor constraintEqualToAnchor:self.webView.scrollView.subViews.lastObject.bottomAnchor].active = true;\n[self.myView.bottomAnchor constraintEqualToAnchor:self.webView.scrollView.bottomAnchor].active = true;\n[self.myView.widthAnchor constraintEqualToAnchor:self.view.widthAnchor].active = true;\n</code></pre>\n"^^ . "Have you tried `contentLayoutGuide`?"^^ . "0"^^ . . "bluetooth"^^ . "0"^^ . . "0"^^ . "server"^^ . . . . "1"^^ . "0"^^ . . . "0"^^ . . "0"^^ . . "0"^^ . . . . . "<p>try this workaround it will fix your problem. but it's a temporary fix you have to make these changes on every install of <code>pods</code></p>\n<pre><code>- SecTrustResultType result;\n\n- OSStatus errorCode = SecTrustEvaluate(serverTrust, &amp;result);\n+ CFErrorRef error;\n+ BOOL trusted = SecTrustEvaluateWithError(serverTrust, &amp;error);\n\n- BOOL evaluatesAsTrusted = (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed);\n- if (errorCode == errSecSuccess &amp;&amp; evaluatesAsTrusted) {\n+ if (trusted &amp;&amp; error == nil) {\n</code></pre>\n"^^ . "0"^^ . . "Nice, it just printed "This is a debug message" in the console after opening the app, i put this in the main function."^^ . "<p>when I turn off face id on the setting,I get a error as follow:</p>\n<pre><code> LAContext *myContext = [[LAContext alloc] init];\n NSError *authError = nil;\n [myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&amp;authError]\n</code></pre>\n<p>authError is &quot;No identities are enrolled.&quot;\nThis error does not indicate whether the phone is touch id or face id,how I determine whether the ios device is a face or a touch?</p>\n<p>I have tried differnt iphone device,authError is &quot;No identities are enrolled.&quot;. I can not determine whether the ios device is a face or a touch.</p>\n"^^ . "0"^^ . . . . "wkwebview"^^ . . . . "-1"^^ . "<p>I have a problem everytime I archive for any mac (catalyst)</p>\n<p>here is the error:\n<a href="https://i.sstatic.net/R9YXB.png" rel="nofollow noreferrer">enter image description here</a></p>\n<p>and also this is my build phase -&gt; Crashlytics run script\n<a href="https://i.sstatic.net/Qmm54.png" rel="nofollow noreferrer">enter image description here</a></p>\n<p>can anyone help me with this ? thank you</p>\n<p>I've done the suggestions I get from this thread.\n<a href="https://stackoverflow.com/questions/63704911/firebasecrashlytics-run-no-such-file-or-directory-error-while-building-the-app">FirebaseCrashlytics/run: No such file or directory error while building the app - swift</a></p>\n<p>but the same error still exists</p>\n"^^ . "Or this https://www.galloway.me.uk/tutorials/singleton-classes/ ?"^^ . . . "I tried it, but this notification is sent dozens of time for each user action. I managed to access the toolbar item view (by traversing the view hierarchy) and to add a tooltip rectangle. This is is not the most elegant, but I can update the tooltip only when it shows."^^ . . . . "1"^^ . . . . "Apple explicitly tells us that semaphores are unsafe in conjunction with Swift concurrency. https://developer.apple.com/videos/play/wwdc2021/10254?time=1558. The function in question should to be, itself, an `async` method."^^ . "singleton"^^ . . . . . . "nstoolbaritem"^^ . . . "2"^^ . . . . . "<p>We have received an external dependency framework from one of our partners, and their latest version (v2) of the framework only exposes Swift async interfaces. We were in the middle of integrating the previous version (v1) of the framework, which does not utilize Swift async, when the new version (v2) was released. We encountered an issue with v1, and their support team recommended switching to the latest version (v2), mentioning that v1 may contain a bug. So now we need to somehow integrate the code that looks like</p>\n<pre><code>let data = try await storage?.data(forKey: key)\n</code></pre>\n<p>in to the code that expect</p>\n<pre><code>let data = storage?.data(forKey: key)\nreturn data \n</code></pre>\n<p>which wouldn't be a problem if there was only swift code but we also have a fair bit of objc code that is using the same framework and the code</p>\n<pre><code>NSData *data = [storage storedDataForKey:key];\nreturn data\n</code></pre>\n<p>becomes something like</p>\n<pre><code>NSData *data = [storage storedDataForKey:key completionHandler:^(NSData* data) {\n // do something here and then call completion\n}\n</code></pre>\n<p>it has a knock off effect and requires changes of quite a lot of code. Considering all we need now is just to check the v2 of the framework work as expected and has no bug I am wondering if there is a simpler solution that could wrap async interfaces of the v2 and let us test the framework.</p>\n"^^ . . . . . "That's Objective-C, not Swift. And I guess your error is on `OSStatus errorCode = SecTrustEvaluateWithError(serverTrust, &result);`, you should pass a `NSError` parameter, not a `SecTrustResultType`. Call later ` SecTrustGetTrustResult` is error is not nil. See the doc: https://developer.apple.com/documentation/security/2980705-sectrustevaluatewitherror?language=objc"^^ . "0"^^ . "0"^^ . . . . . . "0"^^ . . "macos"^^ . "0"^^ . . . . . "0"^^ . . . . . . . "0"^^ . . . . . . "0"^^ . "0"^^ . . "libiconv"^^ . . "4"^^ . . "0"^^ . "So the vertical toolbar is not a `NSToolbar`?"^^ . "@Lucilfer try the new hack please."^^ . "0"^^ . . "0"^^ . . . "<p>The important lesson here is what &quot;dot syntax&quot; actually means in ObjC. Originally (until around 2007) in ObjC, setting a property was always done using a method called <code>-setX:</code>, which would be called as <code>[obj setThing:thing]</code>. There was no <code>obj.thing = thing</code> syntax. (This existed for C structs, but that's a very different thing.)</p>\n<p>This <code>setThing:</code> syntax was through convention. It was not actually part of the language, and there were no <code>@property</code> definitions. It was just well understood that when you wanted to expose a &quot;writable property&quot; called <code>thing</code>, the object should have methods <code>-thing</code> and <code>-setThing:</code> (plus some subtle rules about BOOL properties and the <code>is...</code> prefix, and by-reference <code>get...</code> methods that I won't dive into). This all became formalized as <a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/KeyValueCoding/AccessorConventions.html#//apple_ref/doc/uid/20002174-BAJEAIEE" rel="nofollow noreferrer">Key-Value Coding</a>, but was still technically &quot;convention,&quot; not part of the language.</p>\n<p>In ObjC 2, the convention was made part of the language as &quot;dot syntax.&quot; I do not exaggerate to say this change was extremely controversial. (It is <strong>still</strong> controversial in some circles, but most of us have kind of gotten over it.) With dot syntax, <code>obj.thing</code> is translated into <code>[obj thing]</code>, and <code>obj.thing = thing</code> is translated into <code>[obj setThing:thing]</code>. It is purely syntactic sugar.</p>\n<p>As a separate feature, over a couple of iterations involving ever-less <code>@synthesize</code>, the <code>@property</code> syntax was added. This let you define &quot;properties&quot; that would automatically define a backing ivar (with a leading <code>_</code>) and the required getter and setter methods to match existing conventions.</p>\n<p>So looking at your property definition:</p>\n<pre><code>@property (nonatomic, readwrite, assign) BOOL isFoo;\n</code></pre>\n<p>This, provided that <code>-isFoo</code> and <code>-setIsFoo:</code> are not defined, will automatically create an ivar called <code>_isFoo</code>, and provide synthesized getter and setter methods that apply the requested memory management. (That's another story, leading eventually to ARC.)</p>\n<p>But in your case you define <code>setIsFoo:</code>, so the setter is not generated automatically. Instead, expanding the dot syntax sugar, you've written:</p>\n<pre><code>- (void)setIsFoo:(BOOL)isFoo {\n [self setIsFoo:isFoo];\n}\n</code></pre>\n<p>And, as you might expect, that crashes, since it's infinitely recursive. Accessesing the ivar (<code>_isFoo</code>) directly does not crash, and is the correct way to implement this. (Though in this specific case, since you're using the default implementation, you shouldn't write this; you should allow the system to synthesize it for you.)</p>\n"^^ . "0"^^ . "1"^^ . "0"^^ . . . "0"^^ . "0"^^ . . . . . . . . "1"^^ . . "Yes you're right @Larme I got the issue of type right? but I created it but still gives error that and this one ```Passing 'NSError' to parameter of incompatible type 'CF_RETURNS_RETAINED CFErrorRef _Nullable *' (aka 'struct __CFError **')```"^^ . "0"^^ . "Did not get your question exactly, but if you are trying to connect the IBAction From GlobalSequencerViewController to MainViewController the action method won't show, because the button action can be given to the same viewcontroller where it is added. If you try to connect to GlobalSequencerViewController it will show you the action method. Any way let us know what you are trying to achieve so that can guide you the correct approach. But definitely the button of one VC can not be wired up with another VC"^^ . "0"^^ . . . . . "1"^^ . "1"^^ . . . . . "@Lucilfer how can you inspect what's going on in the farm with your app? Do you see the app screen somehow there? Or in other words what can you do on the farm?"^^ . "@Lucilfer try the new attempt"^^ . "1"^^ . . "0"^^ . . . . . . . "hi author, did you fix that? I have the same problem too"^^ . . "You don't need to register with MFi because you are using a standard keyboard HID profile, but if your device doesn't include an MFi chipset and identifier you will not discover it via external accessory framework."^^ . . . . "1"^^ . "<p>As you already observed <code>_dyld_get_image_header(..)</code> will omit <code>/usr/lib/dyld</code> from the results. Your process does not have any easy way to access it through Apple APIs.</p>\n<p>That's what <code>lldb</code> does:</p>\n<p><a href="https://github.com/apple-oss-distributions/dyld/blob/dyld-1231.3/include/mach-o/dyld_process_info.h" rel="nofollow noreferrer">https://github.com/apple-oss-distributions/dyld/blob/dyld-1231.3/include/mach-o/dyld_process_info.h</a></p>\n<blockquote>\n<p>When starting a process, lldb starts the process suspended, finds\nthe &quot;_dyld_debugger_notification&quot; symbol in dyld, sets a break\npoint on it, then resumes the process. Dyld will call\n_dyld_debugger_notification() with a list of images that were just added or removed from the process. Dyld calls this function before\nrunning any initializers in the image, so the debugger will have a\nchance to set break points in the image.</p>\n</blockquote>\n<p>This is how lldb's</p>\n<pre><code>image list dyld\n[ 0] 651EB4D8-A0F0-3C97-A0C4-6A8F6FC17A56 0x00000001051c4000 /Users/username/Library/Developer/Xcode/iOS DeviceSupport/13.3 (17C54) arm64e/Symbols/usr/lib/dyld\n</code></pre>\n<p>works.</p>\n<p><strong>Update - proper solution</strong></p>\n<pre><code>#include &lt;mach-o/dyld_images.h&gt;\nvoid *getDyldBase(void) {\n struct task_dyld_info dyld_info;\n mach_vm_address_t image_infos;\n struct dyld_all_image_infos *infos;\n\n mach_msg_type_number_t count = TASK_DYLD_INFO_COUNT;\n kern_return_t ret;\n\n ret = task_info(mach_task_self_,\n TASK_DYLD_INFO,\n (task_info_t)&amp;dyld_info,\n &amp;count);\n\n if (ret != KERN_SUCCESS) {\n return NULL;\n }\n\n image_infos = dyld_info.all_image_info_addr;\n\n infos = (struct dyld_all_image_infos *)image_infos;\n return infos-&gt;dyldImageLoadAddress;\n}\n\n- (NSString *) getDynamicLinkerUUID {\n const struct mach_header *dyldHeader = getDyldBase()\n\n if (!dyldHeader)\n return @&quot;Cannot found header: MH_DYLINKER&quot;;\n\n BOOL is64bit = dyldHeader-&gt;magic == MH_MAGIC_64 || dyldHeader-&gt;magic == MH_CIGAM_64;\n uintptr_t cursor = (uintptr_t)dyldHeader + (is64bit ? sizeof(struct mach_header_64) : sizeof(struct mach_header));\n const struct segment_command *segmentCommand = NULL;\n for (uint32_t i = 0; i &lt; dyldHeader-&gt;ncmds; i++, cursor += segmentCommand-&gt;cmdsize) {\n segmentCommand = (struct segment_command *)cursor;\n if (segmentCommand-&gt;cmd == LC_UUID) {\n const struct uuid_command *uuidCommand = (const struct uuid_command *)segmentCommand;\n const uint8_t *uuid = uuidCommand-&gt;uuid;\n NSString* uuidString = [NSString stringWithFormat:@&quot;%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X&quot;,\n uuid[0], uuid[1], uuid[2], uuid[3],\n uuid[4], uuid[5], uuid[6], uuid[7],\n uuid[8], uuid[9], uuid[10], uuid[11],\n uuid[12], uuid[13], uuid[14], uuid[15]];\n NSLog(@&quot;UUID: %@&quot;, uuidString);\n return [uuidString lowercaseString];\n }\n }\n return @&quot;&quot;;\n}\n</code></pre>\n<p><strong>Obsolete Not so pretty hacks territory</strong></p>\n<p>If your process uses <code>LC_MAIN</code> to launch (should be pretty much a guarantee on any modern iOS i.e. iOS11 and beyond) the <code>premain</code> (i.e. marked with C++ constructor attribute) function will return to dyld executable address space.</p>\n<p>My previous approach (edited out) using regular <code>main</code> won't work below iOS15 because the main executable returns to libdyld.dylib instead of dyld.</p>\n<p>Thankfully the <code>premain</code> approach works on all iOS versions I tested, which specifically are:\niPhone 11 iOS 13.3<br />\niPhone 12 iOS 14.1<br />\nipad 9th gen iOS 15.1<br />\niPad mini 6th generation iOS 15.4.1<br />\niPhone 13 Pro iOS 15.5<br />\niPhone 7 iOS 15.7.5<br />\niPhone 8 iOS 16.0</p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n#import &quot;AppDelegate.h&quot;\n#include &lt;mach-o/dyld.h&gt;\n\nvoid __attribute__ ((constructor)) premain(void) {\n // find the return address of the premain function\n char *ptr = __builtin_extract_return_addr (__builtin_return_address (0));\n \n // search backwards in memory for dyld's Mach-o header\n while (*(int*)ptr != MH_MAGIC_64 &amp;&amp; *(int*)ptr != MH_CIGAM_64) {\n ptr--;\n }\n\n const struct mach_header_64 *dyldHeader = (struct mach_header_64 *)ptr;\n\n BOOL is64bit = dyldHeader-&gt;magic == MH_MAGIC_64 || dyldHeader-&gt;magic == MH_CIGAM_64;\n uintptr_t cursor = (uintptr_t)dyldHeader + (is64bit ? sizeof(struct mach_header_64) : sizeof(struct mach_header));\n const struct segment_command *segmentCommand = NULL;\n for (uint32_t i = 0; i &lt; dyldHeader-&gt;ncmds; i++, cursor += segmentCommand-&gt;cmdsize) {\n segmentCommand = (struct segment_command *)cursor;\n if (segmentCommand-&gt;cmd == LC_UUID) {\n const struct uuid_command *uuidCommand = (const struct uuid_command *)segmentCommand;\n const uint8_t *uuid = uuidCommand-&gt;uuid;\n NSString* uuidString = [NSString stringWithFormat:@&quot;%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X&quot;,\n uuid[0], uuid[1], uuid[2], uuid[3],\n uuid[4], uuid[5], uuid[6], uuid[7],\n uuid[8], uuid[9], uuid[10], uuid[11],\n uuid[12], uuid[13], uuid[14], uuid[15]];\n NSLog(@&quot;UUID: %@&quot;, uuidString);\n }\n }\n}\n</code></pre>\n<p><strong>Even more crazy hacks territory</strong><br />\nOP seems to observe a different launch for iOS13 &amp; iOS14 devices when an aws device farm is used. The <code>premain</code> seems to return to libdyld.dyld .\nHere's yet another hack for iOS13.x and iOS14.x</p>\n<pre><code>void searchBackwardsPrintUUID(char *ptr) {\n // search backwards for Mach-o header\n while (*(int*)ptr != MH_MAGIC_64 &amp;&amp; *(int*)ptr != MH_CIGAM_64) {\n ptr--;\n }\n\n const struct mach_header_64 *dyldHeader = (struct mach_header_64 *)ptr;\n\n BOOL is64bit = dyldHeader-&gt;magic == MH_MAGIC_64 || dyldHeader-&gt;magic == MH_CIGAM_64;\n uintptr_t cursor = (uintptr_t)dyldHeader + (is64bit ? sizeof(struct mach_header_64) : sizeof(struct mach_header));\n const struct segment_command *segmentCommand = NULL;\n for (uint32_t i = 0; i &lt; dyldHeader-&gt;ncmds; i++, cursor += segmentCommand-&gt;cmdsize) {\n segmentCommand = (struct segment_command *)cursor;\n if (segmentCommand-&gt;cmd == LC_UUID) {\n const struct uuid_command *uuidCommand = (const struct uuid_command *)segmentCommand;\n const uint8_t *uuid = uuidCommand-&gt;uuid;\n uuidString = [NSString stringWithFormat:@&quot;%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X&quot;,\n uuid[0], uuid[1], uuid[2], uuid[3],\n uuid[4], uuid[5], uuid[6], uuid[7],\n uuid[8], uuid[9], uuid[10], uuid[11],\n uuid[12], uuid[13], uuid[14], uuid[15]];\n NSLog(@&quot;UUID: %@&quot;, uuidString);\n }\n }\n}\n\nvoid __attribute__ ((constructor)) premain() {\n unsigned char *ptr;\n register unsigned char* x0\n#if defined(__arm64__)\n asm(&quot;x0&quot;);\n #if __IPHONE_14_0\n asm volatile (\n &quot;ldr x0, [sp, #8] \\r\\n&quot;\n :&quot;=r&quot;(x0)\n );\n #elif __IPHONE_13_0\n asm volatile (\n &quot;ldr x0, [sp] \\r\\n&quot;\n :&quot;=r&quot;(x0)\n );\n #endif\n\n#endif\n if (@available(iOS 15, *)) {\n // find the return address of the premain function\n ptr = __builtin_extract_return_addr (__builtin_return_address (0));\n } else if (@available(iOS 13, *)) {\n ptr = x0;\n } else { // iOS11\n // find the return address of the premain function\n ptr = __builtin_extract_return_addr (__builtin_return_address (0));\n }\n searchBackwardsPrintUUID(ptr);\n}\n</code></pre>\n<p>Please provide debug logs of following code from the aws device farm:</p>\n<pre><code>static bool once = true;\nstatic void image_added(const struct mach_header *mh, intptr_t slide) {\n\n if (once) {\n once = false;\n NSString* string = [NSString stringWithFormat:@&quot;%@&quot;, NSThread.callStackSymbols];\n os_log_with_type(OS_LOG_DEFAULT, OS_LOG_TYPE_ERROR, &quot;%@&quot;, string);\n }\n}\n\nvoid __attribute__ ((constructor)) premain(void) {\n char *ptr;\n NSString* string = [NSString stringWithFormat:@&quot;%@&quot;, NSThread.callStackSymbols];\n os_log_with_type(OS_LOG_DEFAULT, OS_LOG_TYPE_ERROR, &quot;%@&quot;, string);\n _dyld_register_func_for_add_image(&amp;image_added);\n}\n</code></pre>\n"^^ . . . . . . . "0"^^ . . . . . "smb"^^ . . . "Sorry, `CFError`, is "old" `NSError`. See https://stackoverflow.com/questions/20427104/casting-a-cferrorref-to-an-nserror-or-opposite-with-arc but there should be bridgeable."^^ . "<p>I have some <code>NSToolBarItems</code> to allow undo/redo in my app. I want them to show the name of undo/redo actions in their tooltip.</p>\n<p>I can specify the tooltip of an <code>NSToolBarItem</code> vial its <code>toolTip</code> property. But I'm not sure when this property should be set. I haven't found a way to be notified when the undo manager has recorded a new action to undo or redo.</p>\n<p>It would be better to dynamically return the tooltip string when the user hovers the toolbar item. But this requires adding a tooltip rectangle to a view that I cannot access. Indeed, the <code>view</code> property of <code>NSToolBarItem</code> returns <code>nil</code> by default. It does not return <code>nil</code> if I set the <code>view</code> property with my own view, but a <code>NSToolBarItem</code> uses a private subclass of <code>NSButton</code> as view, by default. This subclass implements nice behaviours that <code>NSButton</code> doesn't. So I'd rather use the default view.</p>\n<p>Is there a way to add a tooltip rectangle to an <code>NSToolBarItem</code>'s <code>view</code> that doesn't use a custom view? IOW, how can I access this view?</p>\n"^^ . . "There are many similar queastions already: https://stackoverflow.com/questions/5381085/how-to-create-singleton-class-in-objective-c, https://stackoverflow.com/questions/46319731/objective-c-singleton-implementation, https://stackoverflow.com/questions/7568935/how-do-i-implement-an-objective-c-singleton-that-is-compatible-with-arc, https://stackoverflow.com/questions/145154/what-should-my-objective-c-singleton-look-like, https://stackoverflow.com/questions/16208041/what-is-the-use-of-singleton-class-in-objective-c."^^ . . . . . "1"^^ . . "<p>I'm trying to create a singleton class in Objective-C that will also be consumed in Swift. I'd like the singleton instance to be accessible in Swift as a property.</p>\n<p>It appears that Apple does something similar (though not quite a singleton) in <code>NSFileManager</code>.</p>\n<pre><code>@property(class, readonly, strong) NSFileManager *defaultManager;\n</code></pre>\n<p>Ref: <a href="https://developer.apple.com/documentation/foundation/nsfilemanager/1409234-defaultmanager" rel="nofollow noreferrer">https://developer.apple.com/documentation/foundation/nsfilemanager/1409234-defaultmanager</a></p>\n<p>Here's my (simplified) attempt so far:</p>\n<p>FOOMyManager.h:</p>\n<pre><code>@interface FOOMyManager : NSObject\n\n@property(class, readonly, strong) FOOMyManager *defaultManager;\n\n- (instancetype)init NS_UNAVAILABLE;\n\n@end\n</code></pre>\n<p>FOOMyManager.mm</p>\n<pre><code>@implementation FOOMyManager\n\n+ (FOOMyManager *)defaultManager {\n static dispatch_once_t s_once = 0;\n static FOOMyManager *s_instance = nil;\n dispatch_once(&amp;s_once, ^{\n s_instance = [[FOOMyManager alloc] initForDefaultManager];\n });\n\n return s_instance;\n}\n\n- (instancetype)initForDefaultManager {\n self = [super init];\n return self;\n}\n\n@end\n</code></pre>\n<p>I've seen instances of a similar pattern being used to create singletons using</p>\n<pre><code>+ (instancetype)defaultManager;\n</code></pre>\n<p>But I'd explicitly like to try and use properties if possible. Is my attempt the &quot;right&quot; way to do this?</p>\n"^^ . . . . . "there are different scripts required depending if you are using Pods or SPM\nhttps://stackoverflow.com/questions/63704911/firebasecrashlytics-run-no-such-file-or-directory-error-while-building-the-app"^^ . "0"^^ . . . . . "0"^^ . . "4"^^ . "1"^^ . . "cocoa"^^ . . "Objective-C NSFileManager works fine on simulator but Operation not permitted error Domain=NSCocoaErrorDomain Code=257 on device when check file size"^^ . . . "1"^^ . . . . . "How to obtain UUID of dynamic linker? (/usr/lib/dyld)"^^ . . "0"^^ . "0"^^ . . "I am using several phones to test, the code you provided is giving me uuid of `/usr/lib/system/libdyld.dylib` not `/usr/lib/dyld`. I tested iPhone 8, 5s, 11 Pro, X with different iOS versions but none of them returned the correct one. Can you please double check? The `7C9C7851823738A7B1EB9CD2DEB4B746` is correct for 15.5 arm64e phone tho."^^ . . . "Use semaphore https://stackoverflow.com/questions/70962534/swift-await-async-how-to-wait-synchronously-for-an-async-task-to-complete **BUT** as said (here in comments and in answers comments), it is **NOT RECOMMENDED**, and you might find issues (after it's not recommended as unsafe, and blocking threads) for your proof of concept, but later, you'll need anyway to convert your sync code to async one..."^^ . "Thanks for your answer. It leads me to the solution I post below. Cheers"^^ . "0"^^ . "New hack to test."^^ . . . . . "0"^^ . . . "0"^^ . . . "3"^^ . . "Yes, I don't believe that there is any way for your app to interact with your peripheral unless it also supports the GATT profile."^^ . "2"^^ . . . . "Cannot call IBAction in derived class instantiated as subview"^^ . . . . . "The app crashed again with the new hack :(("^^ . . "ios"^^ . . . . "The app crashed with the x20 register. With x21 register it didn't crash and returned a different uuid which is not even libdyld.dylib. Env: iPhone 11 iOS 14.0.1, the uuid it returned: 44E7E59A17333D2E90E3473269A3DAEA. On an iPhone 12 Pro running 14.4 it also returns the same uuid, looks like the x21 returns a constant uuid"^^ . . . "I've added code to print some stacktraces (at the bottom of my answer). Please edit & include the output in your question."^^ . . . . . . . . "1"^^ . "0"^^ . "You can try `os_log` first https://developer.apple.com/documentation/os/logging/generating_log_messages_from_your_code?language=objc . Maybe it will appear in the Amazon device farm console."^^ . . "0"^^ . "In that case I'd rather use my previous solution, which was to update the tooltips in `validateUserInterfaceItem`. This is called for every user action (even if not undoable), but only once per action, while `NSUndoManagerCheckpointNotification` can be sent dozen of times in a run loop."^^ . "1"^^ . . . . . . . . . . "You might be able to use IOSs dual mode Bluetooth support - https://developer.apple.com/wwdc19/901 ?"^^ . . . . . . . . "Does this answer your question? [How to programmatically check support of 'Face Id' and 'Touch Id'](https://stackoverflow.com/questions/46887547/how-to-programmatically-check-support-of-face-id-and-touch-id)"^^ . "1"^^ . . . "That is not the correct way to setup a child view controller in a container view controller. Please see the [Creating a custom container view controller](https://developer.apple.com/documentation/uikit/view_controllers/creating_a_custom_container_view_controller?language=objc) document from Apple."^^ . . "0"^^ . . . "1"^^ . "0"^^ . . . "2"^^ . . "Thanks, @RobNapier. Yes is part of Metal, however this bug started in early versions when I wasn't using Metal at all. Must be an OS bug."^^ . . "How to create unit test for UISceneConnectionOptions?"^^ . . "That sounds like a new question. I recommend closing this one as "not reproducible" and opening a new one with the details of your issue. MPRemoteCommandCenter is not attached to view controllers in anyway. It's behavior isn't going to change unless you do write code to interact with it."^^ . "1"^^ . . "0"^^ . . . "How can I wrap Objective-C code for visionOS only?"^^ . . . . . "0"^^ . "0"^^ . "1"^^ . . "0"^^ . . . "Location Manger is not updating location on ios 16+"^^ . . "1"^^ . "I don't know Objective C, but you can use something called an "iconv" library."^^ . "0"^^ . . . "In RNWebViewManager.m. That’s what the error says : you cannot declare the interface category if you do not specify (aka import) the original interface definition."^^ . . "please check this also\n\nlocationManager.desiredAccuracy = kCLLocationAccuracyBest;\nlocationManager.pausesLocationUpdatesAutomatically = NO;\n\nlocationManager.distanceFilter =5;"^^ . "Means your contacts are not sorted ? Can not get. It seems sorted"^^ . . . "0"^^ . . . . . "0"^^ . "0"^^ . "0"^^ . . . . "Is there a [mac-privateapi] tag (or equivalent)? I couldn’t find it if there is; sorry."^^ . "it doesn't have sense RNWebViewManager.h does not exist in my project in fact it gives me the error: 'RNWebViewManager.h' file not found"^^ . . "1"^^ . . . "0"^^ . . "0"^^ . "I tried this out and the NSLog came back with an empty array"^^ . "0"^^ . . "Thanks @IanAbbott, I'm checking if we can do UTF16BigEndian in Objective C, if not, I will check iconv_open(). I'm on macOS, when I run 'iconv -l' in Terminal, I see many encoding entries - and we find the ones I'm interested in "UTF-8 UTF8" and "UTF-16BE". So will I have to use the iconv library to convert every character and then write the character to the file, or write it as usual and then convert the entire file contents to "UTF-16BE"? What do you propose is the right approach?"^^ . "grand-central-dispatch"^^ . "iOS - Can not sort contacts same to Contacts framework order"^^ . . . "0"^^ . . . . . "0"^^ . . . "Please check orientation in uiImage."^^ . . "2"^^ . . "0"^^ . . . "There is no any error console."^^ . . . . . "0"^^ . . . . "13"^^ . "How to detect when two CAShapeLayers intersect and to change the color of the intersecting pixels"^^ . "Search RTF for Bold font"^^ . . "0"^^ . . "It's part of Metal. I would expect running out of GPU memory if I had to guess. Could be an OS bug or yours depending on your code. If you're not using Metal directly, or using frameworks that make heavy use of the GPU, I'd reach out to Apple with it."^^ . "0"^^ . "Avoid use wchar_t and such functions (if you can, they are *obsolete*). Use `char` and things should often be "automatic" with UTF-8 (just remember that one glyphs/characters can have many *char* (but this is also UTF_16, and wchar usually is UCS2, but also in such case there are combining characters, etc.)."^^ . "<p>Use <code>TARGET_OS_VISION</code></p>\n<pre><code>#if TARGET_OS_VISION\n\n#else\n\n#endif\n</code></pre>\n"^^ . . . . "2"^^ . . . "0"^^ . . . . . "xcode"^^ . "crash"^^ . "1"^^ . "0"^^ . "Welcome to Stack Overflow. What is the question, "Why are certain repeated keys ignored?" or "how to debug `interpretKeyEvents`?"? Please read [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) and edit the question."^^ . . "tvos"^^ . . "1"^^ . . . . "0"^^ . . "2"^^ . "0"^^ . . . "4"^^ . . "0"^^ . . "How to use audio remote control device as input device for iOS app"^^ . "0"^^ . "1"^^ . . . . . "It’s definitely bold in preview, TextEdit, and even when I see it in Xcode as a preview"^^ . . . "swift"^^ . . . . "1"^^ . . . "0"^^ . . "Hi @iDec, we were not able to resolve this. We dropped the ConnectSDK library as a result and used the `flutter_cast_video` and `flutter_ios_airplay` plugins instead."^^ . . "hex"^^ . "visionos"^^ . . "0"^^ . . "<p>Is there a way to set the launch URL and source application property of connectionOptions/UISceneConnectionOptions for testing SceneDelegate? I see that the properties of UISceneConnectionOptions are all read-only but I was wondering if there are any workarounds to this. My project has an existing unit test for AppDelegate's launchOptions, and is able to set the url and source application, but I'm getting errors that the property is 'get' only with connectionOptions.</p>\n"^^ . "1"^^ . . . . . . . "@KamyFC The first column does not count. That is the actual Unicode code point U+1EA1. In UTF-8 it is represented by the bytes 'E1 BA A1'. In UTF-16LE it is represented by the bytes 'A1 1E'. In UTF-16BE it is represented by the bytes '1E A1'. In UTF-32LE it is represented by the bytes 'A1 1E 00 00'. In UTF-32BE it is represented by the bytes '00 00 1E A1'."^^ . "<p>Im handling a screen which show contacts from contactDictionary with same native device order.\nI have seen this method in Contacts framework.</p>\n<pre><code>/*! The contact comparator for a given sort order. */\n+ (NSComparator)comparatorForNameSortOrder:(CNContactSortOrder)sortOrder;\n</code></pre>\n<p>But when I call</p>\n<pre><code>NSComparator comparator = [CNContact comparatorForNameSortOrder:CNContactSortOrderUserDefault];\n NSArray&lt;CNContact *&gt; *sortedContacts = [listContacts sortedArrayUsingComparator:comparator];\n</code></pre>\n<p>Its not same to when I fetch all contact with <code>CNContactSortOrderUserDefault</code></p>\n<pre><code>CNContactFetchRequest *fetchRequest = [[CNContactFetchRequest alloc] initWithKeysToFetch:@[\n [CNContactFormatter descriptorForRequiredKeysForStyle:CNContactFormatterStyleFullName],\n CNContactPhoneNumbersKey,\n CNContactOrganizationNameKey,\n CNContactJobTitleKey,\n CNContactBirthdayKey,\n CNContactImageDataKey,\n CNContactThumbnailImageDataKey,\n CNContactImageDataAvailableKey,\n CNContactEmailAddressesKey,\n CNContactPostalAddressesKey,\n CNContactDatesKey,\n CNContactSocialProfilesKey,\n CNContactPhoneticGivenNameKey,\n CNContactPhoneticMiddleNameKey,\n CNContactPhoneticFamilyNameKey,\n CNContactNicknameKey\n ]];\n CNContactSortOrder sortOder = CNContactSortOrderUserDefault;\n fetchRequest.sortOrder = sortOder;\n \n NSError *fetchError = nil;\n [contactStore enumerateContactsWithFetchRequest:fetchRequest error:&amp;fetchError usingBlock:^(CNContact * _Nonnull contact, BOOL * _Nonnull stop){}];\n</code></pre>\n<p>List contact when fetch all:</p>\n<pre><code>!Saz\n\\Sa\n“Sa\n#Sa\n%Sa\n‘Sa\n(Sa\n)Sa\n*Sa\n}Sa\n{Sa\n,Sa\n-Sa\nA\nSa\n.Sa\n/Sa\n:Sa\nSa\n!!Sa\n!?Saz\n;Sa\n?Sa\n@Sa\n[Sa\n\\Sa\n]Sa\n??Saz\n]!Sa\n![Sa\n!!Sa\n]?Sa\n?[Sa\n&amp;?Saz\nSa !\n=Sa\n123hange\n</code></pre>\n<p>My list after sort by <code>comparatorForNameSortOrder</code>:</p>\n<pre><code>-Sa\n,Sa\n;Sa\n:Sa\nSa !\n!!Sa\n!!Sa\n!?Saz\n![Sa\n!Saz\n??Saz\n?[Sa\n?Sa\n.Sa\n‘Sa\n“Sa\n(Sa\n)Sa\n[Sa\n]!Sa\n]?Sa\n]Sa\n{Sa\n}Sa\n@Sa\n*Sa\n/Sa\n\\Sa\n\\Sa\n&amp;?Saz\n#Sa\n%Sa\n=Sa\n123hange\nA\nSa\nSa\n</code></pre>\n<p>Thanks for watching.</p>\n"^^ . . "Sharing code between C/C++/Objective-C and Metal"^^ . "0"^^ . "frameworks"^^ . . "0"^^ . "0"^^ . "0"^^ . . . . "0"^^ . . . . . . . . "<p>I am using this code snippet which enables location tracking</p>\n<pre><code> - (void)enableOrDisableLocationTracking {\n NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];\n NSInteger trackingSetting = [userDefaults integerForKey:@&quot;trackingSetting&quot;];\n \n if (trackingSetting == 0) {\n NSLog(@&quot;Location tracking is enabled&quot;);\n \n self.locationTracker = [[CustomLocationTracker alloc] init];\n self.locationTracker.delegate = self;\n \n [self.locationTracker.normalLocationManager requestAlwaysAuthorization];\n \n NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];\n NSInteger gpsSetting = [userDefaults integerForKey:@&quot;gpsSetting&quot;];\n \n if (self.sharedModel.isFollowMeActive) {\n if (gpsSetting &gt; 3) {\n [self.locationTracker updateGPSSensitivity:gpsSetting];\n [self.locationTracker updateSignificantGPSSensitivity:gpsSetting];\n } else {\n [self.locationTracker updateGPSSensitivity:3];\n [self.locationTracker updateSignificantGPSSensitivity:3];\n }\n } else {\n [self.locationTracker updateGPSSensitivity:gpsSetting];\n [self.locationTracker updateSignificantGPSSensitivity:gpsSetting];\n }\n \n [self.locationTracker.normalLocationManager startUpdatingLocation];\n \n // Significant location changes\n [self.locationTracker.significantLocationManager requestAlwaysAuthorization];\n [self.locationTracker.significantLocationManager startMonitoringSignificantLocationChanges];\n \n switch (CLLocationManager.authorizationStatus) {\n case kCLAuthorizationStatusDenied: {\n NSLog(@&quot;User denied location access request&quot;);\n [self.locationTracker.normalLocationManager requestAlwaysAuthorization];\n \n UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@&quot;Limited Functionality&quot; message:@&quot;GPS Denied. Go to Settings and set Allow Location Access to Always&quot; preferredStyle:UIAlertControllerStyleAlert];\n UIAlertAction* okAction = [UIAlertAction actionWithTitle:@&quot;OK&quot; style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {\n [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];\n }];\n [alertVC addAction:okAction];\n [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alertVC animated:YES completion:nil];\n \n } break;\n case kCLAuthorizationStatusAuthorizedWhenInUse: {\n NSLog(@&quot;Show panel to ask for full authorization&quot;);\n [self.locationTracker.normalLocationManager requestAlwaysAuthorization];\n UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@&quot;Limited Functionality&quot; message:@&quot;GPS Limited. Go to Settings and set Allow Location Access to Always&quot; preferredStyle:UIAlertControllerStyleAlert];\n UIAlertAction* okAction = [UIAlertAction actionWithTitle:@&quot;OK&quot; style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {\n [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];\n }];\n [alertVC addAction:okAction];\n [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alertVC animated:YES completion:nil];\n } break;\n case kCLAuthorizationStatusAuthorizedAlways: {\n NSLog(@&quot;User granted full permission, good to go&quot;);\n } break;\n default:\n break;\n }\n \n } else {\n NSLog(@&quot;Location tracking is disabled&quot;);\n \n if (self.locationTracker != nil) {\n [self.locationTracker.normalLocationManager stopUpdatingLocation];\n [self.locationTracker.significantLocationManager stopMonitoringSignificantLocationChanges];\n self.locationTracker.delegate = nil;\n self.locationTracker = nil;\n }\n }\n}\n</code></pre>\n<p>On the simulator, I do this and I do receive location updates</p>\n<p><a href="https://i.sstatic.net/HZ3i3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HZ3i3.png" alt="enter image description here" /></a></p>\n<p>but on a <em><strong>real device</strong></em>, it doesn't give any updates instead this method is called</p>\n<pre><code>- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {}\n</code></pre>\n<p>and gives this error</p>\n<p><em><strong>Error Domain=kCLErrorDomain Code=0 &quot;(null)&quot;</strong></em></p>\n<p>I see lots of other solutions but non of them worked for me</p>\n"^^ . . "0"^^ . . "0"^^ . . . "FYI - there is nothing wrong with providing links to relevant documentation in a question. That will not trigger any SPAM flags."^^ . "0"^^ . "mac-catalyst"^^ . "<p>I am working on a framework project written in Objective-C. I'm trying to ensure the resulting public Swift API follows modern standards. As a result I'm looking into macros such as <code>NS_SWIFT_NAME</code> and <code>NS_REFINED_FOR_SWIFT</code>. I've been through Apple's documentation for <a href="https://developer.apple.com/documentation/swift/objective-c-and-c-code-customization" rel="nofollow noreferrer">Objective-C and C Code Customization</a>. But they only have one example using <code>NS_REFINED_FOR_SWIFT</code> and it's at the method level.</p>\n<p>I happen to be looking at some of the Apple header files in the CloudKit framework, specifically for the new <a href="https://developer.apple.com/documentation/cloudkit/cksyncengine?language=objc" rel="nofollow noreferrer"><code>CKSyncEngine</code></a> related types. I noticed that every Objective-C class is prefixed with <code>NS_REFINED_FOR_SWIFT</code>. Since now every class name and method name is hidden with the double-underscore prefix, I imagine that this means that there is more than just a simple Swift class extension to help better map the method and property names.</p>\n<p>What I need help with is a starting example when several Objective-C classes are marked with <code>NS_REFINED_FOR_SWIFT</code>. What Swift code must be provided in the framework to properly expose those refined class names?</p>\n<p>Let's start with an example that looks a lot like <code>UIButton</code> and <code>UIButton.Configuration</code>. The Objective-C header file might look like this:</p>\n<pre class="lang-objectivec prettyprint-override"><code>NS_REFINED_FOR_SWIFT\n@interface MyButtonConfiguration: NSObject\n\n@end\n\nNS_REFINED_FOR_SWIFT\n@interface MyButton: UIControl\n\n- (instancetype)initWithConfiguration:(MyButtonConfiguration *)configuration NS_SWIFT_NAME(init(configuration:));\n\n@end\n</code></pre>\n<p>This is a greatly oversimplified example as a starting point. If the code was really this simple I could easily use <code>NS_SWIFT_NAME</code> on the class names and be done. But I'm trying to understand the starting point for a far more complicated API.</p>\n<p>I want to end up with the Swift API having the class names <code>MyButton</code> and <code>MyButton.Configuration</code> (like a nested scope).</p>\n<p>If I had not used <code>NS_REFINED_FOR_SWIFT</code> on the whole class, but just some method/properties, then I would add Swift code such as:</p>\n<pre class="lang-swift prettyprint-override"><code>extension MyButton {\n func someRefinedAPI() {\n __someOriginalAPI()\n }\n}\n</code></pre>\n<p>But having <code>NS_REFINED_FOR_SWIFT</code> at the class level means that <code>MyButton</code> is exposed as <code>__MyButton</code> and <code>MyButtonConfiguration</code> is exposed as <code>__MyButtonConfiguration</code> in Swift. What Swift code do I need to add to my framework to get those refined names exposed as <code>MyButton</code> and <code>MyButton.Configuration</code>?</p>\n<p>I tried something like the following:</p>\n<pre class="lang-swift prettyprint-override"><code>typealias MyButton = __MyButton // This works\ntypealias MyButton.Configuration = __MyButtonConfiguration // Gives error at the period with: Expected '=' in type alias declaration\n</code></pre>\n<p>I was going to follow those with the class extensions for the refined methods and properties but I can't get past the starting point of the class names.</p>\n<p>So how do you translate an Objective-C classname into a nested Swift type hierarchy when using <code>NS_REFINED_FOR_SWIFT</code> at the class level?</p>\n<p>In my real framework there will be Objective-C types that need to become 3rd level nested types in Swift. Think <code>UIButtonConfigurationSize</code> to <code>UIButton.Configuration.Size</code>, for example. <code>NS_SWIFT_NAME</code> doesn't seem to accept names with 3 levels.</p>\n"^^ . . . "0"^^ . "0"^^ . "Write Unicode text to a file in 'wb' mode using C and Objective C?"^^ . . . "0"^^ . . . . . . "0"^^ . . . "0"^^ . "0"^^ . "2"^^ . "<p>I'd like to use Tuist and SwiftGen to generate Localizable strings that are also available for Objective-C.</p>\n<p>When I generate my TuistStrings+{name}.strings files they contain what is written in my strings stencil, so I think I did something wrong.</p>\n<p>Here is my configuration in the <code>Project.swift</code> in Manifests</p>\n<pre><code>let project = Project(\n name: &quot;{name}&quot;, \n organizationName: &quot;{name}&quot;, \n settings: .settings(\n configurations: Configuration.{name}Configuration(basic: true)\n ), \n targets: targets, \n schemes: schemes, \n resourceSynthesizers: [\n .strings(), \n .assets()\n ]\n)\n</code></pre>\n<p>I've tested to use this in my stencil</p>\n<pre><code>strings: inputs: path/to/Localizable.strings outputs: - templateName: objc-h output: Localizable.h - templateName: objc-m output: Localizable.m\n</code></pre>\n<p><a href="https://i.sstatic.net/mzupX.png" rel="nofollow noreferrer">My workspace</a></p>\n<p>I've tried to rename my stencil to Assets.stencil and it does the same thing to my TuistAssets file.</p>\n"^^ . . . . . "1"^^ . . . . "0"^^ . "<p>Use <code>TARGET_OS_VISION</code> to distinguish RealityKit only targets:</p>\n<pre><code>#if TARGET_OS_VISION\n\n#else\n\n#endif // TARGET_OS_VISION\n</code></pre>\n"^^ . . . . . "Generate objective-c string literal with Tuist"^^ . . "How can I fix drawing overlapping 2D objects in Metal (stencil, clipping)?"^^ . "0"^^ . . . . "@Willeke Thank you, you can add an answer and I can mark it as answered, so you get the credit."^^ . . . . . "avplayer"^^ . . . . . . "yes i just tried same issue"^^ . "@GiacomoCatenazzi _"... they are obsolete"_: can you point to any Microsoft documentation that says they are obsolete?"^^ . . "0"^^ . "<p>I have a problem with converting NSString to NSDecimalNumber.</p>\n<pre><code>NSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: --------------------------------------------------------------------ㅍ&quot;);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.0001&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.0002&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.0003&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.0004&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.0005&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.0006&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.0007&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.0008&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.0009&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.001&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.002&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.003&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.004&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.005&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.006&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.007&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.008&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: %@&quot;,[NSDecimalNumber decimalNumberWithString:@&quot;0.009&quot;]);\nNSLog(@&quot;calcuMax_test - calculateMaxForCross feeRateDecimal: --------------------------------------------------------------------&quot;);\n</code></pre>\n<p>The result of the above code is</p>\n<pre><code>calcuMax_test - calculateMaxForCross feeRateDecimal: --------------------------------------------------------------------\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.0001\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.0002\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.0003\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.0004\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.0005\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.0006000000000000001\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.0006999999999999999\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.0008\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.0009\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.001\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.002\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.003\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.004\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.005\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.006\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.006999999999999999\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.008\ncalcuMax_test - calculateMaxForCross feeRateDecimal: 0.008999999999999999\ncalcuMax_test - calculateMaxForCross feeRateDecimal: --------------------------------------------------------------------\n</code></pre>\n<p>Why the heck is it not converting correctly?\nHow exactly do I do the conversion?</p>\n"^^ . . . . . "0"^^ . . "0"^^ . . . . . . "<p>Turns out the issue was with the character accent popover menu. <a href="https://github.com/glfw/glfw/issues/1010" rel="nofollow noreferrer">This</a> issue helped me figure it out. No popover was ever displayed for me, hence my confusion. I assume that is because I did not provide any system cursor information therefore the application doesn't know where to display it, however I haven't confirmed this.</p>\n<p>Adding <code>[[NSUserDefaults standardUserDefaults] setBool: NO forKey: @&quot;ApplePressAndHoldEnabled&quot;];</code> disabled the accent popover for my application and solved the problem.</p>\n"^^ . . . . . "Trying to understand NS_REFINED_FOR_SWIFT when used on a whole class"^^ . "Got it resolved -- needed to make sure the base class also reflected the function name change. Thanks for offering to help, though!"^^ . . . . "0"^^ . . . "This looks fine. I would start by checking that the code you expect to run actually runs. There are many reasons `[self.mysong play]` might not play; you don't demonstrate that this is known good. And there are lots of other little things that could be wrong and you don't show. Start by setting breakpoints and make sure that the code you mean to run actually does or doesn't run. Start with https://developer.apple.com/documentation/mediaplayer/becoming_a_now_playable_app, make sure that works, and then adapt to do what you want."^^ . . "0"^^ . . . . . . "0"^^ . . . "1"^^ . . . "Actually, my case is after I load contacts all, I will save it into a cache. The next time start the app, I will get it from the cache and sort it again same to Contacts order like when I fetch all from Contacts through CNContactStore.enumerateContact (its my business rules)"^^ . . . . . . "I tried to reproduce the issue but `insertText` is called for all repeated keys. Post a [mre] please."^^ . . "1"^^ . . "1"^^ . . . . "0"^^ . "<p>I've danced around this question previously, asking specific questions which I hoped might lead me to the next step in solving the larger problem. That didn't work (no answers), so this is the larger problem.</p>\n<p>Original questions\n<a href="https://stackoverflow.com/questions/76166846/how-can-i-ignore-all-touch-events-in-wkwebview-and-its-enclosingscrolllview">How can I ignore all touch events in WKWebView and its enclosingScrolllView</a></p>\n<p><a href="https://stackoverflow.com/questions/76095477/how-can-i-paginate-html-in-a-wkwebview">How can I paginate html in a wkwebview?</a></p>\n<p><strong>Context</strong></p>\n<p>Apple originally provided a very full featured and functional API for displaying HTML - WebView. Many tools were written for WebView, for example to display the pages of an e-book.\nWebView is now deprecated in favour of WKWebView, which 'feels' minimally functional - a lot of the features that made WebView easy to work with don't exist in WebView, and I can't find any tools for displaying the pages of an e-Book neatly.</p>\n<p>I want to produce a tool which can be shared publicly on GitHub which will provide this e-book functionality, both so that I can benefit from it myself - but also so that everyone else can.</p>\n<p><strong>Problem</strong></p>\n<p>At minimum, this needs to work on macOS (I'll worry about iOS later)</p>\n<p>So far, my code scrolls the book content neatly one page at a time if you press the buttons - but if you swipe on the mouse or trackpad (guessing here) acceleration ruins the functionality (it should work in the same way as pressing the buttons). I can get it so that a swipe will move the book content along by one page - but once the page has been updated the acceleration / deceleration effect of the swipe continues - and the page moves on past the point where it should have stopped moving.</p>\n<p>The page scroll is horizontal.</p>\n<p>The code I have so far is</p>\n<pre><code>//\n// ReaderWindowController.m\n//\n\n#import &quot;ReaderWindowController.h&quot;\n#import &quot;LibrarianFormatPluginInterface.h&quot;\n\n#define WindowSideLeft 0\n#define WindowSideRight 1\n\n@interface WKWebView (SynchronousEvaluateJavaScript)\n- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script;\n@end\n\n@implementation WKWebView (SynchronousEvaluateJavaScript)\n\n- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script {\n __block NSString *resultString = nil;\n __block BOOL finished = NO;\n \n [self evaluateJavaScript:script completionHandler:^(id result, NSError *error) {\n if (error == nil) {\n if (result != nil) {\n resultString = [NSString stringWithFormat:@&quot;%@&quot;, result];\n }\n } else {\n NSLog(@&quot;evaluateJavaScript error : %@&quot;, error.localizedDescription);\n }\n finished = YES;\n }];\n \n while (!finished) {\n [NSRunLoop.currentRunLoop runMode:NSDefaultRunLoopMode beforeDate:NSDate.distantFuture];\n }\n \n return resultString;\n}\n\n- (void)scrollWheel:(NSEvent *)event {\n NSLog(@&quot;Scrolled wheel&quot;);\n}\n\n- (BOOL)scrollRectToVisible:(NSRect)rect {\n NSLog(@&quot;Scroll rect to visible %f x %f , %f x %f&quot;, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);\n \n return true;\n}\n\n- (void)scrollClipView:(NSClipView *)clipView toPoint:(NSPoint)point {\n NSLog(@&quot;Scroll clip view %@ to point %f x %f&quot;, clipView, point.x, point.y);\n}\n\n- (NSRect)adjustScroll:(NSRect)newVisible {\n NSRect modifiedRect=newVisible;\n \n // snap to 72 pixel increments\n modifiedRect.origin.x = (int)(modifiedRect.origin.x/72.0) * 72.0;\n // modifiedRect.origin.y = (int)(modifiedRect.origin.y/72.0) * 72.0;\n \n // return the modified rectangle\n return modifiedRect;\n}\n\n- (void)scrollRangeToVisible:(NSRange)range {\n NSLog(@&quot;Scroll range to visible&quot;);\n}\n\n- (void)scrollPoint:(NSPoint)point {\n NSLog(@&quot;Scroll point to visible&quot;);\n}\n\n- (void)reflectScrolledClipView:(NSClipView *)clipView {\n NSLog(@&quot;reflectScrolledClipView point to visible&quot;);\n}\n\n@end\n\n\n@interface NSView ( TouchEvents )\n\n@end\n\n@implementation NSView ( TouchEvents )\n\nfloat beginX, endX;\n\n\n- (void)touchesBeganWithEvent:(NSEvent *)event {\n if(event.type == NSEventTypeGesture){\n NSSet *touches = [event touchesMatchingPhase:NSTouchPhaseAny inView:self];\n if(touches.count == 2){\n for (NSTouch *touch in touches) {\n beginX = touch.normalizedPosition.x;\n }\n }\n }\n}\n\n- (void)touchesEndedWithEvent:(NSEvent *)event {\n \n if(event.type == NSEventTypeGesture){\n NSSet *touches = [event touchesMatchingPhase:NSTouchPhaseAny inView:self];\n NSDictionary* userInfo;\n if(touches.count == 2){\n for (NSTouch *touch in touches) {\n endX = touch.normalizedPosition.x;\n }\n // since there are two touches, endX will always end up with the data from the second touch\n \n if (endX &gt; beginX) {\n NSLog(@&quot;swipe right!&quot;);\n userInfo = @{@&quot;direction&quot;: @(WindowSideRight)};\n }\n else if (endX &lt; beginX) {\n NSLog(@&quot;swipe left!&quot;);\n userInfo = @{@&quot;direction&quot;: @(WindowSideLeft)};\n }\n else {\n NSLog(@&quot;no swipe!&quot;);\n }\n \n [NSNotificationCenter.defaultCenter postNotificationName:@&quot;pageScrollEvent&quot; object:nil userInfo:userInfo];\n }\n }\n \n}\n\n- (void)scrollWheel:(NSEvent *)event {\n NSLog(@&quot;user scrolled %f horizontally and %f vertically&quot;, [event deltaX], [event deltaY]);\n}\n\n@end\n\n\n@interface ReaderWindowController ()\n\n@end\n\n@implementation ReaderWindowController\n\n- (void)createButtonOnSide:(int)side withSelector:(SEL)aSelector {\n int x = 0, y = 100, width = 40, height = 230;\n NSRect framesize = NSMakeRect(x, y, width, height);\n \n NSString* label = side==WindowSideLeft?@&quot;&lt;&quot;:@&quot;&gt;&quot;;\n \n NSButton *myButton = [NSButton.alloc initWithFrame:CGRectZero];\n [myButton setButtonType:NSButtonTypeMomentaryPushIn];\n if (@available(macOS 11.0, *)) {\n NSImage* arrow = side==WindowSideLeft?[NSImage imageWithSystemSymbolName:@&quot;arrowshape.left.fill&quot; accessibilityDescription:label]:[NSImage imageWithSystemSymbolName:@&quot;arrowshape.right.fill&quot; accessibilityDescription:label];\n [myButton setImage:arrow];\n } else {\n [myButton setTitle:label];\n }\n [myButton setBezelStyle:NSBezelStyleTexturedSquare];\n [myButton setTarget:self];\n [myButton setAction:aSelector];\n [myButton setTag:side];\n \n myButton.translatesAutoresizingMaskIntoConstraints = false;\n [self.window.contentView addSubview:myButton];\n [myButton.widthAnchor constraintEqualToConstant:framesize.size.width].active = YES;\n [myButton.heightAnchor constraintEqualToConstant:framesize.size.height].active = YES;\n [myButton.centerYAnchor constraintEqualToAnchor:self.window.contentView.centerYAnchor].active = YES;\n if (side == WindowSideLeft) {\n [myButton.leadingAnchor constraintEqualToAnchor:self.window.contentView.leadingAnchor constant:0].active = YES;\n } else {\n [myButton.trailingAnchor constraintEqualToAnchor:self.window.contentView.trailingAnchor constant:0].active = YES;\n }\n \n NSTrackingArea* trackingArea = [NSTrackingArea.alloc\n initWithRect:myButton.bounds\n options: NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways\n owner:self userInfo:nil];\n [self.window.contentView addTrackingArea:trackingArea];\n}\n\n- (void)mouseEntered:(NSEvent *)theEvent{\n NSLog(@&quot;entered&quot;);\n}\n\n- (void)mouseExited:(NSEvent *)theEvent{\n NSLog(@&quot;exited&quot;);\n}\n\n- (void)windowDidLoad {\n [super windowDidLoad];\n [self.window setDelegate:self];\n \n [bookPages setAllowedTouchTypes:(NSTouchTypeMaskDirect | NSTouchTypeMaskIndirect)];\n \n [self.window setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameAqua]];\n \n [bookPages setNavigationDelegate:self];\n pageCount = 0; // might want to load this from preferences\n \n [NSNotificationCenter.defaultCenter addObserver:self\n selector:@selector(loadDidFinish:)\n name:@&quot;LoadDidFinishNotification&quot;\n object:nil];\n [NSNotificationCenter.defaultCenter addObserver:self\n selector:@selector(buttonPressed:)\n name:@&quot;PageScrollEvent&quot;\n object:nil];\n \n [self createButtonOnSide:WindowSideLeft withSelector:@selector(buttonPressed:)];\n [self createButtonOnSide:WindowSideRight withSelector:@selector(buttonPressed:)];\n \n}\n\n- (id)initWithBookPlugin:(id)bookPlug andWindowController:(NSNibName)windowNibName {\n if (bookPlug &amp;&amp; ![[bookPlug className] isEqualToString:[NSNull className]] &amp;&amp; (self = [super initWithWindowNibName:windowNibName])) {\n bookPlugin = bookPlug;\n }\n return self;\n}\n\n- (void)loadDidFinish:(NSNotification*)notification {\n NSURLRequest* thisRequest = [bookPlugin getURLRequestForIndex:8];\n [bookPages loadRequest:thisRequest];\n}\n\n- (void)windowWillClose:(NSNotification *)notification {\n [NSNotificationCenter.defaultCenter removeObserver:self];\n if (bookPlugin) { bookPlugin = nil; }\n}\n\n-(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {\n NSString *cssString = @&quot;body { overflow: -webkit-paged-x !important; direction: ltr !important; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; scroll-snap-align: center; }&quot;;\n NSString *javascriptString = @&quot;var style = document.createElement('style'); style.innerHTML = '%@'; document.head.appendChild(style)&quot;;\n NSString *javascriptWithCSSString = [NSString stringWithFormat:javascriptString, cssString];\n [webView evaluateJavaScript:javascriptWithCSSString completionHandler:nil];\n}\n\n-(NSSize)getViewDimensionsForwebView:(WKWebView *)webView {\n NSString* width = [webView stringByEvaluatingJavaScriptFromString:@&quot;Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth )&quot;];\n NSString* height = [webView stringByEvaluatingJavaScriptFromString:@&quot;Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight )&quot;];\n \n return NSMakeSize(width.floatValue,height.floatValue);\n}\n\n- (void) updateAfterDelay:(id)sender {\n [self buttonPressed:nil];\n}\n\n- (void)buttonPressed:(id)sender {\n if ([[sender className] isEqualToString:@&quot;NSButton&quot;]) {\n if ([sender tag] == WindowSideLeft) { pageCount--; } else { pageCount++; }\n } else if ([[sender className] isEqualToString:@&quot;NSConcreteNotification&quot;]) {\n if ([[sender userInfo][@&quot;direction&quot;] isEqualTo: @(WindowSideLeft)]) { pageCount--; } else { pageCount++; }\n }\n \n pageCount = pageCount&lt;0?0:pageCount;\n NSInteger pageWidth = self.window.contentView.frame.size.width;\n \n NSString* jsString = [NSString stringWithFormat:@&quot;window.scrollTo({top: 0, left: %ld, behavior: \\&quot;smooth\\&quot;,});&quot;, pageWidth * pageCount];\n [bookPages evaluateJavaScript:jsString completionHandler:nil];\n\n if (sender != nil) {\n [self performSelector:@selector(updateAfterDelay:) withObject:nil afterDelay:0.75];\n }\n\n}\n\n\n\n@end\n\n</code></pre>\n<p>I'd love to hear what I'm doing wrong here - but I'd also be happy to hear of any project which does the same thing (provided that it doesn't contain any deprecations)</p>\n"^^ . "0"^^ . . . . "1"^^ . "Objective-C Generated Interface Header Cannot Find Pod Header"^^ . "0"^^ . . "0"^^ . . . . . . . . . . . . . . "0"^^ . "0"^^ . . . . . . . "2"^^ . . "4"^^ . "Now the question is why is the bold text not being represented in the rtf"^^ . . . . "I tested the code successfully with a sample RTF file. May something is wrong with your RTF data."^^ . . . . . . . "graphics"^^ . "If this is the data you want then you can write it to a file. You don't need the C string. from the documentation of `cStringUsingEncoding`: "UTF-16 and UTF-32 are not considered to be C string encodings, and should not be used with this method—the results of passing NSUTF16StringEncoding, NSUTF32StringEncoding, or any of their variants are undefined.""^^ . . "@GiacomoCatenazzi Thanks. I tried an approach without using wchar. I added it to the query. It did not work. Can you check?"^^ . "1"^^ . . "<p><code>NSString</code> can work with encodings.</p>\n<p>Extract the data from the string and write it to disk:</p>\n<pre><code>NSData *dataBE = [fileName dataUsingEncoding:NSUTF16BigEndianStringEncoding];\n[dataBE writeToFile:@&quot;/Users/user/Desktop/test&quot; options:NSDataWritingAtomic error:&amp;error];\n</code></pre>\n<p>or write the string to disk:</p>\n<pre><code>[fileName writeToFile:@&quot;/Users/user/Desktop/test&quot; atomically:YES encoding:NSUTF16BigEndianStringEncoding error:&amp;error];\n</code></pre>\n"^^ . . . . . "0"^^ . . . . . . "OC memory continued to grow after using method swapping(swizzle)"^^ . "0"^^ . . . "<p>I am currently making a simple 2D rendering application using Apple Metal 3 in C++. I want to draw overlapping 2D objects using stencil test, but it does not work.</p>\n<p>A constructor for the Renderer class. Creating a stencil texture, descriptor and stencilState object.</p>\n<pre><code>Renderer::Renderer( MTL::Device* pDevice, MTK::View* pView )\n{\n ...\n auto* pTexDesc = MTL::TextureDescriptor::alloc()-&gt;init();\n pTexDesc-&gt;setTextureType( MTL::TextureType2D );\n pTexDesc-&gt;setWidth( _viewWidth );\n pTexDesc-&gt;setHeight( _viewHeight );\n pTexDesc-&gt;setPixelFormat( MTL::PixelFormatStencil8 );\n pTexDesc-&gt;setStorageMode( MTL::StorageModePrivate );\n pTexDesc-&gt;setUsage( MTL::TextureUsageRenderTarget );\n _pStencilTexture = _pDevice-&gt;newTexture( pTexDesc );\n\n _pDepthStencilDesc = MTL::DepthStencilDescriptor::alloc()-&gt;init();\n _pStencilState = _pDevice-&gt;newDepthStencilState( _pDepthStencilDesc );\n ...\n}\n</code></pre>\n<p>Update method(called every frame).</p>\n<pre><code>void Renderer::update( float delta )\n{\n NS::AutoreleasePool* pPool = NS::AutoreleasePool::alloc()-&gt;init();\n _pCurrentDrawableView-&gt;setClearColor( MTL::ClearColor::Make(1.0f, 1.0f, 1.0f, 1.0f) );\n\n MTL::CommandBuffer* pCmd = _pCommandQueue-&gt;commandBuffer();\n MTL::RenderPassDescriptor* pRPD = _pCurrentDrawableView-&gt;currentRenderPassDescriptor();\n\n auto* pStencilAttach = pRPD-&gt;stencilAttachment();\n pStencilAttach-&gt;setTexture( _pStencilTexture );\n pStencilAttach-&gt;setClearStencil( 0 );\n pStencilAttach-&gt;setLoadAction( MTL::LoadActionClear );\n pStencilAttach-&gt;setStoreAction( MTL::StoreActionStore );\n\n MTL::RenderCommandEncoder* pEnc = pCmd-&gt;renderCommandEncoder(pRPD);\n \n // ADD WHAT YOU WANT TO DRAW\n pEnc-&gt;setDepthStencilState( _pStencilState );\n\n auto* pStencil = MTL::StencilDescriptor::alloc()-&gt;init();\n _pDepthStencilDesc-&gt;setFrontFaceStencil( pStencil );\n _pDepthStencilDesc-&gt;setBackFaceStencil( pStencil );\n\n { // draw orc\n pStencil-&gt;setStencilCompareFunction( MTL::CompareFunctionAlways ); // glStencilFunc(func, _, _);\n pEnc-&gt;setStencilReferenceValue( 1 ); // glStencilFunc(_, ref, _);\n pStencil-&gt;setWriteMask( 0xff ); // glStencilFunc(_, _, mask);\n pStencil-&gt;setStencilFailureOperation( MTL::StencilOperationReplace ); // glStencilOp( _, _, zpass );\n \n orc-&gt;update( delta );\n drawImage( orc-&gt;texture(), { 0.0f, 0.0f }, { 100.0f, 100.0f }, orc-&gt;frame() );\n drawFrame( pCmd, pEnc );\n }\n\n { // draw grass backgroud\n pStencil-&gt;setStencilCompareFunction( MTL::CompareFunctionEqual ); // glStencilFunc(func, _, _);\n pEnc-&gt;setStencilReferenceValue( 0 ); // glStencilFunc(_, ref, _);\n pStencil-&gt;setWriteMask( 0x00 ); // glStencilFunc(_, _, mask); \n pStencil-&gt;setStencilFailureOperation( MTL::StencilOperationKeep ); // glStencilOp( _, _, zpass );\n\n _pCurrentTexture = _textureMap[&quot;Grass&quot;]-&gt;_pTexture;\n fillRect( { 0.0f, 0.0f, _viewWidth / 2.0f, _viewHeight / 2.0f } );\n drawFrame( pCmd, pEnc );\n }\n\n pEnc-&gt;endEncoding();\n pCmd-&gt;presentDrawable(_pCurrentDrawableView-&gt;currentDrawable());\n pCmd-&gt;commit();\n\n pStencil-&gt;release();\n pPool-&gt;release();\n}\n</code></pre>\n<p>*drawImage and fillRect is a kind of method that pushes vertices and indices information.</p>\n<p>drawFrame</p>\n<pre><code>void Renderer::drawFrame( MTL::CommandBuffer* pCmd, MTL::RenderCommandEncoder* pEnc )\n{\n NS::AutoreleasePool* pPool = NS::AutoreleasePool::alloc()-&gt;init();\n\n pEnc-&gt;setRenderPipelineState(_pPSO);\n\n _pVertexBuffer = _pDevice-&gt;newBuffer(_vertices.data(), sizeof(shader_types::VertexData) * _vertices.size(), MTL::StorageModeManaged);\n _pIndexBuffer = _pDevice-&gt;newBuffer(_indices.data(), sizeof(uint) * _indices.size(), MTL::StorageModeManaged);\n\n pEnc-&gt;setVertexBuffer(_pVertexBuffer, /* offset */ 0, /* index */ 0);\n pEnc-&gt;setFragmentTexture(_pCurrentTexture, 0);\n\n pEnc-&gt;drawIndexedPrimitives(MTL::PrimitiveTypeTriangle,\n _pIndexBuffer-&gt;length(), MTL::IndexTypeUInt16,\n _pIndexBuffer, 0);\n\n // flush vectors\n _vertices.clear();\n _indices.clear();\n _indexBufferIndex = 0;\n\n pPool-&gt;release();\n}\n</code></pre>\n<p>I am not using the depth test to simplify the code. The result of this code is drawing only background. (Metal draws the last elements) As far as I know, the content of the orc pixels should be 1 and the content of the background pixels should be 0. Please give me any advice. Anything would be helpful to me. Thanks a lot.</p>\n<p>I have tried to change an order to create and set variables in update(delta) method. But it does not work either. Also, I am more familiar with OpenGL than Metal. It seems like Metal API are not matched in OpenGL's API.</p>\n"^^ . "0"^^ . . . "0"^^ . . . "Each UTF-16(BE or LE) code unit is 2 bytes. All characters below U+010000 (i.e. characters in the Unicode Basic Multilingual Plane) will be encoded in a single code unit (i.e. 2 bytes). Characters U+010000 onwards will be encoded in two code units (i.e. 4 bytes) with special values. The first code unit (the "high surrogate") will be in the range U+D800 to U+DBFF and the second code unit (the "low surrogate") will be in the range U+DC00 to U+DFFF. Together, the high surrogate and low surrogate code units form a "surrogate pair"."^^ . . . . . "0"^^ . "0"^^ . . . . "1"^^ . . . . . . . . . . . "<p>I have this unicode text which contains unicode characters</p>\n<pre><code> NSString *fileName = @&quot;Tên tình bạn dưới tình yêu.mp3&quot;;\n const char *cStringFile = [fileName UTF8String];\n</code></pre>\n<p>Now I need to save this string in hex/binary format to a file in this format</p>\n<pre><code> T ê n t ì n h b ạ n\n 54 EA 6E 20 74 EC 6E 68 20 62 1EA1 6E ...... and so on\n</code></pre>\n<p>As you can see the character 'ê' is written as EA, but 'ạ' is written as '1E A1' which is correct as per the Vietnamese character set\n(<a href="https://vietunicode.sourceforge.net/charset/" rel="nofollow noreferrer">https://vietunicode.sourceforge.net/charset/</a>)</p>\n<p>To achieve this, this is the code, I used to write multibyte characters to the file</p>\n<pre><code>// Determine the required size for the wchar_t string\nsize_t input_length = strlen(cStringFile);\nsize_t output_length = mbstowcs(NULL, stringText, input_length);\n\n// Allocate memory for the wchar_t string\nwchar_t *output = (wchar_t *)malloc((output_length + 1) * sizeof(wchar_t));\nif (output == NULL) {\n printf(&quot;Memory allocation failed.\\n&quot;);\n return 1;\n}\n\n// Convert the C string to wchar_t string\nmbstowcs(output, cStringFile, input_length);\noutput[output_length] = L'\\0'; // Add null-termination\n\nunsigned long lenth = wcslen(output);\n// Loop through each character in the Unicode text\nfor (int i = 0; i &lt; lenth; i++) {\n // Write the Unicode character to the file\n fwprintf(fd, L&quot;%lc&quot;, output[i]);\n}\n\n// Free the allocated memory\nfree(output);\n</code></pre>\n<p>Now the issue is the multibyte characters are not being converted to the correct HEX value with the code above</p>\n<pre><code>Example 1) For this text = &quot;Tên tình bạn dưới tình yêu.mp3&quot;\nExpected: \nT ê n t ì n h b ạ n\n54 EA 6E 20 74 EC 6E 68 20 62 1EA1 6E ...... and so on\n\nActual: Wrong!\nT ê n t ì n h b ạ n\n54 C3AA 6E 20 74 C3AC 6E 68 20 62 E1BAA1 6E ...... and so on\n\nExample 2) For this text = &quot;最佳歌曲在这里.mp3&quot;\nExpected: \n最-\\u6700 佳-\\u4F73 歌-\\u6B4C 歌-\\u66F2 曲-\\u5728 \n67 00 4F 73 6B 4C 66 F2 57 28 ..... \n\nActual: Wrong!\n最 佳 歌 歌 曲\nE6 9C 80 BD B3 AD 8C 9B B2 9C \n</code></pre>\n<p>So I think it is writing 2 bytes in the case of 'ê' and 'ì' and 3 bytes in the case of 'ạ'. The code is not writing the Hex equivalent of the multibyte character.</p>\n<p>What could be the issue?\nAny help would be appreciated.</p>\n<p>=====</p>\n<p>I tried another approach not using wchar, checking if a character is a multibyte character and writing all bytes if true</p>\n<pre><code> NSString *fileName = @&quot;Tên tình bạn dưới tình yêu.mp3&quot;;\n const char *stringText = [fileName UTF8String];\n unsigned long len = strlen(stringText);\n setlocale(LC_ALL, &quot;&quot;);\n for (char character = *stringText; character != '\\0'; character = *++stringText)\n {\n if (!character) {\n continue;\n }\n putchar(character);\n int byteCount = numberOfBytesInChar((unsigned char)character);\n if (byteCount &lt;= 1) {\n //putchar(character);\n fprintf(fd, &quot;%c&quot;, character);\n } else {\n \n //putchar(character);\n for(int k = 0; k &lt; byteCount; k++)\n {\n fprintf(fd, &quot;%c&quot;, character);\n character = *++stringText;\n }\n }\n }\n\n int numberOfBytesInChar(unsigned char val) {\n if (val &lt; 128) {\n return 1;\n } else if (val &lt; 224) {\n return 2;\n } else if (val &lt; 240) {\n return 3;\n } else {\n return 4;\n }\n }\n</code></pre>\n<p>Even now it is not writing the expected Hex equavalent for multibyte characters.</p>\n<pre><code>Example 1) For this text = &quot;Tên tình bạn dưới tình yêu.mp3&quot;\nExpected: \nT ê n t ì n h b ạ n\n54 EA 6E 20 74 EC 6E 68 20 62 1EA1 6E ...... and so on\n\nActual: Wrong!\nT ê n t ì n h b ạ n\n54 C3AA 6E 20 74 C3AC 6E 68 20 62 E1BAA1 6E ...... and so on\n\nExample 2) For this text = &quot;最佳歌曲在这里.mp3&quot;\nExpected: \n最-\\u6700 佳-\\u4F73 歌-\\u6B4C 歌-\\u66F2 曲-\\u5728 \n67 00 4F 73 6B 4C 66 F2 57 28 ..... \n\nActual: Wrong!\n最 佳 歌 歌 曲\nE6 9C 80 BD B3 AD 8C 9B B2 9C \n</code></pre>\n<p>Any pointers?</p>\n"^^ . "<p>After digging more into find out the problem, I finally found the issue.</p>\n<p>For some reason when adding urls into the array it added a space after each link except for the last one, I found the problem by counting the string length then logging each character individually.</p>\n<p>so I added this lines of code in the <strong>sortM3UFile</strong> and it fixed the problem</p>\n<pre><code>NSArray *words = [tempTitle componentsSeparatedByCharactersInSet :[NSCharacterSet whitespaceAndNewlineCharacterSet]];\nNSString *nospaces = [words componentsJoinedByString:@&quot;&quot;];\n[movieURL addObject:nospaces];\n</code></pre>\n<p>hope that would help someone</p>\n"^^ . "<p>Try removing the <code>Test_Pod</code> from your project and reinstalling it</p>\n<pre><code>pod deintegrate\npod install\n</code></pre>\n"^^ . "0"^^ . . . . . . "c"^^ . . "1"^^ . "c++"^^ . . . . "If you are using pure Objective-C, it might be more challenging, since you would either just keep using defines or create a separate `extern` declaration and a definition in `.m` file."^^ . "1"^^ . . . "1"^^ . . "<p>Have you tried renaming your <strong>AppDelegate.m</strong> (one &quot;m&quot;) file to <strong>AppDelegate.mm</strong> (two &quot;m&quot;s) inside xcode?</p>\n<p>I had a similar error when upgrading from React Native 0.68.2 to 0.70.8 and Expo 46 to 47:</p>\n<p><code>no visible @interface for 'EXAppDelegateWrapper' declares the selector 'application:didFinishLaunchingWithOptions:'</code></p>\n<p>Renaming my AppDelegate.m file to .mm did the trick.</p>\n<p>The main difference between the two file extensions is that AppDelegate.mm allows you to include Objective-C, C++ or Objective-C++, but AppDelegate.m only allows Objective-C code.</p>\n<p>It's likely that <code>EXAppDelegateWrapper</code> (which comes from <a href="https://github.com/expo/expo/tree/main/packages/expo-modules-core" rel="nofollow noreferrer">expo-modules-core</a>) was updated to include C++ or ObjectiveC++, which is why building with an AppDelegate.m file failed in my case.</p>\n"^^ . . . . "0"^^ . . "0"^^ . . "rtf"^^ . . . "0"^^ . "AVPlayer playing the last link only in NSMutableArray"^^ . "0"^^ . . . . "0"^^ . . . . . . "Unrelated, but you should keep a `NSDictionary`, or a custom class which will have the url and the title, and use an unique array to have that."^^ . "firebase-mlkit"^^ . "<p>We have a Flutter app where we implemented the ConnectSDK with Objective-C platform code. On the iOS Simulator devices are detected but on a physical device we get: <code>nehelper sent invalid result code [1] for Wi-Fi information request</code> and no devices are detected.</p>\n<p>We checked the following:</p>\n<ul>\n<li><code>NSLocalNetworkUsageDescription</code> is in the plist.</li>\n<li><code>Access Wi-Fi Information</code> Entitlement is enabled under Signing and Capabilities and on the Identifier.</li>\n<li>Tried enabling <code>Network Extensions</code>.</li>\n<li>Tried requesting location access permission and setting <code>NSLocationAlwaysAndWhenInUseUsageDescription</code>, <code>NSLocationAlwaysUsageDescription</code>, <code>NSLocationWhenInUseUsageDescription</code> in the plist.</li>\n<li>The native popup to allow network access does not appear and using the <code>permission_handler</code> we see that all permissions including Notifications and Location is set to permanently denied. Local Network Access is enabled in Settings.</li>\n</ul>\n<p>Any advice will be greatly appreciated.</p>\n"^^ . . . . . . . . . . . "*"When this class uses an image..."* -- sorry, but that is confusing me. I posted an answer using a **paths** approach. Hopefully it will help you out."^^ . . . . . . . "The functions you are looking for are `iconv_open()`, `iconv()`, and `iconv_close()`, which are part of the POSIX standard, but the names of the "tocode" and "fromcode" character sets are implementation defined. You will need to find out the names that your target OS uses for these character sets."^^ . . . . "1"^^ . "0"^^ . "objc - How to disable the present view bounces"^^ . "MLKit iOS Face Detection Not Working with CoreImage object"^^ . . . . . . "2"^^ . . . . . . "0"^^ . . . "13"^^ . . . "Thank you very much for your reply. I will continue to study according to your idea"^^ . . . . . . "Thanks for reply, but where I can find the UIScrollView? ViewController ,UINavigationController and presentedViewController also not find ScrollView inside"^^ . . . . . "0"^^ . . . . "0"^^ . . . . . . . . . "0"^^ . . . "0"^^ . . "1"^^ . "@Willeke Thanks for the suggestion. I tried *** NSData *dataBE = [songInfo.fileNamePath dataUsingEncoding:NSUTF16BigEndianStringEncoding]; NSString *objCStringPath = [[NSString alloc] initWithData:dataBE encoding:NSUTF16BigEndianStringEncoding]; const char *cStringPath = (const char *)[objCStringPath cStringUsingEncoding:NSUTF16BigEndianStringEncoding]; *** \nInteresting thing is I can see the path in 'objCStringPath' but cStringPath is "". cStringUsingEncoding does not seem to like NSUTF16BigEndianStringEncoding. \nWill check."^^ . . "0"^^ . "javascript"^^ . "Is there an error message in Console when it crashes?"^^ . . . . "0"^^ . . . "bigdecimal"^^ . "unicode"^^ . "tuist"^^ . . "0"^^ . . . . "1"^^ . "1"^^ . . . . . "2"^^ . . "1"^^ . . "2"^^ . "0"^^ . "<p>I am having a problem with a Pod in Xcode. It has both Objective-C and Swift, and I just added some more Swift classes to it. However, now when building, the Objective-C Generated Interface Header file (Test_Pod-Swift.h) cannot find the Test_Pod.h file, so it isn't building.\nThe pod is called Test_Pod, and the Interface Header file says &quot;'Test_Pod/Test_Pod.h' file not found&quot;.\nIt seems to only happen after making the classes public, which is needed for access outside of the pod, but I dont understand how that is breaking the build.</p>\n"^^ . . . "0"^^ . "apple-m1"^^ . "Does `[songInfo.fileNamePath dataUsingEncoding:NSUTF16BigEndianStringEncoding]` return the data you want?"^^ . . . . . "0"^^ . "0"^^ . . . "sfauthorizationpluginview"^^ . . "zero means location unknown. Have you tried Freeway drive?"^^ . . . . . . . . . . . "0"^^ . . . . "1"^^ . . . . . "1"^^ . . "0"^^ . . "Thank you for your suggestion. Unfortunately, it doesn't make any difference. `hitTest:withEvent:` is a UIView method, not an NSView method. I did have another idea - a very hacky workaround - which kind of, sort of, if you squint does what I need. But not really. See code above which has been updated accordingly."^^ . . "2"^^ . . . . . . . "0"^^ . . . . "Still need to clarify what you're really trying to do. I added two more variations with "shapes" here: https://imgur.com/a/JuVLotk ... does that look similar to your goal?"^^ . "0"^^ . "objective-c-runtime"^^ . . "0"^^ . . . . "No visible @interface for 'EXAppDelegateWrapper' declares the selector 'application:openURL:options:'"^^ . . . "metal"^^ . "@Willeke Thanks for the nudge towards the approach of using NSString methods. The following worked - ***** NSData *dataBE = [fileName dataUsingEncoding:NSUTF16BigEndianStringEncoding]; NSString *objCStringPath = [[NSString alloc] initWithData:dataBE encoding:NSUTF16BigEndianStringEncoding]; [objCStringPath writeToFile:@"/Users/user/Desktop/test" atomically:YES encoding:NSUTF16BigEndianStringEncoding error:nil]; ****\nNow I can see the UTF-16BE encoding in the file with the correct output as expected."^^ . . "2"^^ . "<p>I use the following code to present an NavigationController</p>\n<pre><code>GridMenuViewController* vc = [[UIStoryboard storyboardWithName:@&quot;Main&quot; bundle:nil] instantiateViewControllerWithIdentifier:@&quot;GridMenuViewControllerID&quot;];\nGridMenuNavigationController *nav = [[GridMenuNavigationController alloc] initWithRootViewController:vc];\nvc.sheetPresentationController.prefersScrollingExpandsWhenScrolledToEdge = NO;\nnav.modalPresentationStyle = UIModalPresentationPageSheet;\nif (@available(iOS 16.0, *)) {\n if (nav.sheetPresentationController) {\n id detent = [UISheetPresentationControllerDetent customDetentWithIdentifier:UISheetPresentationControllerDetentIdentifierLarge resolver:^CGFloat(id&lt;UISheetPresentationControllerDetentResolutionContext&gt; _Nonnull context) {\n return [[UIScreen mainScreen] bounds].size.height * 0.6;\n }];\n nav.sheetPresentationController.detents = @[detent];\n nav.sheetPresentationController.prefersGrabberVisible = YES;\n }\n}\nnav.sheetPresentationController.prefersScrollingExpandsWhenScrolledToEdge = NO;\n[self presentViewController:nav animated:YES completion:nil];\n</code></pre>\n<p>I woluld like to disable the bounces when scroll up the present view, how can I do that?</p>\n<p>Support video\n<a href="https://www.youtube.com/watch?v=P53ZPxzdWCU" rel="nofollow noreferrer">https://www.youtube.com/watch?v=P53ZPxzdWCU</a></p>\n<p>I tried so many code like</p>\n<pre><code>if (@available(iOS 11.0, *)) {\n self.collectionView.contentInsetAdjustmentBehavior = 2;\n} else {\n self.collectionView.automaticallyAdjustsScrollIndicatorInsets = NO;\n}\n</code></pre>\n<pre><code>self.collectionView.verticalScrollIndicatorInsets = UIEdgeInsetsMake(0, 0, self.view.safeAreaInsets.bottom, 0);\n</code></pre>\n<pre><code>- (void)scrollViewDidScroll:(UIScrollView *)scrollView {\n [scrollView setContentOffset: CGPointMake(scrollView.contentOffset.x, 0)];\n}\n</code></pre>\n<p>I expecting there no any bounces behavior when scroll up.</p>\n"^^ . . . "port swift in react native deprecated function"^^ . . "appkit"^^ . . . "1"^^ . . "<p>I am upgrading an Expo app from react native 0.63 to 0.71 and am running into this error in my AppDelegate.m file.</p>\n<pre><code>// Linking API\n- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary&lt;UIApplicationOpenURLOptionsKey,id&gt; *)options {\n // error below\n return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options];\n}\n\n// Universal Links\n- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray&lt;id&lt;UIUserActivityRestoring&gt;&gt; * _Nullable))restorationHandler {\n BOOL result = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler];\n return [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler] || result;\n}\n\n@end\n</code></pre>\n<p>I am not very familiar with objective c so I am unsure how to solve this issue. The error is occurring on the line below the comment &quot;error below&quot; and the error is as follows</p>\n<p><code>No visible @interface for 'EXAppDelegateWrapper' declares the selector 'application:openURL:options:'</code></p>\n"^^ . . "0"^^ . "@chanadboy Yes i have all these setups already \n significantLocationManager.distanceFilter = 2;\n significantLocationManager.desiredAccuracy = kCLLocationAccuracyBest;"^^ . . . . "1"^^ . "0"^^ . . . . . . . . . . "2"^^ . . . "1"^^ . . . . . . . . . . . "0"^^ . . "<p>i'm porting swift code on React Native with Objective-C, there is a function that is deprecated what's the correct one\n<a href="https://i.sstatic.net/RKlaQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RKlaQ.png" alt="enter image description here" /></a></p>\n<p>fixing with void doesn't work if i try to import swift func in react native and then run the app</p>\n<p>the code in <strong>RNWebViewManager</strong> and <strong>AwesomeProject...Header</strong> is respectively</p>\n<p><strong>RNWebViewManager</strong></p>\n<pre><code>import Foundation\n\n\n@objc(RNWebVeiewManager)\nclass RNWebViewManager(): RCTViewManager {\n override func view() -&gt; UIView! {\n let label = UILabel()\n label.text = &quot;hello there&quot;\n label.textAlignment = .center\n return label\n }\n}\n</code></pre>\n<p><strong>AwesomeProject...Header</strong></p>\n<pre><code>#import &quot;React/RCTBridgeModule.h&quot;\n#import &quot;React/RCTViewManager.h&quot;\n</code></pre>\n"^^ . "@IanAbbott You are right, my 'actual table' for the expected is not right. if you look at the CJK set https://www.compart.com/en/unicode/block/U+4E00\n最 is mapped to \\u6700 - I'm assuming this too is "UTF-16BE"?"^^ . "0"^^ . . . . . . . . . "<p>I encountered the same issue. It turned out that the module name of the PieChartView in my Storyboard still was the old library name. Just make sure the PieChartView's Module is set to &quot;DGCharts&quot;.</p>\n<p>Images: <a href="https://i.sstatic.net/SQYcc.png" rel="noreferrer">Before</a> and <a href="https://i.sstatic.net/O6dDm.png" rel="noreferrer">After</a></p>\n"^^ . "0"^^ . . "0"^^ . . . . . . . "cncontactstore"^^ . "0"^^ . . . . . "0"^^ . . "1"^^ . . "0"^^ . "0"^^ . "0"^^ . . . . . . . . "<p>I'm trying to create a custom authentication plugin for MacOS Ventura (instead of using a password i want to use a 4 digit code), and i was going to try and follow the code from this repository <a href="https://github.com/skycocker/NameAndPassword" rel="nofollow noreferrer">NameAndPassword</a>, since i saw alot of positive feedback from this repository. But i follow the steps to add the .bundle file and update the authorizationdb but it just makes my MacOS stop working, after the Mac logo the screen just stays black.</p>\n<p>I have follow the steps from this links:</p>\n<p><a href="https://stackoverflow.com/questions/21737444/creating-an-os-x-authentication-plugin">Creating an OS X authentication plugin</a></p>\n<p><a href="https://stackoverflow.com/questions/21582995/custom-login-lock-screen-in-os-x-mavericks/21618085#21618085">Custom login/lock screen in OS X Mavericks</a></p>\n<p><a href="https://stackoverflow.com/questions/45719864/how-to-customize-the-mac-osx-login?rq=3">How to customize the Mac OSX login?</a></p>\n<p>Does anyone know if for MacOS Ventura the configuration to add a authorization plugin have changed, and does anyone can confirm if the NameAndPassword plugin works for MacOS Ventura?</p>\n"^^ . "0"^^ . . . . . "1"^^ . . . . "0"^^ . . . "0"^^ . "uiimageview"^^ . . . "2"^^ . "Is there a way to share global constant in Swift/Obj-C and Metal code"^^ . . . . "Could you share the full error message and the stack trace?"^^ . "@Jabberwocky I'm on macOS. wchar is found in <wchar.h>\nNot sure if it is Microsoft dependent?"^^ . . . . . . "2"^^ . . "You need to import RNWebViewManager.h"^^ . "3"^^ . "contacts"^^ . . . . . . . . . "<blockquote>\n<p>When I locate the Compass storyboard file, I check the name and it is <strong>Compass.storyboard</strong></p>\n</blockquote>\n<p>then you should load it like this</p>\n<pre><code>let storyboard = UIStoryboard(name: &quot;Compass&quot;, bundle: nil)\n</code></pre>\n"^^ . . "Do you have a reference for your "expected" multibyte character encoding scheme (which does not look very sensible to me). The "actual" sequence is using standard Unicode UTF-8 encoding."^^ . "0"^^ . . . . . "0"^^ . . . . . . . "If we don't use Expo, could you clarify what's the definition of `EXAppDelegateWrapper`? Could you also check https://github.com/expo/expo/issues/21042 ?"^^ . "Where is RCT_EXTERN_MODULE declared ?"^^ . "I have the attributed string with all the font data, but I guess it isn't finding anything when it enumerates, but I can verify even looking at the RTF file in Xcode that it is bolded"^^ . . "uiimage"^^ . "1"^^ . . "How do I fix the conversion problem to the DecimalNumberWithString function?"^^ . . "<p>I have a class called <code>ShapeView</code> which subclasses <code>UIImageView</code>. Within this class, there is a <code>CALayer</code> property called <code>shape</code> which I use to define various types of complex shapes. Using <code>UIGraphicsBeginImageContextWithOptions</code>, ShapeView will translate <code>shape</code> into a <code>UIImage</code> which is then set as the <code>UIImageView's</code> image property.</p>\n<p>Using this set up, I'm wanting to merge two shapes that intersect each other like following:</p>\n<p><a href="https://i.sstatic.net/cJam3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/cJam3.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/qY9sp.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qY9sp.png" alt="enter image description here" /></a></p>\n<p>As you can see, I'm setting the stroke property of each <code>CAShapeLayer</code> so that each shape has a black border. I'm wanting to make it so that if two shapes intersect each other, I can detect the part of the stroke that's inside the other shape and change the color of those pixels to <code>UIClearColor</code> so that it gives the impression that the two shapes are merging.</p>\n<p>I'm a little confused though as to how to detect if a certain area of a <code>CAShapeLayer</code>, which has been converted to a <code>UIImage</code>, is in another <code>CAShapeLayer</code> which has also been converted to a <code>UIImage</code>. And also how to change the color of those exact pixels to <code>UIClearColor</code> (is this even possible?).</p>\n<p>Thanks!</p>\n"^^ . "@IanAbbott Actually encoding ASCII characters as two bytes with a dummy 00 is exactly what the software does which we need to match! I thought 00 was a separator all this time! So they are actually encoding in UTF-16BE. That is interesting. So 'T' = 00 54 : ê = 00 EA : n = 00 6E : ạ = 1E A1 : If ASCII characters are encoded as two bytes, How many bytes will Unicode characters be encoded in, with UTF-16BE? The software that does this crazy obfuscation is called Serato - a DJ management tool."^^ . . . "@DonMag Thanks for doing all that, yeah that's correct except for the ones with images. When this class uses an image, it will just be the image itself (no shape or stroke) and it won't have to do the merging thing I want, will be completely separate. But the other ones with the shapes merging, that's exactly right."^^ . . "1"^^ . "0"^^ . . "<p>I know it's possible to declare custom structs in Obj-C header file, and reuse this one declaration in both Metal shaders as well as in Obj-C/Swift host code. Now I was thinking about reusing the small helper function in both Obj-C/Swift and my Metal shaders. After many attempts I was able to do that, but with many limitations and strange compiler quirks.</p>\n<p>This is the C-function declared and defined in Objective-C bridging header:</p>\n<pre><code>#include &lt;simd/simd.h&gt;\n\nextern inline simd_ushort2 test(simd_float2 pos) {\n const float H = 16.0;\n return (simd_ushort2){\n (ushort)(pos.x/H),\n (ushort)(pos.y/H)\n };\n}\n</code></pre>\n<p>This function works in both Swift and Metal shader. But it doesn't work in Metal if I define it in implementation file instead of the header. So it seems like Metal can only operate with C-functions defined in the header? Also for some reason this doesn't work without <code>extern</code> keyword, which to my understanding doesn't do anything for functions defined in header.</p>\n<p>Then if I want to do some more math in this function, like using <code>ceilf</code>, for example...</p>\n<pre><code>#include &lt;simd/simd.h&gt;\n#include &lt;math.h&gt;\n\nextern inline simd_ushort2 test(simd_float2 pos) {\n const float H = 16.0;\n return (simd_ushort2){\n (ushort)ceilf(pos.x/H),\n (ushort)ceilf(pos.y/H)\n };\n}\n</code></pre>\n<p>...it doesn't compile in Metal, spawning countless errors related to importing <code>&lt;math.h&gt;</code> like <code>'double' is not supported in Metal</code></p>\n<p>So it seems to me the scale of incompatibility between Metal and even the plain C reaches the scale of even the most basic math operations. Am I right that trying to share implementation between Metal and host-code is bad idea, and it's better to limit sharing to struct declarations and some global constants if needed?</p>\n"^^ . . . . . "0"^^ . . . . . . . "0"^^ . . . . "authentication"^^ . . . . "yeah, the more I stare at this, the more I expect that the compiler is able to optimize away adding a release in the call to`objectAtIndex:` (since the compiler knows the details of NSArray), because it can see that you never use the object past the expression. I would expect your swizzle to not cooperate with that properly, and it's probably adding a retain that the caller isn't expecting. Should definitely be a lot of fun to explore the assembly output for all of this. Best of luck. Great little toy project to understand it better."^^ . "@JustSomeGuy thank you! I haven't thought of conditional macro myself. I use `#define CONSTANT constant constexpr` for Metal and `#define CONSTANT const static` for Swift. Worked out okay so far."^^ . . "0"^^ . . . . "5"^^ . . . "Private API to embed a Mac Catalyst component in a native AppKit app?"^^ . "0"^^ . . "<p>G'day,\nI've been trying to use <code>MLKit</code> for iOS for face detection task. I referred their code samples through <a href="https://codelabs.developers.google.com/codelabs/mlkit-ios#0" rel="nofollow noreferrer">codelab</a> and <a href="https://github.com/googlesamples/mlkit/tree/master/ios/quickstarts/vision" rel="nofollow noreferrer">sample app</a>.\nSo right out of the box, the <code>MLKit</code> seems to be working alright. I however ran into a problem where if the image comes as <code>CoreImage</code> object, the resulting <code>VisionImage</code> will not work with MLKit (i.e. not detecting any faces in it, no crashes or errors presented). Here is an example code.</p>\n<pre class="lang-swift prettyprint-override"><code>\n/// Processes an Image and detects faces in it\n/// - Parameter coreImage: Image Taken Out of Core Image Pipeline\nfunc detectFaces(coreImage: CIImage) {\n let ciImage = coreImage // image taken out of a core image pipeline\n guard let cgImage = getCGImageFromCIImage(ciImage) else { return }\n \n let uiImage = UIImage(cgImage: cgImage)\n let visionImage = VisionImage(image: uiImage)\n faceDetector.process(visionImage) { result, error in\n if let error = error {\n print(error.localizedDescription)\n return\n }\n \n guard let result = result else {\n print(&quot;no features&quot;)\n return\n }\n \n print(result.count) // &lt;&lt;&lt;&lt; ALWAYS RESULTS IN 0\n \n // Other relevant processing later\n }\n}\n\nprivate func getCGImageFromCIImage(_ ciImage: CIImage) -&gt; CGImage? {\n let context = CIContext()\n if let cgImage = context.createCGImage(ciImage.clampedToExtent(), from: ciImage.extent) {\n return cgImage\n }\n return nil\n}\n\nprivate lazy var faceDetectorOption: FaceDetectorOptions = {\n let option = FaceDetectorOptions()\n option.performanceMode = .accurate\n option.isTrackingEnabled = false\n return option\n}()\n\nprivate lazy var faceDetector = FaceDetector.faceDetector(options: faceDetectorOption)\n\n</code></pre>\n<p>The code above does not crash or produce any error. It simply outputs 0 results. However if I bypass the CoreImage pipeline's work and pass in the original UIImage MLKit outputs the desired result. The core image pipeline is required for the work I'm doing as it's doing a crop and rotate based on the user's input from UI.</p>\n<p>Any ideas for what might be the problem is really appreciated.</p>\n<p>I tried passing the core image through CoreML's CIDetector and it does detect faces without an issue. (As per project's requirement's I need to process the image through MLKit, not CoreML)</p>\n"^^ . . . . "1"^^ . . . . . "Your other approach with `for(int k = 0; k < byteCount; k++)` skips the first byte of the following character when byteCount is greater than 1. It should be something like `fprintf(fd, "%c", character);` `for (int k = 1; k < byteCount; k++)` `{` `character = *++stringText;` `fprintf(fd, "%c", character);` `}`."^^ . "1"^^ . . . "<p>As the work you are doing in your submitted blocks is, itself, asynchronous, you can't rely on <code>dispatch_group_async</code> to manage group entry and exit for you.</p>\n<p>You need to call <code>dispatch_group_enter</code> before you call each function and <code>dispatch_group_leave</code> in the completion handler of each function.</p>\n<p>With your current code, the group is entered when the block is submitted and the group is left when the submitted block is complete.</p>\n<p>Because <code>requestData</code> is asynchronous, <code>getOneData</code> returns but the network operation is not complete.</p>\n<p>As <code>getOneData</code> (and presumably <code>getTwoData</code>) is asynchronous there is little value to calling it from an asynchronous block.</p>\n<p>You also have a bug where both your completion handler for <code>getOneData</code> and your <code>dispatch_group_notify</code> call <code>endRefreshing</code>. This will result in an &quot;unbalanced calls&quot; exception if there is an error in the first data request.</p>\n"^^ . . "1"^^ . . . . . . . . . . . "uiscenedelegate"^^ . "<p>I found a solution. I just misunderstood how the stencil test works.</p>\n<p>Building a texture for stencil test at the initializing point of the Renderer.</p>\n<pre><code>// build a texture for stencil test\nvoid Renderer::buildStencilTest()\n{\n auto* pStencilDesc = MTL::TextureDescriptor::texture2DDescriptor(\n MTL::PixelFormatDepth32Float_Stencil8, _viewSize[0], _viewSize[1], false);\n pStencilDesc-&gt;setStorageMode( MTL::StorageModePrivate );\n pStencilDesc-&gt;setUsage( MTL::TextureUsageRenderTarget | MTL::TextureUsageShaderRead );\n _pDepthStencilTexture = _pDevice-&gt;newTexture( pStencilDesc );\n}\n</code></pre>\n<p>In the update() method, set the texture what we built for stencil test to the stencil attachment of current render pass of a view.</p>\n<ol>\n<li><p>Clear stencil value as ZERO.</p>\n</li>\n<li><p>Draw the area what I want to mask. (I am not gonna use Depth test, so disable it.)</p>\n</li>\n<li><p>Set the stencil compare function to &quot;Pass Always&quot; and depth/stencil pass operation as &quot;Replace&quot;.</p>\n</li>\n<li><p>Set stencil reference value to 1. Stencil test is gonna compare this and the value of stencil texture. At this time, stencil test &quot;always PASS&quot; and replace the drawing area of texture as the result of logical AND of &quot;reference value (1)&quot; and &quot;write mask (0xff)&quot; therefore 1.</p>\n</li>\n<li><p>Draw elements.</p>\n</li>\n</ol>\n<pre><code>void Renderer::update() {\n // Clear stencil \n pRPD-&gt;stencilAttachment()-&gt;setLoadAction( MTL::LoadActionClear );\n pRPD-&gt;stencilAttachment()-&gt;setStoreAction( MTL::StoreActionStore );\n pRPD-&gt;stencilAttachment()-&gt;setTexture( _pDepthStencilTexture );\n pRPD-&gt;stencilAttachment()-&gt;setClearStencil( 0 );\n\n auto* pDsDesc = MTL::DepthStencilDescriptor::alloc()-&gt;init();\n pDsDesc-&gt;setDepthCompareFunction( MTL::CompareFunctionAlways );\n pDsDesc-&gt;setDepthWriteEnabled( false );\n auto* pStencil = MTL::StencilDescriptor::alloc()-&gt;init();\n \n pStencil-&gt;setStencilCompareFunction(MTL::CompareFunctionAlways);\n\n pStencil-&gt;setDepthFailureOperation( MTL::StencilOperationKeep );\n pStencil-&gt;setStencilFailureOperation( MTL::StencilOperationKeep );\n pStencil-&gt;setDepthStencilPassOperation( MTL::StencilOperationReplace );\n pStencil-&gt;setReadMask(0xff);\n pStencil-&gt;setWriteMask(0xff);\n\n pDsDesc-&gt;setFrontFaceStencil(pStencil);\n pDsDesc-&gt;setBackFaceStencil(pStencil);\n pEnc-&gt;setStencilReferenceValue(1);\n pEnc-&gt;setDepthStencilState( _pDevice-&gt;newDepthStencilState( pDsDesc ) );\n\n drawImage( _orcTexture, { 0.0f, 0.0f }, { 50.0f, 50.0f }, _currentFrame );\n drawFrame(pEnc);\n ... \n}\n</code></pre>\n<p>Drawing the other area which is gonna be the background.</p>\n<ol>\n<li><p>Set stencil compare function to &quot;Equal&quot;.</p>\n</li>\n<li><p>Set depth/stencil pass operation to &quot;Keep&quot;. If the stencil test failed, the area of stencil texture is gonna be 0.</p>\n</li>\n<li><p>Draw elements.</p>\n</li>\n</ol>\n<pre><code>void Renderer::update() {\n pDsDesc-&gt;setDepthCompareFunction( MTL::CompareFunctionAlways );\n pDsDesc-&gt;setDepthWriteEnabled( false );\n\n pStencil-&gt;setStencilCompareFunction(MTL::CompareFunctionEqual);\n\n pStencil-&gt;setDepthFailureOperation(MTL::StencilOperationKeep);\n pStencil-&gt;setStencilFailureOperation(MTL::StencilOperationKeep);\n pStencil-&gt;setDepthStencilPassOperation(MTL::StencilOperationKeep);\n pStencil-&gt;setReadMask(0xff);\n pStencil-&gt;setWriteMask(0xff);\n\n pDsDesc-&gt;setFrontFaceStencil(pStencil);\n pDsDesc-&gt;setBackFaceStencil(pStencil);\n pEnc-&gt;setDepthStencilState( _pDevice-&gt;newDepthStencilState( pDsDesc ) );\n\n drawImage( grassTexture, { 0.0f, 0.0f }, { 200.0f, 200.0f } );\n drawFrame( pEnc );\n ... \n}\n</code></pre>\n<p>It will draw only the small masked area with the masked texture(grass) of second elements.</p>\n"^^ . "0"^^ . . "Why are certain repeated keys ignored by interpretKeyEvents in NSResponder?"^^ . . . . . . "2"^^ . . "0"^^ . "2"^^ . . . "0"^^ . . . . . "0"^^ . . "objective-c"^^ . "2"^^ . "0"^^ . . "<p>I have a bicycle app for which I would like to add user input capability in a safe way. I want to use a simple handlebar mounted, thumb activated audio remote control device (+vol, -vol, next track, previous track) for app input rather than user touching phone screen. I want to use the audio control buttons for app specific inputs - not related to audio.\nI started out assuming I would need to bring in media player features to my main view controller.\nI'm not getting any errors, but not getting any results</p>\n<pre><code>interface:\n#import &lt;MediaPlayer/MediaPlayer.h&gt;\n@property (nonatomic, strong) MPRemoteCommandCenter *commandCenter \n\nimplementation:\ninside view did load\nMPRemoteCommandCenter *commandCenter =[MPRemoteCommandCenter sharedCommandCenter] ;\n[commandCenter.nextTrackCommand addTargetWithHandler: ^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent *event) {\n [self.mysong play]; //for testing\n return MPRemoteCommandHandlerStatusSuccess ;\n }];\n</code></pre>\n<p>Please help. Any suggestions on how to accept input from audio remote?\nIs there something better than media plyer? A bluetooth method?</p>\n"^^ . "1"^^ . "<p>You can't include standard library headers in the Metal shader files. Section 1.4.4 of Metal Shading Language Specification says</p>\n<blockquote>\n<p>Do not use the C++ standard library in Metal code. Instead, Metal has its own standard library, as discussed in section 5 of this document.</p>\n</blockquote>\n<p>That doesn't stop you from including it in the Objective-C code. What you should do is include the right header conditionally based on where the header is included or for which &quot;platform&quot; the source file is compiled.</p>\n<p>So, in your case it would look like this:</p>\n<pre><code>#ifdef __METAL_VERSION__\n#include &lt;metal_stdlib&gt;\nusing namespace metal;\n#else\n#include &lt;math.h&gt;\n#endif\n\n#include &lt;simd/simd.h&gt;\n\nextern inline simd_ushort2 test(simd_float2 pos) {\n const float H = 16.0;\n return (simd_ushort2){\n (ushort)ceilf(pos.x/H),\n (ushort)ceilf(pos.y/H)\n };\n}\n</code></pre>\n"^^ . . "where this file must be imported"^^ . "0"^^ . . . "It doesn't compile with either `extern` or `inline` missing or definition given in .m file instead of the header. So I guess Metal compiler do not inline anything automatically, and defining the function in the header with `inline` explicitly is the only way. Also with `extern` for some reason."^^ . . . "multibyte-characters"^^ . . "live-connect-sdk"^^ . . . "I think defines are okay, but you can use macros as well to be more expressive. In case of program scope constants in Metal, you want your constants to be `constant constexpr` and in Objective-C, if you are using the C++ dialect of it, you can just keep it as constexpr. You can use `#ifdef __METAL_VERSION_` to define a different version of `CONSTANT` macro or whatever you wanna call it that will generate the left hand of the constant definition and use it as `CONSTANT(int) myConstant = 123;`."^^ . "0"^^ . . . . "2"^^ . . "I added couple of examples - Chinese text and Vietnamese text\nAlso added an alternate approach of checking if a character is a multibyte character and writing all bytes if true. This too did not work. The edited question has the alternate approach."^^ . "1"^^ . "0"^^ . . . "How can I page through an e-Book using WKWebView"^^ . . . "<p><code>*** -[NSObject allocWithZone:]: attempt to allocate an object of class 'AGXA12FamilyCommandBuffer' failed</code> happens on <code>tvOS</code> to many users that use my product.</p>\n<p>Does anybody know what this class is <code>AGXA12FamilyCommandBuffer</code> and what could cause the crash?</p>\n"^^ . "0"^^ . . "0"^^ . . "Hey, I think you should know that, the code point is a bit different from the multibyte stored in your file. It's very different for different encoding formats, eg: UTF-8, UTF-16, UTF-32."^^ . . . "<p>I have the following code in Objective-C:</p>\n<pre class="lang-objectivec prettyprint-override"><code>if (@available(iOS 13.0, tvOS 13.0, *)) {\n indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleLarge;\n} else {\n indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;\n}\n</code></pre>\n<p>But this is producing an error.</p>\n<pre><code>'UIActivityIndicatorViewStyleWhiteLarge' is unavailable: not available on xrOS\n</code></pre>\n<p>I think I need that first conditional to get run so it doesn't even try to access <code>UIActivityIndicatorViewStyleWhiteLarge</code>.</p>\n<p>But when I change the line to <code>if (@available(iOS 13.0, tvOS 13.0, visionOS 1.0, *))</code>. I get the following error:</p>\n<pre><code>Unrecognized platform name visionOS\n</code></pre>\n<p>I also tried changing it to <code>xrOS 1.0</code> (since I heard that some internal usages had it as xrOS for a while. And while I don't get the second compiler error, it does still say it's unavailable.</p>\n<p>Any ideas on how to fix this?</p>\n"^^ . . "string-literals"^^ . . . . . "@ArpitBParekh that's right. The next time start app, my contacts are not sorted."^^ . "Does this answer your question? [Is floating point math broken?](https://stackoverflow.com/questions/588004/is-floating-point-math-broken)"^^ . . "0"^^ . "uisheetpresentationcontroller"^^ . . "'NSInvalidArgumentException' but types of parameter look fine?"^^ . . . . "nsresponder"^^ . . . . . "1"^^ . "<p>By using method exchange, the problem of NSMutableArray array out of bounds is determined.</p>\n<p>myCode like this:</p>\n<pre><code>static inline void swizzleSelectorKK(Class theClass, SEL originalSelector, SEL swizzledSelector) {\n Method originalMethod = class_getInstanceMethod(theClass, originalSelector);\n Method swizzledMethod = class_getInstanceMethod(theClass, swizzledSelector);\n method_exchangeImplementations(originalMethod, swizzledMethod);\n}\n\n\nand call it in the load function:\n+(void)load{\n [super load];\n static dispatch_once_t onceToken;\n dispatch_once(&amp;onceToken, ^{\n swizzleSelectorKK(NSClassFromString(@&quot;__NSArrayM&quot;) , @selector(objectAtIndex:), @selector(kk_objectAtIndex:));\n });\n}\n\nthe replace function like this:\n- (id)kk_objectAtIndex:(NSUInteger)index {\n if (self.count == 0) {\n return nil;\n }\n if (index &gt;= self.count) {\n return nil;\n }\n return [self kk_objectAtIndex:index];\n}\n</code></pre>\n<p>in my viewcontroll:</p>\n<pre><code>- (void)viewDidLoad {\n [super viewDidLoad];\n self.view.backgroundColor = [UIColor whiteColor];\n self.arr = [[NSMutableArray alloc]init];\n [self.arr addObject:@&quot;this is a array&quot;];\n [self.arr addObject:@&quot;this 2 array&quot;];\n [self.arr addObject:@&quot;this 3&quot;];\n \n UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];\n button.backgroundColor = [UIColor systemBlueColor];\n [button setTitle:@&quot;click&quot; forState:UIControlStateNormal];\n [button addTarget:self action:@selector(reloadDataxxx) forControlEvents:UIControlEventTouchUpInside];\n button.frame = CGRectMake(200, 100, 200, 200);\n [self.view addSubview:button];\n}\n- (void)reloadDataxxx {\n self.index = self.index % 3;\n NSLog(@&quot;index of is %ld data = %@&quot;, self.index, [self.arr objectAtIndex:self.index]);\n self.index ++;\n}\n</code></pre>\n<p>As you continue to click, you will find that the memory continues to grow, as long as you remove the exchange method, the memory will not change.</p>\n<p>It's been a long day. Thank you</p>\n"^^ . . . . "Unfortunately, ML Kit does not provide direct support for converting a CoreImage to a VisionImage. Users are required to accurately set the orientation in VisionImage prior to feeding it into ML Kit's detection pipeline for face detection. To ensure correct orientation, you can verify it in two ways:\n\nSave the UIImage locally and check if its orientation aligns with the .orientation set in VisionImage.\nExperiment with all possible .orientation values on the VisionImage to determine which one yields a valid detection."^^ . "0"^^ . . . . . . . "2"^^ . . "0"^^ . "1"^^ . "0"^^ . "0"^^ . "@Larme Thanks for the advice, definitely will do"^^ . . "cncontact"^^ . . "1"^^ . "3"^^ . "Why do you call `interpretKeyEvents` if you don't implement `NSTextInputClient`?"^^ . . . . "charts"^^ . . . "@IanAbbott - The reference can be found here (https://vietunicode.sourceforge.net/charset/) \nThe character 'ê' is written as EA and 'ạ' is written as '1E A1' \nwhich is what the 'expected' result shows."^^ . . "0"^^ . "i do have all the permissions\nand accuracy setup but location updates are not happening it just throw this\nError Domain=kCLErrorDomain Code=0 "(null)" and does nothing"^^ . "1"^^ . . "1"^^ . . . . "0"^^ . . . . . . . . . "react-native"^^ . . . . "0"^^ . "0"^^ . "0"^^ . . "0"^^ . . "2"^^ . . . . . . . . "0"^^ . "0"^^ . . . "DGCharts EXC_BAD_ACCESS (code=2, address=0x12a113e30)"^^ . "0"^^ . . . . "0"^^ . . "0"^^ . . "You must create a file named RNWebViewManager.h which declared the interface for RNWebViewManager. Then in RNWebViewManager.m import it and declare the implementation of the class. BTW declaring inheritance and protocol conformance in Objective-C is done with : @interface className: parentClassName <protocolName, orherProtocolName..>"^^ . . . . "Input from the emoji and symbol character viewer only comes through on `insertText`, so I needed to implement that path anyway. `interpretKeyEvents` appeared to be the convention for passing character data from `keyDown` to `insertText`, as opposed to getting it out of the `NSEvent` and calling `insertText` myself."^^ . . . "Please do not post duplicate answers."^^ . . . "*"... subclasses UIImageView"* -- will these custom views also have (other) images? If not, is there a reason you're generating `UIImage` from the shape layer? *"... various types of complex shapes"* -- I think you need to show some complex shape examples, and clarify what you want the results to look like. For example, doing something the two examples here - https://imgur.com/a/JuVLotk - is fairly straightforward task."^^ . "0"^^ . . "0"^^ . . . . . "I think, for Metal compiler, if you are not trying to compile a dynamic library, all the definitions go into the same module, and the compiler will most probably also inline all of them, so I'm not sure if you even need that. I don't think it hurts in this case, just be careful not to violate the ODR."^^ . . "1"^^ . . . . . "1"^^ . "How to add a custom authentication plugin for MacOS Ventura?"^^ . . "What OS version are you using? It works fine for me on iOS 16.4 simulator. You might want to use the method that also takes a locale because all those numbers can parse to 0 if the users' locale has a comma instead of a dot as decimal separator."^^ . . "Thank you! This works! Do you know also if defining the function inside the header itself and prefixing it with `extern inline` the only way to go in this case as well?"^^ . "0"^^ . . "0"^^ . "bluetooth"^^ . . "1"^^ . . . . . . . . . . "iphone-privateapi"^^ . "1"^^ . . . . "uicollectionview"^^ . . . . . . . . "<p>I use <code>dispatch_group_t</code> to handle my three network requests with the following code:</p>\n<pre><code>dispatch_group_t group = dispatch_group_create();\ndispatch_queue_t queue = dispatch_get_global_queue(0, 0);\n\n[self.permissionData removeAllObjects];\ndispatch_group_async(group, queue, ^{\n [self getOneData];\n});\n\n[self.bannerData removeAllObjects];\ndispatch_group_async(group, queue, ^{\n [self getTwoData];\n});\n\ndispatch_group_notify(group, dispatch_get_main_queue(), ^{\n [self.tableView.mj_header endRefreshing];\n});\n</code></pre>\n<p>and</p>\n<pre><code>- (void)getOneData {\n [self requestData:^(id _Nullable datas, NSError * _Nullable error) {\n if (error != nil) {\n [self.tableView.mj_header endRefreshing];\n } else {\n if ([datas isKindOfClass:[NSArray class]]) {\n self.datas = datas;\n }\n [self.tableView reloadData];\n }\n }];\n}\n</code></pre>\n<p>This will cause the callbacks of both methods <code>getOneData</code> and <code>getTwoData</code> to go twice. I don't know why they both go twice, but if I don't use <code>dispatch_group_t</code>, there is no problem. May I ask why this is?</p>\n"^^ . . . . . . . "Also super thanks to @IanAbbott for helping me decipher that the encoding expected was indeed "UTF16BigEndian", which pointed me to the right direction."^^ . . . . "<p>I am new to the Swift world, and have created a very basic app that loads up 3 views from a storyboard controller called <code>Main</code></p>\n<pre><code>@IBAction func view2ButtonClicked(_ sender: Any) {\n if let vc = self.storyboard?.instantiateViewController(withIdentifier: String(describing: Test2ViewController.self)) as? Test2ViewController {\n self.navigationController?.pushViewController(vc, animated: true)\n }\n}\n \n@IBAction func view3ButtonClicked(_ sender: Any) {\n if let vc = self.storyboard?.instantiateViewController(withIdentifier: String(describing: Test3ViewController.self)) as? Test3ViewController {\n self.navigationController?.pushViewController(vc, animated: true)\n }\n}\n</code></pre>\n<p>However, I have also copied over a <code>.h</code> &amp; <code>.m</code> as well as a storyboard from an older <code>obj-c</code> project, I have setup the bridging header, and I am trying to load it using the following method;</p>\n<pre><code>@IBAction func view1ButtonClicked(_ sender: Any) {\n \n let storyboard = UIStoryboard(name: &quot;CompassView&quot;, bundle: nil)\n let vc = storyboard.instantiateViewController(withIdentifier: &quot;CompassViewController&quot;)\n self.navigationController!.pushViewController(vc, animated: true)\n \n}\n</code></pre>\n<p>However it crashes with the error;</p>\n<pre><code> *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'CompassView' in bundle NSBundle\n</code></pre>\n<p>When I locate the Compass storyboard file, I check the name and it is <code>Compass.storyboard</code></p>\n<p>and the custom class is <code>CompassViewController</code> and storyboard ID is <code>CompassView</code></p>\n"^^ . . "<p>Its not possible to have a custom logic(4 digit PIN) to authenticate a user on login window as <em>Login Keychain</em> needs to be unlocked before login.</p>\n<p>To unlock login keychain you would need password.</p>\n<p>I have tried and replaced the builtin mechanisms in auth db which allowed me to login using custom logic but since the login keychain couln't be unlocked my mac started behaving in weird way like all apps got logged out, lost touch id, accounts in browsers got logged ot etc...</p>\n<p>Note: Repo you shared works perfectly fine just make sure to update correct mechanism 'loginwindow:login' with your custom auth plugin.</p>\n"^^ . "wkwebview"^^ . . "1"^^ . "0"^^ . . . . . . . . . . . "0"^^ . . . "0"^^ . . "Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . "0"^^ . "swiftgen"^^ . "0"^^ . "<p>With the push in the right direction by @Cy-4AH I figured out how to get a 3rd level as well.</p>\n<p>For example, if I want the Objective-C class <code>MyButtonConfigurationSize</code> to be exposed as <code>MyButton.Configuration.Size</code> in Swift, then after adding the first extension, I would need:</p>\n<pre class="lang-swift prettyprint-override"><code>extension MyButton.Configuration {\n typealias Size = __MyButtonConfigurationSize\n}\n</code></pre>\n<p>It seems so obvious now.</p>\n"^^ . . . "@Jabberwocky: Objective-C is not Microsoft. In any case, can you find some interchangeable format which still recommend UTF-16? (I'm not speaking about using it internally) OTOH I have some impression that also Microsoft is moving to UTF-8 (it would be much easier, but then, like JavaScript, there are API for UCS-2, for UFT-16 and for UTF-8)."^^ . . "<p>In my app I sort through thousands of lines of questions to create a property list file. As part of this, I need it to detect which texts are in bold, as those are the ones marked as the correct answer. It would be something like</p>\n<pre><code>1. What is 1+1?\nA. 2\nB. 3\nC. 4\nD. 5\n</code></pre>\n<p>And in this case, A. 2 would be BOLD. What I'm having issues with is detecting the bold text to easily load all the correct answers. What I am trying so far returns absolutely nothing.</p>\n<p>I simply drag the RTF into the sidebar in Xcode to make sure it is accessible. It is, and everything in this code runs fine, except for trying to find the bold text:</p>\n<pre><code>-(void)editTextFile {\n NSError *error = nil;\n NSString *filepath = [[NSBundle mainBundle] pathForResource:@&quot;2024ROMANSEDITED&quot; ofType:@&quot;rtf&quot;];\n NSAttributedString *fileContent = [[NSAttributedString alloc] initWithFileURL:[NSURL fileURLWithPath:filepath] options:@{NSDocumentTypeDocumentAttribute: NSRTFTextDocumentType} documentAttributes:nil error:&amp;error];\n \n NSArray *questionItems = [fileContent.string componentsSeparatedByString:@&quot;\\n\\n&quot;];\n \n NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);\n NSString *documentsPath = paths.firstObject;\n NSString *plistPath = [documentsPath stringByAppendingPathComponent:@&quot;chatgptoptions.plist&quot;];\n \n NSMutableArray *questions = [NSMutableArray array];\n \n for (NSString *questionItem in questionItems) {\n NSArray *items = [questionItem componentsSeparatedByString:@&quot;\\n&quot;];\n NSString *theQuestion = items.firstObject;\n NSArray *answerOptions = [items subarrayWithRange:NSMakeRange(1, items.count - 1)];\n \n NSString *correctAnswerIndex = @&quot;&quot;;\n \n for (NSUInteger i = 0; i &lt; answerOptions.count; i++) {\n NSString *answerOption = answerOptions[i];\n \n NSRegularExpression *boldRegex = [NSRegularExpression regularExpressionWithPattern:@&quot;&lt;b&gt;(.*?)&lt;\\\\/b&gt;&quot;\n options:NSRegularExpressionCaseInsensitive\n error:nil];\n NSArray *boldMatches = [boldRegex matchesInString:answerOption\n options:0\n range:NSMakeRange(0, answerOption.length)];\n \n if (boldMatches.count &gt; 0) {\n correctAnswerIndex = [NSString stringWithFormat:@&quot;%lu&quot;, i];\n break;\n }\n }\n \n NSDictionary *innerDict = @{\n @&quot;Answer&quot;: correctAnswerIndex,\n @&quot;duration_in_seconds&quot;: @&quot;30&quot;,\n @&quot;negative_points&quot;: @&quot;5&quot;,\n @&quot;options&quot;: answerOptions,\n @&quot;points&quot;: @&quot;20&quot;,\n @&quot;question&quot;: theQuestion,\n @&quot;question_type&quot;: @&quot;1&quot;\n };\n \n [questions addObject:innerDict];\n }\n \n NSDictionary *plistDictionary = @{\n @&quot;Questions&quot;: questions\n };\n \n BOOL success = [plistDictionary writeToFile:plistPath atomically:YES];\n \n if (success) {\n NSLog(@&quot;PLIST file generated successfully at path: %@&quot;, plistPath);\n } else {\n NSLog(@&quot;Failed to generate PLIST file.&quot;);\n }\n }\n</code></pre>\n<p>In this scenario I would expect correctAnswerIndex to give me an NSString of &quot;0&quot;, but instead I get nothing. Any ideas?</p>\n<p>Update 2:\nTrying to keep all the data, but font family keeps coming back as null, so I seem to be losing it somewhere.</p>\n<pre><code> -(void)editTextFile {\n NSString *filepath = [[NSBundle mainBundle] pathForResource:@&quot;2024ROMANSEDITED&quot; ofType:@&quot;rtf&quot;];\n NSError *error = nil;\n NSAttributedString *fileContent = [[NSAttributedString alloc] initWithFileURL:[NSURL fileURLWithPath:filepath] options:@{NSDocumentTypeDocumentAttribute: NSRTFTextDocumentType} documentAttributes:nil error:&amp;error];\n \n NSArray *questionItems = [self extractQuestionItemsFromRTFFileContent:fileContent];\n \n NSMutableArray *questions = [NSMutableArray array];\n \n for (NSAttributedString *questionItem in questionItems) {\n NSString *theQuestion = [self extractQuestionFromQuestionItem:questionItem];\n NSArray *answerOptions = [self extractAnswerOptionsFromQuestionItem:questionItem];\n NSString *correctAnswerIndex = [self extractCorrectAnswerIndexFromAnswerOptions:answerOptions];\n \n NSDictionary *innerDict = @{\n @&quot;Answer&quot;: correctAnswerIndex,\n @&quot;duration_in_seconds&quot;: @&quot;30&quot;,\n @&quot;negative_points&quot;: @&quot;5&quot;,\n @&quot;options&quot;: answerOptions,\n @&quot;points&quot;: @&quot;20&quot;,\n @&quot;question&quot;: theQuestion,\n @&quot;question_type&quot;: @&quot;1&quot;\n };\n \n [questions addObject:innerDict];\n }\n \n NSDictionary *plistDictionary = @{\n @&quot;Questions&quot;: questions\n };\n \n NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);\n NSString *documentsPath = paths.firstObject;\n NSString *plistPath = [documentsPath stringByAppendingPathComponent:@&quot;chatgptoptions.plist&quot;];\n \n BOOL success = [plistDictionary writeToFile:plistPath atomically:YES];\n \n if (success) {\n NSLog(@&quot;PLIST file generated successfully at path: %@&quot;, plistPath);\n } else {\n NSLog(@&quot;Failed to generate PLIST file.&quot;);\n }\n }\n\n - (NSArray *)extractQuestionItemsFromRTFFileContent:(NSAttributedString *)fileContent {\n NSMutableArray *questionItems = [NSMutableArray array];\n NSArray *paragraphs = [fileContent.string componentsSeparatedByString:@&quot;\\n\\n&quot;];\n \n for (NSString *paragraph in paragraphs) {\n NSAttributedString *attributedParagraph = [[NSAttributedString alloc] initWithString:paragraph];\n [questionItems addObject:attributedParagraph];\n }\n \n return questionItems;\n }\n\n - (NSString *)extractQuestionFromQuestionItem:(NSAttributedString *)questionItem {\n return questionItem.string;\n }\n\n - (NSArray *)extractAnswerOptionsFromQuestionItem:(NSAttributedString *)questionItem {\n NSString *questionText = questionItem.string;\n NSArray *lines = [questionText componentsSeparatedByString:@&quot;\\n&quot;];\n return [lines subarrayWithRange:NSMakeRange(1, lines.count - 1)];\n }\n\n - (NSString *)extractCorrectAnswerIndexFromAnswerOptions:(NSArray *)answerOptions {\n for (NSUInteger i = 0; i &lt; answerOptions.count; i++) {\n NSString *answerOption = answerOptions[i];\n if ([self isAnswerOptionBold:answerOption]) {\n return [NSString stringWithFormat:@&quot;%lu&quot;, i];\n }\n }\n return @&quot;&quot;;\n }\n\n- (BOOL)isAnswerOptionBold:(NSString *)answerOption {\n NSAttributedString *attributedOption = [[NSAttributedString alloc] initWithString:answerOption];\n \n NSRange effectiveRange;\n NSDictionary *attributes = [attributedOption attributesAtIndex:0 effectiveRange:&amp;effectiveRange];\n UIFont *font = attributes[NSFontAttributeName];\n NSDictionary *fontAttributes = [font.fontDescriptor fontAttributes];\n NSString *fontFamilyName = fontAttributes[UIFontDescriptorFamilyAttribute];\n UIFontDescriptorSymbolicTraits traits = font.fontDescriptor.symbolicTraits;\n BOOL isFontBold = (traits &amp; UIFontDescriptorTraitBold) == UIFontDescriptorTraitBold;\n \n NSLog(@&quot;Font Family: %@&quot;, fontFamilyName);\n NSLog(@&quot;Is Bold: %@&quot;, isFontBold ? @&quot;YES&quot; : @&quot;NO&quot;);\n if (font) {\n NSDictionary *fontAttributes = [font.fontDescriptor fontAttributes];\n NSString *fontFamilyName = fontAttributes[UIFontDescriptorFamilyAttribute];\n UIFontDescriptorSymbolicTraits traits = font.fontDescriptor.symbolicTraits;\n BOOL isFontBold = (traits &amp; UIFontDescriptorTraitBold) == UIFontDescriptorTraitBold;\n \n NSLog(@&quot;Font Family: %@&quot;, fontFamilyName);\n NSLog(@&quot;Is Bold: %@&quot;, isFontBold ? @&quot;YES&quot; : @&quot;NO&quot;);\n \n if (isFontBold) {\n NSLog(@&quot;Bold: %@&quot;, answerOption);\n return YES;\n }\n }\n \n return NO;\n}\n</code></pre>\n"^^ . "0"^^ . . . "<p>As you already have the RTF string as <code>NSAttributedString</code> you can <a href="https://developer.apple.com/documentation/foundation/nsattributedstring/1412461-enumerateattribute?language=objc" rel="nofollow noreferrer">enumerate</a> the attributed string to get all ranges of the <code>bold</code> parts.</p>\n<p>And I recommend to use the URL related API of <code>NSBundle</code></p>\n<pre><code>NSError *error = nil;\nNSURL *fileURL = [[NSBundle mainBundle] URLForResource:@&quot;2024ROMANSEDITED&quot; withExtension:@&quot;rtf&quot;];\n\nNSAttributedString *fileContent = [[NSAttributedString alloc] initWithURL: fileURL options:@{NSDocumentTypeDocumentAttribute: NSRTFTextDocumentType} documentAttributes:nil error: &amp;error];\nNSMutableArray *result = [NSMutableArray new];\n[fileContent enumerateAttribute: NSFontAttributeName inRange:NSMakeRange(0, fileContent.length) options: 0 usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) {\n if (([[(UIFont *)value fontDescriptor] symbolicTraits] &amp; UIFontDescriptorTraitBold) != 0) {\n [result addObject:[NSValue valueWithRange: range]];\n }\n}];\nNSLog(@&quot;%@&quot;, result);\n</code></pre>\n<p><code>result</code> contains the ranges wrapped in <code>NSValue</code> objects.</p>\n"^^ . . . . . . . "0"^^ . "Hey Jaco, did you solve this?"^^ . . "1"^^ . "macos"^^ . . "1"^^ . . "<p>Sadly Objective-C is terrible when it comes to <code>@available</code>. If you were to write that same logic in Swift you would not get the deprecation warning. I don't know why Objective-C doesn't work better in this regard.</p>\n<p>As you've seen, adding <code>xrOS 1.0</code> to the <code>@available</code> doesn't eliminate the deprecation warning despite the fact that at runtime, the <code>else</code> will not be executed due to the <code>@available</code>. So while it works at runtime, the compiler needlessly complains about a situation that it should not.</p>\n<p>In my own experience, the only solution is to make use of compiler directives. While my experience is with Mac Catalyst and not visionOS, the issue is the same.</p>\n<p>You need to write ugly code similar to the following:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#if TARGET_OS_VISION\n indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleLarge;\n#else\n if (@available(iOS 13.0, tvOS 13.0, *)) {\n indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleLarge;\n } else {\n indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;\n }\n#endif\n</code></pre>\n<p>The bad part of this is the code duplication. Your only other options are converting to Swift or accepting the deprecation warning.</p>\n"^^ . "2"^^ . . . . "+1, you saved my life bro, thank you so much. Such a stupid thing to be updated manually instead of Automatic by XCODE."^^ . "<p>The <code>dispatch_group_async</code> will enter the group immediately, and will leave the group when the called block returns. But the blocks are simply calling methods that launch asynchronous tasks, but doesn’t know when that work finishes. The net effect is that the dispatch group will be prematurely notified, as soon as these two asynchronous tasks are started, but not when this asynchronous work is complete.</p>\n<p>So, the challenge is how to defer the dispatch group until the asynchronous work finishes. We would often reach for completion handler blocks:</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (void)getOneDataWithCompletion:(void (^ _Nullable)(void))completion {\n [self requestData:^(id _Nullable datas, NSError * _Nullable error) {\n …\n\n if (completion) {\n completion();\n }\n }];\n}\n</code></pre>\n<p>And we would do the same with the second API call, too.</p>\n<p>Having done that, we can now “enter” the group before making the asynchronous call and only “leave” the group in the completion handler block, e.g.:</p>\n<pre class="lang-objectivec prettyprint-override"><code>dispatch_group_t group = dispatch_group_create();\n\ndispatch_group_enter(group);\n[self getOneDataWithCompletion:^{\n dispatch_group_leave(group);\n}];\n\ndispatch_group_enter(group);\n[self getTwoDataWithCompletion:^{\n dispatch_group_leave(group);\n}];\n\ndispatch_group_notify(group, dispatch_get_main_queue(), ^{\n …\n});\n</code></pre>\n<p>As a general rule, if you have an asynchronous method, it is prudent to give it completion handler block parameter that you call when the asynchronous method is done. And if you think you might not need that parameter, make it <code>_Nullable</code> (which is why I’m checking that it is not null before I call it).</p>\n"^^ . . "0"^^ . . . . . . "<p>I have an NSView that calls <code>interpretKeyEvents</code> for <code>keyDown</code> events. For some keys like the letter 'a', pressing and holding the key results in repeated calls to <code>insertText</code>. For other keys like 'x', <code>insertText</code> is called once and that is it. I would like press and hold to always call <code>insertText</code>. I'm guessing press and hold for these keys is interpreted as something else, but I cannot find it. I have implemented <code>doCommandBySelector</code> as described by the documentation, but that is never called either.</p>\n<p>Below is a minimal example program that demonstrates the behaviour.</p>\n<pre><code>// clang++ -framework AppKit -o proof-of-concept proof-of-concept.mm\n\n#include &lt;stdio.h&gt;\n#import &lt;Cocoa/Cocoa.h&gt;\n\n@interface AppView : NSView&lt;NSTextInputClient&gt;\n@end\n\n@implementation AppView\n\n- (void)keyDown:(NSEvent *)event {\n printf(&quot;keydown\\n&quot;);\n [self interpretKeyEvents:[NSArray arrayWithObject:event]];\n}\n\n- (void)insertText:(id)string replacementRange:(NSRange)replacementRange {\n printf(&quot;insertText\\n&quot;);\n}\n\n- (BOOL)acceptsFirstResponder { return YES; }\n- (void)setMarkedText:(id)string selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange {}\n- (void)unmarkText {}\n- (NSRange)selectedRange { return NSMakeRange(NSNotFound, 0); }\n- (NSRange)markedRange { return NSMakeRange(NSNotFound, 0); }\n- (BOOL)hasMarkedText { return NO; }\n- (nullable NSAttributedString *)attributedSubstringForProposedRange:(NSRange)range actualRange:(nullable NSRangePointer)actualRange { return nil; }\n- (NSArray&lt;NSAttributedStringKey&gt; *)validAttributesForMarkedText { return [NSArray array]; }\n- (NSRect)firstRectForCharacterRange:(NSRange)range actualRange:(nullable NSRangePointer)actualRange { return NSMakeRect(0, 0, 0, 0); }\n- (NSUInteger)characterIndexForPoint:(NSPoint)point { return 0; }\n\n@end\n\nint main(int argc, char **argv, char **envp, char **apple) {\n [NSApplication sharedApplication];\n [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];\n\n NSRect windowDimensions = NSMakeRect(0, 0, 300, 300);\n NSWindow *window = [[NSWindow alloc] initWithContentRect:windowDimensions\n styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskResizable\n backing:NSBackingStoreBuffered\n defer:NO];\n\n AppView *windowView = [[AppView alloc] initWithFrame:windowDimensions];\n [window setContentView:windowView];\n [window makeKeyAndOrderFront:nil];\n\n [NSApp run];\n return 0;\n}\n</code></pre>\n<p>Is there an explanation for why <code>interpretKeyEvents</code> handles some key repeats by calling <code>insertText</code> and ignores others?</p>\n"^^ . . "Clearly this is a terrible idea, and you should never ship this, but it's a fascinating thing to explore how class clusters are implemented. My guess would be that the underlying class is hand-tuned to either optimize away an extra release or add an autorelease. I would probably first step through the __NSArrayM implementation to see what memory management calls it does internally. You might experiment with compiling your swizzle w/o ARC, and adding an autorelease by hand. (How Apple implements this may change from OS release to release of course, so any hack may crash in the future.)"^^ . "appdelegate"^^ . "0"^^ . "0"^^ . . "0"^^ . . . "core-location"^^ . . . . . . "0"^^ . . "0"^^ . . "0"^^ . . . "0"^^ . . . "<p>I really don't understand what you're trying to do with <strong>images</strong> ... but let's look at a Path option (instead of generating a <code>UIImage</code> from each path / shape).</p>\n<p>If you're targeting <code>iOS 16.0+</code> we can take advantage of <a href="https://developer.apple.com/documentation/coregraphics/3950968-cgpathcreatecopybyunioningpath?language=objc" rel="nofollow noreferrer"><code>CGPathCreateCopyByUnioningPath</code></a> (for prior iOS versions, you can find some Bezier Path libraries out there).</p>\n<p>Quick description...</p>\n<p>Suppose we create two rectangle paths with these <em>separated</em> rects:</p>\n<pre><code>CGRect r1 = CGRectMake(60, 20, 100, 100);\nCGRect r2 = CGRectMake(200, 60, 100, 100);\n\nCGPathRef pthA = CGPathCreateWithRect(r1, nil);\nCGPathRef pthB = CGPathCreateWithRect(r2, nil);\n</code></pre>\n<p>If we then <strong>add</strong> those paths to a mutable path:</p>\n<pre><code>CGMutablePathRef pth = CGPathCreateMutable();\nCGPathAddPath(pth, nil, pthA);\nCGPathAddPath(pth, nil, pthB);\n\nshapeLayer.path = pth;\n</code></pre>\n<p>we get this:</p>\n<p><a href="https://i.sstatic.net/Gvi02.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Gvi02.png" alt="enter image description here" /></a></p>\n<p>Now let's change the rects so they will overlap:</p>\n<pre><code>CGRect r1 = CGRectMake(100, 20, 100, 100);\nCGRect r2 = CGRectMake(160, 60, 100, 100);\n\nCGPathRef pthA = CGPathCreateWithRect(r1, nil);\nCGPathRef pthB = CGPathCreateWithRect(r2, nil);\n\nCGMutablePathRef pth = CGPathCreateMutable();\nCGPathAddPath(pth, nil, pthA);\nCGPathAddPath(pth, nil, pthB);\n\nshapeLayer.path = pth;\n</code></pre>\n<p>and we get this result:</p>\n<p><a href="https://i.sstatic.net/fNLz4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/fNLz4.png" alt="enter image description here" /></a></p>\n<p>Since your goal is to &quot;remove the overlapping lines&quot; we can use <code>CGPathCreateCopyByUnioningPath</code> ... same overlapping rects as above:</p>\n<pre><code>CGRect r1 = CGRectMake(100, 20, 100, 100);\nCGRect r2 = CGRectMake(160, 60, 100, 100);\n\nCGPathRef pthA = CGPathCreateWithRect(r1, nil);\nCGPathRef pthB = CGPathCreateWithRect(r2, nil);\n\nCGPathRef pth = CGPathCreateCopyByUnioningPath(pthA, pthB, NO);\n\nshapeLayer.path = pth;\n</code></pre>\n<p>Now we get this as the output:</p>\n<p><a href="https://i.sstatic.net/3DkOs.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3DkOs.png" alt="enter image description here" /></a></p>\n<p>I posted a sample project here: <a href="https://github.com/DonMag/CGPathUnion" rel="nofollow noreferrer">https://github.com/DonMag/CGPathUnion</a></p>\n<p><a href="https://i.sstatic.net/EBpw7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EBpw7.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/kucrg.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/kucrg.gif" alt="enter image description here" /></a></p>\n"^^ . . "0"^^ . . . . "1"^^ . . "1"^^ . "avplayerviewcontroller"^^ . . . . "I suggest seeing qhat the stencil looks like before the grass is drawn in the Metal debugger"^^ . . "0"^^ . "core-graphics"^^ . . . . . "@KamyFC None of the columns in that charset table contain the hex byte sequence '1E A1'."^^ . "0"^^ . . . . "1"^^ . . "Invalid result code for Wi-Fi information request - Flutter iOS - ConnectSDK"^^ . . . . "Also, isn't it the input string that is encoded as UTF-8? The output in the `output` buffer should contain wide characters (probably 4 bytes per character on Mac OS X and iOS), not multibyte character sequences."^^ . . "@DonMag Thanks, it's funny you mention the thing about generating UIImages because I've been considering just using CAShapeLayers. In some instances, this class will just use a user defined UIImage instead of a CAShapeLayer so I wanted to be able to accommodate both scenarios, but I think I can convert that UIImage to a CAShapeLayer somehow? Regarding complex shapes, they just might have more sides then a square or might be a circle, but nothing too crazy. The result doesn't have to be what you linked to, just want them to intersect if the user moves them together."^^ . . . "@KamyFC You show `最` "actually" encoded as 2 bytes, but actually it is encoded (in UTF-8) as 3 bytes (hex E6 9C 80). You incorrectly show the third byte as encoding the first byte of the next character: `最` (which is actually encoded in UTF-8 as hex E4 BD B3)."^^ . . "0"^^ . "did you add Privacy - Location Always Usage Description or Privacy - Location When In Use Usage Description include ??"^^ . "0"^^ . "Thank-You Rob\nAs you observed the code was fine. Dumb mistake on my part.\nThis is an older project that I was updating. I had forgotten that I have a 'sound-off' button in the UI. After allowing sound all works fine.\nI have a new twist - The remote control device is active while on 'other' screens in my app, not just the VC attached to the 'view did load' in which I added code. I did not expect that. What is the proper way to limit to just the desired VC? I can just add some booleans to 'view did appear/disappear' - is there a more proper way? Thanks"^^ . "<p>I'm working on refactoring my project a little and I'm making some minor adjustments to the function names. However, after doing this to all relevant classes that have the method to be renamed, I seem to be getting some 'NSInvalidArgumentException' errors where I don't think they should be.</p>\n<p>I have this line where my application crashes:</p>\n<pre><code>[super sceneDidConnectWithOptions:connectionOptions];\n</code></pre>\n<p>where the function signature that has this super class invocation is (and reaches this with the debugger telling me connectionOptions is of type UISceneConnectionOptions):</p>\n<pre><code>- (void)sceneDidConnectWithOptions:(UISceneConnectionOptions *)connectionOptions{\n</code></pre>\n<p>where also, the super class's method is defined as:</p>\n<pre><code>- (void)sceneDidConnectWithOptions:(UISceneConnectionOptions *)connectionOptions;\n</code></pre>\n<p>I'm not sure where the NSInvalidArgumentException error would be coming from and don't see any syntax issues as well. I suspected that it could be crashing because of connectionOptions being 'nil', but that's not the case as I put a code block checking for it and it wasn't as well as the debugger showing me that it's not nil.</p>\n"^^ . "@IanAbbott Thank you. So "UTF-16BE" is what I need to look at? As that is the expected output that I need to match. Any pointers on how to write char in "UTF-16BE"?"^^ . . . "2"^^ . . "2"^^ . . "3"^^ . "<p><code>NS_REFINED_FOR_SWIFT</code> is used for API's methods that return values by pointer in parameters.\nRefined API will return values in tuple instead.</p>\n<p><code>NS_REFINED_FOR_SWIFT</code> can't create nested classes.</p>\n<p>Still you can write:</p>\n<pre><code>extension MyButton {\n typealias Configuration = __MyButtonConfiguration\n}\n</code></pre>\n"^^ . . . . . . . "1"^^ . "How to fix crash `*** -[NSObject allocWithZone:]: attempt to allocate object of class 'AGXA12FamilyCommandBuffer' failed`?"^^ . . "<p>I would like to embed a Mac Catalyst component, like TOCropViewController or MessageKit (I am not providing a link to either to avoid getting this post flagged as spam, but if you google them you will find that they handle a lot of functionality that cannot be easily replicated), in a native AppKit app.</p>\n<p>I do not distribute my app in the App Store, so I am OK with private APIs.</p>\n<p><strong>To be clear: I do not want do add an AppKit component to a Mac Catalyst app; I want to do the reverse, as I already have a very large AppKit codebase</strong></p>\n"^^ . "0"^^ . . "flutter"^^ . . . . . . . . "2"^^ . . . "0"^^ . . "5"^^ . "Sometimes it's so easy to miss the obvious! I appreciate your answer thank you!"^^ . . "Question about dispatch_group_t results in two callbacks in a network request"^^ . . "0"^^ . . "Maybe https://developer.apple.com/documentation/uikit/uiscrollview/1619383-alwaysbouncevertical ?"^^ . . . . . . . . . "<p>You are misunderstanding how states and descriptors work.</p>\n<p><code>MTLDepthStencilState</code> is an immutable object, not like OpenGL states, which means that you can't change it after the fact, even if you change the descriptor. So you need to create a proper descriptor before you call <code>newDepthStencilState</code>.</p>\n<p>Also, Property <code>frontFaceStencil</code> and <code>backFaceStencil</code> are defined as <code>@property (copy, nonatomic, null_resettable)</code> in Metal headers:</p>\n<pre><code>@property (copy, nonatomic, null_resettable) MTLStencilDescriptor *frontFaceStencil;\n@property (copy, nonatomic, null_resettable) MTLStencilDescriptor *backFaceStencil;\n</code></pre>\n<p>This means the <code>MTLStencilDescriptor</code> inside <code>MTLDepthStencilDescriptor</code> is copied by value, and not set by reference.</p>\n<p>All of this means that in order for <code>update</code> to work, you need to write <code>Renderer::Renderer</code> like this:</p>\n<pre><code>_pOrcDepthStencilDesc = MTL::DepthStencilDescriptor::alloc()-&gt;init();\n// Set up orc depth stencil state\nauto* pOrcStencil = MTL::StencilDescriptor::alloc()-&gt;init();\npOrcStencil-&gt;setStencilCompareFunction( MTL::CompareFunctionAlways ); // glStencilFunc(func, _, _);\npOrcStencil-&gt;setWriteMask( 0xff ); // glStencilFunc(_, _, mask);\npOrcStencil-&gt;setStencilFailureOperation( MTL::StencilOperationReplace ); // glStencilOp( _, _, zpass );\n \n_pOrcDepthStencilDesc-&gt;setFrontFacingState(...);\n_pOrcDepthStencilDesc-&gt;setBackFacingState(...);\n_pOrcStencilState = _pDevice-&gt;newDepthStencilState( _pOrcDepthStencilDesc );\n\n_pGrassDepthStencilDesc = MTL::DepthStencilDescriptor::alloc()-&gt;init();\n// Set up grass depth stencil state\n_pGrassDepthStencilDesc-&gt;setFrontFacingState(...);\n_pGrassDepthStencilDesc-&gt;setBackFacingState(...);\n_pGrassStencilState = _pDevice-&gt;newDepthStencilState( _pGrassDepthStencilDesc );\n</code></pre>\n<p>and then in <code>update</code>:</p>\n<pre><code>{ // draw orc\n pEnc-&gt;setDepthStencilState( _pOrcStencilState );\n pEnc-&gt;setStencilReferenceValue( 1 ); // glStencilFunc(_, ref, _);\n \n orc-&gt;update( delta );\n drawImage( orc-&gt;texture(), { 0.0f, 0.0f }, { 100.0f, 100.0f }, orc-&gt;frame() );\n drawFrame( pCmd, pEnc );\n}\n</code></pre>\n"^^ . . "0"^^ . "0"^^ . . "@IanAbbott Thanks for the correction in the loop. I will attempt to use your suggestion. Also I will see how to encode in UTF-16BE using Objective C"^^ . "<p>I know it's possible to declare custom structs in Obj-C header file, and reuse this one declaration in both Metal shaders as well as in Obj-C/Swift host code. Can we declare and define global constants in one place without duplication in such a way that they will be accessible in both Metal and host code in Swift/Obj-C as well?</p>\n<p>The only way I have come up by myself is to use <code>#define SOME_CONST 123.45f</code> in this same shared Obj-C header file, but <code>#define</code> is not constant per se and I'm looking to more standard typed definition.</p>\n"^^ . . "<p>I'm trying to play a list of .mp4 links imported from .m3u file, File is save locally in the app and it contains 10 movie titles and links.</p>\n<p>Full code</p>\n<p><strong>App Transport Security Settings</strong> Added in <strong>info.plist</strong></p>\n<p><strong>vController.h</strong></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n#import &lt;AVFoundation/AVFoundation.h&gt;\n#import &lt;AVKit/AVKit.h&gt;\n\n@interface ViewController : UIViewController {\n NSMutableArray *movieTitle;\n NSMutableArray *movieURL;\n NSMutableArray *tempArray;\n NSArray *lines;\n}\n\n@property (nonatomic, retain) NSMutableArray *movieTitle;\n@property (nonatomic, retain) NSMutableArray *movieURL;\n@property (nonatomic, retain) NSMutableArray *tempArray;\n@property (nonatomic, retain) NSArray *lines;\n</code></pre>\n<p><strong>vController.m</strong></p>\n<pre><code>@synthesize movieURL,movieTitle,tempArray,lines;\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n \n movieURL = [[NSMutableArray alloc] init];\n movieTitle = [[NSMutableArray alloc] init];\n tempArray = [[NSMutableArray alloc] init];\n \n [self addM3UFile];\n}\n\n- (void)addM3UFile {\n NSString *addPath = [[NSBundle mainBundle] pathForResource:@&quot;Test&quot; ofType:@&quot;m3u8&quot;];\n \n NSString *fileContents1 = [NSString stringWithContentsOfFile:addPath encoding:NSUTF8StringEncoding error:NULL];\n lines = [fileContents1 componentsSeparatedByString:@&quot;\\n&quot;];\n [tempArray addObjectsFromArray:lines];\n \n [self sortM3UFile];\n \n}\n\n- (void)sortM3UFile {\n int i;\n \n for (i=0; i&lt;[tempArray count]; i++) {\n \n NSString *tempTitle = [tempArray objectAtIndex:i];\n \n if ([tempTitle containsString:@&quot;://&quot;]) {\n [movieURL addObject:tempTitle];\n }\n \n if ([tempTitle containsString:@&quot;#EXTINF:-1 ,&quot;]) {\n [movieTitle addObject:tempTitle];\n }\n }\n}\n</code></pre>\n<p>Code to play the video</p>\n<pre><code>NSString *url = [movieURL objectAtIndex:9];\nNSLog(@&quot;URL: %@&quot;, url);\nAVPlayer *player = [AVPlayer playerWithURL:[NSURL URLWithString:url]];\nAVPlayerViewController *controller = [[AVPlayerViewController alloc] init];\n[self presentViewController:controller animated:YES completion:nil];\ncontroller.player = player;\n[player play];\n</code></pre>\n<p>Works fine <strong>ONLY</strong> with the last object in the list</p>\n<p><em>Links example : <a href="http://www.wwwwwwww.com/1234.mp4" rel="nofollow noreferrer">http://www.wwwwwwww.com/1234.mp4</a></em></p>\n<p>I tested all the links and they all work fine when I enter them in the browser, I also printed each link in the log and they are all there.</p>\n<p>I tried to play the links from <strong>NSArray</strong> instead of <strong>NSMutableArray</strong> and it didn't work.</p>\n<p>Saved the links in <strong>NSUserDefaults</strong> also didn't work.</p>\n<p>When I changed the list order from the .m3u8 file it only played the last link, so now I'm sure that the problem is not within the links.</p>\n<p><strong>one thing worked for me is when I hard encoded the links in the code manually.</strong></p>\n<p>any idea what's going on here ? :)</p>\n"^^ . . . "Loading obj-c files with storyboard in Swift project"^^ . "cocoa"^^ . . . "Thanks, it was literally the first thing I did, but didn't work. Do you know if original image is oriented up, and during core image work it was cropped and rotated (say 20 degrees as example), what's the output image's orientation be?"^^ . . . . "<p>It seems that the provided code aims to implement e-book functionality using WKWebView on macOS. However, there are issues with touch event handling and achieving smooth scrolling. To ignore touch events in WKWebView, override the <code>hitTest:withEvent:</code> method in the NSView category (TouchEvents) and return <code>nil</code>.</p>\n<p>For pagination, modify the <code>webView:didFinishNavigation:</code> delegate method to set the CSS properties <code>column-count</code> and <code>column-gap</code> of the body element to achieve a single column layout without gaps.</p>\n<p>To achieve smooth scrolling, modify the <code>buttonPressed:</code> method. Use <code>scrollTo</code> with <code>behavior: &quot;smooth&quot;</code> in JavaScript to scroll to the desired position smoothly.</p>\n<p>Here's a suggested modification to the <code>buttonPressed:</code> method:</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (void)buttonPressed:(id)sender {\n if ([[sender className] isEqualToString:@&quot;NSButton&quot;]) {\n if ([sender tag] == WindowSideLeft) {\n pageCount--;\n } else {\n pageCount++;\n }\n } else if ([[sender className] isEqualToString:@&quot;NSConcreteNotification&quot;]) {\n if ([[sender userInfo][@&quot;direction&quot;] isEqualTo: @(WindowSideLeft)]) {\n pageCount--;\n } else {\n pageCount++;\n }\n }\n \n pageCount = MAX(pageCount, 0);\n NSInteger pageWidth = self.window.contentView.frame.size.width;\n \n NSString *jsString = [NSString stringWithFormat:@&quot;window.scrollTo({top: 0, left: %ld, behavior: \\&quot;smooth\\&quot;});&quot;, pageWidth * pageCount];\n [bookPages evaluateJavaScript:jsString completionHandler:nil];\n}\n</code></pre>\n"^^ . . . . "Thank you! `MTL::DepthStencilDescriptor` does not have setFront/BackFacingState(). You mean setFrontFaceStencil() right? And I've tried this, the result is same. The grass should be drowed as a background but it just covered all screen. (It seems stencil test does not work)"^^ . . . . . . . "1"^^ . "0"^^ . . . "@KamyFC: right, With char your code cannot work. You should do the *contrary*. You want to get the Unicode codepoint (warning: most wchar interfaces works with code units so never with the 4-byte UTF-8 characters). So if you start with UTF-8, you should calculate codepoint, so the contrary: check the forst byte)"^^ . "2"^^ . "2"^^ . . . "0"^^ . "`UICollectionView` inherits from `UIScrollView`"^^ . "0"^^ . . "0"^^ . . "0"^^ . "2"^^ . . . "google-mlkit"^^ . "0"^^ . . . . . "2"^^ . . . . "1"^^ . . . . . "ios"^^ . "0"^^ . . "0"^^ . . "@KamyFC UTF-16BE would encode ASCII characters as two bytes, e.g. `T` would be encoded as hex bytes 00 54. That is different to what you expected, where `T` would be encoded as a single hex byte 54. What software actually needs the text to be encoded in your weird (and impossible to reliably decode) format?"^^ . "<p>This turned out to be the same issue as in this thread: <a href="https://stackoverflow.com/questions/38192343/building-a-cocoapod-with-both-swift-and-objective-c-how-to-deal-with-umbrella-h?rq=1">Building a Cocoapod with both Swift and Objective-C: How to Deal with Umbrella Header Issues?</a></p>\n<p>Adding the header to the top level of pod classes and naming it &quot;Test_Pod.h&quot; with just:</p>\n<pre><code>#import &quot;Test_Pod-umbrella.h&quot;\n</code></pre>\n"^^ . . . "0"^^ . . . . "0"^^ . . . . "@IanAbbott If you open the link, search for '1EA1', you will find the mapping with 'ạ'"^^ . . . . . . . . "0"^^ . "0"^^ . . . . "<p>Previously this <a href="https://github.com/danielgindi/Charts" rel="noreferrer">Repository</a> was imported as Charts, but after their library updates, it was changed to DGCharts. After I change the pod file, it installed successfully but the app getting crashed while accessing the charts. previously it was working properly. The only change was the pod name (Charts -&gt; DGCharts).</p>\n<p><a href="https://i.sstatic.net/bVB2s.png" rel="noreferrer"><img src="https://i.sstatic.net/bVB2s.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/Zsmyt.png" rel="noreferrer"><img src="https://i.sstatic.net/Zsmyt.png" alt="enter image description here" /></a></p>\n<p>Note that I'm using M1 Macbook.</p>\n<p>Also, I tried to import the library as</p>\n<p>pod 'DGCharts' as well. but the result was the same.</p>\n"^^ . . . "<p>Please follow these points.</p>\n<ol>\n<li><p>check permission in plist file</p>\n</li>\n<li><p>locationManager.desiredAccuracy = kCLLocationAccuracyBest;\nlocationManager.pausesLocationUpdatesAutomatically = NO;</p>\n<p>locationManager.distanceFilter = 5; ( you can change it)</p>\n</li>\n</ol>\n<p>for reference link</p>\n<p><a href="https://stackoverflow.com/questions/37544514/getting-location-update-after-certain-distance-5-m-in-my-case">Getting location update after certain distance (5 m in my case)</a></p>\n<p><a href="https://stackoverflow.com/questions/74588726/how-to-work-with-user-location-in-ios-16-app-intents">How to work with user location in iOS 16 App Intents?</a></p>\n<p><a href="https://i.sstatic.net/UtiQw.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/UtiQw.png" alt="enter image description here" /></a></p>\n"^^ . . . "0"^^ . "@sgx, please pay attention to that `char*`→`*NSString` conversion problem which I have overlooked initially (I have no exposure to Cocoa)."^^ . "2"^^ . "0"^^ . . "<p>I'm looking for a way (if it's even possible) to hierarchically group my <code>XCTestCase</code>s. I've been googling and the only somewhat similar thing I found is <a href="https://developer.apple.com/documentation/xctest/activities_and_attachments/grouping_tests_into_substeps_with_activities?language=objc" rel="nofollow noreferrer">Grouping Tests into Substeps with Activities</a>, which is not what I want (grouping individual tests and groups into other groups).</p>\n<p>For example, here's what the thing I want to do looks like in other languages, e.g. Dart (but it's very similar with Jest in JavaScript land as well):</p>\n<pre class="lang-dart prettyprint-override"><code>void main() {\n group('Top group', () {\n group('nested group 1', () {\n test('test case 1', () {});\n test('test case 2', () {});\n // ...\n });\n\n group('some other nested group', () { /* test cases here ... */ });\n });\n}\n</code></pre>\n<p>The structure is detected by the tooling such as IDEs:</p>\n<p><a href="https://i.sstatic.net/EY8Ti.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EY8Ti.png" alt="enter image description here" /></a></p>\n<p>Is it possible to accomplish this with <a href="https://developer.apple.com/documentation/xctest/xctestcase" rel="nofollow noreferrer"><code>XCTestCase</code></a>? Ideally the solution could be accomplished entirely at runtime, it could even involve some dark magic with Objective-C runtime, as long as it had a chance to work.</p>\n<p>If it's not possible, I'd like to hear that as well. Thanks in advance!</p>\n"^^ . . . "6"^^ . . . "0"^^ . . . . . . . . . . "0"^^ . "Yes, I agree corrupting data due to catching Objective-C isn't a good thing. However, the alternative may be worse... AppKit _already_ catches Objective-C exceptions and blithely ventures forth, which is another level of bad if there are managed frames on the stack. Converting them back/from managed exceptions and the native/managed code boundary makes managed developers actually able to figure out what's happening and do something about it."^^ . . "0"^^ . . "0"^^ . . . "loadimage"^^ . . . "0"^^ . . . . "@LeoDabus I'm not following how that applies here. The synchronous delegate method is being called by the framework. The value that needs to be returned must come from an async call."^^ . . "0"^^ . "2"^^ . . . . . . . . . . "Creating iOS framework with Objective-C"^^ . . . . . . "3"^^ . . . . . "So what is outlined in the posts above is an exception handler and not a crash handler and that is why we are unable to catch crashes like nil unwrapping?"^^ . . . "0"^^ . . . "async-await"^^ . . "I've added an addendum explaining the reason why."^^ . . . . "network.framework"^^ . . . . "grand-central-dispatch"^^ . . "how to hook prerender video with MobileVLCKit on iOS"^^ . . . "<p>It's quite simple, just wrap your label in a view then capture the view instead of the label.</p>\n<pre class="lang-objectivec prettyprint-override"><code>CGRect drawRect = CGRectMake(0, 0, 90, 35);\nUIView *container = [[UIView alloc] initWithFrame: drawRect]\n...\nUILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 80, 25)];\n[container addSubview:myLabel];\n...\n[[container layer] renderInContext:UIGraphicsGetCurrentContext()];\n\n</code></pre>\n<p>Before</p>\n<p><a href="https://i.sstatic.net/6DV01.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6DV01.png" alt="enter image description here" /></a></p>\n<p>After</p>\n<p><a href="https://i.sstatic.net/FWcGq.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/FWcGq.png" alt="enter image description here" /></a></p>\n"^^ . . . "0"^^ . "0"^^ . "0"^^ . . "https://developer.apple.com/documentation/foundation/nspredicate/1416310-allowevaluation"^^ . . . . "0"^^ . "<p>Yes you can, first you have to confirm that UNUserNotificationCenter.current().delegate inside AppDelegate</p>\n<pre><code>func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -&gt; Bool {\n \n //here you have to put these line of code to confirm relevant delegate and to enable device for remote notification if device is still not given access for it\n UIApplication.shared.registerForRemoteNotifications()\n UNUserNotificationCenter.current().delegate = self\n \n return true\n}\n</code></pre>\n<p>after that you have to you have to add following two separate method to handle push notification.</p>\n<p>if your device iOS version is below than 10.0 then use this method..</p>\n<pre><code>func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],\n fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -&gt; Void) {\n\n //To print notification payload\n print(userInfo)\n\n}\n</code></pre>\n<p>otherwise you can use this method to handle push notification..</p>\n<pre><code>@available(iOS 10.0, *)\nfunc userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -&gt; Void) {\n\n\n//To print notification payload:\nprint(response.notification.request.content.userInfo)\n\n}\n</code></pre>\n"^^ . "0"^^ . . "0"^^ . . "1"^^ . "<p>I am trying to figure out the differences in Math (there shouldn't be any) between a quick calculation in Swift and Objective-C:</p>\n<p><strong>Swift</strong></p>\n<pre><code>let z1 = 1.0\nlet width = 0.02197265625\nlet extent = 4096.0\nlet dx = z1 * width / extent\nprint(dx)\n\n// 5.364418029785156e-06\n</code></pre>\n<p><strong>Objective-C</strong></p>\n<pre><code>double z1 = 1.0;\ndouble width = 0.02197265625;\ndouble extent = 4096.0;\ndouble dx = z1 * width / extent;\nNSLog(@&quot;%f&quot;, dx);\n\n// 0.000005\n</code></pre>\n<p>Inputting the numbers into a calculator return what <code>Objective-C</code> provides.</p>\n<p><strong>What is Swift doing differently here?</strong></p>\n"^^ . . . . "0"^^ . . "0"^^ . . . . . "0"^^ . . . . . "I'm sure you're aware, but just for anyone reading along it's worth noting that your code may leak memory and even violate preconditions since a lot of ObjC code is not exception-safe (exceptions are intended to terminate the program "soon" and much ObjC code relies on that fact; except in very controlled cases, there is no safe way to use `@catch` to continue the program). At a minimum you would want to to enable `-fobjc-arc-exceptions` since ARC is not exception-safe by default and would definitely leak memory. I'm guessing you have a good use, but others should be careful not to copy this."^^ . . . "What changes need to be made for the new local receipt validation requirement using SHA-256?"^^ . . "<p>I create a simple example trying to get the first argument of the method, if it works I plan to extend it to any number of arguments:</p>\n<pre><code>+ (void)simpleTest:(NSInteger)teamId {\n\n unsigned int argumentCount = method_getNumberOfArguments(class_getClassMethod([self class], _cmd));\n \n for (unsigned int i = 2; i &lt; argumentCount; i++) {\n const char *argumentType = method_copyArgumentType(class_getClassMethod([self class], _cmd), i);\n \n if (strcmp(argumentType, @encode(NSInteger)) == 0) {\n NSInteger argumentValue = *((NSInteger *)(((uintptr_t)self) + sizeof(void *) * i));\n NSLog(@&quot;Argument %d: %ld&quot;, i - 1, (long)argumentValue);\n }\n \n free((void *)argumentType);\n }\n\n\n}\n</code></pre>\n<p>I call it like this:</p>\n<pre><code>[self simpleTest:22];\n</code></pre>\n<p>the log print:</p>\n<pre><code>Argument 1: 140703128941760\n</code></pre>\n<p>I think the problem happens at the piece of code where I want to get 'argumentValue', but I don`t know how to fix it.</p>\n"^^ . "6"^^ . . "I'm curious why you insist on tagging your tvOS question with the iOS tag. Tags should represent what your question is about. Since your question is about an issue using a table view on tvOS, why tag with iOS?"^^ . . "0"^^ . . "xcode"^^ . . "<p>This is likely not an actual problem. Apps do not always return all memory since they may need it again. The OS may later require the memory back, but in the meantime it is much more efficient to let apps keep allocated memory if there is no pressure.</p>\n<p>If you continue to allocate and release memory, does the app's memory footprint continue to grow, or does it stabilize at 43MB? If it continues to grow, then you do have a memory leak, and can debug that <a href="https://developer.apple.com/documentation/xcode/gathering-information-about-memory-use" rel="nofollow noreferrer">using various tools</a>. If it has a one-time jump, then that is intentional.</p>\n"^^ . . . "<p>I ended up using <code>NSCompoundPredicate</code> to get this done. I was hoping there was a shorter route but it's fairly painless.</p>\n<pre><code>NSArray *collection = @[@&quot;Jerry*&quot;,@&quot;George*&quot;,@&quot;Elaine*&quot;];\nNSMutableArray *thePredicateArray = [NSMutableArray arrayWithCapacity:3];\n \nfor (id *theItem in collection)\n {\n [thePredicateArray addObject:[NSPredicate predicateWithFormat:@&quot;property LIKE %@&quot;,theItem]];\n } \n \nNSCompoundPredicate *theCompoundPredicate = [NSCompoundPredicate orPredicateWithSubpredicates:thePredicateArray];\n\n</code></pre>\n"^^ . "tvos"^^ . "Is there a reason you don't simply add the label as a subview, constrain its top/leading/trailing (or top/leading/width), and render the view as a UIImage? I guess you need to ***show us*** what you're getting, and explain why it's not what you want."^^ . . "Marshalling variable-sized string C array into C# (Unity iOS)"^^ . . . . "2"^^ . . . . . . "0"^^ . . "<p>I'm using this code to get <code>NSData</code> of a specific file:</p>\n<pre><code>NSData* data = [[NSData alloc] initWithContentsOfURL:object.fileURL];\n</code></pre>\n<p>Before this line the memory usage was 18MB and after this line it become 66.1.\nright after i want release this object(Non-ARC class) so i call <code>[data release];</code>\nAnd the data memory usage becomes 43 instead of 18MB.</p>\n<p>Any idea what can be the problem? how i. can fix it?</p>\n"^^ . . . . . . . . . . . . "0"^^ . "Explicitly waiting until I get a close/cancel state seems to be my only reliable recourse at the moment. (even after releasing `nw_connection_t`)"^^ . . . . "0"^^ . . "If you can update your question to cover the specific architecture(s) you're looking for, and what kinds of arguments (will it always be series of 64-bit integers, or could it be arbitrary things?), it would be reasonable to reopen this. It tends to be a bit tedious and fiddly, so I don't know if you'll get an answer, but it would be a different question. Some sense of why you're doing this might help us get you onto an easier path."^^ . . "1"^^ . . "swift"^^ . "0"^^ . . . . . "Well, that is not what i suggested."^^ . "ios-frameworks"^^ . . . . . . . . . . . . . . "0"^^ . . "0"^^ . "Thank you very much, the missing third pointer was the culprit, although in the C# code I had to also first read the underlaying pointers from the returned pointer and then marshal them as string:\n\n`IntPtr ptr = Marshal.ReadIntPtr(buffer);`\n\n`keys.Add(Marshal.PtrToStringAuto(ptr));`\n\n`buffer = IntPtr.Add(buffer, IntPtr.Size);`"^^ . "8"^^ . "Did you ever find a solution?"^^ . . . "0"^^ . "1"^^ . "2"^^ . . . "1"^^ . . . "Does `UIGraphicsImageRenderer` have a better performance too perhaps? Thanks for that suggestion, easy to miss by starting with copy-paste of older code."^^ . . . . "Each platform has its own convention for passing arguments, and it depends on the number and types of the arguments. If you're working with aarch64, start with the [ABI](https://github.com/ARM-software/abi-aa/blob/844a79fd4c77252a11342709e3b27b2c9f590cf1/aapcs64/aapcs64.rst), taking into account [Apple's differences](https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms). You'll probably want to skip down to section 6.8 to get started. A major reason for varargs to provide a consistent way to do this. Note many things are passed in registers, not the stack."^^ . . "thanks. Maybe you could help me with something else. I created more `.h` and `.m` files - let's say they're called `BaseLog`. When I try to import `BaseLog.h` in my `AppLogger.h` I get an error `BaseLog.h file not found`. Do you know want might be the problem?"^^ . . . . "0"^^ . . "0"^^ . "0"^^ . . . . "Moreover even the user killing the app is not a crash."^^ . . . . "After thinking more about it, I think you are confusing `self` -- which is a pointer to your class -- with the _location_ of the first implicit argument. I.e. you probably want something like `((uintptr_t)&self) + sizeof ...`. However, even if the implicit argument is located on the stack, the compiler may return the location of a local copy of the argument rather than the actual argument location."^^ . "The questions in my mind would be (a) what these “yb” routines do (i.e., we need to know whether these blocks are already called on the main queue or not); and (b) you say you’re getting that priority inversion error when you add code, but don’t show us the code that generated that error."^^ . . . . . "<p>I want to hook realtime video data to get realtime base64 image from an video play by MobileVLCKit.</p>\n<p>I researched about this and get this: <a href="https://wiki.videolan.org/Stream_to_memory_(smem)_tutorial/" rel="nofollow noreferrer">https://wiki.videolan.org/Stream_to_memory_(smem)_tutorial/</a>\n<a href="https://gist.github.com/TimSC/4121862" rel="nofollow noreferrer">https://gist.github.com/TimSC/4121862</a></p>\n<p>But I don't know how to use this using Objective-c or Swift.</p>\n"^^ . . "@Keer if your purpose is to do some internal cleanup, without any visible display to the user, you may accept some amount of false positive. In my experience (I use it to store some state of the app to be restored at next launch), `applicationWillTerminate` is called most of the times. Alternatively, as you mention cleanup, an approach would be not to test for crashes, but for the actual need for cleanup, eg checking if the tmp files to be cleaned up have been left behind by the previous run of your app."^^ . . . . "0"^^ . . . . . . . . . . . . . "0"^^ . . "1"^^ . "1"^^ . . . . . "Release NSData not release all memory"^^ . "@Rob Napier I want to get the arguments of existing method dynamically which is not created with varargs."^^ . . "Just wrong. An app can quit cleanly without `applicationWillTerminate` being called. In fact, nowadays `applicationWillTerminate` is just about never called."^^ . "2"^^ . "1"^^ . "1"^^ . . "So what is the problem? How you want to use that information?"^^ . "0"^^ . . "0"^^ . . . . . . "0"^^ . . "2"^^ . "ios-app-group"^^ . "0"^^ . "What you're looking for is varargs. I'm duping this to the question that answers that. Please comment here if you believe there is more to your question and we can reopen this one. The code you're writing here relies on a particular parameter passing approach that is neither correct (see mschmidt's discussion of the ABI), nor reliable if it happened to be correct. But it's luckily also unnecessary."^^ . "0"^^ . . . . . . . . "0"^^ . . "0"^^ . "1"^^ . . . . "What does the documentation of `NSPredicate` say about evaluating a decoded predicate?"^^ . "@HangarRash still same, i just added review information there, still stuck"^^ . . "<p>I have a framework mixed Objective-C and Swift using CocoaPods for distribution. The issue is it cannot load images stored in the framework's Assets.</p>\n<p>This is the code I used to load the image:</p>\n<pre><code>let currentBundle = Bundle(for: &lt;MyClass&gt;.self)\nlet image1 = UIImage(named: &quot;someImage&quot;, in: currentBundle, compatibleWith: nil)\n\n</code></pre>\n<p>The image1 returns nil. After some trials, it worked with the code below:</p>\n<pre><code>let bundleWithIdentifier = Bundle(identifier: &quot;org.cocoapods.MyFramework&quot;)\nlet image2 = UIImage(named: &quot;someImage&quot;, in: bundleWithIdentifier, compatibleWith: nil)\n\n</code></pre>\n<p>currentBundle and bundleWithIdentifier are not the same bundles.</p>\n<p>'org.cocoapods.MyFramework' is the identifier of this framework generated in the hosted app after running pod install. The original identifier is: &quot;com.be.MyFramework&quot;.</p>\n<p>This is part of the podspec file used to store assets in the resource bundle:</p>\n<pre><code>spec.subspec 'Core' do |core|\n core.source_files = '&lt;MyFramework&gt;/**/*.{h,m,swift}'\n core.public_header_files = '&lt;MyFramework&gt;/&lt;MyFramework&gt;.h',\n core.frameworks = 'UIKit', 'Foundation', 'Security', 'QuartzCore'\n core.library = 'c++'\n core.resource_bundles = {\n '&lt;MyFramework&gt;' =&gt; ['&lt;MyFramework&gt;/**/*.{xcassets,xib,storyboard,png,jpg,lproj}']\n }\nend\n\n</code></pre>\n<p>I have another framework, the podspec file, and everything is the same except this framework was mixed with Swift and Objective-C. The other framework can load images without any issues using Bundle(for: .self). Can someone help me explain why there are differences even though the two frameworks are almost the same?</p>\n"^^ . . "How can I move window controls (traffic lights) down in an NSWindow?"^^ . . "2"^^ . . . "@larme thank you, your suggestion worked for me with this option: s.resources = "Resources/**/*.{png,storyboard}""^^ . "0"^^ . "0"^^ . . "nsimage"^^ . "0"^^ . . . . . "0"^^ . "0"^^ . . . . . . . "3"^^ . "1"^^ . "0"^^ . "Without diving deep into profiling I couldn't give you a definitive answer. That said, it's rare that Apple introduces a new API that is less efficient. Aside from performance, there are other reasons why it might be wise to switch to `UIGraphicsImageRenderer` -- such as color formats, memory optimization, etc... But for *your specific task* I can't imagine you would see any difference."^^ . "@HangarRash Because tvOS comes straight from iOS, so many of the same issues can apply, and many people who might see iOS questions and have a wealth of iOS knowledge would likely be able to help out on this one as well."^^ . "<p>I am trying to upload a text file to a web server from an iOS application. I have written an objective C method to handle the upload request and a PHP file to handle the POST request at the server. I have also written a small HTML page to test the upload from a browser (which is working fine using the same PHP file). When the iOS App runs it should upload a text file (which is empty ie 0 bytes in size) to a specified folder on the web server, and although the debug window shows the response as success(200) the file is not uploaded.</p>\n<p>Here is the Objective C method</p>\n<pre><code> + (void)fileUpload{\n NSString *localFilePath = [self GetTokenFilePath];\n NSURL *localFile = [NSURL fileURLWithPath:localFilePath];\n NSData *data = [[NSData alloc] initWithContentsOfFile:localFilePath];\n NSString *filename = [self GetTokenFilename];\n // Set up the body of the POST request.\n\n // This boundary serves as a separator between one form field and the next.\n // It must not appear anywhere within the actual data that you intend to\n // upload.\n NSString * boundary = @&quot;---------------------------14737809831466499882746641449&quot;;\n\n // Body of the POST method\n NSMutableData * body = [NSMutableData data];\n \n // The body must start with the boundary preceded by two hyphens, followed\n // by a carriage return and newline pair.\n //\n // Notice that we prepend two additional hyphens to the boundary when\n // we actually use it as part of the body data.\n //\n [body appendData:[[NSString stringWithFormat:@&quot;\\r\\n--%@\\r\\n&quot;,boundary] dataUsingEncoding:NSUTF8StringEncoding]];\n \n // This is followed by a series of headers for the first field and then\n // TWO CR-LF pairs. set tag-name to submit upload\n [body appendData:[[NSString stringWithFormat:@&quot;Content-Disposition: form-data; name=\\&quot;file\\&quot;; filename=\\&quot;%@.txt\\&quot;\\r\\n&quot;, filename] dataUsingEncoding:NSUTF8StringEncoding]];\n\n [body appendData:[@&quot;Content-Type: application/octet-stream\\r\\n\\r\\n&quot; dataUsingEncoding:NSUTF8StringEncoding]];\n // Next is the actual data for that field (called &quot;tag_name&quot;) followed by\n // a CR-LF pair, a boundary, and another CR-LF pair.\n [body appendData:[NSData dataWithData:data]];\n \n // Close the request body with one last boundary with two\n // additional hyphens prepended **and** two additional hyphens appended.\n [body appendData:[[NSString stringWithFormat:@&quot;\\r\\n--%@--\\r\\n&quot;, boundary] dataUsingEncoding:NSUTF8StringEncoding]];\n\n \n // Data uploading task.\n NSURL * url = [NSURL URLWithString:@&quot;https://MY_URL.co.uk/Upload.php&quot;];\n NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:url];\n NSString * contentType = [NSString stringWithFormat:@&quot;multipart/form-data; boundary=%@&quot;,boundary];\n [request addValue:contentType forHTTPHeaderField:@&quot;Content-Type&quot;];\n request.HTTPMethod = @&quot;POST&quot;;\n request.HTTPBody = body;\n \n /*------------------*/\n NSURLSession *session = [NSURLSession sharedSession];\n \n // Create a NSURLSessionUploadTask object to Upload data for a jpg image.\n NSURLSessionUploadTask *task = [session uploadTaskWithRequest:request fromFile:localFile completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {\n \n if (error == nil) {\n // Upload success.\n NSLog(@&quot;upload file:%@&quot;,localFile);\n NSLog(@&quot;upload success:%@&quot;,[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);\n NSLog(@&quot;upload response:%@&quot;,response);\n // Update user defaults to show success on token upload.\n NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];\n [defaults setBool:TRUE forKey:@&quot;TOKEN_UPLOAD_SUCCESS&quot;];\n } else {\n // Upload fail.\n NSLog(@&quot;upload error:%@&quot;,error);\n NSLog(@&quot;upload response:%@&quot;,response);\n // Update user defaults to show success on token upload.\n NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];\n [defaults setBool:FALSE forKey:@&quot;TOKEN_UPLOAD_SUCCESS&quot;];\n }\n \n }];\n [task resume];\n \n }\n</code></pre>\n<p>Here is the PHP file I use at the server end</p>\n<pre><code> &lt;?php\n\n print_r($_POST);\n echo &quot;&lt;br&gt;&quot;;\n\n //phpinfo();\n\n // file properties\n $file = $_FILES['file'];\n $file_name = $_FILES['file']['name'];\n $file_tmp = $_FILES['file']['tmp_name'];\n $file_size = $_FILES['file']['size'];\n $file_error = $_FILES['file']['error'];\n $file_type = $_FILES['file']['type'];\n echo &quot;File name = &quot;.$file_name.&quot;&lt;br&gt;&quot;;\n echo &quot;File size = &quot;.$file_size.&quot;&lt;br&gt;&quot;;\n echo &quot;File error = &quot;.$file_error.&quot;&lt;br&gt;&quot;;\n //print_r($file);\n\n\n //work out the file extension\n\n $file_ext = explode('.' , $file_name );\n $file_actual_ext = strtolower(end($file_ext));\n echo &quot;File Extension = &quot;.$file_actual_ext.&quot;&lt;br&gt;&quot;;\n //echo $file_actual_ext;\n\n $allowed = array('txt', 'csv');\n print_r($allowed);\n echo &quot;&lt;br&gt;&quot;;\n\n if(in_array($file_actual_ext,$allowed)) {\n echo &quot;File type is allowed&quot;.&quot;&lt;br&gt;&quot;;\n if($file_error === 0) {\n if($file_size &lt;= 1048576) {\n $file_destination = &quot;TokensV11/&quot;.$file_name;\n echo &quot;File Destination = &quot;.$file_destination.&quot;&lt;br&gt;&quot;;\n if(move_uploaded_file($file_tmp, $file_destination)) {\n echo &quot;The file has been uploaded sucessfully&quot;.&quot;&lt;br&gt;&quot;;\n }else{\n echo &quot;The file was not moved to destination&quot;.&quot;&lt;br&gt;&quot;;\n }\n }else{\n echo &quot;The file size is too large&quot;.&quot;&lt;br&gt;&quot;;\n }\n }else{\n echo &quot;There was an error uploading your file&quot;.&quot;&lt;br&gt;&quot;;\n }\n }else {\n echo &quot;You cannot upload files of this type or no file was specified&quot;.&quot;&lt;br&gt;&quot;;\n }\n\n ?&gt;\n\n</code></pre>\n<p>Here is the output sample from the debug window in Xcode</p>\n<pre><code>2023-07-25 12:39:26.855874+0100 BikerCafe[3036:86717] upload file:file:///Users/stephencox/Library/Developer/CoreSimulator/Devices/5246C453-B5BF-4F6E-B4BD-E5121A382E87/data/Containers/Data/Application/MYFILE.txt\n2023-07-25 12:39:28.238222+0100 BikerCafe[3036:86717] upload success:The PHP script has started&lt;br&gt;File name = &lt;br&gt;File size = &lt;br&gt;File error = &lt;br&gt;File Extension = &lt;br&gt;Array\n(\n [0] =&gt; txt\n [1] =&gt; csv\n [2] =&gt; png\n)\n&lt;br&gt;File Destination = TokensV11/&lt;br&gt;\n2023-07-25 12:39:30.723756+0100 BikerCafe[3036:86717] upload response:&lt;NSHTTPURLResponse: 0x6000010e7f60&gt; { URL: https://tokens.ukbikercafes.co.uk/TokenUpload.php } { Status Code: 200, Headers {\n &quot;Content-Encoding&quot; = (\n gzip\n );\n &quot;Content-Type&quot; = (\n &quot;text/html; charset=UTF-8&quot;\n );\n Date = (\n &quot;Tue, 25 Jul 2023 11:39:23 GMT&quot;\n );\n Server = (\n Apache\n );\n &quot;x-powered-by&quot; = (\n &quot;PHP/7.4.33&quot;\n );\n} }\n</code></pre>\n"^^ . . "1"^^ . . "What kind of crash do you mean specifically? Note, that "crashes" are caused by special CPU instructions generated by the source code (Int overflow, array index out of range,...) or caused CPU exceptions generated by the CPU itself (div by zero). We say it's a "crash" when the app terminates or aborts unexpectedly. However, the app also terminates, when the OS orderly terminates your app, or when the source code executes `fatalError()`. There are also CPU exceptions which are vital to the system, for example to implement virtual memory."^^ . . . "0"^^ . . . "1"^^ . "0"^^ . "0"^^ . "0"^^ . . "NSPredicate error after decoding from NSData: "This predicate has evaluation disabled""^^ . "<p>I have an app using in app purchase to buy diamonds. And to buy diamonds I want to use in app purchase. Paid Apps agreement activated. I already defined <code>product_id</code> from API.</p>\n<pre><code>-(void)applePay:(NSDictionary *)dic{\n\n [self.delegate applePayShowHUD];\n NSDictionary *dics = @{\n @&quot;uid&quot;:[Config getOwnID],\n @&quot;coin&quot;:[dic valueForKey:@&quot;coin_ios&quot;],\n @&quot;money&quot;:[dic valueForKey:@&quot;money&quot;],\n @&quot;changeid&quot;:dic[@&quot;id&quot;]\n };\n [YBToolClass postNetworkWithUrl:@&quot;Charge.getIosOrder&quot; andParameter:dics success:^(int code, id _Nonnull info, NSString * _Nonnull msg) {\n if (code == 0) {\n NSString *infos = [[info firstObject] valueForKey:@&quot;orderid&quot;];\n self.OrderNo = infos;//订单\n //苹果支付ID\n NSString *setStr = [NSString stringWithFormat:@&quot;%@_testing&quot;,[dic valueForKey:@&quot;product_id&quot;]];\n NSSet *set = [[NSSet alloc] initWithObjects:setStr, nil];\n self.request = [[SKProductsRequest alloc] initWithProductIdentifiers:set];\n self.request.delegate = self;\n [self.request start];\n \n }\n else{\n [self.delegate applePayHUD];\n dispatch_async(dispatch_get_main_queue(), ^{\n\n [MBProgressHUD showError:msg];\n });\n }\n\n } fail:^{\n \n }];\n}\n\n- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response\n{\n \n [self.delegate applePayHUD];\n \n self.products = response.products;\n self.request = nil;\n for (SKProduct *product in response.products) {\n NSLog(@&quot;已获取到产品信息 %@,%@,%@&quot;,product.localizedTitle,product.localizedDescription,product.price);\n self.product = product;\n }\n if (!self.product) {\n dispatch_async(dispatch_get_main_queue(), ^{\n [self showAlertView:YZMsg(@&quot;无法获取商品信息&quot;)];\n });\n \n return;\n }\n //3.获取到产品信息,加入支付队列\n SKPayment *payment = [SKPayment paymentWithProduct:self.product];\n [[SKPaymentQueue defaultQueue] addTransactionObserver:self];\n [[SKPaymentQueue defaultQueue] addPayment:payment];\n}\n</code></pre>\n<p>and I already put the product in app store connect like this:</p>\n<p><a href="https://i.sstatic.net/9Wsox.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9Wsox.png" alt="enter image description here" /></a></p>\n<p>I put configuration too inn Xcode:</p>\n<p><a href="https://i.sstatic.net/rtUur.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rtUur.png" alt="enter image description here" /></a></p>\n<p>this is for the scheme:</p>\n<p><a href="https://i.sstatic.net/GDz3j.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/GDz3j.png" alt="enter image description here" /></a></p>\n<p>I always get skipping product, am I missing something here ?</p>\n"^^ . . "5"^^ . . "3"^^ . . . "app-store"^^ . . . . . . . . . . . . . "0"^^ . . . . . "2"^^ . . . . . . . . . . "0"^^ . "sockets"^^ . "1"^^ . . . . . . . "I'm really trying to understand exactly what you want, and why it's problematic... see this image: https://i.sstatic.net/zyyaU.png"^^ . "post"^^ . . "<p>You are trying to return a char**, so the C function parameter needs to be a char***:</p>\n<pre><code>FOUNDATION_EXPORT int _GetAllKeys(char*** pointer)\n{\n NSArray* array = @[@&quot;key1&quot;, @&quot;key2&quot;]; // dummy strings\n int size = (int)array.count;\n\n *pointer = malloc(size * sizeof(char *));\n\n for (int i = 0; i &lt; size; i++)\n {\n (*pointer)[i] = MakeStringCopy(array[i]);\n }\n return size;\n}\n</code></pre>\n<p>The C# code looks fine, except that IntPtr.Add returns a new IntPtr, so it has to be:</p>\n<pre><code>keys.Add(Marshal.PtrToStringUTF8(buffer));\nbuffer = IntPtr.Add(buffer, IntPtr.Size);\n</code></pre>\n"^^ . "<p>Is there a way to find if my app has crashed on previous launch.\nI want it from both swift and obj-c without using any 3rd party libraries?\nI want a way to note that my app has crashed, no stack trace needed just want some count of crashes stored to user defaults.\nI saw <a href="https://stackoverflow.com/questions/40631334/how-to-intercept-exc-bad-instruction-when-unwrapping-nil/40712296#40712296">NSSetUncaughtExceptionHandler being used</a> but it is only catching obj-c related errors. eg. force unwrapping nil is not caught here. I want a universal way of catching the crashes, also want to know if this can affect the crash reporting by 3rd party libraries.\nHow do 3rd party libraries do this? Found a repo: <a href="https://github.com/zixun/CrashEye/blob/master/CrashEye/Classes/CrashEye.swift" rel="nofollow noreferrer">Crash Eye</a> but it is not really catching all the crashes.\nThis might seem repetitive but most answers on SO are not complete.</p>\n"^^ . "I have done very little with MacOS apps, however... On iOS, we set the layer contents to a `CGImage` which will not, of course, change with appearance changes. It seems possible (likely?) that assigning a `NSImage` as a layer's content does the same (under-the-hood). Would adding a `NSImageView` as a subview be an option for your use case?"^^ . "`NSImage` will cache images based on their names. I suspect that when you try to re-fetch the image using `imageNamed`, it is returning the cached image instead of re-searching for an image to display (and finding the one in your asset catalog). Try doing `[(NSImage *)sublayer2.content setName: nil];` right before you set `sublayer2.content` and see if that flushes the cached image and forces the system to search for the one in the asset catalog."^^ . "<p>On my case adding the following line in the iOS <code>.podspec</code> fix the problem (in the podspec from your iOS Swift library, not from the React Native library):</p>\n<pre><code>s.pod_target_xcconfig = { 'DEFINES_MODULE' =&gt; 'YES' }\n</code></pre>\n<p>Then re-run <code>pod install</code> in your react native example app and Clean the Build folder</p>\n<p>EDIT: Finally this doesn't work at all (it was a cache issue that make it temporary working in my case), I'm still looking for a solution...</p>\n"^^ . "0"^^ . . "How to get arguments of an objective-c method while executing it"^^ . "0"^^ . . . "0"^^ . . . . "0"^^ . . . "URLSession.didReceiveChallenge : how to ignore one specific certificate check on server-side authentication"^^ . . . . . "1"^^ . . . . "2"^^ . "photokit"^^ . "1"^^ . . "0"^^ . "0"^^ . "<p>To answer your <em>specific</em> questions...</p>\n<p>First, as to <em>&quot;what is the purpose of <code>[screenshot drawInRect:drawRect]</code>&quot;</em> ...</p>\n<p><em><strong>It has no purpose there.</strong></em></p>\n<p>Presumably, the post you got that from intended to say something like: <em>&quot;Now you have a 100 x 100 <code>UIImage</code> &quot;screenshot&quot; which you can draw into some other rect in some other graphics context.&quot;</em></p>\n<hr />\n<p>Second...</p>\n<p>The label is not drawing at <code>(10, 10)</code> because you are rendering the label's <strong>layer</strong> -- which has an origin of <code>(0, 0)</code>.</p>\n<p>If you want it rendered at <code>(10, 10)</code> you can modify the layer's bounds before drawing it:</p>\n<pre><code>myLabel.backgroundColor = [UIColor clearColor];\n\n// change the label's layer bounds\n// to the drawRect rect\nmyLabel.layer.bounds = drawRect;\n\nUIGraphicsBeginImageContextWithOptions(CGSizeMake(size, size), NO, 0);\n</code></pre>\n<hr />\n<p>So, if we run your code (no idea why you have two <code>let</code> statements):</p>\n<pre><code>CGFloat size = 100.0;\nCGRect drawRect = CGRectMake(10, 10, 80, 25);\n\nUILabel *myLabel = [[UILabel alloc] initWithFrame:drawRect];\nmyLabel.font = [UIFont fontWithName:@&quot;HelveticaNeue-BoldItalic&quot; size:16];\nmyLabel.text = &quot;Hello text!&quot;;\nmyLabel.minimumScaleFactor = 0.5;\nmyLabel.adjustsFontSizeToFitWidth = YES;\nmyLabel.textAlignment = NSTextAlignmentCenter;\nmyLabel.backgroundColor = [UIColor clearColor];\n\n// change the label's layer bounds\n// to match the drawRect\nmyLabel.layer.bounds = drawRect;\n\nUIGraphicsBeginImageContextWithOptions(CGSizeMake(size, size), NO, 0);\n[[myLabel layer] renderInContext:UIGraphicsGetCurrentContext()];\nUIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();\nUIGraphicsEndImageContext();\n\n// do something with screenshot, such as\nsomeImageView.image = screenshot;\n</code></pre>\n<p>You will now have a 100 x 100 <strong>point</strong> (not pixel) <code>UIImage</code> named &quot;screenshot&quot; with the label <strong>frame</strong> at <code>(10, 10)</code> (again, <strong>10-points</strong> not pixels).</p>\n<p>This is the result... note that the code you posted specifies a <code>CGContextRef</code> <em>at the device’s main screen scale factor.</em> I'm running this on an iPhone 14 Pro which has a @3x factor, so the output is a 300x300 <em>pixel</em> image, with the label frame at (30, 30) <em>pixels</em>:</p>\n<p><a href="https://i.sstatic.net/cKW4Q.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/cKW4Q.png" alt="enter image description here" /></a></p>\n<p>Since it has a clear background, that's how it looks in a paint app.</p>\n<p>If we modify the code just a little to add color to fill the image rect and the label frame, it looks like this:</p>\n<p><a href="https://i.sstatic.net/DZgdK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/DZgdK.png" alt="enter image description here" /></a></p>\n<hr />\n<p>As a side-note, you might want to look into the more &quot;modern&quot; <code>UIGraphicsImageRenderer</code></p>\n"^^ . . . "0"^^ . . . . . "1"^^ . . . . "4"^^ . "Do you mean you want to check `challenge.protectionSpace.host`?"^^ . . "Update: it doesn't seem to be related to caching. if I create the `CALayer` and the `NSImage` objects only *after* the app has changed appearance, the layer renders the image with the appearance that the app had on launch. It seems that `CALayer` ignores the app current appearance and relies on its initial state. Is this a bug?"^^ . . . . "0"^^ . "0"^^ . . . . . . . "<p>I can't manage to get the <code>responseCompletion</code> type correct, at the for cycle.\nTried to replace it with typedef, but got no luck, only more errors.</p>\n<pre><code>@interface ImageManager : NSObject\n\n//typedef void(^responseBlock)(UIImage * _Nullable image);\n\n@property (nonatomic, strong) NSDictionary&lt;NSString *,NSMutableArray&lt;void(^)(UIImage * _Nullable image)&gt; *&gt; *loadingResponses;\n@end\n\n-(void)fetchImage:(NSString *)urlString and:(void (^_Nonnull)(UIImage * _Nullable image))completionhHandler {\n\n UIImage *image = [self.cache objectForKey:urlString];\n\n if (image != nil) {\n completionhHandler(image);\n return;\n }\n\n if (self.loadingResponses[urlString] != nil) {\n [self.loadingResponses[urlString] addObject:completionhHandler];\n return;\n } else {\n [[self.loadingResponses objectForKey:urlString] setArray:[[NSMutableArray alloc] initWithObjects:completionhHandler, nil]];\n }\n\n NSURL *url = [[NSURL alloc] initWithString:urlString];\n [[self.session dataTaskWithURL:url completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {\n\n if (error != nil) {\n UIImage *image = [[UIImage alloc] initWithData:data];\n [self.cache setObject:image forKey:urlString];\n completionhHandler(image);\n\n NSArray *array = [self.loadingResponses objectForKey:urlString];\n \n for ((void(^)(UIImage * _Nullable image) *responseCompletion) in array) {\n responseCompletion(image);\n }\n }\n\n }] resume];\n}\n</code></pre>\n"^^ . . . "0"^^ . . . "0"^^ . . "We don't really handle varargs at all, so that's not a problem at the moment. I hadn't thought about just computing FP-SP, but we also have to copy all the arguments into the new stack frame, so some understanding of each argument is nice (although I guess we could just copy the entire chunk of memory from A to B and hope for the best?)"^^ . . "0"^^ . . . . "<p>I have some trouble creating a framework for iOS.</p>\n<p>I created a new project (called Logger) and selected the <code>Framework</code> option.\nThen, Xcode created the folder structure and it had a few files including <code>Logger.h</code>, but no <code>Logger.m</code> was created.</p>\n<p>Then, I have created new Cocoa Touch file called <code>AppLogger</code> and added some basic logic to it.</p>\n<p>I imported the <code>AppLoger.h</code> file in my <code>Logger.h</code> like this:</p>\n<pre><code>#import &lt;Logger/AppLoger&gt;\n</code></pre>\n<p>I also tried it like this:</p>\n<pre><code>#import &quot;Logger/AppLoger&quot;\n</code></pre>\n<p>But it gives me an error:</p>\n<pre><code>'Logger/AppLogger.h' file not found\n</code></pre>\n<p>I don't understand what the problem is with my setup.\nAttached is also an image of my project structure.</p>\n<p><a href="https://i.sstatic.net/5EcZL.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5EcZL.png" alt="enter image description here" /></a></p>\n"^^ . "@matt I changed `while(player.isPlaying)` loop to `while(true)` but output is still nothing..."^^ . . . "0"^^ . . . "apple-push-notifications"^^ . . "@mschmidt I think I only care about the value of the argument that passed in"^^ . . . "1"^^ . . "<pre><code>package getlark\n\n/*\n#cgo CFLAGS: -x objective-c\n#cgo LDFLAGS: -framework Cocoa\n#import &lt;Cocoa/Cocoa.h&gt;\n#import &lt;CoreGraphics/CGWindow.h&gt;\n\nstatic NSDictionary* FindChrome(void){\n NSArray *windows = (NSArray *)CGWindowListCopyWindowInfo(kCGWindowListExcludeDesktopElements|kCGWindowListOptionOnScreenOnly,kCGNullWindowID);\n NSLog(@&quot;数组长度:%lu&quot;,windows.count);\n for(NSDictionary *window in windows)\n {\n NSString *currentApp = window[(NSString *)kCGWindowOwnerName];\n NSString *currentWindowTitle = window[(NSString *)kCGWindowName];\n if ([currentApp isEqualToString:@&quot;Google Chrome&quot;]){\n NSDictionary *currentBounds= window[(NSString *)kCGWindowBounds];\n NSLog(@&quot;%@&quot;,currentBounds);\n return currentBounds;\n break;\n }\n }\n}\n*/\nimport &quot;C&quot;\nimport (\n &quot;fmt&quot;\n &quot;reflect&quot;\n)\n\nfunc GetLarkPos() {\n var dd *C.NSDictionary\n\n dd = C.FindChrome()\n fmt.Println(reflect.TypeOf(dd))\n fmt.Println(dd)\n\n}\n</code></pre>\n<p><a href="https://i.sstatic.net/x0BDq.png" rel="nofollow noreferrer">enter image description here</a>\nThe value on the picture, how can I call the function of golang</p>\n<p>Sorry, I am not familiar with cgo and objective-c. I hope I can get some help from you.</p>\n"^^ . . . . "1"^^ . . . . . "1"^^ . . "0"^^ . "0"^^ . "I'm into the same boat here. Old objective-c app that does the appstore downloaded certificate check using own code, decrypting and checking the receipt. Could test that in the past with a dummy apple id. Despite Apple's promises that objective-c would be treated equally to Swift new Storekit is Swift-only, and an asynchronous one too. Not too easy to call from objective-c, but I got that to work I think, calling AppTransaction.shared. TN3138 and docs give the impression you don't have to the receipt any further, but now the sandbox is causing trouble."^^ . . . "nsvisualeffectview"^^ . . "uigraphicscontext"^^ . . "@Willeke No, this is not Core Data, just filtering an array of objects. Regarding NSCompoundPredicate I did end up going that route. I had to iterate my wildcard items to build the compounds but it seems the best solution."^^ . . . . "Write to AppGroup shared directory"^^ . . . . . . "@Larme, thanks for you comment. I've changed my code, I think this should do the trick, perhaps you can approve it ? thnaks !"^^ . "<p>If you put the complete log, I could guide you better. But in general, since I myself faced this error, it is probably because your VOIP codecs are not installed. Therefore, make sure that the codecs are installed. To do this, you can add the following piece of code to the program's main function and recompile it to find the number and name of each installed codec, although in your program, I guess it will return 0:</p>\n<pre><code> unsigned codeccount = 256;\n pjsua_codec_info codecinfo[codeccount];\n pj_status_t codecnum = pjsua_enum_codecs(codecinfo, &amp;codeccount);\n fprintf(stderr, &quot;codec Count: %d &quot;, codeccount);\n for (int i = 0; i &lt; codeccount; i++)\n {\n fprintf(stderr, &quot;id: %s &quot;, codecinfo[i].codec_id);\n }\n</code></pre>\n"^^ . . "1"^^ . . "0"^^ . "0"^^ . . . "@CouchDeveloper thanks, as a dev I feel we should have some way of identifying why my past session terminated and not having any info around this is not helpful. In my case I would at least want to get this metrics to perform a few clean ups before allowing the user to enter the normal flow but seems like there is no straight forward way without using 3rd party libraries that can add to my appsize given I am already using one for crash reporting this is going to be difficult :("^^ . "1"^^ . . . . . . "0"^^ . . "0"^^ . . . . "0"^^ . . . . . . . . . "nsview"^^ . . "Objective-C exceptions are not crashes. In Swift there are no such "exceptions" at all. In Swift, Objective-C exceptions are a very legacy concept. Yet, neither Swift Errors nor Objective-C exceptions are "crashes". Crashes may be caught by signal handlers. The library you linked, "Crash Eye" gives a clue what this is and how you catch those events."^^ . "You probably need to run the runloop long enough for `audioPlayerDidFinishPlaying` to be called. Otherwise `main` exits before the delegate method has a chance to be called."^^ . . "@RobNapier Yes, bridging ObjC exceptions over to C# is exactly what we're doing in https://github.com/xamarin/xamarin-macios. Here's a document describing what we support: https://learn.microsoft.com/en-us/xamarin/ios/platform/exception-marshaling. I know very well that ObjC exceptions are much more _exceptional_ than C# exceptions, but at some point we have to be pragmatic and deal with what we've got. Just terminating the process is not a very good user experience, for a number of reasons."^^ . "0"^^ . "0"^^ . . "2"^^ . . "@kostix Yes, I want to get the contents of the return value of dd in GetLarkPos (), but I don't know how to unlock it."^^ . . "0"^^ . . . "How do I completely stop & cleanup nw_connection_create?"^^ . . . "0"^^ . . "1"^^ . . . . . . . "0"^^ . "0"^^ . "1"^^ . "I'm not 100% what you're trying to build here, but I strongly suspect what you really want is an NSProxy-based surrogate object that implements `forwardInvocation:`. This will create the NSInvocation for you, and you can then pass that along to the underlying object and also save it. For more details, see https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtForwarding.html#//apple_ref/doc/uid/TP40008048-CH105"^^ . . . . . "0"^^ . . "0"^^ . . . . . . . "0"^^ . . . . "Can NSPredicate Compare a Property to an Array of Wildcards?"^^ . "At least with Swift the corruption problem seems to have been fixed!"^^ . "<p>I've been given an Objective-C framework that has the following API (simplified for this question):</p>\n<pre class="lang-objectivec prettyprint-override"><code>@protocol SomeClassDelegate;\n\nNS_REFINED_FOR_SWIFT\n@interface SomeClass: NSObject\n\n@property (weak) id&lt;SomeClassDelegate&gt; delegate;\n\n- (instancetype)initWithDelegate:(id&lt;SomeClassDelegate&gt;)delegate NS_SWIFT_NAME(init(delegate:));\n\n@end\n\nNS_REFINED_FOR_SWIFT\n@protocol SomeClassDelegate\n\n- (BOOL)someClass:(SomeClass *)object shouldProcessData:(UUID *)recordID NS_SWIFT_NAME(someClass(_:shouldProcessData:));\n- (nullable SomeHelper *)someClass:(SomeClass *)object helperFor:(UUID *)recordID NS_SWIFT_NAME(someClass(_:helerFor:));\n\n@end\n</code></pre>\n<p>The Swift version of this API is being dictated as:</p>\n<pre class="lang-swift prettyprint-override"><code>public class SomeClass {\n public weak var delegate: SomeClassDelegate\n\n init(delegate: SomeClassDelegate)\n}\n\npublic protocol SomeClassDelegate : AnyObject {\n func shouldProcessData(recordID: UUID, someClass: SomeClass) async -&gt; Bool\n func helperFor(recordID: UUID, someClass: SomeClass) async -&gt; SomeHelper?\n}\n</code></pre>\n<p>Given these APIs, I need to implement the Swift wrapper of the existing Objective-C framework. My biggest hurdle is that the Swift delegate methods are meant to be <code>async</code> but the Objective-C delegate methods are not asynchronous and do not have completion handlers.</p>\n<p>Here's my first pass at the Swift wrapper which includes a delegate adapter.</p>\n<pre class="lang-swift prettyprint-override"><code>public class SomeClass {\n public weak var delegate: SomeClassDelegate\n\n init(delegate: SomeClassDelegate) {\n wrapper = __SomeClass()\n delegateAdapter = SomeClassDelegateAdapter(self, delegate: delegate)\n wrapper.delegate = delegateAdapter\n }\n\n private wrapper: __SomeClass\n private delegateAdapter: SomeClassDelegateAdapter\n}\n\nfileprivate class SomeClassDelegateAdapter: NSObject, __SomeClassDelegate {\n private let delegate: SomeClassDelegate\n private let wrapper: SomeClass\n\n init(_ wrapper: SomeClass, delegate: SomeClassDelegate) {\n self.wrapper = wrapper\n self.delegate = delegate\n }\n\n func someClass(_ someClass: __SomeClass, shouldProcessData recordID: UUID) -&gt; Bool {\n // The following gives &quot;'async' call in a function that does not support concurrency&quot;\n //return delegate.shouldProcessData(recordID, someClass: wrapper)\n // Adding await doesn't change anything\n //return await delegate.shouldProcessData(recordID, someClass: wrapper)\n // Wrapping in Task gives &quot;Cannot convert return expression of type 'Task&lt;Bool, Never&gt;' to return type 'Bool'&quot;\n Task {\n return await delegate.shouldProcessData(recordID, someClass: wrapper)\n }\n // Adding .value to the Task gets me back to the first error. Ugh!\n }\n\n func someClass(_ someClass: __SomeClass, helperFor recordID: UUID) -&gt; __SomeHelper? {\n // Similar issues to above\n }\n}\n</code></pre>\n<p>So how do I solve this? I've done a lot of searching and all solutions involve using completion handlers. But I can't do that since the Objective-C API is fixed and complete. I don't know why the Swift version of the delegate API is marked with <code>async</code>. That's out of my control. I need a solution that allows me to implement the given Swift API around the given Objective-C API.</p>\n<p>Is there a valid way to get a return value from a Swift <code>async</code> method and return it from inside a non-async method? From my searching, the use of GCD or semaphores is a bad combination with Swift async/await. Do those issues apply here?</p>\n<p>More fundamentally, is my overall approach of the delegate adapter the correct approach? If not, that completely changes my question.</p>\n"^^ . . "0"^^ . . . . . "0"^^ . . . . . . . . . . . . . "1"^^ . "Why does NSURL POST file upload task fail to upload to web server"^^ . "@CouchDeveloper Thanks but I don't think I can use a 3rd party library and implementing something on the level of PLCrashReporter may take time. Does the answer given below by Kasparian seem like a possible approach?"^^ . "0"^^ . . "0"^^ . . . . . . . "…in order to try to clear some magic around what you're observing by calling `fmt.Print*` on the returned value–quite possibly the Cocoa's type embeds some sort of a "token" or a "handle" which is used to look up a real runtime-allocated data structure when you're accessing entries that an `NSDictionary` holds. Go "sees" it as an array of 8 bytes (which is quite likely a 64-bit integer in fact, but I'd not guess further, as it's opaque anyway)."^^ . "3"^^ . . . "0"^^ . . . "1"^^ . . . "0"^^ . . . "0"^^ . "0"^^ . . . . . "nswindow"^^ . "Don't forget varargs, which are unbounded. But since you're already in assembly, I would think you'd check the frame pointer here to determine the size. Otherwise you have to consider all the padding issues. Is there a reason you're trying to compute it directly rather than use the FP-SP? (I haven't tried to build what you're building, so it's very possible I'm missing something obvious.) Also be sure to check Apple's slight alternations to the standard arm64 calling conventions: https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms"^^ . . "1"^^ . "0"^^ . . . . "xctest"^^ . . . "Defining the type of a completionHandler in Objective-C"^^ . "0"^^ . "1"^^ . "0"^^ . . "0"^^ . . . . "pjsip"^^ . . . "-1"^^ . . . . "0"^^ . . . . "0"^^ . . . "React native method not a recognized objective C method"^^ . "1"^^ . "Tip: use URLs instead of paths."^^ . . . "How do I call a Swift async method from within a synchronous method that has a return value and completion handlers can't be used?"^^ . . . "<p>I'm using code found <a href="https://stackoverflow.com/a/21665721/1971013">here</a> to create an image with text that is scaled to available size:</p>\n<pre><code>CGFloat size = 100.0;\nCGRect drawRect = CGRectMake(10, 10, 80, 25);\n\nUILabel *myLabel = [[UILabel alloc] initWithFrame:drawRect];\nmyLabel.font = [UIFont fontWithName:@&quot;HelveticaNeue-BoldItalic&quot; size:16];\nmyLabel.text = &quot;Hello text!&quot;;\nmyLabel.minimumScaleFactor = 0.5;\nmyLabel.adjustsFontSizeToFitWidth = YES;\nmyLabel.textAlignment = NSTextAlignmentCenter;\nmyLabel.backgroundColor = [UIColor clearColor];\n\nUIGraphicsBeginImageContextWithOptions(CGSizeMake(size, size), NO, 0);\n[[myLabel layer] renderInContext:UIGraphicsGetCurrentContext()];\nUIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();\nUIGraphicsEndImageContext();\n\n[screenshot drawInRect:drawRect];\n\nreturn screenshot;\n</code></pre>\n<p>This creates a 100x100 image with the rendered label in the top-left corner: (0, 0). How do I get the text at the desired point (10, 10)?</p>\n<p>To clarify: I want the label to be the size I specify, be centred horizontally, and its text to scale according to the available size.</p>\n<p>Also, what is the purpose of <code>[screenshot drawInRect:drawRect]</code> because I seem to get the same result without it?</p>\n"^^ . . "1"^^ . . . . . "pointers"^^ . . . . . "0"^^ . . "0"^^ . . "1"^^ . . . . . . . . . "0"^^ . "objective-c-runtime"^^ . "3"^^ . . "1"^^ . . . . "0"^^ . "3"^^ . "0"^^ . . . . "1"^^ . "2"^^ . . . "0"^^ . . . . "1"^^ . . . "appkit"^^ . . . . "1"^^ . . "audioPlayerDidFinishPlaying method is not fired in the CLI application on iOS"^^ . . "<p>The problem was with the URL I got back: It startet with &quot;file:///&quot;.</p>\n<p>After converting to a path, it started with &quot;file:/&quot;</p>\n<p>After removing the &quot;file:&quot; at the beginning it works now.</p>\n"^^ . . "0"^^ . . "1"^^ . "<p>I don't believe the encoding format is publicly documented. You can work out most of it from the <a href="https://clang.llvm.org/doxygen/ASTContext_8cpp_source.html#l08465" rel="nofollow noreferrer">ASTContext</a> source. Mattt's <a href="https://nshipster.com/type-encodings/" rel="nofollow noreferrer">Type Encodings blog post</a> sums it up well:</p>\n<blockquote>\n<p>So what do we gain from our newfound understanding of Objective-C Type Encodings? Honestly, not that much (unless you’re doing any crazy metaprogramming).</p>\n<p>But as we said from the very outset, there is wisdom in the pursuit of deciphering secret messages.</p>\n</blockquote>\n<p>And I agree, it's a worthy pursuit. Just don't expect this to be all that useful in Swift.</p>\n<p>To answer this specific situation:</p>\n<blockquote>\n<p>v32@0:8@&quot;NSString&quot;16@?&lt;v@?@&quot;NSString&quot;&gt;24</p>\n</blockquote>\n<p>As you know from your previous research, <a href="https://stackoverflow.com/questions/11527385/how-are-the-digits-in-objc-method-type-encoding-calculated/11527925#11527925">the numbers don't mean much</a>, so we won't worry about those.</p>\n<p>The syntax <code>@&quot;...&quot;</code> is an object with the class name given in quotes. You can find that in the <code>Type::ObjCObjectPointer</code> case:</p>\n<pre><code> 8501 S += '@';\n 8502 if (OPT-&gt;getInterfaceDecl() &amp;&amp;\n 8503 (FD || Options.EncodingProperty() || Options.EncodeClassNames())) {\n 8504 S += '&quot;';\n 8505 S += OPT-&gt;getInterfaceDecl()-&gt;getObjCRuntimeNameAsString();\n 8506 for (const auto *I : OPT-&gt;quals()) {\n 8507 S += '&lt;';\n 8508 S += I-&gt;getObjCRuntimeNameAsString();\n 8509 S += '&gt;';\n 8510 }\n 8511 S += '&quot;';\n 8512 }\n</code></pre>\n<p>The syntax <code>@?&lt;...&gt;</code> is a block pointer, as detailed in the <code>Type::BlockPointer</code> case:</p>\n<pre><code> 8401 case Type::BlockPointer: {\n 8402 const auto *BT = T-&gt;castAs&lt;BlockPointerType&gt;();\n 8403 S += &quot;@?&quot;; // Unlike a pointer-to-function, which is &quot;^?&quot;.\n 8404 if (Options.EncodeBlockParameters()) {\n 8405 const auto *FT = BT-&gt;getPointeeType()-&gt;castAs&lt;FunctionType&gt;();\n 8406 \n 8407 S += '&lt;';\n 8408 // Block return type\n 8409 getObjCEncodingForTypeImpl(FT-&gt;getReturnType(), S,\n 8410 Options.forComponentType(), FD, NotEncodedT);\n 8411 // Block self\n 8412 S += &quot;@?&quot;;\n 8413 // Block parameters\n 8414 if (const auto *FPT = dyn_cast&lt;FunctionProtoType&gt;(FT)) {\n 8415 for (const auto &amp;I : FPT-&gt;param_types())\n 8416 getObjCEncodingForTypeImpl(I, S, Options.forComponentType(), FD,\n 8417 NotEncodedT);\n 8418 }\n 8419 S += '&gt;';\n 8420 }\n 8421 return;\n 8422 }\n</code></pre>\n<p>What this is encoding is the following:</p>\n<pre><code>- (void)m:(NSString *)s completion:(void (^)(NSString *))c;\n</code></pre>\n<p>This is how <code>async</code> methods are translated to ObjC: a completion handler is added that accepts the return value.</p>\n<p>For fun, you can extend this to an <code>async throws</code> function:</p>\n<pre><code>func DebugLog2(message: String) async throws -&gt; String\n</code></pre>\n<p>And the result will be:</p>\n<pre><code>v32@0:8@&quot;NSString&quot;16@?&lt;v@?@&quot;NSString&quot;@&quot;NSError&quot;&gt;24\n</code></pre>\n<p>Which is equivalent to:</p>\n<pre><code>- (void)m:(NSString *)s completion:(void (^)(NSString *, NSError *))c;\n</code></pre>\n<p>(I should be clear when I say &quot;equivalent&quot; here, I don't mean it would literally be the same as calling <code>method_getTypeEncoding</code> on these methods. <code>method_getTypeEncoding</code> doesn't return extended encodings. You'd get <code>v32@0:8@16@?24</code> for both of these: a void-returning method that takes an object (@) and a block (@?). But these are the methods being described by the Swift encodings.)</p>\n<p>As a side note, NSMethodSignature can definitely parse the result. You just changed it to an invalid string (you removed the return type):</p>\n<pre><code>const char *types = &quot;v32@0:8@\\&quot;NSString\\&quot;16@?&lt;v@?@\\&quot;NSString\\&quot;&gt;24&quot;;\nNSMethodSignature *signature = [NSMethodSignature signatureWithObjCTypes:types];\nprintf(&quot;%s\\n&quot;, [signature getArgumentTypeAtIndex:3]);\n\n// Outputs: @?&lt;v@?@&quot;NSString&quot;&gt;\n</code></pre>\n"^^ . . "0"^^ . . "2"^^ . "What exactly do you mean by *"How do I get the text at the desired point (10, 10)"* ??? Do you want the **label frame** at (10, 10)? The first **character**? The text's glyph bounding box? Examples: https://i.sstatic.net/gM1Zz.png"^^ . . . . . "(I'd love to hear more about what you're doing with this. Maybe trying to bridge ObjC exceptions over to C#? That would be very clean for Swift `throws`, but I worry the differences in intent between what ObjC and C# mean by "exception" would break that. Anyway; best of luck with your project.)"^^ . . . . . . . "jailbreak"^^ . "nsdictionary"^^ . . "<p>I want to start pjsip default example on iPhone(simulator). When I make a call I get this error:</p>\n<pre><code>12:00:29.220 pjsua_aud.c .Set sound device: capture=-1, playback=-2, mode=0, use_default_settings=0\n12:00:29.221 pjsua_aud.c ..Error retrieving default audio device parameters: Unable to find default audio device (PJMEDIA_EAUD_NODEFDEV) [status=420006]\n12:00:29.223 pjsua_media.c .Call 0: deinitializing media..\n12:00:29.223 call.cpp pjsua_call_make_call(acc.getId(), &amp;pj_dst_uri, param.p_opt, this, param.p_msg_data, &amp;id) error: Unable to find default audio device (PJMEDIA_EAUD_NODEFDEV) (status=420006) [../src/pjsua2/call.cpp:701]\npjsua_call_make_call(acc.getId(), &amp;pj_dst_uri, param.p_opt, this, param.p_msg_data, &amp;id) error: Unable to find default audio device (PJMEDIA_EAUD_NODEFDEV)\n</code></pre>\n<p>I configured and compiled the pjsip like this</p>\n<pre><code>sudo make distclean\n\nsudo make clean\n\nexport DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/\n\nexport ARCH=&quot;-arch x86_64&quot; CFLAGS=&quot;-O2 -m32 -mios-simulator-version-min=5.0&quot; LDFLAGS=&quot;-O2 -m32 -mios-simulator-version-min=5.0&quot;\n\n./configure-iphone\n\nsudo make dep \n\nsudo make \n\nsudo make install\n</code></pre>\n<p>I tried it on my iPhone and got the same error.\nI find solution <a href="https://stackoverflow.com/questions/16483635/pjsip-new-call-error-unable-to-find-default-audio-device-pjmedia-eaud-nodef">here</a>, but i can’t install libasound2-dev on MacOS</p>\n<p>I use example from pjsipproj/pjsip-apps/src/pjsua2/ios-swift-pjsua2</p>\n<p>PJSIP version: 2.13.1\nOS: MacOS Ventura 13.5\nIOS: 16.4</p>\n"^^ . . "@HangarRash yes I saw this but as you have mentioned this is not called in all cases and I want some way of assuring that a crash has occurred. There is a chance that it may not get called giving me a false crash. I want a solid way of identifying that the crash has occurred. Also how do the 3rd party libraries do it? Very curious."^^ . "3"^^ . . "1"^^ . . . . "nsarray"^^ . . . "Cannot find generated -Swift.h file from local pod"^^ . . . "0"^^ . "Thank you for your answer. From what I see on Quick's website, the hierarchy is still flat when in the Xcode report viewer."^^ . . . . . "pjsip can't detect audio device ios"^^ . "1"^^ . . . "@DonMag I didn't understand why the label did not appear at (10, 10). And, related to that, what the purpose of `[screenshot drawInRect:drawRect]` is (nobody commented/answered on that). I don't understand your confusion, because my only question was about how to get the label at the desired (10, 10) instead of (0, 0); I asked nothing about alignment. Of course in any conversation there are two, so it appears I could have been more clear (and replied quicker). Your suggestion above worked, yet I'm still interested to get my questions answered."^^ . . . . . . "0"^^ . "<p>If you do not want to use third party solutions, you may use userdefaults, set to &quot;crash&quot; just after the app launch and to &quot;no crash&quot; when cleanly quitting. It will read to crash if and only if the app did not quit cleanly.</p>\n<p>Global variables</p>\n<pre><code>let keyCrash = &quot;keyCrash\nlet userDefaults = UserDefaults.standard\n</code></pre>\n<p><code>ViewDidLoad</code> in <code>ViewController</code></p>\n<pre><code>let didCrash = userDefaults.value(forKey: keyCrash) as? Bool ?? false\nif didCrash {\n // handle crash\n}\nuserDefaults.set(true, forKey: keyCrash)\n</code></pre>\n<p><code>AppDelegate</code></p>\n<pre><code>func applicationWillTerminate(_ application: UIApplication){\n userDefaults.set(false, forKey: keyCrash)\n}\n</code></pre>\n"^^ . . . "<p>With plain XCTest, no. But with the third-party library Quick, yes. <a href="https://github.com/Quick/Quick" rel="nofollow noreferrer">https://github.com/Quick/Quick</a></p>\n"^^ . "<p>I want to make a backwards-compatible background view for my application (OS X 10.6+) and then use it inside my <strong>Application.xib</strong>.</p>\n<p>I made a subclass of NSView which returns NSVisualEffectView or NSView (depends on macOS version).</p>\n<p>BackgroundView.h</p>\n<pre><code>#import &lt;Cocoa/Cocoa.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface BackgroundView : NSView\n\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<p>BackgroundView.m</p>\n<pre><code>#import &quot;BackgroundView.h&quot;\n\n@implementation BackgroundView\n\n- (instancetype)init {\n if (@available(macOS 10.10, *)) {\n NSVisualEffectView *visualEffectView = [[NSVisualEffectView alloc] init];\n [self applyPropertiesForVisualEffectView: visualEffectView];\n }\n \n return [super init];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)coder {\n if (@available(macOS 10.10, *)) {\n NSVisualEffectView *visualEffectView = [[NSVisualEffectView alloc] initWithCoder:coder];\n [self applyPropertiesForVisualEffectView: visualEffectView];\n \n // !!!&quot;This coder requires that replaced objects be returned from initWithCoder:&quot;!!!\n return (BackgroundView *)visualEffectView;\n }\n \n return [super initWithCoder:coder];\n}\n\n- (instancetype)initWithFrame:(NSRect)frameRect {\n if (@available(macOS 10.10, *)) {\n NSVisualEffectView *visualEffectView = [[NSVisualEffectView alloc] initWithFrame:frameRect];\n [self applyPropertiesForVisualEffectView: visualEffectView];\n \n return (BackgroundView *)visualEffectView;\n }\n \n return [super initWithFrame: frameRect];\n}\n\n- (void)applyPropertiesForVisualEffectView: (NSVisualEffectView *)visualEffectView API_AVAILABLE(macos(10.10)){\n [visualEffectView setState:NSVisualEffectStateActive];\n [visualEffectView setBlendingMode:NSVisualEffectBlendingModeBehindWindow];\n}\n\n@end\n</code></pre>\n<p>Then I inserted my <strong>BackgroundView</strong> class name as the class for the windows' main view.\n<a href="https://i.sstatic.net/EmW2I.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EmW2I.jpg" alt="My XIB main view Custom Class" /></a></p>\n<p>And then ticked off &quot;<strong>Prefers coder at runtime</strong>&quot;:\n<a href="https://i.sstatic.net/qb1qO.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qb1qO.png" alt="Ticked off option &quot;Prefers coder at runtime&quot;" /></a></p>\n<p>But I'm getting this error for whatever reason.\n<a href="https://i.sstatic.net/OSWAW.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/OSWAW.jpg" alt="This coder requires that replaced objects be returned from initWithCoder:" /></a></p>\n<p>How can I fix this issue?<br />\nI don't want to use some dynamic class injections like <a href="https://stackoverflow.com/questions/25914918/how-to-use-nsvisualeffectview-backwards-compatible-with-osx-10-10">here</a> because it looks like an awful solution in 2023.<br />\nI know I can add NSVisualEffect as a subview but I don't think it's as a good practice.</p>\n<p>Thanks.</p>\n"^^ . . . "You can read about `applicationWillTerminate(_:)` in the [official documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623111-applicationwillterminate). This delegate method will only be called, when the app will be terminated in an _orderly fashion_ – not when it crashes. BUT, my definition what "crash" means might be different than yours ;) Please define _exactly_ what a "crash" is in your view."^^ . "<p>I try to write to the AppGroup shared container with the following Ojecttive-C code:</p>\n<pre><code>NSFileManager *fileManager = [NSFileManager defaultManager]; \nNSURL *path = [fileManager \n containerURLForSecurityApplicationsGroupIdentifier:@&quot;group.*myGroupIdentifier*&quot;]; \nNSString *vtPath = [path.absoluteString stringByAppendingPathComponent:*fileName*]; \n[fileManager createFileAtPath:vtPath contents:nil attributes:nil]; \nNSFileHandle *vtData = [NSFileHandle fileHandleForWritingPath: vtPath];\n</code></pre>\n<p>At this point vtData is always nil, so I can't write there.</p>\n<p>The Path with appended fileName looks like\n@&quot;file:///Users/***/Library/Developer ... /data/Containers/Shared/AppGroup/ ... /Library/filename.dat&quot;</p>\n<p>I have not found a solution after searching for hours. What am I doing wrong?</p>\n"^^ . "1"^^ . . "0"^^ . . . "nskeyedarchiver"^^ . . "4"^^ . . . "<p>I am trying to make a CLI audio player in Objective-C on jailbroken iOS14.<br />\nBut the audioPlayerDidFinishPlaying method is not fired.<br />\nI wrote some codes like this.</p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n#import &lt;AVFoundation/AVFoundation.h&gt;\n#include &lt;unistd.h&gt;\n\n@interface AVAPDelegate: NSObject&lt;AVAudioPlayerDelegate&gt;\n@end\n\n@implementation AVAPDelegate\n-(void) audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag {\n NSLog(@&quot;ok&quot;);\n}\n@end\n\nint main(){\n AVAPDelegate *dele = [[AVAPDelegate alloc] init];\n AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL URLWithString:@&quot;test.mp3&quot;] error:nil];\n player.delegate = dele;\n [player prepareToPlay];\n [player play];\n\n while(player.isPlaying){\n sleep(1);\n }\n return 0;\n}\n</code></pre>\n<p>Result: no output<br />\nWhat should I do?</p>\n"^^ . . . . . "Can XCTestCases be grouped hierarchically?"^^ . . "Math differences in Swift and Objective-C"^^ . . "upload"^^ . . . . . "<p>I have managed to figure out my issue using the guidance of the example from this stackoverflow post. <a href="https://stackoverflow.com/questions/32934329/upload-multipart-image-to-php-server-from-ios-app">Upload multipart image to PHP server from iOS app</a> .\nI did have to convert the example from Swift to Objective C with a few minor changes to suit my needs but it worked well.</p>\n"^^ . "nsurlsession"^^ . "1"^^ . "2"^^ . . . "<p>You asked:</p>\n<blockquote>\n<p>Is there a valid way to get a return value from a Swift async method and return it from inside a non-async method?</p>\n</blockquote>\n<p>No, there really isn’t. Apple is very specific that blocking should be avoided and that, where absolutely needed, things like locks must be isolated to a “tight, well-known critical section”. (The example would be a lock used for a very quick synchronization within a task, but not across separate tasks or continuations.) For more information, see <a href="https://developer.apple.com/videos/play/wwdc2021/10254?time=1507" rel="nofollow noreferrer">Swift concurrency: Behind the scenes</a>. But we have a contract with Swift concurrency to never “impede forward progress”. It's the whole idea behind a “concurrency system” (as in contrast to “parallelism”).</p>\n<p>You raised the example of a <code>UITableViewDataSource</code>. The table view is requesting data and expects/requires the data source to return the results immediately and synchronously. You cannot return the result asynchronously. And you would never block to fetch the results with some anti-pattern (like semaphores, locks, etc.).</p>\n<p>What you <em>can</em> do is initiate the asynchronous process and return nothing for now. Then, when the <code>async</code> fetch is done, tell the table view to <code>reloadData</code>, which will initiate a new query of the <code>UITableViewDataSource</code>. So keep the data source synchronous, but go ahead and use Swift concurrency to launch a task and later initiate a <code>reloadData</code>.</p>\n<p>You also mention the <code>CKSyncEngineDelegate</code> example. That is a curious implementation, where the <a href="https://developer.apple.com/documentation/cloudkit/cksyncengine/" rel="nofollow noreferrer">Swift rendition</a> is <code>async</code>, but the <a href="https://developer.apple.com/documentation/cloudkit/cksyncengine?language=objc" rel="nofollow noreferrer">Objective-C rendition</a> is not (it has no completion handler). So, clearly the framework has been implemented with an asynchronous delegate for Swift developers, but they simply do not offer asynchronous support for Objective-C clients. (I can only guess that they did not want to encumber Objective-C developers with the burden of calling a completion handler, while offering Swift developers a very natural asynchronous interface, where you might have a suspension point, but you might not. That results in an unusual asymmetry between the two programming languages with this framework.) Re the standard interface with async interfaces between Swift and Objective-C, see <a href="https://developer.apple.com/documentation/swift/calling-objective-c-apis-asynchronously" rel="nofollow noreferrer">Calling Objective-C APIs Asynchronously</a>).</p>\n\n"^^ . . . . . . . . . . "1"^^ . "0"^^ . "0"^^ . . . . . . "1"^^ . . . . . "<p>No, the <code>cgo</code>-generated <code>getlark._Ctype_struct_NSDictionary</code> is certainly not a Go <code>map</code> so <code>dd[&quot;Height&quot;]</code> won't obviously work. Please note that <code>cgo</code> is a rather thin layer, it does not do any special magic like somehow turning random implementations of assotiative arrays done in C into Go <code>map</code>s.</p>\n<p>What you should probably do is to write helper code in your C part (that bit which defined <code>GetChrome</code>) which would operate on <code>NSDictionary</code>s. Say, something like this (completely untested):</p>\n<pre><code>char *getNSDictInt(NSDictionary *dict, char *key) int {\n s_key = convertKeyToNSString(key); /* must be implemented */\n return dict[s_key];\n}\n</code></pre>\n<p>and then call them like this:</p>\n<pre class="lang-golang prettyprint-override"><code>dd := C.FindChrome()\nheight := C.getNSDictInt(dd, &quot;Height&quot;)\n</code></pre>\n<p>You'd need to provide such &quot;accessors&quot; for each type of values your <code>NSDictionary</code> may hold.</p>\n<p>(!) Note that after some digging I found out that the keys in a <code>NSDictionary</code> are <code>NSString</code>s which are sequences of UTF-16 code units, so you must use something like <a href="https://stackoverflow.com/a/10797380/720999">this</a> to get an <code>*NSString</code> out of the incoming <code>char *key</code>. (This can also be done on the Go side, but let's start small.)</p>\n<p>Another solution should be to get a ready-made package which is already prepared to deal with Cocoa API's code types–such as <a href="https://github.com/progrium/macdriver" rel="nofollow noreferrer">this</a> or <a href="https://github.com/danielpaulus/go-ios" rel="nofollow noreferrer">this</a>–which both were found by a <a href="https://www.google.com/search?q=golang+NSDictionary" rel="nofollow noreferrer">simple search</a>.</p>\n"^^ . . . "uiimage"^^ . . . . . . "0"^^ . . . . "3"^^ . . . "And don't forget about [NSUndoManager](https://developer.apple.com/documentation/foundation/nsundomanager?language=objc), which is possibly relevant to problems in this space."^^ . . "<p>I'm using macOS native framework to sent https requests (nsurlsession). In order to handle TLS flows of server-side authentication, I've implemented the <code>didReceiveChallenge</code> callback.</p>\n<p>In my special case, My https request's URL composed of IP instead of URL, so i'd like to remove one default check of matching the URL with the server certificate's common name, but remains all the other checks. Perhaps anybody can verify my code ?</p>\n<p>Thanks</p>\n<p>is it possible to eliminate this check for specific connections ?</p>\n<p>UPDATE:</p>\n<p>Thanks to the comment below by Larme, I was able to further research the topic and bind the hostname check to a specific URL instead of the ip address.</p>\n<pre><code>- (void)URLSession:(NSURLSession*)session\n didReceiveChallenge:(NSURLAuthenticationChallenge*)challenge\n completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition,\n NSURLCredential* credential))completionHandler {\n\n if (challenge.protectionSpace.authenticationMethod ==\n NSURLAuthenticationMethodServerTrust) {\n\n BOOL allow = true;\n if (URL_IS_IP) { \n SecTrustRef trust;\n\n trust = challenge.protectionSpace.serverTrust;\n OSStatus err;\n SecPolicyRef policy;\n\n policy = SecPolicyCreateSSL(true, CFSTR(&quot;matchinUrl.com&quot;));\n err = SecTrustSetPolicies(trust, policy);\n if (err == errSecSuccess) {\n allow = evaluateTrust(trust);\n }\n CFRelease(policy);\n } \n\n if (allow) {\n completionHandler(\n NSURLSessionAuthChallengeUseCredential, \n [NSURLCredential credentialForTrust:trust]);\n } else {\n completionHandler(\n NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);\n }\n } else {\n completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);\n }\n}\n\n</code></pre>\n"^^ . . "0"^^ . "0"^^ . . . . . . . "I forgot to add this line in at the start of the PHP file "echo "The PHP script has started"."<br>";" this will then tie up with the debug output."^^ . "@Scott: the issue has certainly something to do with caches, but your suggestion didn't work. I also tried to call `-recache` on the image before/after removing and re-adding all images representation, together with, `NSImageCacheNever` (which should be redundant with `-recache`)... nothing works. I'd rather not use an `NSImageView`. I think I'll end up using different images for dark/light modes as I'm out of ideas."^^ . . . "0"^^ . . . "0"^^ . . . . "<p>Your <code>typedef</code> is fine as-is though I would name it <code>ResponseBlock</code>, not <code>responseBlock</code>.</p>\n<pre><code>typedef void(^ResponseBlock)(UIImage * _Nullable image);\n</code></pre>\n<p>When you use <code>ResponseBlock</code>, don't use a pointer.</p>\n<p>I also suggest changing <code>loadingResponses</code> to be an <code>NSMutableDictionary</code> so you can assign values to it.</p>\n<p>Here's an updated version of your code:</p>\n<p>The interface:</p>\n<pre><code>typedef void(^ResponseBlock)(UIImage * _Nullable image);\n\n@interface ImageManager : NSObject\n\n@property (nonatomic, strong) NSMutableDictionary&lt;NSString *, NSMutableArray&lt;ResponseBlock&gt; *&gt; *loadingResponses;\n\n@end\n</code></pre>\n<p>The method:</p>\n<pre><code>- (void)fetchImage:(NSString *)urlString and:(ResponseBlock)completionHandler {\n UIImage *image = [self.cache objectForKey:urlString];\n\n if (image != nil) {\n completionHandler(image);\n return;\n }\n\n if (self.loadingResponses[urlString] != nil) {\n [self.loadingResponses[urlString] addObject:completionHandler];\n return;\n } else {\n self.loadingResponses[urlString] = [NSMutableArray arrayWithObject:completionHandler];\n }\n\n NSURL *url = [[NSURL alloc] initWithString:urlString];\n [[self.session dataTaskWithURL:url completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {\n if (error != nil) {\n UIImage *image = [[UIImage alloc] initWithData:data];\n [self.cache setObject:image forKey:urlString];\n completionHandler(image);\n\n NSArray *array = [self.loadingResponses objectForKey:urlString];\n\n for (ResponseBlock responseCompletion in array) {\n responseCompletion(image);\n }\n }\n }] resume];\n}\n</code></pre>\n<p>I'm assuming somewhere you initialize <code>loadingResponses</code> as:</p>\n<pre><code>self.loadingResponses = [NSMutableDictionary dictionary];\n</code></pre>\n<p>You also need to call the completion handler if there is an error. Perhaps you mean to do:</p>\n<pre><code> [[self.session dataTaskWithURL:url completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {\n UIImage *image = nil;\n if (error != nil) {\n image = [[UIImage alloc] initWithData:data];\n [self.cache setObject:image forKey:urlString];\n }\n\n completionhHandler(image);\n\n NSArray&lt;ResponseBlock&gt; *array = self.loadingResponses[urlString];\n\n for (ResponseBlock responseCompletion in array) {\n responseCompletion(image);\n }\n }] resume];\n</code></pre>\n"^^ . . "Cocoapods framework: Assets is in different bundle with framework's bundle"^^ . . "Make your async call, get the result, post a notification and then call your sync call with the result from the notification object. Be careful when combining notification with async calls."^^ . . "Maybe some infos there https://stackoverflow.com/questions/50625036/use-resource-bundles-in-cocoapods"^^ . "nsdata"^^ . . "1"^^ . . . . "<p>I'm trying to update MBProgressHUD in my controller.\nFrom only showing a static message, i want to put either progressbar/progress percentage to show uploading process to user.</p>\n<pre><code>YBWeakSelf;\n[[YBStorageManage shareManage]getCOSInfo:^(int code) {\n dispatch_async(dispatch_get_main_queue(), ^{\n if (code == 0) {\n [weakSelf startUpload];\n }\n });\n}];\n[self networkState];\n\n-(void)startUpload{\nYBWeakSelf;\ndispatch_group_t group = dispatch_group_create();\ndispatch_queue_t queue = dispatch_get_global_queue(0, 0);\ndispatch_semaphore_t semaphore = dispatch_semaphore_create(0);\n\nNSString *filePath =_videoPath;\n//传图片\n\ndispatch_group_async(group, queue, ^{\n NSData *imageData = UIImagePNGRepresentation(_videoCoverImage);\n\n if (!imageData) {\n [MBProgressHUD hideHUD];\n [MBProgressHUD showError:YZMsg(@&quot;请重新选择&quot;)];\n return;\n }\n UIImage *herfImg = [UIImage imageWithData:imageData];\n NSString *imageName = [PublicObj getNameBaseCurrentTime:@&quot;.png&quot;];\n [[YBStorageManage shareManage]yb_storageImg:herfImg andName:imageName progress:^(CGFloat percent) {\n \n }complete:^(int code, NSString *key) {\n //图片成功\n [weakSelf uploadimagesuccess:key];\n\n dispatch_semaphore_signal(semaphore);\n }];\n dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);\n});\n\ndispatch_group_async(group, queue, ^{\n //传视频\n NSString *videoName = [PublicObj getNameBaseCurrentTime:@&quot;.mp4&quot;];\n\n [[YBStorageManage shareManage]yb_storageVideoOrVoice:filePath andName:videoName progress:^(CGFloat percent) {\n \n } complete:^(int code, NSString *key) {\n //请求app业务服务器给标题\n [weakSelf uploadvideosuccess:key andTitle:mytitle];\n dispatch_semaphore_signal(semaphore);\n }];\n dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);\n});\n\n\n//上传水印视频\n\nNSString *mkfilePath =_videoWmkPath;\n\ndispatch_group_async(group, queue, ^{\n NSData *imageData = UIImagePNGRepresentation(_videoWmkCoverImage);\n\n if (!imageData) {\n [MBProgressHUD hideHUD];\n [MBProgressHUD showError:YZMsg(@&quot;请重新选择&quot;)];\n return;\n }\n UIImage *herfImg = [UIImage imageWithData:imageData];\n NSString *imageName = [PublicObj getNameBaseCurrentTime:@&quot;_mk .png&quot;];\n [[YBStorageManage shareManage]yb_storageImg:herfImg andName:imageName progress:^(CGFloat percent) {\n \n }complete:^(int code, NSString *key) {\n //图片成功\n [weakSelf uploadWmkimagesuccess:key];\n\n dispatch_semaphore_signal(semaphore);\n }];\n dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);\n});\n\ndispatch_group_async(group, queue, ^{\n //传视频\n NSString *videoName = [PublicObj getNameBaseCurrentTime:@&quot;_mk.mp4&quot;];\n\n [[YBStorageManage shareManage]yb_storageVideoOrVoice:mkfilePath andName:videoName progress:^(CGFloat percent) {\n \n } complete:^(int code, NSString *key) {\n //请求app业务服务器给标题\n [weakSelf uploadvideoWmksuccess:key andTitle:mytitle];\n dispatch_semaphore_signal(semaphore);\n }];\n dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);\n});\ndispatch_group_notify(group, queue, ^{\n dispatch_async(dispatch_get_main_queue(), ^{\n [self requstAPPServceTitle:mytitle andVideo:_videokey andImage:_imagekey];\n });\n NSLog(@&quot;任务完成执行&quot;);\n}); }\n</code></pre>\n<p>How can i update MBProgressHUD to have a progress bar there ?\nmeanwhile there are 4 async in queue thread.\nI want to take the <code>progress:^(CGFloat percent)</code> and put it in MBProgressHUD\nSince it is an update view progress, i have to put it in main thread, right ?\nI've tried several times, but always stuck at the end.</p>\n<p>i've tried to put dispatch main in every <code>progress:^(CGFloat percent)</code>\nbut it always give a purple warning said <code>Thread running at QOS_CLASS_USER_INITIATED waiting on a thread without a QoS class specified. Investigate ways to avoid priority inversions</code></p>\n"^^ . "1"^^ . . "See [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example). We generally cannot help if we can’t reproduce the problem (and we shouldn’t have to go through a lot of kruft to get there). And, to HangarRash’s observation, that link says “[DO NOT use images of code](https://meta.stackoverflow.com/q/285551). Copy the actual text from your code editor, paste it into the question, then [format it as code](https://stackoverflow.com/editing-help#code).”"^^ . . . "0"^^ . . . . . . . . . . . . "<p>I changed the code and finally got the &quot;ok&quot; output.</p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n#import &lt;AVFoundation/AVFoundation.h&gt;\n\n@interface AVAPDelegate: NSObject&lt;AVAudioPlayerDelegate&gt;\n@end\n\n@implementation AVAPDelegate\n-(void) audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag {\n NSLog(@&quot;ok&quot;);\n}\n@end\n\nint main(){\n AVAPDelegate *dele = [[AVAPDelegate alloc] init];\n AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL URLWithString:@&quot;test.mp3&quot;] error:nil];\n player.delegate = dele;\n [player prepareToPlay];\n [player play];\n\n [[NSRunLoop currentRunLoop] run];\n return 0;\n}\n</code></pre>\n"^^ . "<p>I am writing an application using React Native on macOS. By default, the window shows as such:</p>\n<p><a href="https://i.sstatic.net/EtbHL.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EtbHL.png" alt="enter image description here" /></a></p>\n<p>I have managed to hide the title and make the titlebar transparent, as such (ignore the title in the screenshot):</p>\n<p><a href="https://i.sstatic.net/d9KdK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/d9KdK.png" alt="enter image description here" /></a></p>\n<p>I would now like to move the 'traffic lights' down/set the toolbar style to match the style shown below:</p>\n<p><a href="https://i.sstatic.net/CBq42.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/CBq42.png" alt="enter image description here" /></a></p>\n<p>Unfortunately, I can't seem to figure out the combination of settings or so required to do this.</p>\n<p>I am constrained to extending an <strong>objective-c</strong> AppDelegate implementation. I have the current code;</p>\n<pre><code>- (void)applicationWillBecomeActive:(NSNotification *)notification\n{\n NSWindow *window = [[NSApplication sharedApplication] mainWindow];\n window.titleVisibility = NSWindowTitleHidden;\n window.titlebarAppearsTransparent = true;\n window.styleMask |= NSWindowStyleMaskFullSizeContentView;\n}\n</code></pre>\n<p>This works to get to the second stage. I have tried variations such as ;</p>\n<pre><code>- (void)applicationWillBecomeActive:(NSNotification *)notification\n{\n NSWindow *window = [[NSApplication sharedApplication] mainWindow];\n window.titleVisibility = NSWindowTitleHidden;\n window.titlebarAppearsTransparent = true;\n window.styleMask |= NSWindowStyleMaskFullSizeContentView;\n NSToolbar *toolbar = [NSToolbar init];\n window.toolbar = toolbar;\n}\n</code></pre>\n<p>or</p>\n<pre><code>- (void)applicationWillBecomeActive:(NSNotification *)notification\n{\n NSWindow *window = [[NSApplication sharedApplication] mainWindow];\n window.titleVisibility = NSWindowTitleHidden;\n window.titlebarAppearsTransparent = true;\n window.styleMask |= NSWindowStyleMaskFullSizeContentView;\n window.toolbarStyle = NSWindowToolbarStyleUnified;\n}\n</code></pre>\n<p>and other variations of <code>toolbarStyle</code>, to no avail.</p>\n"^^ . . . . "0"^^ . . . . . "cgo"^^ . . . . . "If you don't want to add a third party library, and very likely also don't want to add your own crash handler (which is quite complex), the answer is No. The things you can actually do in a crash handler (not an exception handler!) is very, very limited and requires special knowledge to implement properly."^^ . "cocoapods"^^ . . "Also, be aware that the `wait` on one block can satisfied by the `signal` of a completely different async call. Not a big deal, but it’s something to be cautious about when using semaphores (but becomes moot when you retire them). Finally, note that your first `dispatch_semaphore_wait` is using a QoS for the duration, which is obviously a typo."^^ . "Thanks, I see now: you want to get a value _from_ the returned `NSDictionary` using some key."^^ . . . "libvlc"^^ . . "`print` is not the same as `NSLog` with a format string"^^ . . . . . . . "<p>Both languages return the same number but they are formatted differently. I assume that you understand the scientific notation 5.36e-06 is the same as 0.00000536.</p>\n<p>The format specifiers of <code>NSLog</code> follow the <a href="https://pubs.opengroup.org/onlinepubs/009695399/functions/printf.html" rel="nofollow noreferrer">IEEE printf specification</a>. When describing the specifier <code>f</code>, it says:</p>\n<blockquote>\n<p>If the precision is missing, it shall be taken as 6;</p>\n</blockquote>\n<p>So it's rounded to 6 digits after the point, without using scientific notation (like <em>e-06</em>). It means that all except a single digits are removed.</p>\n<p>Swift's <code>print</code> function doesn't use format specifiers. Instead, the documentation state:</p>\n<blockquote>\n<p>The textual representation for each item is the same as that obtained by calling <code>String(item)</code>.</p>\n</blockquote>\n<p>It obviously choses to print it with scientific notation and the maximum number of relevant digits.</p>\n"^^ . . . . "`self` is a pointer to your class containing function `+simpleTest`. Why should the argument to a function be located at a certain offset behind `self`? Its probably located on the stack or in a register depending on the ABI to call a function..."^^ . . "matt is right here. The vexing thing here is – according the [official documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623111-applicationwillterminate) – "this method **may be called** in situations where the app is running in the background (not suspended) and the system needs to terminate it for some reason." So, it may or may not be called. I have to agree, that this is not exactly what we developers expect. alas."^^ . . "1"^^ . . . "objective-c"^^ . . . "0"^^ . . . "<p>I just went through this myself a few days ago. The header files that you add to the main framework header are meant to be the public headers of your framework. This means you need to mark the header as being public (versus project or private).</p>\n<p>The following screenshot shows what you need to do:</p>\n<p><a href="https://i.sstatic.net/45CBR.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/45CBR.png" alt="enter image description here" /></a></p>\n<ol>\n<li>Select the header that should be public.</li>\n<li>Ensure the Inspectors pane is being shown on the right side of Xcode.</li>\n<li>Select the File Inspector tab.</li>\n<li>Under Target Membership, ensure the header is marked as Public. It defaults to Project.</li>\n</ol>\n<p>With those steps complete you can add the <code>#import &lt;Logger/AppLogger.h&gt;</code> line to the Logger.h file.</p>\n<hr />\n<p>For other .h files in the project, you need to follow the same steps but select &quot;Project&quot; (not Public or Private). And use a &quot;normal&quot; import. For example, in AppLogger.m you might need to import BaseLog.h. Use:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &quot;BaseLog.h&quot;\n</code></pre>\n<p>after setting BaseLog.h was a target membership of &quot;Project&quot;.</p>\n"^^ . . . "I'm afraid the XCTest reporter may still flatten things, but you never know until you try an experiment."^^ . . "0"^^ . . "Also the PHP file in the Objective C code should read "TokenUpload.php""^^ . "<p>The following code works for me:</p>\n<pre><code>- (void)applicationWillBecomeActive:(NSNotification *)notification\n{\n NSWindow *window = [[[NSApplication sharedApplication] windows] firstObject];\n window.titleVisibility = NSWindowTitleHidden;\n window.titlebarAppearsTransparent = true;\n window.styleMask |= NSWindowStyleMaskFullSizeContentView;\n window.toolbar = [NSToolbar new]; // &lt;-- Note this is `new` and not `init`\n window.toolbarStyle = NSWindowToolbarStyleUnified;\n}\n</code></pre>\n<p><a href="https://i.sstatic.net/TmMQF.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TmMQF.png" alt="enter image description here" /></a></p>\n"^^ . . "I would encourage you to retire `dispatch_group_async`, too. It is superfluous. Just enter/leave/notify."^^ . "D'oh. No wonder why no one else complained about this issue... Shame on me. I must have looked up the doc for some subclass (NSComparisonPredicate maybe) rather than NSPredicate. Thanks."^^ . . "0"^^ . "0"^^ . "0"^^ . "1"^^ . . . . "1"^^ . . "For some simple implementations of this, see the trampolines in https://github.com/iosptl/ios7ptl/tree/master/ch24-DeepObjC/ObserverTrampoline."^^ . . "Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/254648/discussion-between-rob-and-hangarrash)."^^ . . "2"^^ . "Have you tried constructing the predicate in code with `[NSPredicate predicateWithFormat:@"property LIKE %@", string]` and `NSCompoundPredicate`?"^^ . . "0"^^ . . . . . . . . . "How to detect if iOS app has crashed previously?"^^ . . . . . . "Navigating tvOS UITableView By Letter of Alphabet"^^ . . . . . "1"^^ . . "For this I thought I can have crash set to false in `applicationDidEnterBackground` , set it back to true in `applicationWillEnterForeground` so in case user goes to background we automatically make it false to avoid this case. @matt does it sound good now. Additionally I want to look at all the lifecycle methods too to check for false positives."^^ . . . . "2"^^ . . . . "The typical way in which your app stops running is that we move to the background and then the _system_ quits the app. In that case, `applicationWillTerminate` is not called. So that is the most common situation. We did not crash at all; we terminated _in good order_."^^ . . "0"^^ . . . "5"^^ . "What's the format for `objc_method_description.types` for swift blocks?"^^ . "0"^^ . "0"^^ . . . . . "0"^^ . "As an aside, semaphores should be removed. (They are so susceptible to problems that they’re best considered an anti-pattern nowadays.) This can easily be refactored to eliminate the semaphores and `dispatch_group_async` and just `dispatch_group_enter` before your async calls and `dispatch_group_leave` in the final completion handler. That’s much simpler than what you have here and less brittle."^^ . . . . . . "0"^^ . "0"^^ . "didReceiveRemoteNotification doesn't get called if mac app isn't running"^^ . . . "0"^^ . "4"^^ . "i looked at it again and i missed it, the extra step is indeed required, you are correct, glad you figured it out anyway"^^ . . . . "0"^^ . "0"^^ . . . "@DonMag The size is an example. For your understanding, this text image will act as an overlay to an icon image of for example 100x100. I need to place the text in a certain box at a certain position on the icon image. (Already have logic to compose the icon from one or more image assets.)"^^ . . . "<p>Is it possible to get a callback when a push notification is received but the mac app is force killed ?</p>\n"^^ . "0"^^ . . . "1"^^ . . . . "AFAIK, they both strictly follow IEEE754, so you shouldn't see any differences in the actual values. As far as _presentation_ goes though, all bets are off. `print` and `NSLog` clearly differ, and there's no real reason to expect them to behave identically."^^ . "0"^^ . . . . . . "0"^^ . . . . "3"^^ . . . . . "0"^^ . . . . . "2"^^ . . "react-native"^^ . . "<p>I'm creating a socket using apple's <code>Network.Framework</code> with <code>nw_connection_create()</code> (which as far as I can tell is the modern, non-deprecated approach to make a TCP connection)</p>\n<p>My flow</p>\n<ul>\n<li>Create end point <code>nw_endpoint_create_host()</code></li>\n<li>Create a connection <code>nw_connection_create()</code></li>\n<li>I create a dispatch queue <code>dispatch_queue_create(DISPATCH_QUEUE_SERIAL)</code></li>\n<li>assign with <code>nw_connection_set_queue()</code></li>\n<li>set status callback <code>nw_connection_set_state_changed_handler()</code></li>\n<li>Start <code>nw_connection_start</code></li>\n<li>Request first recv (incrementing <code>RecvCallCount</code> atomic first - see below) <code>nw_connection_receive</code></li>\n</ul>\n<p>I send &amp; recieve packets/data, status, no problem.\nEvery callback from recv decrements <code>RecvCallCount</code> atomic so I know I'm no longer waiting for a callback.</p>\n<p>When I want to shutdown the socket</p>\n<ul>\n<li><code>nw_connection_force_cancel()</code></li>\n<li><code>nil</code> or release the connection</li>\n<li><code>nil</code> or release the dispatch queue</li>\n<li>My class destructs</li>\n</ul>\n<p>After this, I can get spurious callbacks from the recv callback, or state changed handler. (Which crash as they access my object which has been destructed)\nThe thunk seems to come from nowhere according to xcode, as I'm down to a single thread (Not sure how this is true)</p>\n<ul>\n<li>I have a mutex around any use of the connection handle, as calling send or recv after <code>nw_connection_force_cancel()</code> can crash (or possibly I had null'd it)</li>\n<li>Same effect with ARC on or off (with retain/release in applicable places)</li>\n<li>Same effects on ios &amp; macos</li>\n</ul>\n<p>There's no documentation mentioning this, but I can only assume there's a 1:1 call &amp; response with <code>nw_connection_receive</code> given the effects, so I tried setting an atomic (a ref counter) for every recv call and then made a <code>.wait()</code> in my destructor to wait for the atomic to get to zero (if not zero). This was fine for a while, but I'm getting some cases where the recv callback never occurs.</p>\n<p>Am I supposed to</p>\n<ul>\n<li>Never free until I've had the <code>cancel</code> status update?</li>\n<li>Stop the <code>nw_connection_t</code> in a different way?</li>\n<li>Flush the dispatch queue? (I tried enqueueing blocks and they come back so I assume nothing at destruction time is waiting on the queue)</li>\n<li>Flush the connection (can't see a way to do this)</li>\n</ul>\n<p>What is the correct way to end this socket? flush the dispatch queue, flush any recv callbacks.</p>\n<p>I'm unable to find a solid example using the <code>nw_</code> functions which actually cleans up, so I could easily be missing something obvious.</p>\n"^^ . "Update: The `NSImage` properly adapts to the appearance when I call `-drawInRect:` on it (within a `-drawRect:` method), without the need to recache anything. I just wouldn't change its appearance if I use it in a `CALayer`, even if I don't set it as `contents` and instead call `-drawInRect:` on the image it within `-drawLayer:InContext:`"^^ . . . "Another painpoint we hit was during debugging - inspecting an object's properties shouldn't terminate the process, but inspecting properties often results in "selector not found" exceptions (in particular when running on an earlier OS version - inspecting any property only available in a later OS version will throw a "selector not found" exception)."^^ . "Does this answer your question? [Skproduct skipping product because no price was available](https://stackoverflow.com/questions/73810958/skproduct-skipping-product-because-no-price-was-available)"^^ . . "@matt Sorry. I deleted while loop and added `[[NSRunLoop currentRunLoop] run];` and got "ok" output. Thank you very much!"^^ . "adapter"^^ . "0"^^ . . . . . "0"^^ . . . . . . "<p>I am creating a Turbo Module for React Native. The TM depends on another pod that I have created locally. I'm getting a compilation error stating that my generated <code>-Swift.h</code> header file is missing.</p>\n<p>Heres the setup:</p>\n<p>I have a local pod (lets call it &quot;MyLocalPod&quot;) that is written in Swift. It is intended to use this pod with Objective-C code from my Turbo Module, so I have placed <code>@objc</code> attributes to the relevant public code in the pod. I have also updated some <code>struct</code>s to be <code>class</code> objects that extends <code>NSObject</code> as well.</p>\n<p>I have a React Native Turbo Module package setup with an example RN project included. The TM package's podspec uses the above local pod like so:</p>\n<p><code>s.dependency &quot;MyLocalPod&quot;</code></p>\n<p>Now I know you cannot add a local development pod to a podspec file so I used a workaround from this answer <a href="https://stackoverflow.com/a/49422999/10820594">https://stackoverflow.com/a/49422999/10820594</a>. My example app's <code>Podfile</code> is like the following:</p>\n<p><code>pod 'MyLocalPod', :path =&gt; '/Users/dev/Projects/MyLocalPod'</code></p>\n<p>In my Objective-C (.mm file) source code for the TM I import my local pod like:</p>\n<p><code>#import &lt;MyLocalPod/MyLocalPod-Swift.h&gt;</code></p>\n<p>But I always get a compilation error when I run <code>npm run ios</code> that says <code>fatal error: 'MyLocalPod/MyLocalPod-Swift.h' file not found</code>. The <code>MyLocalPod-Umbrella.h</code> file is found, but not the <code>-Swift.h</code> file.</p>\n<p>I have tried a few things:</p>\n<ol>\n<li>Cleaned the product build, manually deleted DerivedData, and deleted Pods folder and Podfile.lock before completely re-adding the TM, codegen, and <code>pod install</code> multiple times (and in different orders)</li>\n<li>I manually built <code>MyLocalPod</code> before doing <code>pod install</code> in the example app</li>\n<li>Found the generated <code>MyLocalPod-Swift.h</code> header file deep in DerivedData and added its path to <code>HEADER_SEARCH_PATHS</code> in XCode</li>\n<li>Set <code>Defined Modules</code> to <code>YES</code> in <code>MyLocalPod</code>'s target's Build Settings</li>\n</ol>\n<p>Each possible fix never found the generated <code>-Swift.h</code> file.</p>\n"^^ . . . . "I am in the exact same situation, does someone have any news or solution ?"^^ . . "<p>I am trying to create bridge from native module to react native. I have tried all errors and solutions related to the same subject with no luck to get it running</p>\n<p>Following is my swift code</p>\n<pre><code>import Foundation\n\n@objc(MyModule)\nclass MyModule: NSObject {\n \n let mySdk = MySdkBuilder.build()\n \n @objc func renderForm(_ intentId: String,\n intentType: String,\n withResolver resolve: @escaping RCTPromiseResolveBlock,\n withRejecter reject: @escaping RCTPromiseRejectBlock) {\n\n let rootViewController: UIViewController?\n\n if #available(iOS 13.0, *) {\n rootViewController = (UIApplication.shared.connectedScenes.first as? UIWindowScene)?.windows.first(where: { $0.isKeyWindow })?.rootViewController\n } else {\n rootViewController = UIApplication.shared.delegate?.window??.rootViewController\n }\n\n mySdk.renderForm(\n on: rootViewController,\n intentId: intentId,\n intentType: intentType\n ) { details in\n do {\n resolve(details)\n } catch {\n let error = NSError(domain: &quot;MyDomain&quot;, code: -1, userInfo: nil)\n reject(&quot;1000&quot;, &quot;Error message&quot;, error)\n }\n }\n }\n \n}\n</code></pre>\n<pre><code>\n#import &quot;MyModule.h&quot;\n\n@implementation MyModule\nRCT_EXPORT_MODULE()\n\nRCT_EXTERN_METHOD(renderForm:(NSString *)intentId\n intentType:(NSString *)intentType\n withResolver:(RCTPromiseResolveBlock)resolve\n withRejecter:(RCTPromiseRejectBlock)reject)\n\n\n// Don't compile this code when we build for the old architecture.\n#ifdef RCT_NEW_ARCH_ENABLED\n- (std::shared_ptr&lt;facebook::react::TurboModule&gt;)getTurboModule:\n (const facebook::react::ObjCTurboModule::InitParams &amp;)params\n{\n return std::make_shared&lt;facebook::react::NativeMyModuleSpecJSI&gt;(params);\n}\n#endif\n\n@end\n</code></pre>\n<p>and here is my .h file</p>\n<pre><code>\n#ifdef RCT_NEW_ARCH_ENABLED\n#import &quot;RNMyModuleSpec.h&quot;\n\n@interface MyModule : NSObject &lt;NativeMyModuleSpec&gt;\n#else\n#import &lt;React/RCTBridgeModule.h&gt;\n\n@interface MyModule : NSObject &lt;RCTBridgeModule&gt;\n#endif\n\n@end\n</code></pre>\n<p>But I got the following error when tried to run the app</p>\n<pre><code>Exception 'renderForm:intentType:withResolver:withRejecter: is not a recognized Objective-C method.' was thrown while invoking renderForm on target MyModule with params (\n ZOkYjmZ,\n Payment,\n 46,\n 47\n)\n</code></pre>\n<p>I tried to change the order of the parameters and other solutions with no luck, any advice?</p>\n"^^ . . . . "appstore-sandbox"^^ . . . . . . . "0"^^ . "@RobNapier Generally speaking, I want to save the method name and the arguments of any method, then I could 'reproduce' the method at any time with NSInvocation instance created with the saved method name and arguments"^^ . . . . . . . . "-1"^^ . . "0"^^ . "<p>On <code>tvOS</code> platform you should work with focuses instead of selections for the navigation purposes so just use <code>indexPathForPreferredFocusedViewInTableView</code> to inform <code>UITableView</code> for a focused index path, e.g:</p>\n<pre class="lang-objectivec prettyprint-override"><code>@interface ViewController () &lt;UITableViewDataSource, UITableViewDelegate&gt;\n\n...\n@property (nonatomic) NSIndexPath* focusedIndexPath;\n\n@end\n\n@implementation ViewController\n\n...\n\n- (void)focusRow:(NSInteger)row {\n self.focusedIndexPath = [NSIndexPath indexPathForRow:row inSection:0];\n [self.tableView setNeedsFocusUpdate];\n}\n\n#pragma mark - UITableViewDelegate\n\n- (NSIndexPath *)indexPathForPreferredFocusedViewInTableView:(UITableView *)tableView {\n return self.focusedIndexPath;\n}\n\n@end\n\n</code></pre>\n"^^ . "1"^^ . "0"^^ . "1"^^ . "There's no question in your question. You show some code and, if I get it correctly, a screenshot of the output `GetLarkPos()` produces, when called. But then there's no actual problem statement. What do you want to ask?"^^ . "0"^^ . . "1"^^ . . "Does your code check the creation date in asn 1 field type 12 when determining which algorithm to use?"^^ . "1"^^ . "0"^^ . "4"^^ . "1"^^ . "0"^^ . . . "0"^^ . . . "<p>I would organize delegate methods loosely into two general categories:</p>\n<ol>\n<li>Methods which just inform you of certain events, giving you the opportunity to react, but not necessarily immediately.</li>\n<li>Methods which are called to request your code to achieve some immediate effect, such as <em>returning</em> some kind of data as an immediate return value of the method call.</li>\n</ol>\n<p>Group 1 methods are easy, you can usually just kick off your work in a <code>Task</code> (or dispatch async to another queue, etc.), and have your effect take place after the method's completion.</p>\n<p>Group 2 methods are the trickier ones, because you need the result synchronously, but there are some tricks:</p>\n<ol>\n<li>As Rob pointed out, in some cases like <code>UITableViewDataSource.tableView(_:numberOfRowsInSection:)</code>, you can return <code>0</code> for the item count at first (while you start off your load in the background), and then reload shortly after, to give the &quot;real answer&quot;.</li>\n<li>In some other cases, you can return a &quot;half baked&quot; object synchronously, and flesh out the details asynchronously. For example, for <code>UITableViewDataSource.tableView(_:cellForRowAt:)</code> you might immediately return an empty cell, but kick off some background task that will asynchronously fill it in.</li>\n<li>In the worst case, you have methods where a result is immediately required, with its full details. You basically have no recourse here, you need to block in some way (ideally off the main thread), to do the work and have the result ready by the time the method returns.</li>\n</ol>\n"^^ . "@DonMag I want the top-left corner of the label's bounding box to be at (10, 10)."^^ . . . "0"^^ . . . . . . . . . . . . "I was also thinking about creating XCTestSuite and XCTestCases dynamically with Objective-C runtime, using methods like XCTestSuite.addTest (which accepts an XCTest, and XCTestSuite is a subclass of XCTest, so I was thinking that it *may* be possible). Curious to hear what you think about it."^^ . "0"^^ . "0"^^ . . "I already put my product in app store connect, but it keep showing "skipping product because no price was available""^^ . . . . . . . . . . "<p>I'm trying to save an <code>NSPredicate</code> to the user defaults and I thought I should encode is like so, since this class conforms to <code>NSSecureCoding</code>:</p>\n<pre><code>NSPredicate *filterPredicate = [NSPredicate predicateWithFormat:@&quot;name == 'test'&quot;];\nNSData *filterPredicateData = [NSKeyedArchiver archivedDataWithRootObject:filterPredicate\n requiringSecureCoding:YES\n error:nil];\n</code></pre>\n<p>I then decode it.</p>\n<pre><code>NSPredicate *decodedPredicate = [NSKeyedUnarchiver unarchivedObjectOfClass:NSPredicate.class fromData:filterPredicateData error:nil];\nif([filterPredicate isEqualTo:decodedPredicate]) { // YES\n someNSArrayController.filterPredicate = filterPredicate; // this works\n someNSArrayController.filterPredicate = decodedPredicate; // this throws an exception\n [someNSArray filteredArrayUsingPredicate: decodedPredicate]; // this throws an exception\n}\n</code></pre>\n<p>I'm getting this exception:</p>\n<pre><code>This predicate has evaluation disabled\n</code></pre>\n<p>Notes:</p>\n<ul>\n<li><p><code>decodedPredicate</code> works as the predicate of an <code>NSFetchRequest</code> without issue.</p>\n<p><code>decodedPredicate</code> and <code>filterPredicate</code> return the same <code>predicateFormat</code>.</p>\n</li>\n</ul>\n<p>Can anyone explain this error?</p>\n"^^ . . . . "0"^^ . . "0"^^ . "<p>I have an <code>NSView</code> whose <code>layer</code> has various <code>sublayers</code>.</p>\n<p>Its <code>needsDisplay</code> property is set to <code>YES</code> when the app changes its effective appearance, which ends up calling:</p>\n<pre><code>-(void)updateLayer {\n // this is a simplified version\n sublayer1.backgroundColor = NSColor.windowBackgroundColor.CGColor;\n sublayer2.content = [NSImage imageNamed:@&quot;dynamic image&quot;];\n // &quot;dynamic image&quot; is an image asset that has light and dark variants.\n}\n</code></pre>\n<p>Both layers render properly according to the theme after the app launches, but when the app changes theme (without being relaunched), the appearance of <code>sublayer2</code> does not change. The appearance of <code>sublayer1</code> does change, but I have to relaunch the app for <code>sublayer2</code> to update to the app theme.\nUsing &quot;dynamic image&quot; as template image or original image has no effect on this issue.</p>\n<p>Note that the same image used in an <code>NSButton</code> does change appearance properly without having to relaunch the app.</p>\n<p>Any suggestion?</p>\n"^^ . "go"^^ . "@Ananth using just IN will search the collection but not for wildcard values. Property, for example, might be "Jerry S", "George C" or "Elaine B" and I want to match those."^^ . . . . . . . . "1"^^ . "How to make a CALayer with NSImage dynamically adapt to the app appearance?"^^ . "in-app-purchase"^^ . "xcuitest"^^ . "calayer"^^ . "0"^^ . . . . . . . "1"^^ . "0"^^ . . "0"^^ . . . "0"^^ . . "0"^^ . . . . . . "0"^^ . . . . "macos"^^ . "How are you going to use the predicate, in a Core Data fetch?"^^ . "<p>Inset the rectangle used to initialize the label's frame...</p>\n<pre><code>// ...\nlet drawRect = CGRectMake(10, 10, 80, 25);\n\n// Inset the drawRect with UIEdgeInsetsInsetRect()\n// I've set the (... bottom, left) insets to (... -20, -20) in case\n// you wish to center the label. If not, set those to (... 0, 0)\nconst UIEdgeInsets insets = UIEdgeInsetsMake(10, 10, -20, -20);\nconst CGRect insetRect = UIEdgeInsetsInsetRect(drawRect, insets);\n\n// changed drawRect to insetRect\nUILabel *myLabel = [[UILabel alloc] initWithFrame: insetRect];\n// ...\n</code></pre>\n<p>Disclaimer: it has been years since I used Objective-C.</p>\n<p>(Regarding what the <code>drawInRect:</code> is for, that's how you might choose to use the image after creating it. You might choose to draw it. If you don't need to, or are drawing it elsewhere later, you can remove that line).</p>\n"^^ . . "1"^^ . . "I think you can find desired implementation from firebase sources: https://github.com/firebase/firebase-ios-sdk"^^ . . . . "0"^^ . "0"^^ . . . . "0"^^ . . . "1"^^ . . . "0"^^ . "2"^^ . "0"^^ . . . "ssl"^^ . . . . "0"^^ . . . "0"^^ . . . "xcasset"^^ . . . "<p>You need to do <code>[decodedPredicate allowEvaluation];</code> first before using it.</p>\n<p>From the doc of <a href="https://developer.apple.com/documentation/foundation/nspredicate/1416310-allowevaluation" rel="nofollow noreferrer"><code>allowEvaluation</code></a>:</p>\n<blockquote>\n<p>Forces a securely decoded predicate to allow evaluation.</p>\n</blockquote>\n<blockquote>\n<p>Discussion<br>\n<strong>When securely decoding <code>NSPredicate</code> objects that are encoded using <code>NSSecureCoding</code>, evaluation is disabled because it is potentially unsafe to evaluate predicates you get out of an archive.<br></strong>\nBefore you enable evaluation, you should validate key paths, selectors, and other details to ensure no erroneous or malicious code will be executed. Once you’ve verified the predicate, you can enable the receiver for evaluation by calling <code>allowEvaluation</code>.</p>\n</blockquote>\n<p>Sample tests (if someone wants to verify it):</p>\n<pre><code>//Test Sample array\nNSArray *array = @[@{@&quot;name&quot;:@&quot;test&quot;}, @{@&quot;name&quot;: @&quot;other&quot;}];\n\nNSPredicate *filterPredicate = [NSPredicate predicateWithFormat:@&quot;name == 'test'&quot;];\nNSArray *filtered1 = [array filteredArrayUsingPredicate:filterPredicate];\nNSLog(@&quot;Filtered: %@&quot;, filtered1);\n\nNSError *encodingError = nil;\nNSData *filterPredicateData = [NSKeyedArchiver archivedDataWithRootObject:filterPredicate\n requiringSecureCoding:YES\n error:&amp;encodingError];\nif (encodingError) {\n NSLog(@&quot;Encoding error: %@&quot;, encodingError);\n}\n\nNSError *decodingError = nil;\nNSPredicate *decodedPredicate = [NSKeyedUnarchiver unarchivedObjectOfClass:NSPredicate.class\n fromData:filterPredicateData\n error:&amp;decodingError];\n\nif (decodingError) {\n NSLog(@&quot;Decoding error: %@&quot;, decodingError);\n}\nNSLog(@&quot;Initial: %@&quot;, filterPredicate); //Let's check the `description` if there it's seems correct\nNSLog(@&quot;Decoded: %@&quot;, decodedPredicate); //Let's check the `description` if there it's seems correct\nif ([filterPredicate isEqualTo:decodedPredicate]) { // YES\n [decodedPredicate allowEvaluation]; //Comment this line and it will fail\n NSArray *filtered2 = [array filteredArrayUsingPredicate:decodedPredicate];\n NSLog(@&quot;Filtered with decoded predicate: %@&quot;, filtered2);\n}\n</code></pre>\n"^^ . . "2"^^ . "thanks for all the response guys, i am new here, i already edited the question.\nCheers"^^ . "<p>G'day\nFor a photos processing application, I have to fetch and filter out images and videos saved from other applications and exclude screenshots and screen recordings.</p>\n<ol>\n<li><p>For screenshots I'm using <code>PHAsset</code>'s <code>PHAssetMediaSubtype</code> property to filter the <code>PHAssetMediaSubtypePhotoScreenshot</code> types and it works really well.</p>\n</li>\n<li><p>For screen recordings I haven't found a good way unfortunately. I stumbled onto <a href="https://stackoverflow.com/questions/63294309/how-to-fetch-screen-recordings-video">this</a> but it is not really working well because calling <code>PHAssetResource</code> on each asset is a very heavy operation. The closest I've found is to use <code>PHAssetCollection</code> and use it's localised name but this not really a good way either.</p>\n</li>\n<li><p>Lastly how do I filter out images and videos saved from other apps such as messenger apps and other apps such as tiktok. When you open apple's native Photos app and view info for an image/video it shows if the resource is taken from a camera or saved from other app. But is there a way to get this information from Photos Kit apis? Attached picture below to show what I mean by &quot;saved by&quot; shown on photos app.</p>\n</li>\n</ol>\n<p><a href="https://i.sstatic.net/a9RYw.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/a9RYw.png" alt="saved by" /></a></p>\n<p>Thanks!</p>\n"^^ . . . "Push notification of mac OSX when is force quit"^^ . . "1"^^ . . . . . . "0"^^ . . ""Not good user experience" needs to include "corrupting their persistent data" which is absolutely possible once you violate basic preconditions, which is what the majority of ObjC exceptions indicate has happened. I agree there may be debate on this topic, but recovering from arbitrary ObjC exceptions is something we've discussed in the Cocoa world for decades, and the answer we came to was "let it crash." Changing that long-forged decision is a big lift."^^ . . "<p>I need an NSPredicate that compares a property to an array of wildcards. Something like...</p>\n<pre><code>NSArray *collection = @[@&quot;Jerry*&quot;,@&quot;George*&quot;,@&quot;Elaine*&quot;];\n[NSPredicate predicateWithFormat:@&quot;property LIKE IN %@&quot;, collection];\n</code></pre>\n<p>Is this possible?</p>\n"^^ . "0"^^ . . . . "1"^^ . . "0"^^ . "How to get the a value of particular key out of Cocoa's NSDictionary?"^^ . "Does this answer your question? [Swift: Natively Detect if App has Crashed](https://stackoverflow.com/questions/37220379/swift-natively-detect-if-app-has-crashed)"^^ . . "2"^^ . "0"^^ . . "0"^^ . . "1"^^ . . . . . . . . "uitableview"^^ . . "Working on a solution, see [https://stackoverflow.com/questions/79318039/mac-appstore-local-receipt-validation-using-storekit-apptransaction-from-swift](https://stackoverflow.com/questions/79318039/mac-appstore-local-receipt-validation-using-storekit-apptransaction-from-swift)"^^ . "synchronous"^^ . . . . . . . . . . . . . . "Follow the same steps but in step 4 you want to choose Project (not Public or Private). Also use `#import "BaseLog.h"` in `AppLogger.h`."^^ . "0"^^ . "1"^^ . . "method-signature"^^ . . "<p>Here's a clip on YouTube showing the issue. <a href="https://www.youtube.com/watch?v=WWzh50TbW64" rel="nofollow noreferrer">Video</a></p>\n<p>I have a UITableView that lists the files located in the app alphabetically. As there are over 1500 files, I'm trying to implement functionality to navigate by letter of the alphabet when the right button is clicked on the remote. The issue I'm having is that the TableView indeed moves to the right spot, but instead of being highlighted like it normally would, I get a lighter highlighted color, and clicking select does nothing. If I then navigate normally by pressing down, it moves it back up to the 2nd item in the list. What am I doing wrong?</p>\n<pre><code>- (void)viewDidLoad {\n [super viewDidLoad];\n\n self.tableView.delegate = self;\n self.tableView.dataSource = self;\n self.definesPresentationContext = YES; // know where you want UISearchController to be displayed\n self.currentIndex = 0;\n \n [self populateTheView];\n}\n\n- (void)populateTheView {\n NSBundle *bundle = [NSBundle mainBundle];\n self.title = @&quot;Devo Songs&quot;;\n self.files = [bundle pathsForResourcesOfType:@&quot;pdf&quot; inDirectory:@&quot;WorshipSongs&quot;];\n NSString *documentsDirectoryPath = [self.files objectAtIndex:thepath.row];\n \n self.filenames = [[documentsDirectoryPath lastPathComponent] stringByDeletingPathExtension];\n \n NSMutableArray *names = [NSMutableArray arrayWithCapacity:[self.files count]];\n for (NSString *path in self.files) {\n [names addObject:[[path lastPathComponent] stringByDeletingPathExtension]];\n }\n \n //self.files = names;\n self.files = [names sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];\n NSLog(@&quot;FILESLOAD%@&quot;, self.files);\n}\n\n- (void)viewDidAppear:(BOOL)animated {\n [super viewDidAppear:animated];\n\n [self becomeFirstResponder]; // Make the view controller the first responder to handle remote control events.\n}\n\n- (BOOL)canBecomeFirstResponder {\n return YES;\n}\n\n// Override pressesBegan method to detect right arrow key press event.\n- (void)pressesEnded:(NSSet&lt;UIPress *&gt; *)presses withEvent:(UIPressesEvent *)event {\n [super pressesEnded:presses withEvent:event];\n\n for (UIPress *press in presses) {\n if (press.type == UIPressTypeRightArrow) {\n [self handleRightButtonPress];\n }\n }\n}\n\n- (void)handleRightButtonPress {\n // Get the current name.\n NSString *currentName = self.files[self.currentIndex];\n\n // Get the current letter.\n NSString *currentLetter = [currentName substringToIndex:1];\n\n // Find the next index starting from the current index.\n NSInteger nextIndex = self.currentIndex + 1;\n while (nextIndex &lt; self.files.count) {\n NSString *nextName = self.files[nextIndex];\n NSString *nextLetter = [nextName substringToIndex:1];\n\n if (![nextLetter isEqualToString:currentLetter]) {\n break;\n }\n\n nextIndex++;\n }\n\n // Check if we found a valid next index.\n if (nextIndex &lt; self.files.count) {\n // Scroll the table view to the row corresponding to the next letter.\n [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:nextIndex inSection:0]\n atScrollPosition:UITableViewScrollPositionTop animated:NO];\n\n // Update the current index to the new index.\n self.currentIndex = nextIndex;\n \n // Deselect the current selected row (if any).\n NSIndexPath *previousSelectedIndexPath = [self.tableView indexPathForSelectedRow];\n if (previousSelectedIndexPath) {\n [self.tableView deselectRowAtIndexPath:previousSelectedIndexPath animated:NO];\n }\n\n // Select the cell at the specified index.\n NSIndexPath *indexPathToSelect = [NSIndexPath indexPathForRow:self.currentIndex inSection:0];\n [self.tableView selectRowAtIndexPath:indexPathToSelect animated:NO scrollPosition:UITableViewScrollPositionNone];\n } else {\n // If we have reached the end of the list, reset the index to the first element.\n self.currentIndex = 0;\n\n // Scroll back to the top of the table view.\n [self.tableView setContentOffset:CGPointZero animated:NO];\n\n // Deselect the current selected row (if any).\n NSIndexPath *previousSelectedIndexPath = [self.tableView indexPathForSelectedRow];\n if (previousSelectedIndexPath) {\n [self.tableView deselectRowAtIndexPath:previousSelectedIndexPath animated:NO];\n }\n\n // Select the cell at the specified index.\n NSIndexPath *indexPathToSelect = [NSIndexPath indexPathForRow:self.currentIndex inSection:0];\n [self.tableView selectRowAtIndexPath:indexPathToSelect animated:NO scrollPosition:UITableViewScrollPositionNone];\n }\n}\n</code></pre>\n<p>Not sure if it is needed, but the main scene for the app is a Tab Bar Controller. It has a total of two tabs, the one on the left that shows when launched is a Split View, and the second one is the one in question here which is just a <code>UITableViewController</code>, and is presented via segue in storyboard.\n<a href="https://i.sstatic.net/dQYmb.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/dQYmb.png" alt="enter image description here" /></a>\n<a href="https://i.sstatic.net/je419.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/je419.png" alt="enter image description here" /></a></p>\n"^^ . "0"^^ . "0"^^ . "If you are not successful with "Crash Eye", you may try [PLCrashReporter](https://github.com/microsoft/plcrashreporter). In my experience, the most reliable and battle tested library for mac and iOS."^^ . . . . . . . . "OK - before we get into complicated sizing issues... is this your actual goal? `100x100` pixel image, with MAX font-size of `16`? Or is this just an "example" and you may have a target of `300x300` image, with maybe a MAX font-size of `50`?"^^ . . . "<p>From Apple's <a href="https://developer.apple.com/documentation/quartzcore/calayer/1410773-contents?language=objc" rel="nofollow noreferrer">docs</a> for <code>CALayer</code>.<code>contents</code>:</p>\n<blockquote>\n<p>Discussion</p>\n<p>The default value of this property is nil.</p>\n<p>If you are using the layer to display a static image, you can set this property to the CGImageRef containing the image you want to display. (In macOS 10.6 and later, you can also set the property to an NSImage object.) Assigning a value to this property causes the layer to use your image rather than create a separate backing store.</p>\n<p>If the layer object is tied to a view object, you should avoid setting the contents of this property directly. The interplay between views and layers usually results in the view replacing the contents of this property during a subsequent update.</p>\n</blockquote>\n<p>So, when setting:</p>\n<pre><code>sublayer2.content = [NSImage imageNamed:@&quot;dynamic image&quot;];\n</code></pre>\n<p>the layer gets a <code>CGImageRef</code>, not a <code>NSImage</code> ... and appearance changes will have no effect.</p>\n<p>One approach would be to replace the <code>CALayer</code> with a <code>NSImageView</code> as a subview. Set the <code>.image</code> property, and you're done.</p>\n<p>If you <strong>need to use <code>CALayer</code></strong>, we need to get the <code>CGImageRef</code> from the image with the current appearance in <code>updateLayer</code>.</p>\n<p>Quick example:</p>\n<p><strong><code>LayeredView.h</code></strong></p>\n<pre><code>#import &lt;Cocoa/Cocoa.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n@interface LayeredView : NSView\n@end\nNS_ASSUME_NONNULL_END\n</code></pre>\n<p><strong><code>LayeredView.m</code></strong></p>\n<pre><code>#import &quot;LayeredView.h&quot;\n#import &lt;Quartz/Quartz.h&gt;\n\n@interface LayeredView()\n{\n CALayer *imgLayer;\n NSImage *img;\n}\n@end\n\n@implementation LayeredView\n\n- (id)initWithFrame:(NSRect)frame {\n NSLog(@&quot;%s&quot;, __PRETTY_FUNCTION__);\n self = [super initWithFrame:frame];\n if (self) {\n [self commonInit];\n }\n return self;\n}\n- (instancetype)initWithCoder:(NSCoder *)coder {\n NSLog(@&quot;%s&quot;, __PRETTY_FUNCTION__);\n self = [super initWithCoder:coder];\n if (self) {\n [self commonInit];\n }\n return self;\n}\n- (void)commonInit {\n NSLog(@&quot;%s&quot;, __PRETTY_FUNCTION__);\n [self setWantsLayer:YES];\n \n // load the image\n img = [NSImage imageNamed:@&quot;i100x100&quot;];\n \n // create layer\n imgLayer = [CALayer new];\n \n // .contentsGravity as desired\n imgLayer.contentsGravity = kCAGravityCenter;\n \n // add the layer\n [self.layer addSublayer:imgLayer];\n}\n- (void)updateLayer {\n NSLog(@&quot;%s&quot;, __PRETTY_FUNCTION__);\n [super updateLayer];\n \n // built-in layer animation will result in a &quot;fade&quot;\n // so disable it (if desired)\n [CATransaction begin];\n [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];\n \n if (img) {\n // get the CGImageRef from img -- this will reflect light/dark mode\n imgLayer.contents = (__bridge id _Nullable)([img CGImageForProposedRect:nil context:nil hints:nil]);\n }\n\n // image layer frame as desired\n imgLayer.frame = self.bounds;\n\n [CATransaction commit];\n}\n@end\n</code></pre>\n"^^ . "pagination"^^ . . "iOS Photo Kit Filter screenshots, screen recordings and assets saved other apps"^^ . . "I am having trouble updating MBProgressHUD in dispatch main thread"^^ . . . . . . . "1"^^ . . "nsurl"^^ . . . . "1"^^ . "0"^^ . "0"^^ . . . . . "0"^^ . "0"^^ . . . . . . . "Thanks. I searched for "evalua" on the NSPredicate documentation page in Safari, and it found nothing. I should have looked more carefully."^^ . "0"^^ . . . "0"^^ . . . . . . . . "0"^^ . "1"^^ . . . . . . "You can’t convert an asynchronous method into a synchronous method."^^ . . "cocoa"^^ . . . . . . "0"^^ . . . "In fact, my ultimate goal is to get the location of other software windows through golang. If you have an answer or golang has a better solution, you can let me know."^^ . . "1"^^ . . . "0"^^ . . "marshalling"^^ . . . . . . "0"^^ . . . . . "<p>The Objective-C method encoding produced by the Swift compiler for swift methods with blocks seems to use syntax not documented anywhere.</p>\n<p>For instance the method:</p>\n<pre class="lang-swift prettyprint-override"><code>func DebugLog2(message: String) async -&gt; String\n</code></pre>\n<p>has the method encoding:</p>\n<blockquote>\n<p>v32@0:8@&quot;NSString&quot;16@?&lt;v@?@&quot;NSString&quot;&gt;24</p>\n</blockquote>\n<p>and there are at least three characters (<code>&quot;</code>, <code>&lt;</code>, and <code>&gt;</code>) not covered in the documentation:</p>\n<p><a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html" rel="nofollow noreferrer">https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html</a></p>\n<p>The <code>NSMethodSignature</code> class also doesn't like this encoding:</p>\n<pre class="lang-objectivec prettyprint-override"><code>[NSMethodSignature signatureWithObjCTypes:&quot;\\&quot;NSString\\&quot;16@?&lt;v@?@\\&quot;NSString\\&quot;&gt;24&quot;];\n</code></pre>\n<p>results in:</p>\n<blockquote>\n<p>'+[NSMethodSignature signatureWithObjCTypes:]: unsupported type encoding spec '&quot;' in '&quot;NSString&quot;16@?&lt;v@?@&quot;NSString&quot;&gt;24''</p>\n</blockquote>\n<p>I tried looking through Swift's code, and it seems there's something called &quot;extended method type encodings&quot;:</p>\n<p><a href="https://github.com/apple/swift/blob/c2fc7ee9e72e9a39854548e3202c667e4934dc65/test/IRGen/objc_methods.swift#L13-L14" rel="nofollow noreferrer">https://github.com/apple/swift/blob/c2fc7ee9e72e9a39854548e3202c667e4934dc65/test/IRGen/objc_methods.swift#L13-L14</a></p>\n<p>but I got lost trying to figure out where in the Swift codebase the method type encoding is generated.</p>\n<p>Related questions that don't answer this:</p>\n<ul>\n<li><a href="https://stackoverflow.com/questions/41502199/how-to-decipher-objc-method-description-from-protocol-method-description-list">How to decipher &quot;objc_method_description&quot; from protocol method description list?</a></li>\n<li><a href="https://stackoverflow.com/questions/11491947/what-are-the-digits-in-an-objc-method-type-encoding-string">What are the digits in an ObjC method type encoding string?</a></li>\n</ul>\n<p>Sample code:</p>\n<pre class="lang-swift prettyprint-override"><code>decodeProto()\n\n@objc\nclass TestClass : NSObject {\n @objc\n func DebugLog(message: String) -&gt; String {\n print(message)\n return message\n }\n\n @objc\n func DebugLog2(message: String) async -&gt; String {\n do {\n try await Task.sleep(nanoseconds: 1_000_000_000)\n } catch {}\n print(message);\n return message;\n }\n}\n\nfunc decodeProto() {\n var methodCount : UInt32 = 1\n let methodList = class_copyMethodList(TestClass.self, UnsafeMutablePointer&lt;UInt32&gt;(&amp;methodCount))!\n for i in 0..&lt;Int(methodCount) {\n let method = methodList[i];\n let desc = method_getDescription (method);\n let name = desc.pointee.name!\n let types = String(validatingUTF8: desc.pointee.types!)!\n print(&quot;Selector: \\(name) Description: \\(types)&quot;)\n }\n}\n</code></pre>\n<p>prints:</p>\n<pre><code>Selector: DebugLog2WithMessage:completionHandler: Description: v32@0:8@&quot;NSString&quot;16@?&lt;v@?@&quot;NSString&quot;&gt;24\nSelector: DebugLogWithMessage: Description: @24@0:8@16\nSelector: init Description: @16@0:8\n</code></pre>\n<hr />\n<p>But why do I need this?</p>\n<p>I need to compute a maximum size for the stack frame, and in order to do that I parse the method encoding. The reason I need to compute the minimum size is because I intercept calls to objc_msgSend to add Objective-C exception handling before I call the actual objc_msgSend, so it's something like:</p>\n<pre class="lang-objectivec prettyprint-override"><code>intercept_objc_msgSend (...) {\n @try {\n objc_msgSend (...);\n } @catch (NSException *ex) {\n handleException (ex);\n }\n}\n</code></pre>\n<p>Note that it's not possible to create a generic interception method in C, so I've done it in assembly code. The generic interception code needs to allocate space for and copy the original arguments (stack frame), and in order to do that I parse the method encoding to figure out how big each argument is.</p>\n<p>The count doesn't have to be exact, only a maximum is needed, so adding up the space required for all the arguments and allocating that much stack space works just fine, there's no need to subtract the size for any argument passed in registers.</p>\n"^^ . . "To the latter, "just copy the entire chunk of memory from A to B" is a mandatory starting point. But I think you'll eventually discover you **also** need to understand each argument, which is hard, and always subject to change. (And Apple absolutely does change how these things work, mercilessly, within anything allowed by their ABI, which is a lot.)"^^ . . . . "@kostix 科斯蒂克斯 Objective-c, what is actually returned is a NSDictionary*, type of (* getlark._Ctype_struct_NSDictionary). I received it with dd in GetLarkPos (). How can I get the value of dd? I tried dd.Height,dd ["Height"], dd {}, but could not get the value of Height."^^ . . . "vlc"^^ . . "i think im gonna try it using dispatch_group_async and just dispatch_group_enter before my async calls and dispatch_group_leave in final completion handler, ill let you know the result @Rob"^^ . . "1"^^ . "Try with just `IN` - Refer - https://nspredicate.xyz/#is-included-in-an-array-of-values."^^ . "1"^^ . . . . . . "1"^^ . . "nspredicate"^^ . "ios"^^ . . . . . "0"^^ . . . . "1"^^ . . "2"^^ . . . "<p>I have an old app that was built using Objective-C and uses <a href="https://github.com/robotmedia/RMStore" rel="nofollow noreferrer">this library</a> for local receipt validation for IAPs.</p>\n<p>Recently Apple announced that local receipt validation code must change from SHA1 to SHA256 as described in: <a href="https://developer.apple.com/documentation/technotes/tn3138-handling-app-store-receipt-signing-certificate-changes" rel="nofollow noreferrer">TN3138: Handling App Store receipt signing certificate changes</a>.</p>\n<p>I read the document but I'm still not clear on what exactly I'm supposed to change in the code. I tried changing <a href="https://github.com/robotmedia/RMStore/blob/303b1e9625a80b21e195e7a58034f33a63edbeb1/RMStore/Optional/RMAppReceipt.m#L194" rel="nofollow noreferrer">the hashing algorithm in the verify receipt method</a> from:</p>\n<pre><code> SHA1((const uint8_t*)data.bytes, data.length, (uint8_t*)expectedHash.mutableBytes);\n</code></pre>\n<p>to:</p>\n<pre><code> SHA256((const uint8_t*)data.bytes, data.length, (uint8_t*)expectedHash.mutableBytes);\n</code></pre>\n<p>But the computed hash was different than the one in the receipt. Using the original <code>SHA1</code> the computed hash equals the one in the receipt.</p>\n<p>According to the article linked above, the Sandbox should have updated certificates that work with the new SHA-256 hash since the 20th of June, 2023.</p>\n<p>So I'm not sure what I should be doing to make sure the app and all IAPs work fine by the 14th of August when this change goes live. Any help would be appreciated!</p>\n"^^ . "0"^^ . "Okay, thank you for following up on this question. I'll try."^^ . . . . "0"^^ . . . "From what I saw `applicationWillTerminate` is not called only when we move to background and then quit the app. Can you pls throw light on how this is never called, the apple docs are not very helpful? @matt"^^ . . . . "@sgx, oh, and one more note. The solution proposed in this answer presupposes you might want to deal with _any_ `NSDictionary` values. If, instead, your problem is quite narrow, and you'd want to basically only deal with "coordinates of windows", and nothing more, a better approach would be to define a custom `struct` type in your C code, with four `int`-typed fields, and merely "gateway" values of the fields of interest from the returned `NSDictionary` into the fields of a variable of that custom type, and returning that variable. At the call site–in Go code–you'd then work with plain fields."^^ . . . . "Returning another NSView subclass in 'initWithCoder' results in error "This coder requires that replaced objects be returned from initWithCoder"""^^ . . . . "c#"^^ . . . . . "Look at your screenshot from App Store Connect. You need to finish setting up the in-app purchases so it doesn't say "Missing metadata"."^^ . "How to render UILabel at certain point in UIImage?"^^ . . . . "0"^^ . "0"^^ . "<p>I need to return a collection of strings from Objective-C to C# and can't wrap my head around how to do this properly. When I print the returned pointer on managed side its value is 0.</p>\n<p>Objective-c</p>\n<pre class="lang-objectivec prettyprint-override"><code>FOUNDATION_EXPORT int _GetAllKeys(char** pointer)\n{\n NSArray* array = @[@&quot;key1&quot;, @&quot;key2&quot;]; // dummy strings\n \n int size = (int)array.count;\n\n pointer = malloc(size * sizeof(char *));\n \n for (int i = 0; i &lt; size; i++)\n {\n pointer[i] = MakeStringCopy(array[i]);\n }\n return size;\n}\n</code></pre>\n<p>C#</p>\n<pre class="lang-cs prettyprint-override"><code>[DllImport(&quot;__Internal&quot;)]\nprivate static extern int _GetAllKeys(out IntPtr buffer);\n\ninternal static IEnumerable&lt;string&gt; GetAllKeys()\n{\n int count = _GetAllKeys(out var buffer);\n List&lt;string&gt; keys = new List&lt;string&gt;();\n for (int i = 0; i &lt; count; i++)\n {\n keys.Add(Marshal.PtrToStringUTF8(IntPtr.Add(buffer, IntPtr.Size))); //eventually when i make this work the strings will be returned as UTF8 but for now its not even making it to this line, so ignore the encoding.\n }\n\n return keys;\n}\n</code></pre>\n<p>---------------- SOLUTION ----------------</p>\n<p>Objective-c</p>\n<pre class="lang-objectivec prettyprint-override"><code>FOUNDATION_EXPORT int _GetAllKeys(char*** pointer)\n{\n NSArray* array = @[@&quot;key1&quot;, @&quot;key2&quot;]; \n int size = (int)array.count;\n \n *pointer = malloc(size * sizeof(char *));\n\n for (int i = 0; i &lt; size; i++)\n {\n (*pointer)[i] = MakeStringCopy(array[i]);\n }\n \n return size;\n}\n</code></pre>\n<p>C#</p>\n<pre class="lang-cs prettyprint-override"><code>[DllImport(&quot;__Internal&quot;)]\nprivate static extern int _GetAllKeys(out IntPtr buffer);\n\ninternal static IEnumerable&lt;string&gt; GetAllKeys()\n{\n int count = _GetAllKeys(out var buffer);\n List&lt;string&gt; keys = new List&lt;string&gt;();\n for (int i = 0; i &lt; count; i++)\n {\n IntPtr ptr = Marshal.ReadIntPtr(buffer);\n keys.Add(Marshal.PtrToStringAuto(ptr));\n buffer = IntPtr.Add(buffer, IntPtr.Size);\n }\n\n return keys;\n}\n</code></pre>\n"^^ . "@CouchDeveloper the signal handler approach is not able to catch all crash occurrences. Any suggestions around this? I implemented it as given in the Crash Eye library."^^ . . "0"^^ . "0"^^ . "3"^^ . . . "1"^^ . . "0"^^ . "@koen nope it doesn't"^^ . "kotlin-multiplatform"^^ . "uifont"^^ . . . "0"^^ . . . . . "What difficulty are you experiencing?"^^ . "1"^^ . "0"^^ . . . . "0"^^ . "0"^^ . . . "`assign` and `strong` are mutually exclusive. `assign` says "don't retain" and `strong` says "retain". Is there a reason you're trying to use `assign`? (See "Setter Semantics" in https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocProperties.html for more info) The basic answer is "yes", though: if you don't specify an attribute, the default applies"^^ . . "1"^^ . . . . "1"^^ . . . "0"^^ . "@HangarRash it’s in appdelegate where the remote notifications normally are handled"^^ . "So back to my first comment above. Have you used the debugger to see what your code is actually doing? Update your question with details about what is actually happening in your code."^^ . . "1"^^ . . . . "localization"^^ . . "0"^^ . "0"^^ . . "Custom Font for iOS Only shows if Added in IB?"^^ . . . "2"^^ . . "0"^^ . . . . . . . . . . . . . . . . . . . "thank you, you are right! I delete the HTML_PARSE_NOERROR and then the console output the error."^^ . . . . . "1"^^ . . "Why is this tagged with CoreData & MongoDB while you seem to use Realm?"^^ . "@HangarRash The details of the layout are not really relevant. My question pertains more to how I would go about implementing viewport width/height percentages in UIKit for a modal view. If this is the incorrect way to go about positioning subviews, what is the preferred method/strategy?"^^ . "0"^^ . "Probably an improvement, but I am a bit too invested at this point to change implementations"^^ . . "1"^^ . . "Consider using `UIImage imageByPreparingThumbnailOfSize:` instead writing your own method."^^ . . . "0"^^ . . . . . . . . "0"^^ . "1"^^ . . . "outline-view"^^ . "0"^^ . . . . . . . "<p>With the help of both <a href="https://stackoverflow.com/a/76994555/8102500">Hamid Yusifli's answer</a> and <a href="https://github.com/DTolm/VkFFT/issues/131#issuecomment-1697203936" rel="nofollow noreferrer">this GitHub Issue</a>, I solved my problem.</p>\n<ol>\n<li><p>From Objective-C code (<code>.m</code>), cast the <code>id&lt;MTLCommandQueue&gt;</code> into <code>void*</code>:</p>\n<pre class="lang-objectivec prettyprint-override"><code>id&lt;MTLCommandQueue&gt; objcQueue = /* Your Objective-c queue */;\nvoid* commandQueuePtr = (__bridge void*)objcQueue;\n</code></pre>\n</li>\n<li><p>Pass this opaque pointer to C++ world.</p>\n</li>\n<li><p>In C++ code, &quot;decode&quot; the <code>void*</code> back to a <code>MTL::CommandQueue*</code>:</p>\n<pre class="lang-c prettyprint-override"><code>void foo(void* commandQueuePtr) {\n MTL::CommandQueue* commandQueue = (MTL::CommandQueue*) commandQueuePtr;\n // submit GPU works to commandQueue...\n}\n</code></pre>\n</li>\n</ol>\n"^^ . "crash"^^ . "0"^^ . . . "Thanks. I tried that and it unfortunately causes an error `Invalid pairing of layout attributes.` This is because it is trying to constrain a `topAnchor` to a `heightAnchor`.\nSource: https://github.com/SnapKit/SnapKit/issues/534"^^ . "<p>By default, the maximum depth of the document tree is indeed limited to 256. You should get an error message like:</p>\n<pre><code>Excessive depth in document: 256 use XML_PARSE_HUGE option\n</code></pre>\n<p>As the message explains, you get around this limitation by using the <code>XML_PARSE_HUGE</code> parser option.</p>\n"^^ . . . . . "They are remote"^^ . . . . . . "0"^^ . . . "@ennell I updated my answer with an example for that case."^^ . . "0"^^ . . "1"^^ . "0"^^ . "@HangarRash Thank you very much:) Don't know I was messing around with NSData!!"^^ . . "FYI - It is standard practice to name classes and types starting with an uppercase letter. Method and variable names start with lowercase letters. Following such guidelines makes your code a lot easier to read."^^ . "1"^^ . . "I tried to build the iOS demos from the iCarousel package, and I'm getting a linker error that it can't find the file libarclite_iphonesimulator.a. That sounds like a pre-built file of some sort. Did you encounter that problem?"^^ . "0"^^ . . "swift"^^ . "1"^^ . . "1"^^ . . . . . . . . "3"^^ . . . . "0"^^ . . . "1"^^ . "0"^^ . "0"^^ . "<p>As we see in this code, <code>Text</code> should be &quot;Program Started&quot; after 3 seconds, but in the view it is still stuck in &quot;Hello World&quot;. Does anyone have a solution for this?</p>\n<pre><code>NSString *Text = @&quot;Hello World&quot;;\nNSLog(Text); // Hello World\nUIViewController *vc = [HelloWorldViewFactory createWithText:Text];\nvc.view.backgroundColor = [UIColor systemBackgroundColor];\n[vc.sheetPresentationController setPreferredCornerRadius:0];\n[vc.sheetPresentationController setDetents:@[UISheetPresentationControllerDetent.mediumDetent]];\n[vc.sheetPresentationController setPrefersScrollingExpandsWhenScrolledToEdge:false];\n[UIApplication.sharedApplication.keyWindow.rootViewController presentViewController:vc animated:YES completion:nil];\n\ndispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n Text = @&quot;Program started&quot;;\n});\nNSLog(Text); // Program started\n</code></pre>\n"^^ . "<p>I am new to Objective-C. I'm trying to create a category method for arrays that doesn't use a parameter. I'm told there is a way that the method can use this array without using the array as an argument. I haven't seen much specific to this question. Can anyone tell me how to access the array calling the method from within the category method?</p>\n<p>I know using an argument works. Like this:</p>\n<pre><code>[array reversed:array];\n</code></pre>\n<p>I'm trying to do this instead:</p>\n<pre><code>[array reversed];\n</code></pre>\n"^^ . . . "0"^^ . . "Objective C POST call not executing NSURLSession"^^ . "You should be able to implement the U you show using collection view controllers. Those are quite flexible. Look up `UICollectionViewFlowLayout` in Apple's docs."^^ . . . . . . . . "0"^^ . "1"^^ . . . "try-catch"^^ . . . "0"^^ . "0"^^ . "0"^^ . . . "1"^^ . . . . . "@Larme Core data was obviously incorrect but Realm is actually called MongoDB Realm. Mongo bought Realm a few years ago and integrated it into their offerings. Realm is backed by MongoDB Atlas at the server level."^^ . "1"^^ . . . . . "1"^^ . . "0"^^ . "iCarousel as in the Nick Lockwood library written in Objective-C (https://github.com/nicklockwood/iCarousel)? That was last updated in 2017, and is badly out of date at this point. I would strongly advise against using it for new development."^^ . . . . . "0"^^ . "<p>I have a swift model class like this;</p>\n<p><code>class Test: NSObject, Codable { var property: Bool? }  </code></p>\n<p>i want to use this bool type in swift class and objective - c at the same time. But the problem is I can't use Bool type in objective - c, if I replace bool type with NSNumber and use in objective - c than I'm having Test class codable error since NSNumber is not codable data type. What is the best way to use bool type in swift and objective - c same time.</p>\n"^^ . . "1"^^ . . . "Yes, linear is close to what I need with wrap options, but I can't make the left and the right views smaller. Don't know if it is possible though"^^ . . . . . "0"^^ . "0"^^ . "1"^^ . . . . . "0"^^ . . "0"^^ . "0"^^ . . . . . . "0"^^ . "nsimage"^^ . "0"^^ . . . "0"^^ . . . "0"^^ . . "@MarMon. There are a number of issues with the code; first off it appears you're using Swift? If so, you really need to use the more modern Swift syntax to structure the Realm models and make calls. Secondly, that code should not even compile as this `return objetoLogin` is a syntax error and does not exist. Lastly, we don't know how your realm is formed `self.realm`. Please take a moment and review [How to ask a good question](https://stackoverflow.com/help/how-to-ask) and [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example)"^^ . . . "0"^^ . . . "1"^^ . . "The code syntax is ObjC and while there's nothing wrong with it, Swift syntax may be a bit easier, require less code and provide more compatibility. For example `@objc dynamic var password : String = ""` is replaced in Swift `@Persisted var password = ""`. The [Realm Swift SDK](https://www.mongodb.com/docs/realm/sdk/swift/) guide provides numerous code examples using Swift. Getting data from Firebase and storing in Realm goes beyond the scope of SO, but it can be done (we use both). However, I would suggest either using Realm or Firebase but not both as there may not be a reason to."^^ . . "How to convert a `id<MTLCommandQueue>` to a `MTL::CommandQueue` of Metal-Cpp?"^^ . "<p>In your example, <code>array</code> is not calling anything. It is the object that the <code>reversed</code> message is passed to. Within the <code>-reversed</code> method, the object being passed the method (<code>array</code> in this case) is called <code>self</code>, which is how you would access it in a category, or any method of an object.</p>\n<p>In your example, that would look something like:</p>\n<pre><code>@interface NSArray (Reversed)\n- (NSArray *)reversed;\n@end\n\n@implementation NSArray (Reversed)\n\n- (NSArray *)reversed {\n NSMutableArray *result = [NSMutableArray new];\n\n // Here is where you refer to the target as `self`\n for (id element in [self reverseObjectEnumerator]) {\n [result addObject: element];\n }\n return result;\n}\n\nint main(int argc, const char * argv[]) {\n @autoreleasepool {\n NSArray *xs = @[@1, @2, @3];\n NSArray *reversed = [xs reversed];\n NSLog(@&quot;%@ -&gt; %@&quot;, xs, reversed);\n }\n return 0;\n}\n</code></pre>\n"^^ . . . . . "Try replacing `NSData *requestData = [NSData dataWithBytes:[jsonRequestString UTF8String] length:[jsonRequestString length]];` with `NSData *requestData = jsonRequestData`."^^ . . "0"^^ . "0"^^ . . "0"^^ . "<p>I'm facing a tricky issue with Cocoa's <code>addGlobalMonitorForEventsMatchingMask</code> leaking memory over time. In particular, with the flags provided in the example below, some events (eg. Mouse down) cause NSEvent objects to NOT being released, causing an unbounded memory growth over time.</p>\n<p>I'm not using ARC (as this example is extracted from a native library in which Objective C is not the main language, thus I need to be able to retain control over memory allocations)</p>\n<p>AppDelegate.m</p>\n<pre><code>#import &quot;AppDelegate.h&quot;\n\nconst unsigned long long FLAGS = NSEventMaskKeyDown | NSEventMaskKeyUp | NSEventMaskFlagsChanged | NSEventMaskLeftMouseDown | \n NSEventMaskLeftMouseUp | NSEventMaskRightMouseDown | NSEventMaskRightMouseUp | \n NSEventMaskOtherMouseDown | NSEventMaskOtherMouseUp;\n\n@implementation AppDelegate\n\n- (void)applicationDidFinishLaunching:(NSNotification *)aNotification\n{\n [NSEvent addGlobalMonitorForEventsMatchingMask:FLAGS handler:^(NSEvent *event){\n //NSLog(@&quot;event&quot;);\n }];\n}\n\n@end\n</code></pre>\n<p>AppDelegate.h</p>\n<pre><code>#import &lt;AppKit/AppKit.h&gt;\n#import &lt;Foundation/Foundation.h&gt;\n\n@interface AppDelegate : NSObject &lt;NSApplicationDelegate, NSUserNotificationCenterDelegate&gt; {\n}\n\n- (void)applicationDidFinishLaunching:(NSNotification *)aNotification;\n\n@end\n</code></pre>\n<p>main.m</p>\n<pre><code>#include &quot;AppDelegate.h&quot;\n#import &lt;AppKit/AppKit.h&gt;\n#import &lt;Foundation/Foundation.h&gt;\n\nint main(int argc, const char * argv[]) {\n @autoreleasepool {\n AppDelegate *delegate = [[AppDelegate alloc] init];\n\n NSApplication *application = [NSApplication sharedApplication];\n [application setDelegate:delegate];\n [application setActivationPolicy:NSApplicationActivationPolicyAccessory];\n [application run];\n }\n return 0;\n}\n</code></pre>\n<p>This program is compiled with:</p>\n<pre><code>gcc -framework Cocoa -framework IOKit -o testleak main.m AppDelegate.m\n</code></pre>\n<p>Any idea of what could be causing it? Or what I should do to prevent it?</p>\n<p>I've tried with multiple combinations of <code>NSAutoreleasePool</code>s and other approaches, but none solved the issue.</p>\n<p>My findings so far:</p>\n<ul>\n<li>Not all events cause the leak. For example, key down events don't, while mouse events do</li>\n</ul>\n<p>Screenshot of the Zombie tool displaying an increasing list of NSEvents</p>\n<p><a href="https://i.sstatic.net/xAwFe.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/xAwFe.png" alt="enter image description here" /></a></p>\n"^^ . . "Maybe this helps: [Difference between Instruments (Zombies and leaks)](https://stackoverflow.com/questions/19122803/difference-between-instruments-zombies-and-leaks) and [Why am I seeing all these leaks when NSZombie is enabled?](https://stackoverflow.com/questions/10801051/why-am-i-seeing-all-these-leaks-when-nszombie-is-enabled)"^^ . "1"^^ . "3"^^ . . . "3"^^ . . . "OBJC @selector doesnt work from another implementation"^^ . "1"^^ . . . . "0"^^ . . . "0"^^ . "sdl"^^ . "<p>I have managed to solve my issue with the following line of code:</p>\n<pre><code> public override CATransform3D ItemTransformForOffset(iCarousel carousel, nfloat offset, CATransform3D transform)\n {\n // How much smaller the left and right views should be relative to the center view (expressed as pixels)\n float viewSizeDifference = -100;\n\n // The horizontal spacing between the views (expressed as a multiple of the views width)\n float viewDistance = 1.17f;\n\n float transformZ = (float)(Math.Min(1.0f, Math.Abs(offset)) * viewSizeDifference);\n\n return transform.Translate(offset * carousel.ItemWidth * viewDistance, 0f, transformZ);\n }\n</code></pre>\n<p>but for this to work you also have to change the type to custom:</p>\n<pre><code>ViewCarousel.Type = iCarouselType.Custom;\n</code></pre>\n"^^ . . . . . "1"^^ . . . . . . "-2"^^ . "0"^^ . . . "Memory leak with Cocoa's `addGlobalMonitorForEventsMatchingMask`"^^ . . "push-notification"^^ . . "@Jay thank you so much for the info, I have to use both Firebase and Realm since the data I want to handle comes from a Firebase project that is shared by more Apps and I want the device to remember the data from Firebase whenever I log in the App. So I store it in Realm. I considered using SQLite also but the App was built with Realm initially."^^ . . "What `size` are you passing for `andPreferredSize` ?"^^ . . "@HangarRash - `imageByPreparingThumbnailOfSize:` *might* be a good alternative, but the sizing appears to be ***very quirky*** (unless I'm completely mis-understanding what it is supposed to be doing)."^^ . . . . "0"^^ . "This is a swift view!"^^ . . "I'd try wrapping the contents of the `DispatchQueue.main.async` closure in an `autoreleasepool`."^^ . . . "1"^^ . . "0"^^ . "0"^^ . . "1"^^ . "<p>To answer my own question, I ended up modifying SDL and made a PR, see here: <a href="https://github.com/libsdl-org/SDL/pull/8356" rel="nofollow noreferrer">https://github.com/libsdl-org/SDL/pull/8356</a> If that gets through then there will be <code>SDL_UNIVERSALLINK</code> that gets triggered on every new URL.</p>\n"^^ . . . "0"^^ . "3"^^ . . "2"^^ . . . . . "Image resize crash in share extention"^^ . . . . . "0"^^ . . . "0"^^ . "0"^^ . . . "0"^^ . . "0"^^ . . . . . . . "@ennell I've updated the answer to reflect that change. Glad it worked for you."^^ . . "0"^^ . "Thanks @DuncanC, you led me to the right places. I will check out UICollection when I can"^^ . . "0"^^ . . . . . "@Begbie do you actually need to access all of your model classes from Obj-C? You can extend Obj-C classes from Swift and access pure Swift methods/types from these extensions. Forward declaration is also a very valuable tool, since you can forward declare pure Swift classes in Obj-C headers and then assign values to them from a Swift extension."^^ . "`self.window` could be nil. Modern apps (iOS 13+) do not use `UIApplicationDelegate window` any more due to the use of scenes."^^ . "<p><strong>Problem</strong>: I am having some issues using the correct frame values to simulate viewport percentages when sizing subviews of a modal view-controller. I would rather size subviews using layout constraints instead of explicit frame values.</p>\n<p>The frame value is not correctly set for the modal view-controller up to and including <code>viewWillAppear</code>. The two methods that are called in sequence with the desired frame values are <code>viewWillLayoutSubviews</code> and <code>viewDidAppear</code>. Thus far, these appear to be the only &quot;hooks&quot; I can use with access to the correct frame values.</p>\n<p>These methods are not easily useable because:</p>\n<ul>\n<li><p><code>viewWillLayoutSubviews</code> is called multiple times with what I am assuming are intermediary frame values. Setting the same constraint(s) multiple times throws an Auto Layout constraint error.</p>\n<pre class="lang-objectivec prettyprint-override"><code>// Multiple frame values return from viewWillLayoutSubviews\n{{0, 0}, {393, 783}}\n{{0, 0}, {393, 283.66666666666663}}\n</code></pre>\n</li>\n<li><p><code>viewDidAppear</code> works better in that it is only called once with the final, desired frame value. However, by this point the views are added to the view hierarchy and shown on the screen. Then when setting the layout constraints, the screen brief displays the unconstrained layout before displaying the constrained layout.</p>\n</li>\n</ul>\n<p><strong>Workaround solution</strong>: Using <code>viewWillLayoutSubviews</code> and deactivating old constraints before activating new constraints to avoid constraint conflicts. This can be done by either iterating through <code>modal.view.constraints</code> or maintaining a state variable (strong reference) to the original constraints on the first call of <code>viewWillLayoutSubviews</code>. This does not seem to be that clean of a solution.</p>\n<pre class="lang-objectivec prettyprint-override"><code>// Utility function to activate constraints\nvoid setConstraints (UIView* view, NSLayoutAnchor *leading, NSLayoutAnchor *trailing, NSLayoutAnchor *top, NSLayoutAnchor *bottom,\n CGFloat cLeading, CGFloat cTrailing, CGFloat cTop, CGFloat cBottom, NSArray&lt;NSLayoutConstraint*&gt;* __strong *constraints) {\n NSArray *newConstraints = @[\n [view.leadingAnchor constraintEqualToAnchor:leading constant:cLeading],\n [view.trailingAnchor constraintEqualToAnchor:trailing constant:cTrailing],\n [view.topAnchor constraintEqualToAnchor:top constant:cTop],\n [view.bottomAnchor constraintEqualToAnchor:bottom constant:cBottom]\n ];\n [NSLayoutConstraint deactivateConstraints:*constraints];\n [NSLayoutConstraint activateConstraints:newConstraints];\n *constraints = newConstraints;\n}\n\n// UIViewController &quot;hook&quot; with eventually correct frame value\n- (void)viewWillLayoutSubviews {\n [super viewWillLayoutSubviews];\n [self.recordingView setConstraints];\n}\n\n// Modal view-controller setting auto layout constraints based on layoutMarginsGuide and current modal frame values\n- (void) setConstraints {\n UILayoutGuide *guide = self.layoutMarginsGuide;\n CGFloat width = self.frame.size.width;\n CGFloat height = self.frame.size.height;\n setConstraints(self.textField, guide.leadingAnchor, guide.trailingAnchor, guide.topAnchor, guide.topAnchor,\n 0.05*width, -0.05*width, 0.0, 0.2*height, &amp;textFieldConstraints);\n setConstraints(self.progressBar, guide.leadingAnchor, guide.trailingAnchor, self.textField.bottomAnchor, self.textField.bottomAnchor,\n 0.05*width, -0.05*width, 0.08*height, 0.1*height, &amp;progressBarConstraints);\n}\n</code></pre>\n<p><strong>Question</strong>: Is there a better way to do this that I am not seeing? Or am I not really supposed to be using frame values as viewport width/height percentages (similar to CSS)?</p>\n"^^ . . . . . . . . . . "<p>I'm trying to implement a share extension in my ios application. I want to share photos and before the app will send them to the backend I want to resize the photos.\nI'm using this function:</p>\n<pre><code>+(UIImage*) resizedImage :(UIImage*) image andPreferredSize:(CGSize) size\n{\n if(image.size.height &gt; size.height &amp;&amp; image.size.width &gt; size.width)\n {\n float ratio1 = image.size.height/size.height;\n float ratio2 = image.size.width/size.width;\n float ratio3 = ratio1 &lt; ratio2 ? ratio1 : ratio2;\n \n CGSize newSize = CGSizeMake(image.size.width/ratio3 , image.size.height/ratio3);\n UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);\n [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];\n UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();\n image = [[newImage retain] autorelease];\n UIGraphicsEndImageContext(); \n }\n \n return image;\n}\n</code></pre>\n<p>If i share multiple photos(in a serial queue) in the second photo i get this msg error and crash:</p>\n<pre><code>Message from debugger: Terminated due to memory issue\n</code></pre>\n<p>The memory usage does not exceed 20 Mb. Any idea what can be the problem?</p>\n"^^ . . . "-2"^^ . . "c++"^^ . . "Is the end goal to simply position the text field and progress bar within the recording view or should the size of the recording view be adjusted based on the layout of the text field and the progress bar?"^^ . "0"^^ . "<blockquote>\n<p>I cant find a way to move the disclosure triangle between the folder icon and the name.</p>\n</blockquote>\n<p>Put the folder icon in column 0 and the title in column 1. Set <code>outlineTableColumn</code> (or the Outline Column in IB) to column 1.</p>\n"^^ . "I don't see the relation with the protocol. Could you explain it?"^^ . . . . . . . . . . . . . . . . "0"^^ . "0"^^ . . . "0"^^ . . "As I recall, there are settings you can adjust that alter the way items scale. You should be able to customize a linear carousel so that it looks like what you show."^^ . . . . . . . . . . . . "1"^^ . . . "0"^^ . . . . . . . "@DonMag Sorry about that. Yes `textField` is indeed a `UITextView`. And basically I want to position subviews based on viewport width/height percentages as you've described. The specific percentages are not particularly relevant."^^ . "0"^^ . . . "nslayoutconstraint"^^ . . . . . . . . "1"^^ . . . . . . . . "A better way of instantiating a class that follows a protocol"^^ . . . "1"^^ . "How to create NSImage from pixel array in Xcode for macOS app"^^ . . . . . . . . . . "`UINavigationController *rootNavigationController = (UINavigationController *)self.window.rootViewController;\n NSLog(@"Navigate%@", rootNavigationController);` This returns NULL...Actually both that and current are returning NULL"^^ . "0"^^ . . . . "<p>I generate a html of an img tag is wrapped by 255 div tags. I use libxml parse the html and output the result, but the img tag is missed in the result. But if the count of the div tags is 254, the output result is right, the img tag is show in it. Why it happend and How to fix it? Is the node level too deep? The code is below:</p>\n<pre><code> NSString* html = @&quot;&lt;img src='https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png'&gt;&quot;;\n for (int i = 0; i &lt; 255; i++) {\n html = [NSString stringWithFormat:@&quot;&lt;div&gt;%@&lt;/div&gt;&quot;, html];\n }\n NSData* data = [html dataUsingEncoding:NSUTF8StringEncoding];\n\n xmlDocPtr _doc = htmlReadMemory([_data bytes], (int)[_data length], &quot;&quot;, NULL, HTML_PARSE_NOWARNING | HTML_PARSE_NOERROR);\n if (_doc == NULL) {\n NSLog(@&quot;Unable to parse.&quot;);\n return;\n }\n \n xmlXPathContextPtr _context = xmlXPathNewContext(_doc);\n if(_context == NULL) {\n NSLog(@&quot;Unable to create XPath context.&quot;);\n return;\n }\n \n xmlNodePtr rootNode = xmlDocGetRootElement(_doc);\n xmlBufferPtr buffer = xmlBufferCreate();\n if (rootNode == NULL || rootNode == nil || buffer == NULL || buffer == nil) {\n return;\n }\n xmlNodeDump(buffer, rootNode-&gt;doc, rootNode, 0, 0);\n NSString *htmlContent = [NSString stringWithCString:(const char *)buffer-&gt;content encoding:NSUTF8StringEncoding];\n xmlBufferFree(buffer);\n\n xmlXPathFreeContext(_context);\n xmlFreeDoc(_doc);\n\n NSLog(@“%@”, htmlContent);\n</code></pre>\n<p>i try many different tags, but is the same way. Maybe the node level is too deep?</p>\n"^^ . . . . . . "Can you show me an example?"^^ . "0"^^ . . . . . . . . "code-splitting"^^ . . "0"^^ . . . . . "0"^^ . . . "<p>My font file name is &quot;CONSELHEIRO.otf&quot;. It is located in a folder called 'fonts'. I have added this file to Xcode, and made sure that it was indeed added to the target. I added it in the &quot;Fonts provided by application&quot; part of Info.plist as well. I have tried to confirm this by running this in AppDelegate:</p>\n<pre><code>for (NSString *familyName in [UIFont familyNames]){\n NSLog(@&quot;Family name: %@&quot;, familyName);\n for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) {\n NSLog(@&quot;--Font name: %@&quot;, fontName);\n }\n }\n</code></pre>\n<p>The font would not appear in the console when I did this. I then went into my storyboard, and added a UILabel to one of my views, and clicked custom, and sure enough, &quot;CONSELHEIRO&quot; was one of my options. I then built the app, and voila, it appeared in the console, as well as the font for the UITableView I had wanted it to appear on. So, thinking I had it solved, I went ahead and deleted the UILabel from IB, and once again, the font would not appear in console, or in the table view.</p>\n<p><a href="https://i.sstatic.net/WGPsK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WGPsK.png" alt="enter image description here" /></a>\n<a href="https://i.sstatic.net/EJjk9.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EJjk9.png" alt="enter image description here" /></a></p>\n<p>I can't for the life of me figure out why this is causing any difference at all, and I'd rather NOT have this random UILabel visible in my app. Anyone have any suggestions for what may be causing this? The PostScript name is &quot;Conselheiro&quot;, but changing capitalization across the app does not seem to make a difference.</p>\n<p>Since there's some question as to whether I'm doing everything right, in addition to the two different screenshots above where I have shown trying to do both upper or lowercase, here's more screenshots showing it is in the project bundle, and added to the target.</p>\n<p><a href="https://i.sstatic.net/jdgPF.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jdgPF.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/ignMD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ignMD.png" alt="enter image description here" /></a></p>\n"^^ . . . . "realm"^^ . "Thank you! With your help, I solved my problem. But I wrote another answer myself which I think would be more appropriate to be the accepted answer."^^ . . . . . . . . . "0"^^ . . . . . "Objective-c : set attribute to property, does it preserve the default settings"^^ . "<pre><code>- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {\nNSDictionary *notificationData = response.notification.request.content.userInfo;\n \n NSString *title = notificationData[@&quot;title&quot;];\n NSString *description = notificationData[@&quot;description&quot;];\n \n // Instantiate the JustNotifications view controller\n UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@&quot;Main&quot; bundle:nil];\n JustNotifications *newViewController = [mainStoryboard instantiateViewControllerWithIdentifier:@&quot;JustNotifications&quot;];\n newViewController.titleText = title;\n newViewController.descriptionText = description;\n \n // Wrap the JustNotifications view controller in a new navigation controller\n UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:newViewController];\n \n // Present the navigation controller modally\n UIViewController *rootViewController = UIApplication.sharedApplication.keyWindow.rootViewController;\n [rootViewController presentViewController:navController animated:YES completion:nil];\n \n completionHandler();\n}\n</code></pre>\n"^^ . . . . "Thank you so much for your very detail code @Cryptic. I tried your code and found out that although "myFile.txt" is already placed in the same folder level as Tweak.xm file, the log print nothing on the first injection to the app and a blank "myFile.txt" file was created in the app document. Anyway it did give me an other solution, which is to manually go to the app document directory in Filza and edit the newly created blank "myFile.txt" myself. I just wondering if there are any way to directly get the text content from the tweak and not having to create and edit a text file the doc directory"^^ . . . . . . . . "Hopefully it is more understandable now. `self.selectedUnit.name` contains the type of squad the user wants to configure and is used to determine which class I need `self.squadToConfigure` to point to."^^ . "0"^^ . . . . . . "<pre><code>int alert()\n{\n //Alerting\n UIAlertController *alert = [UIAlertController alertControllerWithTitle:@&quot;0%&quot; message:nil preferredStyle:UIAlertControllerStyleAlert];\n\n UIView *customView = [[UIView alloc] initWithFrame:CGRectMake(5, 5, 50.0F, 50.0F)];\n \n UIButton *sampleButton = [UIButton buttonWithType:UIButtonTypeCustom];\n [sampleButton setFrame:CGRectMake(0,5,60.0F, 40.0F)];\n [sampleButton setBackgroundImage:[UIImage systemImageNamed:@&quot;terminal.fill&quot;] forState:UIControlStateNormal];\n\n [sampleButton addTarget:[[MyObject alloc] init] action:@selector(showTerminal) forControlEvents:UIControlEventTouchDown];\n \n [customView addSubview:sampleButton];\n\n [alert.view addSubview:customView];\n\n dispatch_async(dispatch_get_main_queue(), ^{\n [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alert animated:YES completion:nil];\n });\n}\n\n@implementation MyObject\n\n-(void)showTerminal\n{\n NSLog(@&quot;Terminal opened!&quot;);\n}\n\n@end\n</code></pre>\n<p>How can I make @selector work when calling function from another @implementation!</p>\n<p>I have tried this code but the function never executes &quot;[sampleButton addTarget:[[MyObject alloc] init] action:@selector(showTerminal) forControlEvents:UIControlEventTouchDown];&quot;</p>\n<p>Can someone help me fix it or tell me a work around that doesn't involve using the ViewController()?</p>\n"^^ . "inheritance"^^ . "<p>The <code>[NSSpellChecker availableLanguages]</code> method returns an array of locale codes (like &quot;de&quot;, &quot;en_GB&quot; etc.). Is there a way that I can get localized language names (eg. &quot;Deutsch&quot; for &quot;de&quot; on a German system) from that on OS X in Objective-C?</p>\n<p>(The spellchecker panel has a popup menu of these languages, so the OS obviously has a table.)</p>\n"^^ . . . . . . "You are simply changing the local variable `Text`. You need to pass the updated text to the view controller. Also note that you are trying to change the text after 0.1 seconds, not 3 seconds."^^ . . . "Have you used the debugger to see what is actually happening at runtime?"^^ . "It also is very confusing that you want the leading edge of the text field and progress view to be 5% of the view's width further in from the view's leading margin. Is that really your intent? Or do you really just want the leading edge of the text field and progress bar to be 5% of the view's width from the view's leading edge?"^^ . "1"^^ . . . "0"^^ . . "Understood. Firebase does provide offline persistence in case you need it. As far as the code in the question goes, other than the Syntax error mentioned above, I copy and pasted your exact code into a project and it works correctly. No crashes. That leads me to believe the issue lies elsewhere in the project, probably how `realm` is defined or configured."^^ . . . "2"^^ . "<p>I have a Storyboard app with a UINavigationController as its Storyboard Entry Point. Its normal main view is a ViewController called &quot;ViewController&quot;. What I want to have happen is push the controller named &quot;JustNotifications&quot; when a user taps the incoming notification. However, nothing happens as of now. What am I missing?</p>\n<pre><code>- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {\n NSDictionary *notificationData = response.notification.request.content.userInfo;\n \n // Extract data from the notification payload\n NSString *title = notificationData[@&quot;title&quot;];\n NSString *description = notificationData[@&quot;description&quot;];\n\n // Get a reference to the navigation controller\n UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;\n\n // Find the currently visible view controller in the navigation stack\n UIViewController *currentViewController = navigationController.visibleViewController;\n\n // Perform the segue\n [currentViewController performSegueWithIdentifier:@&quot;ShowJustNotificationsSegue&quot; sender:self];\n\n // Call the completion handler\n completionHandler();\n}\n</code></pre>\n"^^ . "@Cy-4AH Thanks, post that as an answer and you'll get the credit."^^ . . "<p>Since your question is asking about a general approach, the following is just an example for setting up the constraints for the text view within its superview.</p>\n<pre><code>[NSLayoutConstraint activateConstraints:@[\n // Set the width as a percentage of the superview's width\n [self.textView.widthAnchor constraintEqualToAnchor:self.layoutMarginsGuide.widthAnchor multiplier:0.9],\n // Align in the center horizontally\n [self.textView.centerXAnchor constraintEqualToAnchor:self.layoutMarginsGuide.centerXAnchor],\n // Set the top\n [self.textView.topAnchor constraintEqualToAnchor:self.layoutMarginsGuide.topAnchor],\n // Rely on the intrinsic height of the text view or you can optionally set a specific height constraint if desired\n]];\n</code></pre>\n<p>The first constraint is the one most relevant to your question. This shows how to make the text view be 90% the width of the superview's margin layout width. Adjust as needed. Maybe replace <code>self.layoutMarginsGuide.widthAnchor</code> with <code>self.widthAnchor</code> depending on your needs.</p>\n<p>Set these up once and you're done. No need to update. As the width of the superview changes, so will the width of the text view.</p>\n<hr />\n<p>If you want to set a <code>topAnchor</code>, <code>bottomAnchor</code>, <code>leadingAnchor</code>, or <code>trailingAnchor</code> to be a percentage of a view's height or width, then you need to use the longer form of creating the constraint.</p>\n<p>The following would set the text view's <code>topAnchor</code> to be 30% of the superview's <code>bottomAnchor</code>:</p>\n<pre><code>NSLayoutConstraint *top = [NSLayoutConstraint constraintWithItem:self.textView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:0.3 constant:0];\n</code></pre>\n<p>Then you need to activate it as usual.</p>\n"^^ . "0"^^ . . "0"^^ . . . . "Showing your current Swift code might help, and printing `data` and `items` might help too."^^ . "iCarousel iOS with reduced size views on the sides"^^ . . "0"^^ . . . "1"^^ . . "1"^^ . . "metal"^^ . "0"^^ . "1"^^ . . "3"^^ . "<p>The lines:</p>\n<pre class="lang-objectivec prettyprint-override"><code>// Extract properties\nproperties = [NSURL resourceValuesForKeys:@[@&quot;AllPropertiesKey&quot;] fromBookmarkData:bookmark][@&quot;AllPropertiesKey&quot;];\nif(properties == nil)\n{\n // Skip this item\n continue;\n}\n</code></pre>\n<p>would be something like this:</p>\n<pre class="lang-swift prettyprint-override"><code>// Extract properties\nlet allPropertiesKey = URLResourceKey(&quot;AllPropertiesKey&quot;)\nguard let properties = NSURL.resourceValues(forKeys: [ allPropertiesKey ], fromBookmarkData: bookmark)?[allPropertiesKey] as? [URLResourceKey: Any] else {\n // Skip this item\n continue;\n}\n</code></pre>\n<p>I think the cast at the end is correct but it really depends on what the made-up <code>&quot;AllPropertiesKey&quot;</code> key returns. Given the rest of your code, <code>[URLResourceKey: Any]</code> seems likely.</p>\n<p>If that all does work, then a line like:</p>\n<pre class="lang-objectivec prettyprint-override"><code>item.name = properties[@&quot;NSURLNameKey&quot;];\n</code></pre>\n<p>would become:</p>\n<pre class="lang-swift prettyprint-override"><code>item.name = properties[.nameKey] as? String // or as! but write that defensively\n</code></pre>\n"^^ . . . . "2"^^ . . . . "How to update text of a presented view controller after a delay?"^^ . "0"^^ . . . "You still have not shown what `selectedUnit` is (what properties it has, etc.) But this, as I already suggested, is the heart of the matter."^^ . . . . . . "1"^^ . "<p>I was tasked with adding support for universal links into our iOS app written in C++ with an additional complication that the app uses SDL 2 for wrapping iOS specific code (like the <code>AppDelegate</code>).</p>\n<p>From my brief research SDL does not provide any API to get the url, or did I miss something ? Is there a way to get the URL from SDL without modifying SDL itself ?</p>\n<p>If not, then at least an outline (a code snippet) of how to get the URL from Objective C to C++ would be nice, as my Objective-C knowledge is zero.</p>\n"^^ . "interface-builder"^^ . "exception"^^ . . . . "It's part of [`DeviceCheck`](https://developer.apple.com/documentation/devicecheck?language=objc) so, `#import <DeviceCheck.h>` ?"^^ . . "<p>The problem you're having is that you are keying off a literal string, which is really fragile. At the very least, you need to have on hand a <em>dictionary</em> that maps between your <code>selectedUnit.name</code> possibilities and the class you want to instantiate.</p>\n<p>This would be made more bullet-proof if the name possibilities themselves were constants rather than mere literal strings, which can be incorrectly typed, or if the units had some sort of immutable and reliable identifier. But you have not shown anything about these units and how they are used, so it's impossible to say more.</p>\n<p>But a more sophisticated approach might be to plan ahead such that <code>selectedUnit</code> itself has a property that <em>is</em> the class corresponding to this unit, so that you can just read that property directly and instantiate.</p>\n"^^ . "Very confusing... is `textField` actually a `UITextView`? And you want it to be 20% of the height of the controller's view? And `progressBar` is a `UIProgressView`? And that should be 10% of the height? And both should be 90% of the width, centered horizontally?"^^ . "0"^^ . "jailbreak"^^ . . . . "0"^^ . "<p>As already pointed out in comments you are not assigning a new text on your view so you can not see the change on your screen. You need to have a way to update text on your view.</p>\n<p>Using a direct way you could assign a new text through your view controller. Something like this:</p>\n<pre><code>[vc assignNewText: @&quot;Program started&quot;];\n// Instead of Text = @&quot;Program started&quot;;\n</code></pre>\n<p>But to do so you will need access to your view controller as your own subclass (which is not included in your question but we can assume it exists). If it is called <code>HelloWorldViewController</code> then:</p>\n<pre><code>HelloWorldViewController *vc = [HelloWorldViewFactory createWithText:Text];\n// Instead of UIViewController *vc = [HelloWorldViewFactory createWithText:Text];\n</code></pre>\n<p>We should also ensure that the method to create your view controller is actually defined to return this type of view. It should be:</p>\n<pre><code>// In @interface of HelloWorldViewFactory\n+ (HelloWorldViewController *)createWithText:(NSString *)text;\n// In @implementation of HelloWorldViewFactory\n+ (HelloWorldViewController *)createWithText:(NSString *)text {\n</code></pre>\n<p>And a method to assign new text should be added to your <code>HelloWorldViewController</code>. Again assuming a lot there could be a label referenced through <code>textLabel</code> which displays your text.</p>\n<pre><code>@implementation HelloWorldViewController\n\n- (void)assignNewText:(NSString *)text {\n self.textLabel.text = text;\n}\n\n\n@end\n</code></pre>\n"^^ . . "Please update your question with your relevant code (as text)."^^ . . "metro-bundler"^^ . . "0"^^ . "Try replacing `NSLayoutAttributeHeight` with `NSLayoutAttributeBottom`."^^ . "<p>The process is exactly the same except rather than <code>UIImage</code> convenience initializer <a href="https://developer.apple.com/documentation/uikit/uiimage/1624124-imagewithcgimage/" rel="nofollow noreferrer"><code>imageWithCGImage:</code></a>, you call <code>NSImage</code> initializer <a href="https://developer.apple.com/documentation/appkit/nsimage/1519939-initwithcgimage?language=objc" rel="nofollow noreferrer"><code>initWithCGImage:size:</code></a>:</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSImage *image;\nCGImageRef cgImage = CGBitmapContextCreateImage(context);\n\nif (cgImage) {\n NSSize size = NSMakeSize(width, height);\n image = [[NSImage alloc] initWithCGImage:cgImage size:size];\n\n CGImageRelease(cgImage);\n}\n</code></pre>\n"^^ . . "<p>In Objective-C, how do I include the Framework containing DCAppAttestService so that I can do this:</p>\n<p><code>DCAppAttestService *attestService = [[DCAppAttestService alloc] init];</code></p>\n"^^ . . . . . . . . . . "0"^^ . . . . . . . "3"^^ . . "0"^^ . . . . . . "What is `NSURLBookmarkAllPropertiesKey` ? There's no such key. You seem to have a lot of made up keys in your code."^^ . "1"^^ . "How do you import DCAppAttestService?"^^ . "0"^^ . . . "0"^^ . "0"^^ . . . . "`-[NSLocale localizedStringForLanguageCode:]`"^^ . . . . . . . "Ask one question per question please. Please read [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask)."^^ . "AWSS3TransferManager defaultS3TransferManager exception SIGABRT not caught"^^ . . "nsurlsession"^^ . . . . . "1"^^ . . . "How to use URLSession to decide ignoreSSL from another class?"^^ . . . "Then either `navigationController` or `currentViewController` is nil. Checking those need to be part of the debugging. Also verify the segue is setup correctly in the storyboard."^^ . . . . "0"^^ . . . . "<p>If I specify an attribute for a defined property, does it have any effect on the default attribute configuration?</p>\n<p>For example, the following declarations are equal since <code>atomic, readwrite and strong</code> are set by default</p>\n<pre><code>@property(atomic,readwrite,strong)NSString *name;\n@property NSString *name;\n</code></pre>\n<p>if I declare the property with <code>assign</code> attribute, does it keep the other attributes ?</p>\n<p>are these 2 statements equivalent ?</p>\n<pre><code>@property (assign) NSString* name;\n@property (assign,atomic,readwrite,strong) NSString * name;\n</code></pre>\n<p>and what happen if I change one default property, does it keep the other in their default setting ? are these 2 statements equivalent ?</p>\n<pre><code>@property (nonatomic,weak) NSString * name;\n@property (nonatomic,weak,readwrite) NSString * name; \n\n</code></pre>\n<p>I'm asking this since when I set a property with <code>assign</code> attribute only, it looks like the <code>strong</code> attribute is no longer applied, since when I set it with another variable, it doesn't retain reference.</p>\n"^^ . "@Jay Sorry, what do you mean by modern swift syntax? I am new to Swift developing and Realm also. This methods where built back in 2019. Currently I've been rewritting this app's clases. But I am stucked with Realm. I dont quite understand the database handling. I know how to handle java objects but these are completely different.\nWhat would you recommend for me to start building a simple App in Swift using UIKIT and RealmSwift for storing 5 objects that get their values from Firebase and store it in local Realm. Where can I educate myself to be able to solve this?"^^ . "Update your question with relevant portions of your `HelloWorldViewFactory createWithText:` method. That will make it a lot easier to show a relevant solution."^^ . "<p>I'm trying to implement Code Splitting in a React Native app. Currently I managed to load multiple bundles in Android both in packager mode and in production mode.</p>\n<p>However, on iOS I'm facing the following issue:\n<code>Cannot initialize hmrClient twice</code>.\nI'm trying to load the additional bundles using <code>[bridge.batchedBridge executeSourceCode]</code> which works in production mode but throws when using the packager.</p>\n<p>When looking at the implementation of <code>executeSourceCode</code> I see that it indeed calls <code>setupHMRClientWithBundleURL</code> without checking if it was already initialized.</p>\n<p>Is there any way to overcome this issue?</p>\n"^^ . . "uiimage"^^ . . . . . . . . . . . . . . . "<p>The various attributes of Objective-C properties are grouped into mutually exclusive sets of values. You can only pick one value from each group.</p>\n<ul>\n<li>A property is either atomic or nonatomic.</li>\n<li>A property is either readwrite or readonly.</li>\n<li>A property is either assign, weak, strong, or copy.</li>\n<li>A property is either nullable or nonnull.</li>\n</ul>\n<p>So you can't make a property that is both <code>assign</code> and <code>strong</code>. It can only be one of them.</p>\n<p>Picking a value from each group has no effect on the values in any other group.</p>\n<p>For a reference type (<code>NSString *</code> for example), the defaults are atomic, readwrite, and strong as you have stated. Explicitly choosing a non-default value for one value does not change the other defaults.</p>\n<p>You asked:</p>\n<blockquote>\n<p>are these 2 statements equivalent?</p>\n</blockquote>\n<pre><code>@property (assign) NSString* name;\n@property (assign,atomic,readwrite,strong) NSString * name;\n</code></pre>\n<p>No since once you pick <code>assign</code>, <code>strong</code> is not used. On a side note, never use <code>assign</code> with a reference type unless you really, really have a good and fully understood reason to do so.</p>\n<p>In other words, these are the same:</p>\n<pre><code>@property (assign) NSString *name;\n@property (assign, atomic, readwrite) NSString *name;\n</code></pre>\n<p>Though again, don't use <code>assign</code> with reference types.</p>\n<p>You asked if the following are equivalent:</p>\n<pre><code>@property (nonatomic,weak) NSString * name;\n@property (nonatomic,weak,readwrite) NSString * name; \n</code></pre>\n<p>Yes, these are the same. I use the 1st all of the time and the property is always readwrite as well.</p>\n<hr />\n<p>I said you can only pick one value from each group. This is actually only partially true. In a class's public interface you can declare a property as readonly. And then in the class's private class extension, you can redeclare the property as readwrite. For example:</p>\n<p>.h file:</p>\n<pre><code>@interface SomeClass\n\n@property (readonly) NSString *someValue;\n\n@end\n</code></pre>\n<p>.m file</p>\n<pre><code>@interface SomeClass ()\n\n@property (readwrite) NSString *someValue;\n\n@end\n</code></pre>\n<p>What this does is expose a readonly property to users of the class but allow the private implementation of the class to also write values to the property.</p>\n"^^ . . . . . "BTW: handlers commonly set on `UIControlEventTouchUpInside`"^^ . "https://youtrack.jetbrains.com/issue/KT-61763/Kotlin-Multiplatform-native-iOS-memory-overload-issue"^^ . . . "0"^^ . "<p><strong>The situation:</strong> I'm developing an iOS Metal App in <strong>Objective-C</strong>. I need to use a 3rd-party library <a href="https://github.com/DTolm/VkFFT" rel="nofollow noreferrer">VkFFT</a> that provides Metal FFTs based on <a href="https://github.com/bkaradzic/metal-cpp" rel="nofollow noreferrer">Metal-Cpp</a>.</p>\n<p><strong>What I need:</strong> pass a <code>id&lt;MTLCommandQueue&gt;</code> instance from Objective-C world to C++ world as a <code>MTL::CommandQueue</code> object so that I can push compute commands to it. <strong>I don't want to create a seperate commmand queue in Metal-Cpp</strong> because using a single command queue can let me keep pushing all commands to it without <code>waitUntilCompleted</code>.</p>\n"^^ . . . "0"^^ . . . "Can I get a localized language name for a locale code in Cocoa?"^^ . "1"^^ . "0"^^ . "<p>I did a little redesign but it should work correctly for your purposes.</p>\n<p>Example Code:</p>\n<pre><code>NSError *error = nil;\n\n// Open the file and create it if it doesn't exist\nNSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);\nNSString *documentsDirectory = [paths firstObject];\nNSString *filePath = [NSString stringWithFormat:@&quot;%@/myFile.txt&quot;, documentsDirectory];\nNSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:filePath];\n\nif (fileHandle == nil) {\n [[NSFileManager defaultManager] createFileAtPath:filePath contents:nil attributes:nil];\n}\n\n// Open the output stream\nNSOutputStream *outputStream = [NSOutputStream outputStreamToFileAtPath:filePath append:YES];\n[outputStream open];\n\n// Open the input stream\nNSInputStream *inputStream = [NSInputStream inputStreamWithFileAtPath:filePath];\n[inputStream open];\n\n// What you are writing\nNSString *printString = [NSString stringWithFormat:@&quot;Hello Logos\\n&quot;];\n\n// Write to file\n[fileHandle seekToEndOfFile];\nNSData *contentData = [printString dataUsingEncoding:NSUTF8StringEncoding];\n[outputStream write:contentData.bytes maxLength:contentData.length];\n\n// Read from file\nsize_t fileSize = [[[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:&amp;error] fileSize];\nif(error) {\n NSLog(@&quot;Error reading file: %@&quot;, error);\n return;\n}\nNSMutableData* data = [NSMutableData dataWithLength:fileSize];\nsize_t result = [inputStream read:(uint8_t *)data.bytes maxLength:fileSize];\nif(result != fileSize) {\n NSLog(@&quot;Failed to read %zu bytes, only read %zu!&quot;, fileSize, result);\n}\nNSLog(@&quot;%@: contains:\\n%@&quot;, filePath, [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);\n</code></pre>\n<p>Test run:</p>\n<pre><code>❯ xcrun clang -arch x86_64 -isysroot $(xcrun --sdk macosx --show-sdk-path) -O3 -DNDEBUG test.m -o test -framework Foundation\n\n/var/folders/x2/gjkg0qk92j92svxfk1x1cn100000gn/T\n❯ rm ~/Documents/myFile.txt\nrm: cannot remove '/Users/cryptic/Documents/myFile.txt': No such file or directory\n\n/var/folders/x2/gjkg0qk92j92svxfk1x1cn100000gn/T\n❯ ./test\n2023-08-27 19:48:23.654 test[2318:1592365] /Users/cryptic/Documents/myFile.txt: contains:\nHello Logos\n\n/var/folders/x2/gjkg0qk92j92svxfk1x1cn100000gn/T\n❯ ./test\n2023-08-27 19:48:24.381 test[2361:1592410] /Users/cryptic/Documents/myFile.txt: contains:\nHello Logos\nHello Logos\n\n/var/folders/x2/gjkg0qk92j92svxfk1x1cn100000gn/T\n❯ ./test\n2023-08-27 19:48:25.304 test[2387:1592456] /Users/cryptic/Documents/myFile.txt: contains:\nHello Logos\nHello Logos\nHello Logos\n\n/var/folders/x2/gjkg0qk92j92svxfk1x1cn100000gn/T\n❯\n\n</code></pre>\n"^^ . . "0"^^ . "0"^^ . . . "Using modal view frame size in subview layout constraints"^^ . . . "0"^^ . "Changing the position of NSOutlineView disclosure triangle and setting up icons for child nodes"^^ . . "0"^^ . . "0"^^ . "webrtc"^^ . . . . . . . "@DonMag i want to resize from (width = 3024, height = 4032) to (width = 768, height = 1024)"^^ . . "xamarin.ios"^^ . . . . "0"^^ . . . . . "0"^^ . . . "Universal links in iOS with C++ and SDL"^^ . . "Thank you for detailed explanation. Second option is make sense but I have a lot of model class so its gonna be long process seems like :)"^^ . "objective-c"^^ . . . "0"^^ . "@HangarRash The code runs, I added some logs in the console, and everything is there, it just isn't pushing the view controller"^^ . . . . "1"^^ . . . . . . "0"^^ . "<p>Here is the code I use to resize my images .it is in swift you can take clue from this.</p>\n<pre><code>func resize(targetSize: CGSize) -&gt; Data { \n var actualHeight = Float(self.size.height)\n var actualWidth = Float(self.size.width)\n let maxHeight: Float = Float(targetSize.width)\n let maxWidth: Float = Float(targetSize.height)\n var imgRatio: Float = actualWidth / actualHeight\n let maxRatio: Float = maxWidth / maxHeight\n let compressionQuality: Float = 0.5\n //50 percent compression\n if actualHeight &gt; maxHeight || actualWidth &gt; maxWidth {\n if imgRatio &lt; maxRatio {\n //adjust width according to maxHeight\n imgRatio = maxHeight / actualHeight\n actualWidth = imgRatio * actualWidth\n actualHeight = maxHeight\n }\n else if imgRatio &gt; maxRatio {\n //adjust height according to maxWidth\n imgRatio = maxWidth / actualWidth\n actualHeight = imgRatio * actualHeight\n actualWidth = maxWidth\n }\n else {\n actualHeight = maxHeight\n actualWidth = maxWidth\n }\n }\n let rect = CGRect(x: 0.0, y: 0.0, width: CGFloat(actualWidth), height: CGFloat(actualHeight))\n UIGraphicsBeginImageContext(rect.size)\n self.draw(in: rect)\n let img = UIGraphicsGetImageFromCurrentImageContext()\n let imageData = img?.jpegData(compressionQuality: CGFloat(compressionQuality)) ?? Data()\n UIGraphicsEndImageContext()\n return imageData\n \n}\n</code></pre>\n"^^ . . "-1"^^ . "<p>Because your <code>filter</code> variable is not kept referenced after the function has finished running, like the <code>videoCapturer</code> variable it is kept referenced in self. Let's do that and I think it will work. Now define the <code>filter</code> variable in the header file like <code>videoCapturer</code> and edit the code as follows:</p>\n<pre class="lang-objectivec prettyprint-override"><code>self.filter = [[MyVideoSourceFilter alloc] initWithSource:videoSource];\nself.videoCapturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:filter];\nself.videoCapturer.delegate = self.filter;\n</code></pre>\n"^^ . "3"^^ . . "I was suggesting that you pass the class as an object. But you could pass the string name of the class, I suppose."^^ . "1"^^ . . . . . "0"^^ . . "4"^^ . . "<p>I designed a full class to manage Realm Database on my app. Every method seems to work fine with the same instance of Realm. But when I go to the query methods I get an EXC_BAD_ACCESS Error. For example lets take my method getLogin():</p>\n<pre><code>public func getLogin() -&gt; Login {\n guard let realm = self.realm else {\n fatalError(&quot;Didnt find Realm instance&quot;)\n }\n let loginObjects: Results&lt;Login&gt; = realm.objects(Login.self)\n guard let loginObject: Login = loginObjects.first else { --- Thread1: EXC_BAD_ACCESS\n fatalError(&quot;Error getting Login object from Realm&quot;)\n }\n return objetoLogin\n}\n</code></pre>\n<p>My Login object is defined in an independent class:</p>\n<pre><code>import Foundation\nimport RealmSwift\n\nclass Login : Object{\n @objc dynamic var cif : String = &quot;&quot;\n @objc dynamic var password : String = &quot;&quot;\n @objc dynamic var iosToken : String = &quot;&quot;\n @objc dynamic var iag_id : Int32 = 0\n @objc dynamic var iat_id : Int32 = 0\n convenience init(cif: String, password: String, iosToken: String) {\n self.init()\n self.cif = cif\n self.password = password\n self.iosToken = iosToken\n self.iag_id = 0\n self.iat_id = 0\n }\n \n override static func primaryKey() -&gt; String? {\n return &quot;cif&quot;\n }\n}\n</code></pre>\n<p>I tried controlling an error that's not working, since I never get to see any of the fatalErrors on the console. I made sure to define an instance of Realm that would be used in the entire app without leaving the instance. I made sure I have at least 1 Login object in the database when initiating the app. Maybe I got the syntax wrong for handling Objects in Realm.</p>\n<p>I am using the following software versions:\nRealm 10.39.1\nRealmDatabase 13.10.1\n-- Both imported by SwiftPackageManager --\nXcode 13.4\nAnd building for iOS 12+</p>\n"^^ . . . . "0"^^ . . . . . . "0"^^ . "0"^^ . . "<p>inside an iOS tweak, I have a long text and store it in a text file at the same folder level with .xm file. Let's say I have a tweak project with a Tweak.xm file at the top level of the project, and another file called myFile.txt placed at the same folder level as Tweak.xm. How do I read the content of this txt file in the xm code?</p>\n<p>I tried this Objective-C code but an error came up as the file path may not be correct.</p>\n<pre><code>NSString *filePath = [[NSBundle mainBundle] pathForResource:@&quot;myFile&quot; ofType:@&quot;txt&quot;];\nNSError *error = nil;\nNSString *fileContent = [NSString stringWithContentsOfFile:filePath\n encoding:NSUTF8StringEncoding\n error:&amp;error];\n\nif (error) {\n NSLog(@&quot;Error reading file: %@&quot;, error);\n NSLog(@&quot;File Path: %@&quot;, filePath);\n // the log error is `Error reading file: Error Domain=NSCocoaErrorDomain Code=258 &quot;The file name is invalid.&quot;`\n} else {\n NSLog(@&quot;File Content:\\n%@&quot;, fileContent);\n\n \n}\n</code></pre>\n"^^ . "3"^^ . . . . . "0"^^ . . . . "1"^^ . "0"^^ . "<p>I found the answer, we need to create ignoreSSL globally that could be accessed by both class.</p>\n<p>Here we could create <strong>SSLManager.h</strong>:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &lt;Foundation/Foundation.h&gt;\n\n@interface SSLManager : NSObject\n\n@property (nonatomic, assign) BOOL ignoreSSL;\n\n+ (instancetype)sharedManager;\n\n@end\n\n</code></pre>\n<p>Here we could create <strong>SSLManager.m</strong>:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &quot;SSLManager.h&quot;\n\n@implementation SSLManager\n\n+ (instancetype)sharedManager {\n static SSLManager *sharedInstance = nil;\n static dispatch_once_t onceToken;\n dispatch_once(&amp;onceToken, ^{\n sharedInstance = [[self alloc] init];\n });\n return sharedInstance;\n}\n@end\n</code></pre>\n<p>Then, you can set to shared instance like this:</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (void)join:(JitsiMeetConferenceOptions *)options {\n \n \n // Access the boolean value from options._starvConferenceInfo._ignoreSSL\n NSString *ignoreSSL = options.starvConferenceInfo.ignoreSSL;\n \n NSLog(@&quot;Ivan SSL Ignored: %@&quot;, ignoreSSL);\n\n // Convert the ignoreSSL value to a BOOL and set it in the SSLManager\n [SSLManager sharedManager].ignoreSSL = [ignoreSSL isEqualToString:@&quot;true&quot;];\n\n \n [self setProps:options == nil ? @{} : [options asProps]];\n}\n</code></pre>\n<p>In RCTHTTPRequestHandler+ignoreSSL.m, you can access sharedManager like this:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &quot;React/RCTBridgeModule.h&quot;\n#import &quot;React/RCTHTTPRequestHandler.h&quot;\n#import &quot;SSLManager.h&quot;\n\n@implementation RCTHTTPRequestHandler (ignoreSSL)\n\n- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler\n{\n // Get the value of &quot;ignoreSSL&quot; from the SSLManager singleton\n BOOL ignoreSSLValue = [SSLManager sharedManager].ignoreSSL;\n \n NSLog(@&quot;Ignore SSL: %@&quot;, @(ignoreSSLValue));\n // Check if the value is set to true\n if (ignoreSSLValue) {\n NSLog(@&quot;SSL Ignored: %@&quot;, @(ignoreSSLValue));\n // Handle SSL challenge here if ignoreSSL is true\n completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);\n } else {\n // Do not ignore SSL if false\n NSLog(@&quot;SSL Not Ignored: %@&quot;, @(ignoreSSLValue));\n completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);\n }\n}\n\n@end\n\n</code></pre>\n<p>Finally, you can set ignoreSSL from another class and share the value from this sharedManager.</p>\n"^^ . . . . "0"^^ . "3"^^ . "0"^^ . . "2"^^ . "Kotlin MPP: iOS Memory overload when using Kotlin defined function"^^ . . "<p>Developing apps for iOS, it is simple to extract pixels from <code>UIImage</code>, manipulate them, then reconstruct an <code>UIImage</code> from them, example:</p>\n<pre><code>csr = CGColorSpaceCreateDeviceRGB();\nctx = CGBitmapContextCreate(pax, devlar, devalt, 8, devlar*4, \n csr,kCGImageAlphaNoneSkipLast);\nrim = CGBitmapContextCreateImage(ctx);\ngen = [UIImage imageWithCGImage:rim scale:1.0 orientation:UIImageOrientationUp];*\n</code></pre>\n<p>But developing a macOS app, things are different, data structures and methods are different, and I don't understand how to.</p>\n"^^ . "0"^^ . "<p>The problem is that <code>Bool</code> is a value type and Obj-C doesn't support optional value types. Obj-C only supports nullability for reference types, by representing null values with a null pointer.</p>\n<p>There are multiple workarounds for this problem, such as</p>\n<ol>\n<li>Declare <code>property</code> as <code>NSNumber</code> and implement the <code>Codable</code> conformance manually</li>\n<li>Make <code>Test</code> a pure-Swift type and create a separate Obj-C bridge type (similar to how Foundations bridges between Swift and Obj-C types, such as <code>String</code> and <code>NSString</code> or <code>Array</code> and <code>NSArray</code>).</li>\n</ol>\n<p>I'd suggest point 2, since <code>Codable</code> is only usable from Swift, so there's no point in exposing a <code>Codable</code> conformant type to Obj-C, because you can only encode/decode it in Swift anyways. This also means that you can use any Swift features in your type, you don't need to restrict yourself to Obj-C compatible types and language features. Moreover, if you get to the point where you can remove the access from Obj-C, you can simply delete your bridge type and won't have to modify your pure Swift type.</p>\n<p>Here's a simple example of an Obj-C bridge for <code>Test</code>:</p>\n<pre><code>@objc class TestBridge: NSObject {\n @objc var property: NSNumber? {\n get {\n wrapped.property as NSNumber?\n }\n\n set {\n wrapped.property = newValue?.boolValue\n }\n }\n\n let wrapped: Test\n\n @objc init(property: NSNumber?) {\n self.wrapped = Test(property: property?.boolValue)\n }\n}\n</code></pre>\n<p>And the pure-Swift <code>Test</code> class:</p>\n<pre><code>class Test: Codable {\n var property: Bool?\n\n init(property: Bool?) {\n self.property = property\n }\n}\n</code></pre>\n"^^ . "Can’t parse too deep node by using libxml2"^^ . . . . . . "-2"^^ . . "How to read the content of a text file in an iOS tweak"^^ . "<p>I'm currently working on converting a piece of code written in Objective-C to Swift, and I've encountered a bit of a roadblock. The part that's giving me trouble involves extracting properties from a bookmark data.</p>\n<pre><code>NSMutableArray *extractItems(NSString *path)\n{\n NSDictionary *data = [NSDictionary dictionaryWithContentsOfFile:path];\n NSMutableArray* items = [[NSMutableArray alloc] init];\n NSData* bookmark = nil;\n NSDictionary* properties = nil;\n \n // Extract items\n for(id object in data[@&quot;$objects&quot;])\n {\n // Reset bookmark\n bookmark = nil;\n \n // Extract bookmark data\n if([object isKindOfClass:[NSData class]] == YES)\n {\n bookmark = object;\n }\n \n // Extract bookmark from dictionary\n if([object isKindOfClass:[NSDictionary class]] == YES)\n {\n bookmark = [object objectForKey:@&quot;NS.data&quot;];\n }\n \n // Skip if no bookmark\n if(bookmark == nil)\n {\n continue;\n }\n \n // Extract properties\n properties = [NSURL resourceValuesForKeys:@[@&quot;AllPropertiesKey&quot;] fromBookmarkData:bookmark][@&quot;AllPropertiesKey&quot;];\n if(properties == nil)\n {\n // Skip this item\n continue;\n }\n \n // Create item\n Item *item = [[Item alloc] init];\n item.path = path;\n item.executable = properties[@&quot;_NSURLPathKey&quot;];\n item.type = [NSNumber numberWithInt:ItemType];\n item.user = extractUserFromPath(path);\n item.content = nil;\n \n // Use name from bundle or NSURLNameKey\n item.name = [NSBundle bundleWithPath:item.executable].infoDictionary[@&quot;CFBundleName&quot;];\n if(item.name.length == 0)\n {\n item.name = properties[@&quot;NSURLNameKey&quot;];\n }\n \n // Skip if there are issues\n if (item.name == nil || item.executable == nil)\n {\n continue;\n }\n \n // Add item\n [items addObject:item];\n }\n \n return items;\n}\n\n</code></pre>\n<p>The challenge I'm facing is related to the extraction of properties using the resourceValuesForKeys method and then accessing the NSURLBookmarkAllPropertiesKey dictionary within it</p>\n"^^ . . "0"^^ . . . "0"^^ . "react-native"^^ . . . . . . "@YosiFZ - this line: `image = [[newImage retain] autorelease];` is really out of place. Have you disabled **ARC** for some reason? If so, why?"^^ . "0"^^ . . "uikit"^^ . "libxml2"^^ . . . . "0"^^ . . . . . . "0"^^ . . "@HangarRash Correct, window is nil"^^ . . . . . "0"^^ . . . "0"^^ . "0"^^ . "0"^^ . "1"^^ . . . . "0"^^ . "0"^^ . . "This works well for the sizing of the subview. Thanks!\nAs a follow-up, what if I want to position the subview let's say 30% of the superview height from the topAnchor as opposed to just on the topAnchor? There doesn't seem to be an adaptive layout method to do that using a similar "multiplier" argument, only "constant" which is a fixed value."^^ . . "2"^^ . "1"^^ . . . . . . . . . "<p>I would like to call a POST url and pass JSON data. For some reason my <strong>NSURLSessionDataTask</strong> is not firing at all I believe. I do not see any issues with my JSON data and api url is working fine (tested with postman). Could someone please let me know, what am I doing wrong here? Please find the code snippet bellow. TIA</p>\n<pre><code>-(bool)CallPayPass:(PaymentConfig *)aConfig\n{\n \n NSData *jsonRequestData = [self GETJSONData:aConfig];\n \n if (!jsonRequestData)\n {\n NSLog(@&quot;Failed to create JSON data&quot;);//Handle Error Here. Later\n }\n else\n {\n NSString *jsonRequestString = [[NSString alloc] initWithData:jsonRequestData encoding:NSUTF8StringEncoding];\n \n //Step 1: Initialize transaction and get transactionnumber\n NSURL *url = [NSURL URLWithString:@&quot;https://api.sandbox.paypass.com/api/transactions/init&quot;];\n \n NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];\n NSData *requestData = [NSData dataWithBytes:[jsonRequestString UTF8String] length:[jsonRequestString length]];\n [request setHTTPMethod:@&quot;POST&quot;];\n [request setValue:@&quot;application/json&quot; forHTTPHeaderField:@&quot;Accept&quot;];\n [request setValue:@&quot;application/json; charset=UTF-8&quot; forHTTPHeaderField:@&quot;Content-Type&quot;];\n [request setValue:[NSString stringWithFormat:@&quot;%lu&quot;, (unsigned long)[requestData length]] forHTTPHeaderField:@&quot;Content-Length&quot;];\n [request setHTTPBody: requestData];\n \n NSURLSession *session = [NSURLSession sharedSession];\n NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)\n {\n // do something with the data\n NSData *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&amp;error];\n \n if (!json)\n {\n NSLog(@&quot;Failed to create JSON response data: %@&quot;, [error localizedDescription]);\n }\n else\n {\n NSLog(@&quot;%@&quot;, json);\n NSString *jsonResponseString = [[NSString alloc] initWithData:json encoding:NSUTF8StringEncoding];\n NSLog(@&quot;%@&quot;, jsonResponseString);\n }\n \n \n \n }];\n [dataTask resume];\n \n \n }\n return YES;\n}\n</code></pre>\n"^^ . . . "protocols"^^ . "0"^^ . "1"^^ . . "Bool type usage for Swift class and Objective - c same time"^^ . . "<p>I am trying to create a circular carousel. I would like to always show 3 at a time. One view is centralized and the other two (the previous and the next) on a reduced size like the image below:</p>\n<p><a href="https://i.sstatic.net/tKznz.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tKznz.png" alt="enter image description here" /></a></p>\n<p>I am working with Xamarin.iOS but a solution in swift and object-c is welcomed.</p>\n<p>This is the closest I could get:</p>\n<p><a href="https://i.sstatic.net/Tr6Me.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Tr6Me.png" alt="enter image description here" /></a></p>\n<p>I have this inside the iCarouselDelegate</p>\n<blockquote>\n<pre><code>public override nfloat ValueForOption(iCarousel carousel, iCarouselOption option, nfloat value)\n{\n switch (option)\n {\n case iCarouselOption.OffsetMultiplier:\n return 2f;\n\n case iCarouselOption.Wrap:\n return 1.5f;\n\n case iCarouselOption.VisibleItems:\n return count;\n\n case iCarouselOption.Spacing:\n return 2f;\n\n default:\n return value;\n }\n}\n</code></pre>\n</blockquote>\n<p>and also:</p>\n<blockquote>\n<p>ViewCarousel.Type = iCarouselType.Rotary;</p>\n</blockquote>\n"^^ . . . . "uiviewcontroller"^^ . . . "and... is your goal to **grow** the image? or **shrink** it? and... are you expecting the output size to be in **pixels** or in **points**?"^^ . "@DonMag There's the picture. I also tried it with everything capitalized the way the file name is, with the same outcome."^^ . ""Translating Objective-C Code to Swift: Struggling with Properties Extraction from Bookmark Data"Help me to translate this code"^^ . "<p>In your Objective-C <code>.m</code> file, add the following import:</p>\n<pre><code>#import &lt;DeviceCheck/DCAppAttestService.h&gt;\n</code></pre>\n<p>Add the framework <code>DeviceCheck.framework</code> under <em>Frameworks, Libraries, and Embedded Content</em> in the <em>General</em> tab of your target.</p>\n<p>Note however that, according to the <a href="https://developer.apple.com/documentation/devicecheck/establishing_your_app_s_integrity?language=objc" rel="nofollow noreferrer">documentation</a>, you should use the <code>DCAppAttestService.sharedService</code> singleton instead of creating your own.</p>\n"^^ . . . "1"^^ . . . "EXC_BAD_ACCESS quey consulting Realm database with RealmSwift library retrieving Object from Database"^^ . . "0"^^ . "Show me your method, I have no idea about the stuff that you are saying!"^^ . "0"^^ . "0"^^ . "<p><a href="https://clang.llvm.org/docs/AutomaticReferenceCounting.html#id15" rel="nofollow noreferrer">Bridged casts</a></p>\n<blockquote>\n<p>A bridged cast is a C-style cast annotated with one of three keywords:</p>\n<ul>\n<li>(__bridge T) op casts the operand to the destination type T. If T is a\nretainable object pointer type, then op must have a non-retainable\npointer type. If T is a non-retainable pointer type, then op must have\na retainable object pointer type. Otherwise the cast is ill-formed.\nThere is no transfer of ownership, and ARC inserts no retain\noperations.</li>\n<li>(__bridge_retained T) op casts the operand, which must\nhave retainable object pointer type, to the destination type, which\nmust be a non-retainable pointer type. ARC retains the value, subject\nto the usual optimizations on local values, and the recipient is\nresponsible for balancing that +1.</li>\n<li>(__bridge_transfer T) op casts the\noperand, which must have non-retainable pointer type, to the\ndestination type, which must be a retainable object pointer type. ARC\nwill release the value at the end of the enclosing full-expression,\nsubject to the usual optimizations on local values. These casts are\nrequired in order to transfer objects in and out of ARC control; see\nthe rationale in the section on conversion of retainable object\npointers.</li>\n</ul>\n</blockquote>\n<blockquote>\n<p>Using a __bridge_retained or __bridge_transfer cast purely to convince ARC &gt; to emit an unbalanced retain or release, respectively, is poor form.</p>\n</blockquote>\n<pre><code>id&lt;MTLCommandQueue&gt; objcQueue = /* Your Objective-c queue */;\nMTL::CommandQueue* queue = (__bridge MTL::CommandQueue*)objcQueue;\n</code></pre>\n"^^ . . . "0"^^ . . "methods"^^ . . . . . "macos"^^ . . . . . "<p>I’m creating a kotlin multiplatform application that runs on web, iOS and Android that will process images captured from the device’s video stream. The processing works fine on Android and web, but iOS has a serious memory problem that causes HUGE spikes in the application memory footprint.</p>\n<p>on iOS, I have my Camera management class that handles starting the video stream and capturing the output frames as CMSampleBuffer’s. Here is the output function:</p>\n<pre><code>func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {\n DispatchQueue.main.async { [unowned self] in\n guard let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else { return }\n let ciImage = CIImage(cvPixelBuffer: imageBuffer)\n guard let cgImage = context.createCGImage(ciImage, from: ciImage.extent) else { return }\n let uiImage = UIImage(cgImage: cgImage, scale: 1.0, orientation: .up)\n \n // kotlin class that handles image processing\n self.manager.processImage(image: uiImage)\n }\n }\n</code></pre>\n<p>Capturing the frames works fine, but when I pass the UIImage into the Kotlin function : “self.manager.processImage(image: UIImage)” the memory quickly overloads and creates a saw-tooth pattern that can lead to an app crash.</p>\n<p>Here is the processImage function:</p>\n<pre><code>class ImageManager {\n\n fun processImage(image: UIImage) {\n println(&quot;processing image&quot;)\n }\n}\n</code></pre>\n<p>I’ve only got the function printing out a simple value right now for debugging purposes. But this code causes huge spikes in the memory that reach 600Mb before the garbage collection cycles catch up. This code will eventually crash the application once the memory gets close to the 2Gb mark.</p>\n<p>If I comment out the “self.manager.processImage(image: uiImage)” the memory stays around ~40Mb and the application is stable.</p>\n<p>I’ve attached 2 images:</p>\n<ul>\n<li>First is the stable memory when not passing the UIImage into the Kotlin processing function.</li>\n<li>Second is with the function in use and how much memory the app accumulates in such a short amount of time.</li>\n</ul>\n<p><a href="https://i.sstatic.net/HfoZs.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HfoZs.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/eRJKg.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/eRJKg.png" alt="enter image description here" /></a></p>\n<p>Any thoughts or suggestions on something that might fix this?? This is currently blocking my development and I can’t find a way around it :(</p>\n<p>I've tried changing the input type on the processing function to something like a CMSampleBuffer or a CIImage. But all of these show up as &quot;UnsafeMutableRawPointers&quot; when calling the function from Swift and I haven't found a way to correctly pass it in.</p>\n<p>I've tried updating to Kotlin 1.9 and using the new custom memory allocator for Kotlin/ObjC. But it has no change.</p>\n"^^ . . . . . "0"^^ . . . "Feel stupid...the full filename had even the Extension all capitalized. Changed that, and it worked fine."^^ . . . "4"^^ . "<p>My iOS app crashes when I execute following code:</p>\n<pre><code> - (UIImage *)getImageAndSaveInDBWithKey:(NSString *)imageKey withKeyPath:(NSString *)keyPath inBucket:(NSString *)bucketName scanhistoryRecord:(ScanHistory *) scanHistoryRecord\n{\n \n [self setImageExceptionTitle:@&quot;&quot;];\n [self setImageExceptionName:@&quot;&quot;];\n [self setImageExceptionReason:@&quot;&quot;];\n \n [self setImageDownloadErrorCode:@&quot;&quot;];\n [self setImageDownloadErrorDomain:@&quot;&quot;];\n [self setImageDownloadErrorDescription:@&quot;&quot;];\n \n NSString *downloadingFilePath = [NSTemporaryDirectory()stringByAppendingPathComponent:imageKey];\n NSURL *downloadingFileURL = [NSURL fileURLWithPath:downloadingFilePath];\n __block UIImage *downloadedImage = nil;\n \n AWSS3TransferManagerDownloadRequest *downloadRequest = [AWSS3TransferManagerDownloadRequest new];\n downloadRequest.bucket = bucketName;\n downloadRequest.key = [NSString stringWithFormat:@&quot;%@%@&quot;, keyPath, imageKey];\n downloadRequest.downloadingFileURL = downloadingFileURL;\n \n @try {\n AWSS3TransferManager *transferManager = [AWSS3TransferManager defaultS3TransferManager];\n \n [[[transferManager download:downloadRequest] continueWithBlock:^id(AWSTask *task) {\n if (task.error)\n</code></pre>\n<p>In the crash log I can see that the exception is thrown in this line:</p>\n<pre><code>AWSS3TransferManager *transferManager = [AWSS3TransferManager defaultS3TransferManager];\n</code></pre>\n<p>This is the crashlog:</p>\n<pre><code>Exception Type: EXC_CRASH (SIGABRT)\nException Codes: 0x0000000000000000, 0x0000000000000000\nTermination Reason: SIGNAL 6 Abort trap: 6\nTerminating Process: iTracker [32153]\n\nTriggered by Thread: 6\n\nLast Exception Backtrace:\n0 CoreFoundation 0x1ba17ccb4 __exceptionPreprocess + 164 (NSException.m:202)\n1 libobjc.A.dylib 0x1b32183d0 objc_exception_throw + 60 (objc-exception.mm:356)\n2 AWSS3 0x1036e9b38 __48+[AWSS3TransferManager defaultS3TransferManager]_block_invoke + 440\n3 libdispatch.dylib 0x1c1643eac _dispatch_client_callout + 20 (object.m:560)\n4 libdispatch.dylib 0x1c16456ec _dispatch_once_callout + 32 (once.c:52)\n5 AWSS3 0x1036e9978 +[AWSS3TransferManager defaultS3TransferManager] + 56\n6 iTracker 0x102a0a79c -[AWSManager getImageAndSaveInDBWithKey:withKeyPath:inBucket:scanhistoryRecord:] + 284 (AWSManager.m:98)\n7 iTracker 0x102a50554 closure #1 in ResultView.showSuccess() + 316 (ResultView.swift:587)\n8 iTracker 0x102a7a63c thunk for @escaping @callee_guaranteed () -&gt; () + 28 (&lt;compiler-generated&gt;:0)\n9 libdispatch.dylib 0x1c1642320 _dispatch_call_block_and_release + 32 (init.c:1518)\n10 libdispatch.dylib 0x1c1643eac _dispatch_client_callout + 20 (object.m:560)\n11 libdispatch.dylib 0x1c1655a64 _dispatch_root_queue_drain + 684 (queue.c:7051)\n12 libdispatch.dylib 0x1c1656158 _dispatch_worker_thread2 + 164 (queue.c:7119)\n13 libsystem_pthread.dylib 0x219fadda0 _pthread_wqthread + 228 (pthread.c:2631)\n14 libsystem_pthread.dylib 0x219fadb7c start_wqthread + 8\n</code></pre>\n<p>I have wrapped this code in a try catch block. But the catch block is ignored and the app just crashes. What can I do in order to fix this issue?</p>\n"^^ . "1"^^ . . . . . . "0"^^ . "0"^^ . . "0"^^ . "0"^^ . . . . . . "Would add an extension with a dynamic property help? Something like this `var propertyForObjc: NSNumber? { self.property }`"^^ . . . "1"^^ . . . . . . "0"^^ . . "0"^^ . . . . . "0"^^ . "0"^^ . "1"^^ . . . "I'm glad you solve your problem, and thanks for sharing your solution with the community. (Voted)"^^ . . "-1"^^ . . . . . "<p>image resize with OC.</p>\n<pre><code>- (void)resizeImage:(UIButton *)sender {\n UIImage* originalImage = [UIImage imageNamed:@&quot;big_image&quot;];\n for (int i = 0; i &lt; 1000; i++) {\n @autoreleasepool {\n [[self class] resizedImage:originalImage andPreferredSize:CGSizeMake(768, 1024)];\n NSLog(@&quot;index:%d&quot;, i);\n }\n }\n}\n\n+ (UIImage *)resizedImage:(UIImage*)image andPreferredSize:(CGSize)size {\n if (size.width != 0 &amp;&amp; size.height != 0 &amp;&amp; image.size.height &gt; size.height &amp;&amp; image.size.width &gt; size.width) {\n // 这里image创建的时候需要考虑屏幕倍数 iphone7,8是2,x,xs,11pro是3.\n float device_pixel = 2;\n \n float ratio1 = size.height / image.size.height / device_pixel;\n float ratio2 = size.width / image.size.width / device_pixel;\n float ratio3 = ratio1 &lt; ratio2 ? ratio1 : ratio2;\n \n UIGraphicsBeginImageContextWithOptions(CGSizeMake(image.size.width * ratio3, image.size.height * ratio3), NO, 0.0);\n \n [image drawInRect:CGRectMake(0, 0, image.size.width * ratio3, image.size.height * ratio3)];\n // 由于涉及到float运算,返回值的图片分辨率可能有+-1的差异。\n UIImage* resizedImage = UIGraphicsGetImageFromCurrentImageContext();\n UIGraphicsEndImageContext();\n return resizedImage;\n }\n return image;\n}\n</code></pre>\n"^^ . "Thanks Matt. That's very helpful. `selectedUnit.name` is picked from a list (set at startup) rather than typed. Your suggestion of the dictionary is a good idea and I will add the class to be created as part of the class definition that defines `selectedUnit`. The class, `THMUnit` would contain `name`, `classtocreate` and a few other fields. \n\nHow do I create an instance of the class name stored in `classtocreate`?"^^ . "-1"^^ . . . "0"^^ . . . . "1"^^ . . . . "I worked with iCarousel back in 2015 or so, and seem to remember that it had an option for linear lists as you show. It looks like you're set up for a circular carousel. You might want to run the demo app and look through the options (If it will still build and run.)"^^ . . "0"^^ . . . . . . . . . . "1"^^ . . . "1"^^ . "Push View Controller When Notification Is Tapped"^^ . . "0"^^ . . "flutter"^^ . . "1"^^ . "<p>I am creating an OutlineView like this:</p>\n<p><img src="https://i.sstatic.net/UcxgN.png" alt="My OutlineView" /></p>\n<p>And I want to achieve a view which looks like this:</p>\n<p><img src="https://i.sstatic.net/PiTb0.png" alt="Desired view" /></p>\n<p>The 2 issues that I am facing are:</p>\n<ol>\n<li><p>I cant find a way to move the disclosure triangle between the folder icon and the name.</p>\n</li>\n<li><p>I am unable to setup the &quot;P&quot; icon for the child nodes.</p>\n</li>\n</ol>\n<p>For the 2nd issue, this is the code I tried setting up the icon with:</p>\n<pre><code>- (void)outlineView:(NSOutlineView *)aTableView willDisplayCell:(NSCell*)aCell forTableColumn:(NSTableColumn *)aTableColumn item:(id)item\n{\n NSImage* image = nil;\n BOOL isLeaf = [item isLeaf];\n \n if ([[aTableColumn identifier] isEqualToString:@&quot;styleIcon&quot;]) {\n \n if (aTableView == _charOutlineView) {\n image = [QXPGeneralInterfaces imageFor:(isLeaf ? kCharacterIconImage : kFolderIconImage)];\n }\n else {\n image = [QXPGeneralInterfaces imageFor:(isLeaf ? kParagraphIconImage : kFolderIconImage)];\n }\n \n if (image != nil) {\n [aCell setImage:image];\n }\n}\n</code></pre>\n<p>aCell does set the image but somehow it disappears in the UI.</p>\n"^^ . . . . "0"^^ . "Too many unknowns. Show your code! What is `self.selectedUnit.name` all about? That seems to be the heart of the problem."^^ . "nsoutlineview"^^ . . . . "What's happening? What are the logs saying? What's the cURL equivalent in POSTMAN, or the Objective-C generated code? What's calling that method? Is the object deallocated too soon?"^^ . . . . . "Be sure to accept your self-answer when the system allows you to."^^ . . "<p>So it seems that <code>metro</code> does things a bit differently in <code>dev</code> vs <code>prod</code> and I didn't account for that.</p>\n<p>Bundling JS with <code>--dev true</code> works. In order to avoid the <code>hmrClient</code> error it's better to use <code>[bridge.batchedBridge executeApplicationScript]</code> rather than <code>executeSourceCode</code>.</p>\n"^^ . "cocoa"^^ . "0"^^ . "0"^^ . . "0"^^ . "3"^^ . "*"I added it in the "Fonts provided by application" part of Info.plist as well."* ... File name is case-sensitive, and must include the extension. Show a screen-cap of of your info plist like this: https://i.sstatic.net/n8TI3.png"^^ . "2"^^ . "What class is this code in? Is this delegate being called at all? Have you used the debugger to step through this code and see what it does and where thing don't go as expected?"^^ . . . . . "<p>I found out that [AWSServiceManager defaultServiceManager].defaultServiceConfiguration was nil and added an if statement to handle the case when it is nil.</p>\n<pre><code> AWSS3TransferManagerDownloadRequest *downloadRequest = [AWSS3TransferManagerDownloadRequest new];\n downloadRequest.bucket = bucketName;\n downloadRequest.key = [NSString stringWithFormat:@&quot;%@%@&quot;, keyPath, imageKey];\n downloadRequest.downloadingFileURL = downloadingFileURL;\n \n if([AWSServiceManager defaultServiceManager].defaultServiceConfiguration == nil) {\n \n NSString *accessPointId = [[NSUserDefaults standardUserDefaults] stringForKey:@&quot;ap_id_1&quot;];\n NSString *vendorId = [[NSUserDefaults standardUserDefaults] stringForKey:@&quot;vendor_id&quot;];\n NSString *deviceId = [[NSUserDefaults standardUserDefaults] stringForKey:@&quot;device_id&quot;];\n NSString *username = [[NSUserDefaults standardUserDefaults] stringForKey:@&quot;username&quot;];\n NSString *message = [NSString stringWithFormat:@&quot;AWS not connected. Image not downloaded. accesspoint: %@ vendor: %@ device: %@ user: %@&quot;, accessPointId, vendorId, deviceId, username];\n [self setImageDownloadErrorDescription: message];\n NSLog(@&quot;%@&quot;,message);\n return downloadedImage;\n }\n</code></pre>\n<p>This solved my problem!</p>\n"^^ . . "1"^^ . . . "0"^^ . "1"^^ . . "<p>Here I have RCTHTTPRequestHandler+ignoreSSL.m that can ignoreSSL based on value from plist.info. It works nicely when I set the value of ignoreSSL from plist.info.</p>\n<pre class="lang-objectivec prettyprint-override"><code>\n#import &quot;React/RCTBridgeModule.h&quot;\n#import &quot;React/RCTHTTPRequestHandler.h&quot;\n\n@implementation RCTHTTPRequestHandler (ignoreSSL)\n\n- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler\n{\n // Get the main bundle\n NSBundle *mainBundle = [NSBundle mainBundle];\n \n // Get the value of &quot;IgnoreSSL&quot; from the Info.plist\n NSNumber *ignoreSSLValue = [mainBundle objectForInfoDictionaryKey:@&quot;IgnoreSSL&quot;];\n \n NSLog(@&quot;Ignore SSL: %@&quot;, ignoreSSLValue);\n\n \n // Check if the value is a boolean and if it's set to true (1)\n if ([ignoreSSLValue isKindOfClass:[NSNumber class]] &amp;&amp; [ignoreSSLValue boolValue]) {\n NSLog(@&quot;SSL Ignored: %@&quot;, ignoreSSLValue);\n\n // Handle SSL challenge here if IgnoreSSL is true\n completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);\n } else {\n // Do not IgnoreSSL is false\n NSLog(@&quot;SSL Not Ignored: %@&quot;, ignoreSSLValue);\n completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);\n }\n}\n\n@end\n</code></pre>\n<p>I expect to set IgnoreSSL when something happens in my code like shown below:</p>\n<pre class="lang-objectivec prettyprint-override"><code>\n@implementation JitsiMeetView {\n /**\n * The unique identifier of this `JitsiMeetView` within the process for the\n * purposes of `ExternalAPI`. The name scope was inspired by postis which we\n * use on Web for the similar purposes of the iframe-based external API.\n */\n NSString *externalAPIScope;\n\n /**\n * React Native view where the entire content will be rendered.\n */\n RNRootView *rootView;\n}\n\n- (void)join:(JitsiMeetConferenceOptions *)options {\n [self setProps:options == nil ? @{} : [options asProps]];\n \n \n // Access the boolean value from options._starvConferenceInfo._ignoreSSL\n NSString *ignoreSSL = options.starvConferenceInfo.ignoreSSL;\n \n NSLog(@&quot;Ivan SSL Ignored: %@&quot;,ignoreSSL);\n\n // Or use it in a conditional statement:\n if ([ignoreSSL isEqual: @&quot;true&quot;]) {\n // Do something when ignoreSSL is true\n NSLog(@&quot; SSL Ignored&quot;);\n } else {\n // Do something when ignoreSSL is false\n NSLog(@&quot; SSL not ignored&quot;);\n }\n}\n</code></pre>\n<p>Could we do something like this? I am sorry, I am a beginner in Objective-C</p>\n"^^ . . . "0"^^ . . . . . "1"^^ . "0"^^ . . . . . "Loading multiple JS bundles in React Native iOS"^^ . . . "0"^^ . . . . "It can't be done with your current code since all you have is a `UIViewController` reference. You need a subclass of `UIViewController` that has some method or property that you can update with the new text."^^ . "1"^^ . "ios"^^ . "0"^^ . "kotlin"^^ . "<p>i want to change the videosource from the rtccameravideocapture to remove background or add filter. and the method i do is to change the initwithdelegate to the class i create called myvideosourcefilter, so i can't use the didcapturevideoframe method , but the question is didcapturevideoframe method never goes in , what do i do wrong, the result i that i can initwithmyvideosource class, but i can't use the didcapturevideoframe method , i wonder what did i do wrong.</p>\n<pre><code>MyVideoSourceFilter *filter = [[MyVideoSourceFilter alloc] initWithSource:videoSource];\n self.videoCapturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:filter];\n self.videoCapturer.delegate = filter;\n</code></pre>\n<p>i want to override the didcapturevideoframe method , but the didcaptureframe method never goes in , what did i do wrong or what should i add</p>\n<p><code>MyVideoSourceFilter *filter = [[MyVideoSourceFilter alloc] initWithSource:videoSource]; self.videoCapturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:filter]; self.videoCapturer.delegate = filter;</code></p>\n<pre><code>\n- (instancetype)initWithSource:(RTCVideoSource *)source {\n NSLog(@&quot;init with source &quot;);\n self = [super init];\n self.videoSource = source;\n //if (self = [super init]) {\n\n\n //}\n return self;\n}\n\n- (void)capturer:(RTCVideoCapturer *)capturer didCaptureVideoFrame:(RTCVideoFrame *)frame {\n NSLog(@&quot;did capture video frame &quot;);\n\n if (self.videoSource != nil) {\n [self.videoSource capturer:capturer didCaptureVideoFrame:frame];\n }else{\n NSLog(@&quot;self.source = nil &quot;);\n }\n}\n</code></pre>\n<p>and the method i do is to change the initwithdelegate to the class i create called myvideosourcefilter, so i can't use the didcapturevideoframe method , but the question is didcapturevideoframe method never goes in , what do i do wrong, the result i that i can initwithmyvideosource class, but i can't use the didcapturevideoframe method , i wonder what did i do wrong.</p>\n"^^ . "0"^^ . "uinavigationcontroller"^^ . "<p><code>addTarget</code> is not retaining, so yours object is deallocated. You can use class object and method to retrieve event</p>\n<pre><code>[sampleButton addTarget:[MyObject class] action:@selector(showTerminal) forControlEvents:UIControlEventTouchDown];\n</code></pre>\n<p>and:</p>\n<pre><code>+ (void)showTerminal\n</code></pre>\n"^^ . . "0"^^ . . . . . "0"^^ . . . . . . . . "2"^^ . . . . . "<p>I'm working on my first iOS app part of which uses a protocol which then has a number of classes that follow it.</p>\n<pre><code>@protocol unitLoadoutDataController &lt;NSObject&gt;\n@required\n- (void)setDefaultLoadout:(NSString *)unitType unitId:(NSNumber *)uniqueUnitId;\n- (void)resizeDefaultLoadout:(NSString *)unitType unitId:(NSNumber *)uniqueUnitId number:(NSNumber *)models;\n- (UIAlertController *)updateLoadout:(NSInteger)section row:(NSInteger)row unitType:(NSString *)unitType unitId:(NSNumber *)uniqueUnitId number:(NSNumber *)models;\n@end\n</code></pre>\n<p>and then a set of classes that use it. e.g.</p>\n<pre><code>@interface heavyIntercessorSquad : NSObject &lt;unitLoadoutDataController&gt;\n\n@end\n@interface eradicatorSquad : NSObject &lt;unitLoadoutDataController&gt;\n\n@end\n</code></pre>\n<p>Both of these include the three 3 methods my protocol defines with different implementations.</p>\n<p>When the user clicks on one of the units from the list in a tableview I need an instance of that class so they can configure it on the next screen. I don't know which class I need until the row is clicked.</p>\n<p>To solve this problem I'm using a set of local variables and a big if/else block to get the class I need. selectedUnit.name contains the name of the squad the user clicked and depending on that value I create a class of the appropriate type. Once I have the pointer to the class I need I assign it to squadToConfigure and call the method I need.</p>\n<p>Here's the definition of squadToConfigure which holds the class once created.</p>\n<pre><code>@property (weak, nonatomic) id &lt;unitLoadoutDataController&gt; squadToConfigure;\n</code></pre>\n<p>Here is a subset of the code that works out which class I need (I have about 30 of these so far) based on selectUnit.name</p>\n<pre><code>heavyIntercessorSquad *heavyIntercessorSquadToConfigure;\neradicatorSquad *eradicatorSquadToConfigure;\n\nif ([selectedUnit.name isEqualToString:@&quot;Heavy Intercessor Squad&quot;]) {\n heavyIntercessorSquadToConfigure=[[heavyIntercessorSquad alloc] init];\n self.squadToConfigure=heavyIntercessorSquadToConfigure;\n}\nelse if ([selectedUnit.name isEqualToString:@&quot;Eradicator Squad&quot;]) {\n eradicatorSquadToConfigure =[[eradicatorSquad alloc] init];\n self.squadToConfigure= eradicatorSquadToConfigure;\n}\n[self.squadToConfigure setDefaultLoadout:self.selectedUnit.name\n unitId:newUnitId];\n \n</code></pre>\n<p>Is there a more elegant way of doing this? How can I instantiate a class of a type determined by the value of selectedUnit.name and assign it to self.squadToConfigure without having lots of else statements?</p>\n<p>The code above works well at the moment but isn't sustainable once I have a large number of classes - I have about 30 at the moment.</p>\n"^^ . . "How to access an array calling a category method within the method itself?"^^ . "ios webrtc virtual background and filter"^^ . "1"^^ . . . . "3"^^ . "2"^^ . . . "@HangarRash When I look at IB, I see Navigation Controller Scene. The controller in that scene is UINavigationController, doesn't contain a Storyboard ID, and is check marked for "Is initial view controller". There's an arrow pointing to it from the left for "Storyboard entry point""^^ . "1"^^ . "1"^^ . . . "-1"^^ . . "Can't you add a factory method to `unitLoadoutDataController` for it to construct an object? like `+(id < unitLoadoutDataController)factoryMethod`? It's hard to tell."^^ . . . "storyboard"^^ . "0"^^ . . . . . . . "1"^^ . "0"^^ . "0"^^ . . . "0"^^ . . . "0"^^ . . . "1"^^ . . . . . . . . "date"^^ . . . "How to open finder inside WKWebView in macOS app?"^^ . "It's an internal SwiftUI class, so there is no way to subclass it, nor extend it. The only way I can access it is during runtime, so that is why I resorted to this method."^^ . . "0"^^ . "yes, It is.\nwe are migrating each property to non-optional. Using the above function."^^ . . . . . . . "1"^^ . . . . . . . . . . . . . . . . . "1"^^ . "0"^^ . "0"^^ . . . . . "1"^^ . "0"^^ . "No, `-[NSMutableArray arrayByMultiplyingByNumber :]` is not implemented, it returns a `NSArray`. `-[NSMutableArray multiplyByNumber:]` is `- (void) multiplyByNumber:(NSInteger)number`, it mutates the receiver."^^ . . "widgetliveactivity"^^ . . "0"^^ . . "0"^^ . . . . . . . "xcode"^^ . "1"^^ . . "Ah yeah. I changed my approach, so I won't be needing this anymore, but I couldn't implement `multiplyByNumber` on `NSMutableArray` calls to super's `arrayByMultiplyingByNumber`: how do you "overwrite" self?"^^ . . . . . . . "-1"^^ . . . . . "realm-migration"^^ . . . "0"^^ . . . . . . . . . . "swift"^^ . . . . "<p>In my project <a href="https://github.com/pushy/pushy-sdk-ios" rel="nofollow noreferrer">Pushy</a> used to handle Push notification. I want to update my local Sqlite data when I got a specific type of Push Notification.</p>\n<p>I am able to handle this when application is in foreground. Using this Delegate method.</p>\n<pre><code>func notificationWillPresent(userInfo: [String: Any], completionHandler: ((UNNotificationPresentationOptions) -&gt; Void)?) {\n let remoteNotification = RemoteNotificationModel(userInfo)\ncompletionHandler?([.sound])\n}\n</code></pre>\n<p>But I want this same local data updating when app is in background or in killed state.\nCould you please suggest me how I can Achieve this.</p>\n<p>I did a lot of R &amp; D and found that no method calls when app is in killed state or in background state to handle this.</p>\n"^^ . . . . . . "Remember, such macros are simply compile-time text replacements. You are trying to do a runtime check with macros. Just write a normal function that you call at runtime."^^ . . "@Willeke, I have set the delegate `[self.webview setUIDelegate:self];`"^^ . . "0"^^ . . "0"^^ . . . . . . . . . "You should add `-[NSArray arrayByMultiplyingByNumber:]` and `-[NSMutableArray multiplyByNumber:]`, like `arrayByAddingObject:` and `addObject:`. `NSMutableArray` inherits `arrayByMultiplyingByNumber:`."^^ . "@Willeke we have tried using upload panel as well and it didn't work. I couldn't open the panel when button is tapped inside the webview."^^ . . "<p>I have a <code>CIImage</code> from YUV data without alpha plane, and a gray scaled <code>CIImage</code>. I want to use the second image as the alpha plane. Currently, gpt tells me to use <code>CISourceOverCompositing</code> filter, but it seems that this filter will blend the color of the second image's color. If I convert the gray scaled image into a black mask (0, 0, 0, alpha), then this filter will use black as &quot;background color&quot;. However, I just want to <strong>replace</strong> the color instead of <strong>blend</strong> it with another color.</p>\n"^^ . . . "@BalázsVincze You should upvote answers if they helped you :) (including the other answer from Cy-4AH)"^^ . "This is far from an answer because I have no direct experience with it, but is it possible to feed your framebuffer directly to Metal for display? (That would be my first avenue of exploration: avoiding the manual processing required to take the framebuffer, copy it into a bitmap representation, then re-draw it onto the screen; anything that'll let you blit it directly to the GPU will be an order of magnitude faster, if I had to guess.)"^^ . . "Nil values will remain nil or null. @Joakim Danielson"^^ . . "1"^^ . . . "you are asking about whether webView is set to UIDelegate in storyboard, right?"^^ . . "<p>Rather than generating your own IMP and type encoding, I'd suggest you let the compiler do it for you, by creating a method normally, and transplanting it over:</p>\n<pre class="lang-swift prettyprint-override"><code>import Foundation\nimport ObjectiveC\n\n@objc class ScrollViewPatch: NSObject {\n @objc func scrollViewWillEndDragging(\n _ scrollView: UIScrollView,\n withVelocity velocity: CGPoint,\n targetContentOffset: UnsafeMutablePointer&lt;CGPoint&gt;\n ) {\n targetContentOffset.pointee = .zero\n }\n}\n\nfunc extendDelegate(scrollViewDelegte: UIScrollViewDelegate) {\n let patchedMethod = class_getInstanceMethod(\n ScrollViewPatch.self,\n #selector(ScrollViewPatch.scrollViewWillEndDragging(_:withVelocity:targetContentOffset:))\n )!\n\n class_addMethod(\n type(of: scrollViewDelegte),\n #selector(UIScrollViewDelegate.scrollViewWillEndDragging(_:withVelocity:targetContentOffset:)),\n method_getImplementation(patchedMethod),\n method_getTypeEncoding(patchedMethod) // Much more reliable than hard-coding &quot;v@:@{CGPoint=dd}^{CGPoint=dd}&quot;\n )\n}\n</code></pre>\n<p>Here's a simpler standalone proof-of-concept:</p>\n<pre class="lang-swift prettyprint-override"><code>import Foundation\nimport ObjectiveC\n\n@objc class MethodSource: NSObject {\n @objc func myMethod(_ arg: NSString) {\n print(&quot;Called \\(#function) on \\(self) with \\&quot;\\(arg)\\&quot;&quot;)\n }\n}\n\n@objc class TargetClass: NSObject {\n // Doens't natively respond to `-myMethod`\n}\n\nlet targetObject = TargetClass()\n\n// The target object doesn't initially respond to `-myMethod`\nprint(targetObject.responds(to: #selector(MethodSource.myMethod))) // false\n\nlet patchedMethod = class_getInstanceMethod(\n MethodSource.self,\n #selector(MethodSource.myMethod)\n)!\n\nclass_addMethod(\n type(of: targetObject),\n #selector(MethodSource.myMethod),\n method_getImplementation(patchedMethod),\n method_getTypeEncoding(patchedMethod)\n)\n\n// Now it's true\nprint(targetObject.responds(to: #selector(MethodSource.myMethod)))\n\n// Called myMethod(_:) on &lt;main.TargetClass: 0x6000016b0040&gt; with &quot;some string&quot;\ntargetObject.perform(#selector(MethodSource.myMethod), with: &quot;some string&quot;)\n</code></pre>\n"^^ . . . . . . . . . . . "0"^^ . . . . . . . . "Cocoapods (AFNetworking) issue when archiving project"^^ . . . . . . . "1"^^ . . . . . . ""I am unable to debug the Call Directory Extension in Xcode" In Xcode's bar at the top your app will be selected, change it to the extension and then hit run, it'll prompt you to choose an app to run, select your app. When your app calls the extension the extension code will run and you can add debug it just like your app"^^ . "The obvious approach would be a completely separate implementation from what super offers (adding the array to itself number-1 times), but I would have liked to do it differently"^^ . . "<p>A window is created in a xib, and it contains two tableviews, A and B. In interface builder, both A and B have the File's owner set as the delegate, since both will use some delegate methods, e.g. for drag and drop.</p>\n<p>I would like to fill table A programmatically, i.e. using <code>-tableView:viewForTableColumn:row:</code>, but I would still like to fill table B using the <em>Bindings</em> tab in interface builder.</p>\n<p>Is this possible directly?</p>\n<p>It seems that in my case, having the delegate of both tableviews set to the file's owner will automatically mean that B is populated using delegate methods, overriding anything set in the IB.</p>\n"^^ . . . "0"^^ . "Will I have to use `__bridge` somehow?"^^ . . . "<p><code>test()</code> is not a method. It's a function. The syntax to call it is <code>test()</code>.</p>\n"^^ . . "3"^^ . "<p>I am trying to build a legacy Obj-C project, it's getting around 80% of progress and fails with the following error. I tried to reinstall pods, clean Derived Data, restart Xcode/computer.</p>\n<pre><code>`mkdir -p /Users/myusername/Library/Developer/Xcode/DerivedData/MyApp-cghzlwxuhadyvrehqungfijxixti/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/BuildProductsPath/Release-iphoneos/MyApp.app/Frameworks\n\nSymlinked...\n\nrsync --delete -av --filter P .*.?????? --links --filter &quot;- CVS/&quot; --filter &quot;- .svn/&quot; --filter &quot;- .git/&quot; --filter &quot;- .hg/&quot; --filter &quot;- Headers&quot; --filter &quot;- PrivateHeaders&quot; --filter &quot;- Modules&quot; \n\n&quot;../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AFNetworking.framework&quot; &quot;/Users/myusername/Library/Developer/Xcode/DerivedData/MyApp-cghzlwxuhadyvrehqungfijxixti/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app/Frameworks&quot;\n\nbuilding file list ... rsync: link_stat\n &quot;/Users/myusername/myapp_ios/MyApp/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AFNetworking.framework&quot; failed: No such file or directory (2)\ndone\n\nsent 29 bytes received 20 bytes 98.00 bytes/sec\ntotal size is 0 speedup is 0.00\nrsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]\nCommand PhaseScriptExecution failed with a nonzero exit code`\n</code></pre>\n"^^ . "1"^^ . . . . . . . . . "iOS 17 , when entering Chinese characters, the program crashes. The system is using UIWebView"^^ . . "2"^^ . "0"^^ . . . . . . "1"^^ . "0"^^ . "1"^^ . "0"^^ . . . . . . "1"^^ . . . "1"^^ . . . . . . "3"^^ . . "Is `self.items` nil? `self.items.lastObject == 0` doesn't seems to be the correct way too. Did you meant `if ([self.items.lastObject equalsTo:@(0.0)])` or `if (self.items.lastObject == nil)`? ... ?"^^ . . . . "Pan Gesture is not recognized for the view while it is being transformed with scale animation? Why this is happening?"^^ . . . "0"^^ . "If it's a class internal to `SwiftUI` you shouldn't be using it at all. Your code will be brittle at best and could break with every new release of SwiftUI. There's probably an official way to achieve what you are trying to achieve, so maybe if you explain it, somebody can give you an alternate answer."^^ . . "1"^^ . . "0"^^ . . . . "Does this answer your question? [rsync error: some files could not be transferred (code 23) Command PhaseScriptExecution failed with a nonzero exit code](https://stackoverflow.com/questions/63533819/rsync-error-some-files-could-not-be-transferred-code-23-command-phasescriptex)"^^ . "It actually worked. Thanks a lot @Mykyta iOS"^^ . "automatic-ref-counting"^^ . "html"^^ . "Assigning to a pointer causes EXC_BAD_ACCESS through class_addMethod"^^ . . . "0"^^ . . . . . "1"^^ . . "-3"^^ . "push-notification"^^ . "Objective C: no known instance method for selector"^^ . . . . . . . . . . . . . "graphics"^^ . . "<p>I am using WKWebView in objective c to load my html string that i wrote for my project.</p>\n<p>it actually worked and i managed to save the image in my image path BUT it didnt work if the height exceeds 4100.</p>\n<p>Case A: html height &lt; 4100</p>\n<p>Case B: html height &gt; 4100</p>\n<p>i put my view off screen so people dont actually see it but its rendering in the &quot;background&quot;, i got my height from the WKWebView using the javascript to capture my image.</p>\n<p>this is my example code below,</p>\n<p>getWKWebViewConfiguration --&gt; settings</p>\n<p>loadWebView --&gt; a button to run my html string into wkWebview</p>\n<pre><code>+ (WKWebViewConfiguration *) getWKWebViewConfiguration\n{\n NSString *jScript = @&quot;var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', initial-scale=1.0, shrink-to-fit=yes'); document.getElementsByTagName('head')[0].appendChild(meta);&quot;;\n WKUserScript *wkUScript = [[WKUserScript alloc] initWithSource:jScript injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];\n WKUserContentController *wkUController = [[WKUserContentController alloc] init];\n [wkUController addUserScript:wkUScript];\n \n WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];\n if ([self deviceIsIOS10])\n {\n //these 2 only available since iOS10.\n config.dataDetectorTypes = NO; \n config.ignoresViewportScaleLimits = NO;\n }\n config.userContentController = wkUController;\n \n return config;\n}\n\n\n- (void) loadWebView\n{\n //x origin = 2000, to render off screen.\n view = [[WKWebView alloc] initWithFrame:CGRectMake(2000, 0, webviewWidth, webviewHeight) configuration:[self getWKWebViewConfiguration]];\n view.UIDelegate = self;\n view.navigationDelegate = self;\n [view loadHTMLString:reportString baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]];\n}\n\n- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {\n [webView evaluateJavaScript:@&quot;document.body.offsetHeight&quot; completionHandler:^(id result, NSError *error) {\n if (error == nil) {\n float height = [result floatValue];\n WKSnapshotConfiguration *snapshotConfig = [[WKSnapshotConfiguration alloc] init];\n snapshotConfig.rect = CGRectMake(0, 0, width, height);\n snapshotConfig.snapshotWidth = @(width);\n \n __block UIImage *testImage = nil;\n [webView takeSnapshotWithConfiguration:snapshotConfig completionHandler:^(UIImage * _Nullable snapshotImage, NSError * _Nullable error) {\n if (error == nil) {\n UIGraphicsBeginImageContextWithOptions(newSize, NO, 1.0); \n [testImage drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];\n testImage = UIGraphicsGetImageFromCurrentImageContext();\n UIGraphicsEndImageContext();\n \n [self saveImage:testImage];\n }\n }];\n }\n }];\n\n}\n</code></pre>\n<p>testImage in both cases is NOT nil. but when i save testImage in Case A, it will show exactly what i wrote for html but in Case B, it will just show an empty white background with the height assigned.</p>\n<p>Appreciate if anyone could help. Thanks in advance!</p>\n<p>I've tried converting UIImage to NSData and writeToFile but it still shows empty. Possible due to the UIImage is empty from the start.</p>\n<p>Tried to run the wkwebview on screen where i could see it in my view. both cases show the html string and rendered. however, only case B couldn't do the snapshot and save it as a image in my path.</p>\n"^^ . "1"^^ . "Did you initialize self.items? Self.items = [NSMutableArray new]; Additionally if you want to check for a number value you should call doubleValue or integerValue on the stored object"^^ . . . . . . "0"^^ . . . "0"^^ . . . . . . "0"^^ . "0"^^ . "Realm Objective-C to Swift Migration (Dynamic Migration)"^^ . . "0"^^ . "<p>you can integrate it by using swift bridging header,</p>\n<p><strong>let me explain</strong> ,</p>\n<p>once you add live activity widget in project , you will able to see one swiftUI file for live activity's UI , now you need to create one swift file for 'ActivityAttributes' in swift , as well need to create one swift file where you will implement all needed methods and code for live activity , now crate bridging header to use your swift code in objective c project , import swift file in a obj-c view controller where you want to implement live activity and call needed functions according your feature flaw,\nI've implement same way in my project and it's <strong>working well</strong> .</p>\n"^^ . "arrays"^^ . "iphone"^^ . . . . . . . "WKWebView snapshot not working after certain size"^^ . . "1"^^ . "0"^^ . . . "0"^^ . . "0"^^ . . "Modifying .sh file worked like a charm, thanks"^^ . . . . . . . "0"^^ . "0"^^ . . . . . . . . . "c++"^^ . . . "1"^^ . "0"^^ . "`WKWebView` has been around since iOS 8. There's no reason to keep using the very outdated `UIWebView` (which was deprecated in iOS 12). It will be much quicker to switch to `WKWebView` than to try to work around issues with an unsupported and out-of-date `UIWebView`."^^ . . . "Have you tried adding AFNetworking directly as code instead of via CocoaPods? I have an older Obj-C project with AFNetworking and it still builds fine with Xcode 14."^^ . . . "1"^^ . "0"^^ . "You probably never initialized your `items` property. Also, your `if` check isn't doing what you probably think it is trying to do. The only way that will ever be true is if `self.items` is nil or if there are no objects in the array."^^ . . "CGImageSourceCreateThumbnailAtIndex doesnot rotate the image on ios 17"^^ . . . "How to integrate Live Activity into Objective C projects?"^^ . "<blockquote>\n<p>It seems that in my case, having the delegate of both tableviews set to the file's owner will automatically mean that B is populated using delegate methods, overriding anything set in the IB.</p>\n</blockquote>\n<p>No, <code>tableView:viewForTableColumn:row:</code> and bindings work well together. Just do what the documentation says:</p>\n<blockquote>\n<p>It’s recommended that the implementation of this method first call the NSTableView method makeViewWithIdentifier:owner: passing, respectively, the tableColumn parameter’s identifier and self as the owner to attempt to reuse a view that is no longer visible or automatically unarchive an associated prototype view for that identifier.</p>\n</blockquote>\n<blockquote>\n<p>When using Cocoa bindings, this method is optional if at least one identifier has been associated with the table view at design time. (Note that a view’s identifier must be the same as the identifier of its column. An easy way to achieve this is to use the Automatic identifier setting in Interface Builder.)</p>\n</blockquote>\n<p>Example:</p>\n<pre><code>- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {\n if (tableView == self.tableViewA) {\n MyTableCellView *cellView = [tableView makeViewWithIdentifier:myIdentifier owner:self];\n cellView.customView.data = myData;\n return cellView;\n }\n else {\n return [tableView makeViewWithIdentifier:tableColumn.identifier owner:self];\n }\n}\n</code></pre>\n"^^ . . "keypress"^^ . . . "0"^^ . "<p>Why kVK_F2 is not equivalent to constant NSF2FunctionKey for F2 key press event, What is equivalent constant of kVK_F2, since carbon framework is deprecated.</p>\n<p>When I printed the keyCode, The [Event keyCode] against NSF2FunctionKey is 63237(0xF705) whereas for kVK_F2, it prints is 120 which is 0x78. 0x78 seems to be the standard keyboard value for F2 key.</p>\n<p>Sample code :</p>\n<pre><code>//@property (nonatomic, strong) id eventMonitor; \n\nNSEvent* (^handler)(NSEvent*) = ^(NSEvent *theEvent) {\n\n NSEvent *result = theEvent;\n NSUInteger flags = [theEvent modifierFlags] &amp; NSEventModifierFlagDeviceIndependentFlagsMask;\n\n if ((flags &amp; NSEventModifierFlagFunction) &amp;&amp; (flags &amp; NSEventModifierFlagCommand) &amp;&amp; ([theEvent keyCode] == NSF2FunctionKey)) {\n NSLog(@&quot;Command + F2 key pressed.&quot;);\n }\n\n return result;\n };\n\n_eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:(NSEventModifierFlagFunction | NSEventMaskKeyDown) handler:handler];\n</code></pre>\n<p>Whenever I press F2 key, it does not read the event for NSF2FunctionKey. but reads for KVK_F2.</p>\n"^^ . . "0"^^ . . . "0"^^ . . "3"^^ . "<p>iOS 17 , when entering Chinese characters, the program crashes. The system is using UIWebView.\nThis is my error message.\n<a href="https://i.sstatic.net/K0FHw.png" rel="nofollow noreferrer">enter image description here</a>.</p>\n<p>I know that Apple recommends replacing UIWebView with WKWebView, but I hope to find a faster solution to this problem.\ni've noticed that in the iOS 17 environment, there is an underline when typing Chinese characters. Is this due to UIWebView not supporting the display of this underline\nAny assistance would be greatly appreciated. Thank You.</p>\n"^^ . . . "<p>Solution provided by NSGod in the comments:</p>\n<p>Set becomesKeyOnlyIfNeeded to YES.</p>\n"^^ . "1"^^ . "There is no equivalent. Maybe this helps: [Swift 2: Detect Function Key Presses](https://stackoverflow.com/questions/32992293/swift-2-detect-function-key-presses)."^^ . . . . . . "How to make a window level active when opening a utility panel"^^ . "0"^^ . . "If you want your app delegate to have a `launchOptions` property you need to declare it."^^ . . . "`arrayByMultiplyingByNumber:` and `multiplyByNumber:` can both call the same function or private method. Or `arrayByMultiplyingByNumber:` can do `mutableCopy`, `multiplyByNumber:` and return an immutable copy."^^ . . . "How to update local sqlite data from custom data of Push notification payload when application is in Killed state or in background state"^^ . . "0"^^ . . . "<p>AppDelegate does not have a default implementation of <code>launchOptions</code>. In your AppDelegate class implementation you must create an instance variable and then you can assign to it. See below:</p>\n<pre><code>@implementation AppDelegate {\n NSDictionary launchOptions;\n\n -(BOOL)application:(UIApplication *) application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n self.launchOptions = launchOptions;\n }\n}\n</code></pre>\n"^^ . "1"^^ . . "what exactly are you trying to achieve? what is your ultimate goal? show an example of hypothetic usage"^^ . . . "1"^^ . "0"^^ . "0"^^ . . "<p>Disclaimer: I am mostly experienced with Gtk and FLTK on Linux and Windows. I am pretty much starting my macOS / Cocoa / Objective-C development journey. While I have done much research, I am not finding adequate documentation or code examples for this issue. Also, I suffer from a developmental disability, so please take it easy.</p>\n<p>I am trying to draw the contents of a VNC library <em>(libvncserver / libvncclient)</em> framebuffer onto an NSView within my program at a fast rate, around 20 to 30 frames a second. While I am successful at drawing the image onto the NSView at the needed rate, it looks awful with white artifacts all over the place:</p>\n<p><a href="https://i.sstatic.net/FgEOx.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/FgEOx.jpg" alt="Image showing drawing artifacts" /></a></p>\n<p>In the NSView's <code>drawRect</code> method I first must loop through the framebuffer and set the alpha to 255, otherwise the image will be (mostly) transparent:</p>\n<pre class="lang-objectivec prettyprint-override"><code> if ([vnc bytesPerPixel] == 2 || [vnc bytesPerPixel] == 4)\n {\n for (int i = ([vnc bytesPerPixel] - 1); i &lt; [vnc buffSize]; i+= [vnc bytesPerPixel])\n vnc.vncClient-&gt;frameBuffer[i] = 255;\n }\n</code></pre>\n<p>I then make the NSBitmapImageRep:</p>\n<pre class="lang-objectivec prettyprint-override"><code> NSBitmapImageRep * rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:&amp;vnc.vncClient-&gt;frameBuffer\n pixelsWide:vnc.vncClient-&gt;width\n pixelsHigh:vnc.vncClient-&gt;height\n bitsPerSample:8\n samplesPerPixel:4\n hasAlpha:YES\n isPlanar:NO\n colorSpaceName:NSDeviceRGBColorSpace\n bytesPerRow:vnc.vncClient-&gt;width * [vnc bytesPerPixel]\n bitsPerPixel:vnc.vncClient-&gt;format.bitsPerPixel\n ];\n</code></pre>\n<p>Then I actually do the draw:</p>\n<pre class="lang-objectivec prettyprint-override"><code> [rep drawInRect:[self bounds] \n fromRect:NSZeroRect\n operation:NSCompositingOperationCopy \n fraction:1.0\n respectFlipped:YES\n hints:nil\n ];\n</code></pre>\n<p>Since obviously there are other Mac apps out there that can do higher frame-rates without all of the artifacts, is there a better way to do this?</p>\n"^^ . . "2"^^ . "Post a [mre] please. How is the web view created? Where and when do you set `UIDelegate`?"^^ . . "1"^^ . . . . . "@Willeke I have edited the question and shared the code, please refer that."^^ . "0"^^ . . "0"^^ . . . . "1"^^ . "How can I store automatic reference counted Swift/Objective-C objects in a C++ map without causing memory leaks when they are deleted from the map?"^^ . "format"^^ . "<p>You can use ternary operator inside macro for condition instead of #ifdef:</p>\n<pre><code>#define APP_LOCALE ([[[NSLocale preferredLanguages] objectAtIndex:0] isEqualToString:@&quot;nl_NL&quot;] ? @&quot;&amp;locale=nl_NL&quot; : @&quot;&amp;locale=en_US&quot;)\n</code></pre>\n<p>If you want to have boolean value extracted to a separate variable you can do it the following way:</p>\n<pre><code>#define APP_LOCALE_X [[[NSLocale preferredLanguages] objectAtIndex:0] isEqualToString:@&quot;nl_NL&quot;]\n#define APP_LOCALE (APP_LOCALE_X ? @&quot;&amp;locale=nl_NL&quot; : @&quot;&amp;locale=en_US&quot;)\n</code></pre>\n<p>Please note that in your example you placed semicolon <code>;</code> after #define statement, you should not place it there, as it will be inserted when expanding macro.</p>\n"^^ . "1"^^ . . "0"^^ . "realm"^^ . "@Paulw11 Thanks a lot, solved my problem! was very new to it"^^ . . . "Is `webView:runOpenPanelWithParameters:initiatedByFrame:completionHandler:` called? Do you set `UIDelegate`? Any exceptions?"^^ . . . "yes. but we can handle nil and respective properties seperately. \nAlso it works for wide cases. @Jay"^^ . . . . . . "1"^^ . . "0"^^ . "1"^^ . . "1"^^ . . . . "1"^^ . . . "0"^^ . . . . . "nswindow"^^ . "0"^^ . . "0"^^ . . "<p><em>&quot;this string is in valid ISO8601 format&quot;</em> - actually, no. To make it valid you need the <code>T</code> between the date and time. The valid string would be:</p>\n<pre><code>NSString* timeStampValue = @&quot;20230917T120009.289Z&quot;; // Note the added T\n</code></pre>\n<p>Even with that, you need very specific format options for the string to be recognized properly. You need the following options:</p>\n<ul>\n<li>NSISO8601DateFormatWithYear</li>\n<li>NSISO8601DateFormatWithMonth</li>\n<li>NSISO8601DateFormatWithDate</li>\n<li>NSISO8601DateFormatWithTime</li>\n<li>NSISO8601DateFormatWithFractionalSeconds</li>\n<li>NSISO8601DateFormatWithTimeZone</li>\n</ul>\n<p>If you apply all of those options to the <code>formatOptions</code> property of the formatter, along with adding the needed <code>T</code> in the string, you will then be able to convert the string to an <code>NSDate</code>.</p>\n<pre class="lang-objc prettyprint-override"><code>NSString* timeStampValue = @&quot;20230917T120009.289Z&quot;;\nNSISO8601DateFormatter* formatter = [[NSISO8601DateFormatter alloc] init];\nformatter.formatOptions = NSISO8601DateFormatWithYear | NSISO8601DateFormatWithMonth | NSISO8601DateFormatWithDay | NSISO8601DateFormatWithTime | NSISO8601DateFormatWithFractionalSeconds | NSISO8601DateFormatWithTimeZone;\nNSDate* dateOfLastVerification = [formatter dateFromString:timeStampValue];\n</code></pre>\n<p>Note that in order to use <code>NSISO8601DateFormatWithFullDate</code>, the string must have the date in the format &quot;yyyy-MM-dd&quot;. If that's the only option you specify then the string can only contain the date and nothing else.</p>\n<hr />\n<p>If you wanted to use the <code>NSISO8601DateFormatter</code> without needing to specify any format options, your string needs to be in the format &quot;yyyy-MM-ddTHH:mm:ssZZZZZ&quot;.</p>\n<hr />\n<p>A helpful debugging technique when working out issues with parsing a date string is to see what output you get converting an <code>NSDate</code> into an <code>NSString</code> with your date formatter. If the resulting output doesn't match the input you are trying to parse then you know you have the wrong format options or an invalid input string.</p>\n"^^ . . . "0"^^ . . "1"^^ . . "Assign double variable to mutable array"^^ . . . "<p>I am trying the find some alternative to <code>NSRange.location</code> and <code>NSRange.length</code> in Swift.</p>\n<p>I have a string for example <code>sip:name@xyz.com</code></p>\n<p>I am trying to extract name from it. I can do it using <code>componentsSeperatedBy</code> method from String. But I was wondering whether it can be done using range similar to Objective C.</p>\n<p>I already have old legacy Objective C code which I am trying to convert to Swift.</p>\n<pre><code>// Extract name from sip:name@xyz.com.....\nNSString *name = nil;\nNSRange rangeForSip;\nNSRange rangeFor@;\nrangeForSip = [self rangeOfString: @&quot;sip:&quot;];\n\nif (rangeForSip.location == NSNotFound) {\n //Look for sips\n rangeForSip = [self rangeOfString: @&quot;sips:&quot;];\n}\n match2 = [self rangeOfString: @&quot;@&quot;];\n\nif ((rangeForSip.location != NSNotFound) &amp;&amp; (rangeFor@.location != NSNotFound)) {\n name = [self substringWithRange:NSMakeRange(rangeForSip.location + rangeForSip.length, rangeFor@.location - (rangeForSip.location + rangeForSip.length))];\n} else if (rangeFor@.location != NSNotFound) {\n // Extract name from sip:name@xyz.com.....\n name = [self substringWithRange:NSMakeRange(0, rangeFor@.location)];\n}\n</code></pre>\n"^^ . "0"^^ . . . "I suggest using a simple shared text file. It can be JSON encoded, or just a CSV. The phone number is represented as an integer in E.164 format, so the US phone number +1-408-555-1234 would be represented by the integer `14085551234`. The Australian phone number 02 8424 1244 (which is +61-2-8424-1244) would be the integer `61284241244`. Your extension must present the phone numbers in increasing order, so sort I suggest you sort your text file before saving it. Also the extension has a limited memory quota. See https://github.com/paulw11/CallKitTutorial for an example extension in Swift"^^ . "<p>See the documentation for <a href="https://developer.apple.com/documentation/swift/customplaygrounddisplayconvertible" rel="nofollow noreferrer"><code>CustomPlaygroundDisplayConvertible</code></a>. Playgrounds only supports specialised displays for a limited number of types. That includes <code>CIImage</code>, <code>URL</code> etc. For other types, only a &quot;structured description&quot; is displayed, which is probably what you are seeing.</p>\n<p>Luckily, your <code>SampleRect</code> is just a wrapper around a <code>CGRect</code>, so you can easily conform to <code>CustomPlaygroundDisplayConvertible</code> and use the wrapped <code>CGRect</code> as the playground display.</p>\n<pre><code>extension SampleRect: CustomPlaygroundDisplayConvertible {\n var playgroundDescription: Any {\n dimensions\n }\n}\n</code></pre>\n"^^ . . "0"^^ . "1"^^ . "0"^^ . "Thanks a lot, will definetely change my implementation to this."^^ . . "0"^^ . . . . . . "0"^^ . . . . . . . . . "1"^^ . . . . "FYI - Easier syntax: `[self.items addObject:@(number)];`."^^ . "<p>Here is the dynamic function for realm migration,</p>\n<pre><code> migrationBlock: { migration, oldSchemaVersion in\n if oldSchemaVersion &lt; 1 {\n \n for objectSchema in migration.oldSchema.objectSchema {\n \n for property in objectSchema.properties {\n \n if property.isOptional {\n migration.enumerateObjects(ofType: objectSchema.className) { oldObject, newObject in\n if let oldValue = oldObject?[property.name] as? String {\n newObject![property.name] = String(oldValue)\n }\n \n if let oldValue = oldObject?[property.name] as? Int {\n newObject![property.name] = Int(oldValue)\n }\n \n if let oldValue = oldObject?[property.name] as? Bool {\n newObject![property.name] = Bool(oldValue)\n }\n }\n }\n }\n }\n }\n }\n</code></pre>\n"^^ . . "call-directory-extension"^^ . . . . "Take into consideration where you're from in the first place and are you going to keep it after it gets added to the extension and how much of it there could be. Also does the data need to accessible to the RN side and the native side? You could store them in a database for example - if the database is located in the group location then it can be accessed by both the app and the extension, or you could just write the data as plain text to a file which again is in the group directory. Which database would depend on your needs and requirements."^^ . . . "nswindowcontroller"^^ . . . "0"^^ . . . "0"^^ . . "1"^^ . "@koen thanks but this will require updating the project significantly, would prefer to avoid."^^ . . . . "0"^^ . . . "0"^^ . "Programmatically fill one tableview, use IB bindings to fill others"^^ . "1"^^ . "This actually solved it. I have no clue how are the two related but thank you so much!"^^ . . . . "0"^^ . . . "<p>From <code>imp_implementationWithBlock</code>'s documentation:</p>\n<blockquote>\n<p>The signature of block should be method_return_type <code>^(id self, method_args ...)</code></p>\n</blockquote>\n<p>I think you are missing self in parameters.</p>\n"^^ . . . . . . . . . . . . . . . . "<p>In Python, the expression <code>2*[a,b,c]</code> (with a,b,c variables) is meaningful, and returns <code>[a,b,c,a,b,c]</code>. Also, in Python, lists (or arrays) are mutable by design.</p>\n<p>It is easy enough to write a category on e.g. <code>NSArray</code> that implements an instance method <code>-(NSArray*) multiplyByNumber:(NSInteger)number;</code> which copies Python's behavior.\nBut the mutability is not given in Objective-C: <code>NSArray</code>s are immutable by design, but they have a mutable subclass <code>NSMutableArray</code>, which can not really inherit the <code>multiplyByNumber</code> method.</p>\n<p>Is there a way to avoid reimplementation of the method for <code>NSMutableArray</code>? Or do I really have to do it for the mutable subclasses as well?</p>\n"^^ . . . . "<p>You can blend your color image with a transparent image, using the grayscale image as a mask:</p>\n<pre><code>CIImage* clearBackground = [[CIImage clearImage] imageByCroppingToRect:colorImage.extent];\n\nCIFilter* blendFilter = [CIFilter filterWithName:@&quot;CIBlendWithMask&quot;];\n[blendFilter setValue:colorImage forKey:kCIInputImageKey];\n[blendFilter setValue:clearBackground forKey:kCIInputBackgroundImageKey];\n[blendFilter setValue:grayscaleImage forKey:kCIInputMaskImageKey];\n\nCIImage* output = [blendFilter outputImage];\n</code></pre>\n"^^ . . . . "And why can't you just add the method to your delegate class? Failing that, why can't you create a subclass of your delegate class with just the new method in?"^^ . . . . . . "0"^^ . "Hey Sweeper, just some minor suggestions: Some guard-lets can help unnest some of this code., 2) Once all the parsing is done, it might be best to promote back into a `String`"^^ . . "@ItaiFerber Thanks! I will check that out and see if it's an option. Apple's API documentation often has major holes that make it challenging to learn, but the Metal suggestion sounds interesting. "^^ . "<p>I use CGImageSourceCreateThumbnailAtIndex to resize and rotate a CGIImage. It works fine on ios 16 and below, but on ios 17, rotating does not work anymore.</p>\n<pre><code>\n\n CGImageSourceRef imageSource = CGImageSourceCreateWithData(capturedImage, nil);\n CFDictionaryRef options = (__bridge CFDictionaryRef) @{\n (id) kCGImageSourceCreateThumbnailWithTransform: @YES,\n (id) kCGImageSourceCreateThumbnailFromImageAlways : @YES,\n (id) kCGImageSourceThumbnailMaxPixelSize : @(maxPixelSize),\n (id) kCGImagePropertyOrientation: @(rotationAngle)\n };\n CGImageRef thumbnail = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, options);\n CFRelease(imageSource);\n return thumbnail;\n}\n</code></pre>\n<p>I tried to set the rotationAngle to different constant kCGImagePropertyOrientationUp, kCGImagePropertyOrientationLeft, kCGImagePropertyOrientationDown, kCGImagePropertyOrientationRight but it all returns the same image.</p>\n<p>Anyone experiencing the same issue and have an idea what has changed on ios 17 that breaks the API.</p>\n<p>Noted: it still works fine on iPadOS 17, can only reproduce on iOS 17.</p>\n"^^ . . . . "<p>I want a macro with the language in in. Currently the code is:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#define APP_LOCALE_X @([[[NSLocale preferredLanguages] objectAtIndex:0] isEqualToString:@&quot;nl_NL&quot;]);\n#ifdef APP_LOCALE_X\n #define APP_LOCALE @&quot;&amp;locale=nl_NL&quot;\n#else\n #define APP_LOCALE @&quot;&amp;locale=en_US&quot;\n#endif\n</code></pre>\n<p>Logically this will not work since <code>#ifdef</code> sees the macro defined. I can't seem to wrap my head around the Macro logic.</p>\n<p>The other option would be to have a macro with the APP_LOCALE_X and a string. Like this: Obviously this is pseudo code:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#define APP_LOCALE_X @([[NSLocale preferredLanguages] objectAtIndex:0]) == &quot;nl_NL&quot;);\n#define APP_LOCALE @&quot;&amp;locale=&quot;APP_LOCALE_X\n</code></pre>\n"^^ . "0"^^ . . . . . . . . . . "<p>I can't figure out why variable <code>number</code> is not being assigned to array <code>self.items</code>.\nIn the debugger it is showing value of NULL.</p>\n<pre><code>-(void)pushItem:(double)number{\n [self.items addObject:[[NSNumber alloc]initWithDouble:number]];\n\n if (self.items.lastObject == 0)\n {\n // ** need to add variable number to self.items array**\n \n }\n}\n</code></pre>\n"^^ . . . "It's both data source and delegate, for both of the tables. But I (we) figured it out now: The content bindings of the tables must be set to their respective arraycontroller (rather, their arrangedObjects). This was not necessary before, when both tables were populated from the xib"^^ . "<p>Similar to the <code>range</code> method in <code>NSString</code>, Swift <code>Strings</code> also have a <a href="https://developer.apple.com/documentation/swift/stringprotocol/range(of:options:range:locale:)" rel="nofollow noreferrer"><code>range</code></a> method that finds a particular substring in a string.</p>\n<p>You can create your desired range by using the <code>..&lt;</code> operator on the <code>lowerBound</code> and <code>upperBound</code> of the found ranges of &quot;sip:&quot; and &quot;@&quot;.</p>\n<p>You can then pass the range to the <code>String</code> subscript to get the result as a <code>Substring</code>.</p>\n<p>If I understand correctly, the logic you want is:</p>\n<pre><code>func parseNameFrom(_ string: String) -&gt; Substring? {\n let rangeOfSip = string.range(of: &quot;sip:&quot;) ?? string.range(of: &quot;sips:&quot;)\n if let rangeOfAt = string.range(of: &quot;@&quot;) {\n if let rangeOfSip {\n return string[rangeOfSip.upperBound..&lt;rangeOfAt.lowerBound]\n } else {\n return string[..&lt;rangeOfAt.lowerBound]\n }\n } else {\n return nil // can't find it\n }\n}\n\nprint(parseNameFrom(&quot;sip:name@xyz.com&quot;)!)\n</code></pre>\n"^^ . "1"^^ . "image-rotation"^^ . . . . "Does this answer your question? [How to import own classes from your own project into a Playground](https://stackoverflow.com/questions/24045245/how-to-import-own-classes-from-your-own-project-into-a-playground)"^^ . . . . . . . "0"^^ . . "Why do you need to change the target offset. Won't that make the scroll view feel weird to the user?"^^ . "uianimation"^^ . "Array multiplication in Objective-C, for NSArray and NSMutableArray"^^ . . . . . "1"^^ . . "string"^^ . . "0"^^ . "0"^^ . . . "1"^^ . "Try to do it in Objective-C. It's native. And pass NULL for types, it's already known from selector."^^ . "0"^^ . . . . . "0"^^ . . "0"^^ . "1"^^ . . . . . "@Willeke, it prints @"?"\nWhat is the equivalent key code for kVK_F2 then?"^^ . "0"^^ . . "Have you tried the [Displaying an upload panel](https://developer.apple.com/documentation/webkit/wkuidelegate#2138155_) section of `WKUIDelegate`?"^^ . "Yes, if you don't set `UIDelegate` in code then it must be set in the storyboard. You can check `self.webView. UIDelegate` in `buttonClick:`, is it set to the same object as `self`?"^^ . . "2"^^ . . . "Thanks a lot, I have now debugged the app, and fixed the issue. Can you please provide me a solution better than User defaults?"^^ . . . . . "1"^^ . . "0"^^ . "uipangesturerecognizer"^^ . "cocoapods"^^ . . . "0"^^ . "0"^^ . "Objective-c Macro Language detection"^^ . . "swift-playground"^^ . "1"^^ . . "0"^^ . "To be clear, the code in the question (not the answer) [Swift 2: Detect Function Key Presses](https://stackoverflow.com/questions/32992293/swift-2-detect-function-key-presses) detects F7, F8 and F9."^^ . . . "0"^^ . "<p>It's quite easy with smart pointers. See the sketch below.</p>\n<pre class="lang-c++ prettyprint-override"><code>struct Deleter {\n void operator()(void *buffer) const nothrow { CFRelease(buffer); }\n};\n\nstruct Region {\n std::unique_ptr&lt;void, Deleter&gt; buffer;\n // Other fields\n};\n\nmap[positon].buffer.reset([device newBufferWithBytes:vertices\n length:length\n options:MTLStorageModeShared]);\n</code></pre>\n"^^ . "bridging-header"^^ . . "nsrange"^^ . . . "0"^^ . . . "0"^^ . . . . . "cifilter"^^ . "1"^^ . . . . "objective-c"^^ . "0"^^ . . . . . "<p>I have a C++ map which manages loaded regions. Each region has an associated <code>MTLBuffer</code> for the geometry generated after the region data is converted into a mesh. The idea is to store a reference to each buffer inside the C++ map so I have all of the regions and their associated data in a single data structure. I could have this Objective-C++ pseudocode:</p>\n<pre><code>struct Region {\n void *buffer;\n // Other fields\n};\nstd::unordered_map&lt;uint64_t, Region&gt; loaded_regions;\nvoid render_region(Region *region) {\n float vertices[MAX_SIZE];\n unsigned length;\n\n // ...\n\n // There are multiple ways I could do this. One could be:\n map[position].buffer = [device newBufferWithBytes: vertices length: length options: MTLStorageModeShared];\n\n // I could also pass `vertices` to some external function defined in Swift that creates a new `MTLBuffer` and returns it.\n // This is then converted to a bare pointer and stored in the map.\n}\n</code></pre>\n<p>However, when regions are deleted from the map, for example in a function like this:</p>\n<pre><code>void delete_region(uint16_t position) {\n Region *region = loaded_regions[position];\n\n // ...\n\n map.erase(position);\n delete position;\n}\n</code></pre>\n<p>How can I ensure any stored Swift object references or Objective-C object references are properly released and no memory leak is caused, assuming I have ARC enabled?</p>\n<p>Is this possible, or will I just have to make a Swift <code>Dictionary</code> or an Objective-C <code>NSDictionary</code> to store these buffers independently from the C++ map that stores the actual regions?</p>\n<p>When ARC is enabled, Xcode will not allow <code>release</code> messages to be used directly, so I do not know how else to manually free the memory.</p>\n"^^ . . "User defaults isn't a good choice for doing this, its ok for experimenting with a new numbers, but it your list of numbers grows to hundreds or thousands its not suitable."^^ . "0"^^ . . "<p>In Local Database we moved from Realm (Obj-C) to RealmSwift. After migration we have an issue in local db like all the properties were declared as Optional in Obj-C. Whereas, we used non-optional in swift db. now, we are forced to migrate entire database to new one.</p>\n<p>we can't make manually migrate each property.\nlike,</p>\n<pre><code>migrationBlock: { migration, oldSchemaVersion in\n if (oldSchemaVersion &lt; 1) {\n migration.enumerateObjects(ofType: User.className()) { oldObject, newObject in\n newObject![&quot;Id&quot;] = oldObject![&quot;Id&quot;]\n }\n }\n</code></pre>\n<p>we need a function to do migration for each property without hardcoding. Handle respective datatypes Dynamically as required.</p>\n<p>We are trying to make dynamic function.</p>\n"^^ . . . "@Willeke, no it didn't get called but i have set the UIDelegate"^^ . . "finder"^^ . . "0"^^ . . . . . . . . . "<p>User interaction is disabled by default for animated views. Consider adding <code>UIViewAnimationOptionAllowUserInteraction</code> to the list of your options.</p>\n<pre><code>[UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAllowUserInteraction animations:^{\nself.currentView2.transform = CGAffineTransformMakeTranslation(0, self.currentView2.frame.size.height);\nself.currentView.transform = CGAffineTransformMakeScale(1.0, 1.0);\n} completion:^(BOOL finished) {\nself.currentView2 = nil;\n}];\n</code></pre>\n"^^ . . "1"^^ . "memory-leaks"^^ . "window-management"^^ . "<p>Question about Objective-C and Swift interoperability.\nI have some Objective-C headers and implementation files which I am using in a Swift playground for a bridging project. However the Playground does not show any of my Objective-C class properties or methods of the instances of the class in the preview. I can however see properties of instances of URL, CIImage, and NSImage just fine. What step/s am I missing?</p>\n<pre class="lang-swift prettyprint-override"><code>let image = CIImage(contentsOf: myUrl!) // With a url location to the image file on my disk.\n</code></pre>\n<p>The Swift Playground shows w, h beside this line.</p>\n<p>However for my Objective-C properties of my</p>\n<pre class="lang-objc prettyprint-override"><code>@interface SampleRect : NSObject\n\n/** NSRect contains region of output pixels to render **/\n\n@property CGRect dimensions;\n\n-(id) init; \n@end \n</code></pre>\n<p>The properties after setting the preview shows no information on the SampleRect instance.</p>\n<p>What keyword or steps am I missing?</p>\n"^^ . . "0"^^ . . "keyboard"^^ . "What is Swift alternative to NSRange.location and NSRange.length?"^^ . . "0"^^ . "The documentation of `NSF2FunctionKey` is "Constants for reserved keyboard function keys that correspond to unicode characters.". What is the value of `[theEvent characters]`?"^^ . . . . "callkit"^^ . . . . "1"^^ . . . . . "Sure. Please explain how to adjust the target offset of a decelerating List view in SwiftUI without resorting back to a UIScrollView and loosing the lazy loading behaviour of List. List does use a a UIScrollView underneath anyways, which is easy to access but changing it's delegate to a custom object breaks it, so I would like to extend the original delegate with this method instead. I am open to any alternate suggestions that can achieve changing the target offset."^^ . "<p>I have an internal class that adopts<code>UIScrollViewDelegate</code>, but does not implement <code>scrollViewWillEndDragging(_:withVelocity:targetContentOffset:)</code>. I want to add this method to the class using <code>class_addMethod</code>, but unfortunately run into a <code>EXC_BAD_ACCESS</code> error when trying to assign a new value to <code>targetContentOffset</code>.</p>\n<p>Here is my code:</p>\n<pre><code>func extendDelegate(scrollViewDelegte: UIScrollViewDelegate) {\n let block : @convention(block) (UIScrollView, CGPoint, UnsafeMutablePointer&lt;CGPoint&gt;) -&gt; Void = { scrollView, velocity, targetContentOffset in\n // EXC_BAD_ACCESS here. \n // I can read the pointee and it does contain a valid CGPoint value, \n // however assigning to it gives a crash.\n targetContentOffset.pointee = .zero\n }\n\n class_addMethod(\n type(of: scrollViewDelegte),\n #selector(UIScrollViewDelegate.scrollViewWillEndDragging(_:withVelocity:targetContentOffset:)),\n imp_implementationWithBlock(block),\n &quot;v@:@{CGPoint=dd}^{CGPoint=dd}&quot;\n )\n}\n</code></pre>\n<p>Any helps is greatly appreciated!</p>\n"^^ . . . . "A *free translation* of the code can take advantage of Swift Regex in a String extension: `let name = self.firstMatch(of: /(?:sips?:)?([^@]+)@/)?.output.1`. The result is of type `Substring?`"^^ . . . . "nsmutablearray"^^ . . "1"^^ . "F2 key press event on macOS"^^ . . . "0"^^ . "<p>You can't do that with a user-directed push nor an app directed push.</p>\n<p>You need to implement a notification service extension, then the user directed push will get delivered to that.\nThe notification service extension can extract the payload and update the database.</p>\n<p>You have probably created the database in the app's file sandbox, therefore you will need to add the app group capability to the app and to the notification extension and create the database in the shared group file sandbox so it can be accessed by both the extension and the app.</p>\n<p>I don't know if QSLLite can handle simultaneous updates/accesses from multiple threads (or in this case it would be multiple processes), if it can then you are good to go.\nIf it cannot then when the notification extension receives the push, it may need to determine if the app is running or not (that's possible for the extension to do using MMWormmhole), if it is running you will need to add some co-ordination between them to ensure they're not both simultaneously accessing the db.</p>\n"^^ . . "1"^^ . . "How do you migrate nil values?"^^ . "[Where and how to __bridge](https://stackoverflow.com/questions/14854521/where-and-how-to-bridge). You don't need `__bridge` for `CFRelease()`."^^ . . . . . . . . "This code, while it may work has a very limited range of use - there are about a dozen different property types - what if the property is a double, or a date or a Decimal128? Expanding on that, what if it's a Realm object and not a primitive, how will that migrate?"^^ . "0"^^ . . . "0"^^ . "Is `UIDelegate` set in the storyboard? I tried your code, `runOpenPanelWithParameters` is called but there are some other issues."^^ . "1"^^ . . . "0"^^ . "0"^^ . "react-native"^^ . . . . . . . . . . . . . . . . . . "0"^^ . "0"^^ . "Please provide enough code so others can better understand or reproduce the problem."^^ . . "0"^^ . "0"^^ . . "0"^^ . "Please don't post duplicate questions. It's better to update your existing question with additional info or edits and post the answer to *that* question if you have one."^^ . . "1"^^ . . . "0"^^ . "Don't convert old legacy Objective-C code. Ask how to extract the name in Swift."^^ . . . . . "0"^^ . . . . . . "Objective-C class properties not viewable on Swift playground"^^ . . . . "uiwebview"^^ . . . . . . "<p>I want to implement Callkit Call Directory Extension in my React Native App, and created a Bridge too. I've used <strong>objective-c</strong> to handle CallDirectoryHandler. I have built the extension by following <a href="https://medium.com/write-a-native-module-to-detect-caller-id-in-react/write-a-native-module-to-detect-caller-id-in-react-native-b879def0c47c" rel="nofollow noreferrer">this tutorial</a>, however, I am still struggling with adding and Identifying numbers. I have tried almost every possible solution, but neither of them worked for me. Below are the codes, I am using:\n<strong>CallkitBridge.m</strong></p>\n<pre><code>#import &quot;CallkitBridge.h&quot;\n\n#define DATA_KEY @&quot;CALLER_LIST&quot;\n\n#define DATA_GROUP @&quot;group.org.reactn.futurecodes.CallDirectory&quot;\n\n#define EXTENSION_ID @&quot;org.reactn.futurecodes.CallDirectory&quot;\n\n@implementation CallkitBridge\n\nRCT_EXPORT_MODULE()\n\n-(NSError*) buildErrorFromException: (NSException*) exception withErrorCode: (NSInteger)errorCode {\n NSMutableDictionary* info = [NSMutableDictionary dictionary];\n [info setValue:exception.name forKey:@&quot;Name&quot;];\n [info setValue:exception.reason forKey:@&quot;Reason&quot;];\n [info setValue:exception.callStackReturnAddresses forKey:@&quot;CallStack&quot;];\n [info setValue:exception.callStackSymbols forKey:@&quot;CallStackSymbols&quot;];\n [info setValue:exception.userInfo forKey:@&quot;UserInfo&quot;];\n \n NSError *error = [[NSError alloc] initWithDomain:EXTENSION_ID code:errorCode userInfo:info];\n return error;\n}\n\n- (NSArray*)getCallerList {\n @try {\n NSUserDefaults* userDefaults = [[NSUserDefaults alloc] initWithSuiteName:DATA_GROUP];\n NSArray* callerList = [userDefaults arrayForKey:DATA_KEY];\n if (callerList) {\n return callerList;\n }\n\n return [[NSArray alloc] init];\n }\n @catch(NSException* e) {\n NSLog(@&quot;CallerId: Failed to getCallerList: %@&quot;, e.description);\n }\n}\n\nRCT_EXPORT_METHOD(getCallerList: (RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {\n @try {\n NSArray* callerList = [NSArray arrayWithArray:[self getCallerList]];\n resolve(callerList);\n }\n @catch (NSException* e) {\n NSError* error = [self buildErrorFromException:e withErrorCode: 100];\n reject(@&quot;getCallerList&quot;, @&quot;Failed to getCallerList bridge:&quot;, error);\n }\n}\n\nRCT_EXPORT_METHOD(setCallerList: (NSArray*) callerList withResolver: (RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {\n @try {\n NSLog(@&quot;Caller List -&gt; %@&quot;,callerList);\n NSUserDefaults* userDefaults = [[NSUserDefaults alloc] initWithSuiteName:DATA_GROUP];\n [userDefaults setObject:callerList forKey:DATA_KEY];\n [userDefaults synchronize];\n [CXCallDirectoryManager.sharedInstance reloadExtensionWithIdentifier:EXTENSION_ID completionHandler:^(NSError * _Nullable error) {\n if(error) {\n NSLog(@&quot;error while reloading&quot;);\n reject(@&quot;setCallerList&quot;, @&quot;Failed to reload extension&quot;, error);\n } else {\n NSLog(@&quot;reloading extension....&quot;);\n resolve(@true);\n }\n }];\n }\n @catch (NSException* e) {\n NSError* error = [self buildErrorFromException:e withErrorCode: 100];\n reject(@&quot;setCallerList&quot;, @&quot;Failed to set caller list&quot;, error);\n }\n}\n\nRCT_EXPORT_METHOD(getExtensionEnabledStatus: (RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {\n // The completionHandler is called twice. This is a workaround\n __block BOOL hasResult = false;\n __block int realResult = 0;\n [CXCallDirectoryManager.sharedInstance getEnabledStatusForExtensionWithIdentifier:EXTENSION_ID completionHandler:^(CXCallDirectoryEnabledStatus enabledStatus, NSError * _Nullable error) {\n // TODO: Remove these conditions when you find a way to return the correct result or Apple just fix their bug.\n if (hasResult == false) {\n hasResult = true;\n realResult = (int)enabledStatus;\n }\n if(error) {\n reject(@&quot;getExtensionEnabledStatus&quot;, @&quot;Failed to get extension status&quot;, error);\n } else {\n resolve([NSNumber numberWithInt:realResult]);\n }\n }];\n}\n\n- (NSDictionary *)constantsToExport\n{\n return @{ @&quot;UNKNOWN&quot;: @0, @&quot;DISABLED&quot;: @1, @&quot;ENABLED&quot;: @2};\n}\n\n@end\n</code></pre>\n<p><strong>CallDirectoryHandler.m</strong></p>\n<pre><code>#import &quot;CallDirectoryHandler.h&quot;\n\n#define DATA_KEY @&quot;CALLER_LIST&quot;\n#define APP_GROUP @&quot;group.org.reactn.futurecodes.CallDirectory&quot;\n\n@interface Caller : NSObject\n@property NSString* name;\n@property NSArray&lt;NSNumber*&gt;* numbers;\n-(instancetype) initWithDictionary: (NSDictionary*) dictionary;\n@end\n\n@implementation Caller\n-(instancetype) initWithDictionary: (NSDictionary*) dictionary {\n if (self = [super init]) {\n self.name = dictionary[@&quot;name&quot;];\n self.numbers = dictionary[@&quot;numbers&quot;];\n }\n return self;\n}\n@end\n\n@interface CallDirectoryHandler () &lt;CXCallDirectoryExtensionContextDelegate&gt;\n\n@end\n\n@implementation CallDirectoryHandler\n\n- (void)beginRequestWithExtensionContext:(CXCallDirectoryExtensionContext *)context {\n context.delegate = self;\n if (context.isIncremental) {\n [context removeAllIdentificationEntries];\n }\n NSLog(@&quot;reloaded and adding numbers...&quot;);\n [self addAllIdentificationPhoneNumbersToContext:context];\n \n [context completeRequestWithCompletionHandler:nil];\n}\n\n- (NSArray*)getCallerList {\n @try {\n NSUserDefaults* userDefaults = [[NSUserDefaults alloc] initWithSuiteName:APP_GROUP];\n NSArray* callerList = [userDefaults arrayForKey:DATA_KEY];\n if (callerList) {\n NSLog(@&quot;%@&quot;,callerList);\n return callerList;\n }\n return [[NSArray alloc] init];\n }\n @catch(NSException* e) {\n NSLog(@&quot;Failed to get caller list: %@&quot;, e.description);\n }\n}\n\n- (void)addAllIdentificationPhoneNumbersToContext:(CXCallDirectoryExtensionContext *)context {\n @try {\n NSArray* callerList = [self getCallerList];\n NSLog(@&quot;Call dir list %@&quot;,callerList);\n NSMutableDictionary&lt;NSNumber*, NSString*&gt;* labelsKeyedByPhoneNumber = [[NSMutableDictionary alloc] init];\n NSUInteger callersCount = [callerList count];\n if(callersCount &gt; 0) {\n for (NSUInteger i = 0; i &lt; callersCount; i += 1) {\n Caller* caller = [[Caller alloc] initWithDictionary:([callerList objectAtIndex:i])];\n for (NSUInteger j = 0; j &lt; [caller.numbers count]; j++) {\n NSNumber* number = caller.numbers[j];\n [labelsKeyedByPhoneNumber setValue:caller.name forKey:number];\n }\n }\n }\n for (NSNumber *phoneNumber in [labelsKeyedByPhoneNumber.allKeys sortedArrayUsingSelector:@selector(compare:)]) {\n NSString *label = labelsKeyedByPhoneNumber[phoneNumber];\n [context addIdentificationEntryWithNextSequentialPhoneNumber:(CXCallDirectoryPhoneNumber)[phoneNumber longLongValue] label:label];\n }\n } @catch (NSException* e) {\n NSLog(@&quot;Failed to get caller list: %@&quot;, e.description);\n }\n \n}\n\n- (void)requestFailedForExtensionContext:(nonnull CXCallDirectoryExtensionContext *)extensionContext withError:(nonnull NSError *)error {\n NSLog(@&quot;Request failed: %@&quot;, error.localizedDescription);\n}\n\n@end\n</code></pre>\n<p>And this is how I am calling it in my React Native App.js</p>\n<pre><code>import React, {useEffect} from 'react';\nimport {View, Text, NativeModules} from 'react-native';\n\nfunction App() {\n const {CallkitBridge} = NativeModules;\n const callers = [\n {\n name: 'Debt Collector',\n number: '+923100000000',\n },\n ];\n\n useEffect(() =&gt; {\n (async () =&gt; {\n try {\n const status = await CallkitBridge.getExtensionEnabledStatus();\n if (status === 2) {\n try {\n await CallkitBridge.setCallerList(callers);\n } catch (error) {\n console.log('Adding error =&gt; ', error);\n }\n }\n } catch (error) {\n console.log('Err -&gt; ', error);\n }\n })();\n }, []);\n return (\n &lt;View&gt;\n &lt;Text&gt;Hello world&lt;/Text&gt;\n &lt;/View&gt;\n );\n}\n\nexport default App;\n\n</code></pre>\n<p><strong>P.S:</strong> I have checked the App Group and it is correct, and the +92 is my Country Code i.e. Pakistan, however, I am not seeing the caller ID. I have checked and enable the extension, and I am seeing the Extension Status === 2 which is enabled.\n<strong>Please Note:</strong> While I tried every solution, I am unable to debug the Call Directory Extension in XCode. Any help is appreciated, <strong>thanks</strong>.</p>\n<p>I tried changing the callers array from name and a array of numbers inside the object, as well as changing a bit the native codes too.\n<strong>Expectation:</strong>\nI want the Caller ID to be shown, whenever, someone calls me from the number, I provide back from my React Native App.</p>\n"^^ . . . . . "0"^^ . . . "wkwebview"^^ . "0"^^ . "But you said the new db will hold only non-optional properties so it’s hard to understand the logic behind this code."^^ . "1"^^ . . . . "<p>My app consists of several windows that all exist at the NSNormalWindowLevel. I recently added a new window that opens as a utility panel (and, hence, NSFloatingWindowLevel). This utility panel correctly opens as a floating window and stays on top of the other windows, and I can change focus by clicking in any of the &quot;normal&quot; windows, or clicking again on the utility panel when I want interactions to take place there.</p>\n<p>The problem I'm having, though, is that I <em>don't</em> want the utility panel to always grab focus when it is opened; I'd like focus to remain with the top window at the NSNormalWindowLevel so the user does not have to click on the top &quot;normal&quot; window in order to continue working there.</p>\n<p>The basic code looks like this:</p>\n<pre><code> storyBoard = [NSStoryboard storyboardWithName:@&quot;UtilityPanel&quot; bundle:nil];\n utilityPanelController = [storyBoard instantiateControllerWithIdentifier:@&quot;Utility Panel&quot;];\n\n [utilityPanelController showWindow:sender];\n</code></pre>\n<p>I've tried to force the top normal window to the front by getting a reference to the top window and calling orderFront:</p>\n<pre><code> NSWindow *topWindow = [[NSApplication sharedApplication] keyWindow];\n [topWindow orderFront:nil];\n</code></pre>\n<p>But the utility panel still has the focus, requiring a click in the top window to return focus where it was. I've also tried using orderFrontRegardless with the same result.</p>\n<p>It occurs to be that both orderFront and orderFrontRegardless only operate on windows at the same window level, and here the windows are at different levels.</p>\n<p>I've looked through the Window manager, but have yet to find a way to change the focus to a particular window level (say, NSNormalWindowLevel) in code at the time that I open the utility panel. Have I missed something obvious?</p>\n<p>Thanks!</p>\n"^^ . . . . . . . "0"^^ . . . . . . . . . . "macos"^^ . . . . "@Willeke, i have shared the code in question please refer that. I have created webView in storyboard."^^ . . "0"^^ . . "1"^^ . . "<p>I'm trying to assign <code>launchOption</code> from <code>didFinishLaunchingWithOptions</code> to <code>self</code> so I can use it in another function but it doesn't seem to work.</p>\n<p>I keep getting the error:</p>\n<pre><code>&quot;Property 'launchOptions' not found on object of type 'AppDelegate *'&quot; .\n</code></pre>\n<p>It seems like I'm having problems when I try to access <code>self.launchOptions</code>.</p>\n<p><a href="https://i.sstatic.net/06vdP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/06vdP.png" alt="enter image description here" /></a></p>\n"^^ . "-1"^^ . "<p>For the life of me I can't understand why <code>dateFromString</code> is producing a nil value in the code below.</p>\n<pre><code>NSString* timeStampValue = @&quot;20230917120009.289Z&quot;;\n NSString* dateString = [timeStampValue substringToIndex:8];\n NSISO8601DateFormatter* formatter = [[NSISO8601DateFormatter alloc] init];\n [formatter setFormatOptions:NSISO8601DateFormatWithFullDate];\n NSDate* dateOfLastVerification = [formatter dateFromString:dateString];\n</code></pre>\n<p>First I tried converting the entire string <code>timeStampValue</code> and set the format options accordingly. I was expecting that to work because, as far as I'm aware, this string is in valid ISO8601 format. Technically its using GeneralizedTime syntax but it doesn't seem like that should matter. But that threw a nil pointer.</p>\n<p>Then I decided to just extract the date substring (I don't necessarily need the time and time zone data) and specify NSISO8601DateFormatWithFullDate as the only option. That should be my safest bet, right? Well, dateFromString threw nil in that scenario as well. I tried setting the format options on the formatter directly and it made no difference:</p>\n<pre><code>formatter.formatOptions = NSISO8601DateFormatWithFullDate\n</code></pre>\n"^^ . . . "1"^^ . . . . "Hm, I implemented `numberOfRowsInTableView` and the method you provided (with appropriate changes), and now table B is populated but the rows display empty strings (clicking the row still selects the correct data, as logging shows) \n- so, not as configured in IB. And table A is not populated at all. I guess my problem might be more specific/somewhere else."^^ . "0"^^ . . . "That's all I needed; thank you!"^^ . . "0"^^ . "0"^^ . . "So, in IB the column only contained an NSTextFieldCell - I changed that, and now your solution works for table A. For table B, however, it does not seem possible to set the values in IB, so I will resort to just setting them programmatically as well, meh."^^ . . . . . . . "<p>Trying to call another static method in a file of static methods, although I get:\nTweak.xm:324:11: error: no known instance method for selector 'test'</p>\n<pre><code>static void rddhandler(id self2, SEL _cmd){\n [self test]; //\n}\n\nstatic void test() {\n NSLog(@&quot;test&quot;);\n}\n</code></pre>\n"^^ . . . . . "macros"^^ . . . . "method-swizzling"^^ . . . "Assigning launchOption to self in AppDelegate"^^ . "0"^^ . . . . "1"^^ . . "I have a similar issue. Have you found a faster solution without replacing UIWebView? Thanks."^^ . "0"^^ . "2"^^ . "0"^^ . "I believe you missed the point of the question asked by @JoakimDanielson. Your current properties are optional, and could be nil. How are you migrating a nil (optional) property to a non-optional property. e.g. Non-optional properties CANNOT be nil, they must contain a value. So a nil value cannot remain nil as that will crash."^^ . . "1"^^ . . . "1"^^ . . . . . "1"^^ . . . "0"^^ . "0"^^ . . . . . "Finder is an app. Do you mean an Open panel?"^^ . . . . . . . "0"^^ . . . . "Post the code you tried please."^^ . "0"^^ . . . "Try setting `NSPanel`'s `becomesKeyOnlyIfNeeded` to YES?"^^ . . . . "1"^^ . "0"^^ . . "pushy"^^ . "ciimage"^^ . "0"^^ . . "1"^^ . "0"^^ . . . . . . . "0"^^ . "cocoa"^^ . . . "0"^^ . . . "Oh, and I'd just call the super and then do a mutable copy. And this is.. "safe", for lack of a better word, because the name `arrayByMultiplyingByNumber` suggests the return value is not mutable. Thank you!"^^ . "My example uses Core Data, but that can run into memory issues if you have a lot of numbers."^^ . "2"^^ . "0"^^ . . . "1"^^ . "0"^^ . . "1"^^ . . "0"^^ . "0"^^ . "Is the file's owner also the data source? Should work just as well. Bindings are difficult to debug, data source and delegate are easier."^^ . "0"^^ . "How do I use NSISO8601DateFormatter to parse a date from a string in iOS?"^^ . . "ios16"^^ . . . . . . . "ios"^^ . "Callkit Call Directory Extension not working with React Native"^^ . "0"^^ . . . . "<pre><code>[self.currentView addGestureRecognizer:self.pangr]; // added somewhere above in the code\n\n[UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{\nself.currentView2.transform = CGAffineTransformMakeTranslation(0, self.currentView2.frame.size.height);\nself.currentView.transform = CGAffineTransformMakeScale(1.0, 1.0);\n} completion:^(BOOL finished) {\nself.currentView2 = nil;\n}];\n</code></pre>\n<p>Here the currentView does have a pan gesture recognizer and it has a handling function. Inside the handler in the onEnded case i have written the above animation where the currentView2 is dummy one and it is out of concern. the main problem here is after releasing the gesture on the currenView and it is tranforming and during that time the gesture on that view is not recognizing. It is recognizing only after that tranform animation in completed. Why is this happening?</p>\n<p>Any explanation will be appriciated. Thank you.</p>\n<p>I tried to transform a view and at the same time i want to make the gesture on the view to be recognized. But that is not happening.</p>\n"^^ . "How to perform artifact-free fast drawing from bitmap data in Cocoa / Objective-C?"^^ . "0"^^ . "<p>In macOS, our requirement is to open a Finder when clicking Upload File from a web view. It works when I opened the same URL link in Safari but inside macOS application Open Finder its not getting triggered.</p>\n<p>I've used <code>WKWebKit</code> delegate function but its not triggered.</p>\n<pre><code>- (void)webView:(WKWebView *)webView \ndecidePolicyForNavigationAction:(WKNavigationAction *)navigationAction \ndecisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler;\n</code></pre>\n<p>Also I've tried with <code>WKNavigationDelegate</code> as well but no luck.</p>\n<pre><code>webView:didStartProvisionalNavigation:\nwebView:didCommitNavigation:\nwebView:didFinishNavigation:\nwebView:didFailNavigation:withError:\nwebView:decidePolicyForNavigationAction:decisionHandler: \n</code></pre>\n<p>And also with <code>WKUIDelegate</code> functions as well.</p>\n<pre><code>webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:\nwebView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:\nwebView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:\nwebView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:\n</code></pre>\n<p>Here is the code I have tried,</p>\n<pre><code>@interface ViewController() &lt;WKUIDelegate, WKNavigationDelegate&gt;\n@property (nonatomic, assign) BOOL isFinderOpen;\n\n@end\n\n@implementation ViewController\n\n(IBAction)buttonClick:(id)sender {\n NSString *urlAddress = [NSString stringWithFormat:@&quot;https://www.diawi.com/&quot;];\n [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlAddress]]];\n}\n\n- (void)webView:(WKWebView *)webView runOpenPanelWithParameters:(WKOpenPanelParameters *)parameters initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSArray&lt;NSURL *&gt; * _Nullable))completionHandler{\n \n if (!self.isFinderOpen) {\n self.isFinderOpen = YES;\n [self.webView.configuration.preferences setValue:@TRUE forKey:@&quot;allowFileAccessFromFileURLs&quot;];\n NSOpenPanel *openPanel = [NSOpenPanel openPanel];\n [openPanel setCanChooseFiles:YES];\n [openPanel beginWithCompletionHandler:^(NSInteger result) {\n self.isFinderOpen = NO;\n if (result == NSModalResponseOK) {\n NSURL *url = [openPanel URL];\n if (url) {\n NSLog(@&quot;%@&quot;,url);\n }\n }\n else if (result == NSModalResponseCancel) {\n NSLog(@&quot;nil&quot;);\n }\n }];\n } \n}\n</code></pre>\n<p>Any thing I'm missing in this ?</p>\n"^^ . "1"^^ . . . . . "1"^^ . . . "1"^^ . . . . . . "<p>I have a food delivery app similar to Uber Eat it was developed in Objective C now the requirement is to implement the Live activity for tracking the Active orders. As i tried Live activity over the Swift it is working fine on all IOS Devices but when i implement that swift code into Objective C using all the standards by Bridging between Swift and Obj C copied the same code, There is no Error or Warning i am seeing in Live activity functionality in Objective C, but Live Activity UI can't seen on Lockscreen even i have checked in settings my app is showing that it supports Live Activity but no view.</p>\n<p>Can somebody help me out in that how to integrate live activity into Objective C project?</p>\n<p>I tried Swift Code in a separate app it works Fine and showing Live Activity both in Simulator and on real Device.</p>\n<p>I copied the same code followed the same methods into my old Objective C Project but no Live activity is going to be shown. even no error no warnings. also declared the NSSupportsLiveActivities to YES in Project info.plist file. Also getting the Activity registration Token in logs. but on viewing the live activity its not showing anywhere.</p>\n"^^ . . "0"^^ . "<p>You should be using outdated Cocoapods version, please consider updating to the latest one.</p>\n<p>As a temporary workaround, in your Pods-YourAppName-Frameworks.sh file you can change the following line:</p>\n<pre><code>source=&quot;$(readlink &quot;${source}&quot;)&quot;\n</code></pre>\n<p>to:</p>\n<pre><code>source=&quot;$(readlink -f &quot;${source}&quot;)&quot;\n</code></pre>\n"^^ . . "How to combine the color channels and alpha channel from two CIImage?"^^ . . . "0"^^ . "0"^^ . . . "interop"^^ . . . "ios17"^^ . . . . . . . . . "2"^^ . . "0"^^ . . "I have posted that method now - appreciate it's old code, but strange how it crashes with iOS 16, and not 17?!"^^ . "Migrate to the SPM version of the library"^^ . "It makes no sense to add a `UIAlertController` as a child. Just present it normally. That's how it is designed to be used."^^ . . "1"^^ . . "0"^^ . . "Successfully using KVC with Swift Structs"^^ . "0"^^ . . . "<p>I have successfully resolved the issue! Although I couldn't initially pinpoint the exact problem, it turned out that the overridden function &quot;setDataSource&quot; in my code was making a call to an &quot;init&quot; function, which belonged to a different interface. This unexpected call to the &quot;init&quot; function was preventing the execution of &quot;writeItems:toPasteBoard.&quot; The solution was to remove the call to the &quot;init&quot; function, and now everything works as expected.</p>\n"^^ . "1"^^ . "0"^^ . "<p>You do not need to reference the symbol. Use hardcoded value <code>DAMediaEncrypted</code> within the macro block and see if it helps.</p>\n<pre><code>(lldb) po kDADiskDescriptionMediaEncryptionDetailKey\nDAMediaEncryptionDetail\n(lldb) po kDADiskDescriptionMediaEncryptedKey\nDAMediaEncrypted\n</code></pre>\n"^^ . "0"^^ . "It mentioned: When your app calls this method while it’s in development mode, StoreKit always displays the rating and review request view, so you can test the user interface and experience."^^ . "audiokit"^^ . . "Having exactly the same issue in Xcode 15.0.1 on macOS 13.6.1. When running my MacOS app in debug from Xcode the review prompt never shows. Tried @Environmen(.\\requestReview) and SKStoreReviewController.requestReview(). Again, developing and testing on real Mac. Both debug builds from Xcode and development test from archive. According to the documentation, in development / debug builds it should always present the rating prompt. Making development around this very difficult."^^ . . . . "0"^^ . "struct"^^ . . . "0"^^ . . . . . "0"^^ . . "0"^^ . . "0"^^ . . "0"^^ . "rpsystembroadcastpickerview"^^ . "0"^^ . . . "<p><code>UIAlertController</code> is a specialized controller that makes use of <code>UIAlertAction</code>.</p>\n<p>Worth noting from Apple's <a href="https://developer.apple.com/documentation/uikit/uialertcontroller" rel="nofollow noreferrer">docs</a>:</p>\n<blockquote>\n<p><strong>Important</strong></p>\n<p>The UIAlertController class is intended to be used as-is and doesn’t support subclassing. The view hierarchy for this class is private and must not be modified.</p>\n</blockquote>\n<p>While you may not be subclassing it (you didn't provide your <code>AlertHelper</code> code), you're clearly not using it &quot;as-is.&quot;</p>\n<p>Instead, you probably want to design your own &quot;simulated&quot; alert controller.</p>\n<p>Here's a quick example...</p>\n<hr />\n<p><strong>AlertHelper.h</strong></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface AlertHelper : NSObject\n\n+ (UIAlertController *)createAlertWithTitle:(NSString *)title\n message:(NSString *)message\n cancelButton:(NSString *)cancel\n continueButtonText:(NSString *)ok\n continueAction:(UIAction *)continueAction\n cancelAction:(UIAction *)cancelAction;\n\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<hr />\n<p><strong>AlertHelper.m</strong></p>\n<pre><code>#import &quot;AlertHelper.h&quot;\n\n@implementation AlertHelper\n\n+ (UIViewController *)createAlertWithTitle:(NSString *)title\n message:(NSString *)message\n cancelButton:(NSString *)cancel\n continueButtonText:(NSString *)ok\n continueAction:(UIAction *)continueAction\n cancelAction:(UIAction *)cancelAction;\n{\n UIViewController *vc = [UIViewController new];\n vc.view.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.25];\n \n UIView *bkg = [UIView new];\n bkg.clipsToBounds = YES;\n bkg.backgroundColor = [UIColor systemBackgroundColor];\n bkg.layer.cornerRadius = 12.0;\n \n UILabel *titleLabel = [UILabel new];\n titleLabel.font = [UIFont systemFontOfSize:17.0 weight:UIFontWeightSemibold];\n titleLabel.numberOfLines = 0;\n titleLabel.textAlignment = NSTextAlignmentCenter;\n titleLabel.text = title;\n \n UILabel *msgLabel = [UILabel new];\n msgLabel.font = [UIFont systemFontOfSize:13.0 weight:UIFontWeightRegular];\n msgLabel.numberOfLines = 0;\n msgLabel.textAlignment = NSTextAlignmentCenter;\n msgLabel.text = message;\n\n UIButton *cancelButton = [UIButton systemButtonWithPrimaryAction:cancelAction];\n UIButton *okButton = [UIButton systemButtonWithPrimaryAction:continueAction];\n \n cancelButton.layer.borderColor = [UIColor systemBlueColor].CGColor;\n okButton.layer.borderColor = [UIColor systemBlueColor].CGColor;\n cancelButton.layer.borderWidth = 1.0;\n okButton.layer.borderWidth = 1.0;\n\n for (UIView *v in @[bkg, titleLabel, msgLabel, okButton, cancelButton]) {\n v.translatesAutoresizingMaskIntoConstraints = NO;\n }\n for (UIView *v in @[titleLabel, msgLabel, okButton, cancelButton]) {\n [bkg addSubview:v];\n }\n [vc.view addSubview:bkg];\n \n [NSLayoutConstraint activateConstraints:@[\n \n [titleLabel.topAnchor constraintEqualToAnchor:bkg.topAnchor constant:20.0],\n\n [titleLabel.leadingAnchor constraintEqualToAnchor:bkg.leadingAnchor constant:8.0],\n [titleLabel.trailingAnchor constraintEqualToAnchor:bkg.trailingAnchor constant:-8.0],\n \n [msgLabel.topAnchor constraintEqualToAnchor:titleLabel.bottomAnchor constant:4.0],\n [msgLabel.leadingAnchor constraintEqualToAnchor:bkg.leadingAnchor constant:8.0],\n [msgLabel.trailingAnchor constraintEqualToAnchor:bkg.trailingAnchor constant:-8.0],\n \n [cancelButton.topAnchor constraintEqualToAnchor:msgLabel.bottomAnchor constant:20.0],\n [cancelButton.leadingAnchor constraintEqualToAnchor:bkg.leadingAnchor constant:-1.0],\n\n [okButton.topAnchor constraintEqualToAnchor:cancelButton.topAnchor constant:0.0],\n [okButton.trailingAnchor constraintEqualToAnchor:bkg.trailingAnchor constant:1.0],\n\n [cancelButton.bottomAnchor constraintEqualToAnchor:bkg.bottomAnchor constant:1.0],\n \n [cancelButton.trailingAnchor constraintEqualToAnchor:okButton.leadingAnchor constant:1.0],\n [cancelButton.widthAnchor constraintEqualToAnchor:okButton.widthAnchor],\n\n [cancelButton.heightAnchor constraintEqualToConstant:40.0],\n [okButton.heightAnchor constraintEqualToAnchor:cancelButton.heightAnchor],\n \n [bkg.widthAnchor constraintEqualToConstant:274.0],\n [bkg.centerXAnchor constraintEqualToAnchor:vc.view.centerXAnchor],\n [bkg.centerYAnchor constraintEqualToAnchor:vc.view.centerYAnchor],\n\n ]];\n\n return vc;\n}\n\n@end\n</code></pre>\n<hr />\n<p>and an example view controller:</p>\n<p><strong>ViewController.h</strong></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\n@interface ViewController : UIViewController\n@end\n</code></pre>\n<hr />\n<p><strong>ViewController.m</strong></p>\n<pre><code>#import &quot;ViewController.h&quot;\n#import &quot;AlertHelper.h&quot;\n\n@interface ViewController ()\n@end\n\n@implementation ViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n\n self.view.backgroundColor = [UIColor systemYellowColor];\n\n UIAction *act = [UIAction actionWithTitle:@&quot;Show Fake Alert VC&quot; image:nil identifier:nil handler:^(UIAction * _Nonnull action) {\n [self showFakeAlertVC];\n }];\n\n UIButton *btn = [UIButton systemButtonWithPrimaryAction:act];\n btn.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1.0];\n btn.translatesAutoresizingMaskIntoConstraints = NO;\n [self.view addSubview:btn];\n \n UILayoutGuide *g = self.view.safeAreaLayoutGuide;\n \n [NSLayoutConstraint activateConstraints:@[\n [btn.topAnchor constraintEqualToAnchor:g.topAnchor constant:60.0],\n [btn.leadingAnchor constraintEqualToAnchor:g.leadingAnchor constant:80.0],\n [btn.trailingAnchor constraintEqualToAnchor:g.trailingAnchor constant:-80.0],\n ]];\n}\n\n- (void)removeFakeAlertVC {\n UIViewController *vc;\n for (int i = 0; i &lt; [self.childViewControllers count]; i++) {\n if ([self.childViewControllers[i].title isEqualToString:@&quot;MyFakeAlertVC&quot;]) {\n vc = self.childViewControllers[i];\n break;\n }\n }\n if (nil != vc) {\n [vc willMoveToParentViewController:nil];\n [vc.view removeFromSuperview];\n [vc removeFromParentViewController];\n }\n}\n- (void)showFakeAlertVC {\n \n UIAction *okAction = [UIAction actionWithTitle:@&quot;Continue&quot; image:nil identifier:nil handler:^(UIAction * _Nonnull action) {\n // do something because OK / Continue was tapped\n NSLog(@&quot;OK tapped!&quot;);\n [self removeFakeAlertVC];\n }];\n UIAction *cancelAction = [UIAction actionWithTitle:@&quot;Cancel&quot; image:nil identifier:nil handler:^(UIAction * _Nonnull action) {\n // do something because Cancel was tapped\n NSLog(@&quot;Cancel tapped!&quot;);\n [self removeFakeAlertVC];\n }];\n \n UIViewController *alert = [AlertHelper createAlertWithTitle:@&quot;Some really long Title that we expect to wrap.&quot;\n message:@&quot;Some really long Message that we also expect to wrap.&quot;\n cancelButton:@&quot;Cancel Btn&quot;\n continueButtonText:@&quot;Continue Btn&quot;\n continueAction:okAction\n cancelAction:cancelAction\n ];\n \n [self addChildViewController:alert];\n\n // we'll use this when we want to remove the\n // view and child controller\n // in case we have more than one child\n alert.title = @&quot;MyFakeAlertVC&quot;;\n \n UIView *sv = self.view;\n UIView *v = alert.view;\n \n v.translatesAutoresizingMaskIntoConstraints = false;\n \n [sv addSubview:v];\n [alert didMoveToParentViewController:self];\n \n [NSLayoutConstraint activateConstraints:@[\n \n [v.topAnchor constraintEqualToAnchor:sv.topAnchor constant:0.0],\n [v.leadingAnchor constraintEqualToAnchor:sv.leadingAnchor constant:0.0],\n [v.trailingAnchor constraintEqualToAnchor:sv.trailingAnchor constant:0.0],\n [v.bottomAnchor constraintEqualToAnchor:sv.bottomAnchor constant:0.0],\n\n ]];\n \n}\n\n@end\n</code></pre>\n<hr />\n<p>Output:</p>\n<p><a href="https://i.sstatic.net/D8nVj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/D8nVj.png" alt="enter image description here" /></a></p>\n"^^ . "<p>I have a project on React Native that has a bunch of Native Modules and UI Components. The code is mostly written on Swift but it also has Objective-C code for exporting my swift's native classes and methods to React Native because Swift doesn't support C macros, e.g.:</p>\n<pre class="lang-objectivec prettyprint-override"><code>// Calendar.m\n\n#import &lt;React/RCTBridgeModule.h&gt;\n\n@interface RCT_EXTERN_MODULE(Calendar, NSObject)\n\nRCT_EXTERN_METHOD(createEvent:(NSString *)title location:(NSString* )location)\n\n@end\n</code></pre>\n<pre class="lang-swift prettyprint-override"><code>// Calendar.swift\n\n@objc(Calendar)\nclass Calendar: NSObject {\n \n @objc\n func createEvent(_ title: String, location: String) {\n print(title, location)\n }\n}\n</code></pre>\n<p>It's inconvenient to manage both Objective-C and Swift method interfaces each time of any modification so is there any approach to eliminate Objective-C code?</p>\n"^^ . . . . . . . "<p>Thanks to Larme's comment and link.</p>\n<p>The issue appears to be with linking. Adding <code>-Wl,-ld_classic</code> in <code>OTHER_LDFLAGS</code> in the target Build Settings is the fix.</p>\n"^^ . . . "0"^^ . . . . . "BTW, IMO, The bot shouldn't have closed this question, I didn't mean to close it on my own."^^ . . "<p>I suspect there is another implementation of a method named -imageWithShadow: somewhere (a private TelephonyUI framework from the looks of it), and it takes an object argument instead of an int (maybe an NSShadow argument). And you are calling that method, not the one you think you are, and that method attempts to retain the object argument, but you are passing an int value of 8, so it dereferences 0x8 as a pointer to retain the argument, and crashes. Change your imageWithShadow: method name to something more project-specific, maybe with a myapp_ prefix (always a good idea when adding category methods to standard Apple classes).</p>\n<p>It's possible that TelephonyUI changed their method name in iOS17, or that your method &quot;wins&quot; there and TelephonyUI would crash it ever was needed.</p>\n"^^ . "0"^^ . . . . . . . "<p>There is exactly one occurrence of symbol <code>kDADiskDescriptionMediaEncryptedKey</code> in my Objective-C project. It is surrounded by an <code>@available</code> block:</p>\n<pre><code>if (@available(macOS 10.14.4, *)) {\n CFStringRef x = kDADiskDescriptionMediaEncryptedKey;\n}\n\n</code></pre>\n<p>Yet the program crashes on macOS 10.13:</p>\n<pre><code>Date/Time: 2023-10-18 19:37:34.273 +0200\nOS Version: Mac OS X 10.13.6 (17G65)\nReport Version: 12\nAnonymous UUID: C780E8BB-9F5C-A7EC-2846-AD51F8D2912C\n\n\nTime Awake Since Boot: 2700 seconds\n\nSystem Integrity Protection: enabled\n\nCrashed Thread: 0\n\nException Type: EXC_CRASH (SIGABRT)\nException Codes: 0x0000000000000000, 0x0000000000000000\nException Note: EXC_CORPSE_NOTIFY\n\nTermination Reason: DYLD, [0x4] Symbol missing\n\nApplication Specific Information:\ndyld: launch, loading dependent libraries\n\nDyld Error Message:\n Symbol not found: _kDADiskDescriptionMediaEncryptedKey\n Referenced from: /Users/USER/Desktop/AvailableCrash.app/Contents/MacOS/AvailableCrash\n Expected in: /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration\n in /Users/USER/Desktop/AvailableCrash.app/Contents/MacOS/AvailableCrash\n\n</code></pre>\n<p>I'm running Xcode 15.0 (15A240d) on macOS 13.6 (22G120). The program runs as expected on this development machine.</p>\n<p>What am I doing wrong?</p>\n"^^ . "0"^^ . "1"^^ . . "xcode"^^ . . . "0"^^ . . "2"^^ . . "<blockquote>\n<p>I have one View in react native,
Now to I want to pass that View into native iOS, but I don’t know is it possible or not 
And if possible how to implement that</p>\n</blockquote>\n<p>I have Implemented some code, Here I shared the code</p>\n<p>ViewController.h code</p>\n<pre><code>// ViewController.h\n#import &lt;React/RCTViewManager.h&gt;\n\n@interface CustomComponentManager : RCTViewManager\n\n@end\n\n</code></pre>\n<p>ViewController.m code</p>\n<pre><code>// ViewController.m\n#import &quot;ViewController.h&quot;\n#import &lt;React/RCTRootView.h&gt;\n@interface CustomViewController ()\n\n- (void)addReactNativeComponent:(NSString *)componentName;\n\n@end\n\n@implementation CustomViewController\n\nRCT_EXPORT_MODULE(CustomComponent)\n\n- (UIView *)view {\n // Return a custom UIView to host the React Native component\n return [[UIView alloc] init];\n}\n- (void)addReactNativeComponent:(NSString *)componentName{\n // Initialize the React Native bridge\n RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:nil];\n // Create a React Native component using the componentName\n RCTRootView *reactNativeView = [[RCTRootView alloc] initWithBridge:bridge moduleName:componentName initialProperties:nil];\n // Add the React Native component to your custom UIView\n [self.view addSubview:reactNativeView];\n}\n@end\n\n</code></pre>\n<p>App.tsx code</p>\n<pre><code>//App.tsx\n\nimport React, {useEffect, useRef, useState} from 'react';\nimport type {PropsWithChildren} from 'react';\nimport {\n LogBox,\n SafeAreaView,\n StyleSheet,\n Text,\n View,\n NativeModules,\n AppState,\n requireNativeComponent,\n} from 'react-native';\n\nLogBox.ignoreLogs(['new NativeEventEmitter']); // Ignore log notification by message\nLogBox.ignoreAllLogs();\n\nconst CustomComponent = requireNativeComponent('CustomComponent');\n\nconst App = () =&gt; {\n console.log(NativeModules, 'native&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;.');\n const {ViewController} = NativeModules;\n\n console.log('ViewController&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;.', ViewController);\n const appState = useRef(AppState.currentState);\n const [appStateVisible, setAppStateVisible] = useState(appState.current);\n useEffect(() =&gt; {\n console.log('App state&gt;&gt;&gt;&gt;&gt;&gt;', appStateVisible);\n NativeModules.CustomComponent.addReactNativeComponent('MyCustomReactNativeComponent');\n if (appStateVisible == 'background') {\n // ViewController.setupCustomView()\n }\n }, []);\n\n const handlePiPButtonPress = () =&gt; {\n console.log('pip button presss&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;');\n };\n return (\n &lt;SafeAreaView style={{flex: 1}}&gt;\n &lt;View style={{flex: 1}}&gt;\n &lt;Text&gt;React Native Pip&lt;/Text&gt;\n &lt;/View&gt;\n &lt;CustomComponent style={{ width: 200, height: 200 }} /&gt;\n &lt;/SafeAreaView&gt;\n \n );\n};\nexport default App;\n</code></pre>\n<p>But I don’t know is it right or not, I have to pass &lt;CustomComponent style={{ width: 200, height: 200 }} /&gt; to native iOS(objective-c)</p>\n<p>Please let me know if anyone have any idea regarding this</p>\n<p>I Found the simlilar Question, But no one can answer this\n<a href="https://stackoverflow.com/questions/34149169/pass-a-view-from-react-native-to-native-objective-c-code-over-the-bridge">enter link description here</a></p>\n"^^ . "The methods for Drag and Drop in NSOutlineView are not getting called"^^ . "0"^^ . . . . . "storekit"^^ . . . "Why is path to movie file in app bundle nil?"^^ . "2"^^ . . . "1"^^ . "<p>Is the Objective-C equivalent of a Swift opaque type just id&lt;protocol&gt;?</p>\n<p>What's the equivalent of a boxed type?</p>\n"^^ . "0"^^ . . . . . . "2"^^ . . . . "swift"^^ . . "Apologies, the code was wrong - I have corrected it and edited original question to better suit the stack trace error."^^ . . . . . "@SimonMcNeil - nope, that's not how a `UIAlertController` works... you cannot simply grab the view and add it to your view hierarchy."^^ . . "What is `type.state`? I assume this is a property you declared for `AdvertType` but didn't show in the question?"^^ . . . "kvc"^^ . . . . . . . . . . "uivisualeffectview"^^ . "I feel dumb cuz you're right... It doesn't work with CGRect (updated my question). My earlier code for making it "work" was wrong. However, a similar thing can be accomplished in animations as seen in https://stackoverflow.com/questions/23216673/how-can-i-animate-the-height-of-a-calayer-with-the-origin-coming-from-the-bottom#:~:text=Then%20for%20the%20animation%2C%20you%20simply%20animate%20the%20bounds%20(or%20even%20better%2C%20you%20can%20animate%20%22bounds.size.height%22%2C%20since%20only%20the%20height%20is%20changing)%3A"^^ . "<p>So I found out some significant difference. If I overlooked something essential, please let me know.</p>\n<p>When I created a topic (using <code>\\defgroup</code> and <code>\\ingroup</code>) I was wondering why some of my comments just would not show up in the group. Well, the comments were in the .m file.</p>\n<ul>\n<li>After copying them to the .h file (and adding a hint it comes from the header) the group did contain the expected reference but both comments were visible.</li>\n<li>Then I removed the hint to make both comments the same. The duplication in the doxygen output vanished.</li>\n<li>Then I removed the one from the .m file and am good to go.</li>\n</ul>\n<p>It seems the comments in the header get better spread where they need to go.</p>\n<p>Edit: I found some classes that have their header in .m files. Maybe not the best practice, but here it also turned out to <strong>better have the documentation in the declaration</strong> (header) than in the implementation.</p>\n"^^ . . "arm64"^^ . . . . "0"^^ . . . . "0"^^ . "<p>I'm facing a very niche problem but hope someone can help me. I'm using KVC in my project to set values in a class. This class contains properties including some that are structs. I was able to make these structs <code>@objc</code> compatible using the <code>_ObjectiveCBridgeable</code> protocol (I know it's not ideal but that's the best method I found for this). Now when I try to use <code>setValue(_:forKeyPath:)</code> on the parent class to set a value for one of the properties in the struct, it doesn't work. After some debugging I understand that it's bridging the struct to its Objective-C equivalent class and setting the value on that Objective-C equivalent class, but it's not converting the Objective-C class back to the struct and updating the struct on the parent class.</p>\n<p>I think it should be possible as can be seen in <a href="https://stackoverflow.com/questions/23216673/how-can-i-animate-the-height-of-a-calayer-with-the-origin-coming-from-the-bottom#:%7E:text=Then%20for%20the%20animation%2C%20you%20simply%20animate%20the%20bounds%20(or%20even%20better%2C%20you%20can%20animate%20%22bounds.size.height%22%2C%20since%20only%20the%20height%20is%20changing)%3A">https://stackoverflow.com/questions/23216673/how-can-i-animate-the-height-of-a-calayer-with-the-origin-coming-from-the-bottom#:~:text=Then%20for%20the%20animation%2C%20you%20simply%20animate%20the%20bounds%20(or%20even%20better%2C%20you%20can%20animate%20%22bounds.size.height%22%2C%20since%20only%20the%20height%20is%20changing)%3A</a> where it is stated that you can animate you can animate <code>bounds.size.height</code> using its keyPath in a <code>CABasicAnimation</code></p>\n<p>Here's my code (which can run in a Swift playground):</p>\n<pre class="lang-swift prettyprint-override"><code>@available(iOS 2.0, *)\n@objc public class TestClass: NSObject {\n @objc public var x: Int\n @objc public var y: Int\n @objc public var testStruct = TestStruct(z: 0)\n \n init(x:Int, y: Int) {\n self.x = x\n self.y = y\n }\n}\n\n@available(iOS 2.0, *)\npublic struct TestStruct: _ObjectiveCBridgeable {\n public typealias _ObjectiveCType = NSTestStruct\n \n public var z: Int\n \n public init(z: Int) { self.z = z }\n \n public func _bridgeToObjectiveC() -&gt; NSTestStruct {\n return NSTestStruct(z: z)\n }\n public static func _forceBridgeFromObjectiveC(_ source: NSTestStruct, result: inout TestStruct?) {\n result = TestStruct(z: source.z)\n }\n public static func _unconditionallyBridgeFromObjectiveC(_ source: NSTestStruct?) -&gt; TestStruct {\n return TestStruct(z: source?.z ?? 0)\n }\n public static func _conditionallyBridgeFromObjectiveC(_ source: NSTestStruct, result: inout TestStruct?) -&gt; Bool {\n result = TestStruct(z: source.z)\n return true\n }\n}\n\n@available(iOS 2.0, *)\n@objc public class NSTestStruct: NSObject {\n @objc public var z: Int // Updates to &quot;12&quot;\n @objc public init(z: Int) {\n self.z = z\n }\n}\n\nvar testClass = TestClass(x: 0, y: 0)\ntestClass.setValue(12, forKeyPath: &quot;testStruct.z&quot;)\nprint(testClass.testStruct.z) // Prints &quot;0&quot;, expected &quot;12&quot;\n</code></pre>\n"^^ . "frameworks"^^ . . . . "UIVisualEffectView glitches"^^ . . . . . . "1"^^ . "@SimonMcNeil You should post the relevant code showing how everything is being presented/dismissed so we can see why you think the only solution is to attempt to add the alert as a child instead of presenting it normally. Better to ask about the actual problem than to ask about one specific possible solution to that problem."^^ . . . "0"^^ . "1"^^ . . "Objective-C ISA pointer on disk vs when object being instantiated"^^ . . "Decompiling ARM64 and understanding branch targets bounderies"^^ . . "0"^^ . . . . . "0"^^ . . . . "2"^^ . "If you remove the `:(BOOL)animated` part then you have invented your own method called `viewWillAppear` that is never called (compared to the standard `viewWillAppear:` method of `UIViewController`)."^^ . "0"^^ . . "Thank you, HangarRash, for the reply, but I don't see how that would help me. I added a few words to the question, in case it wasn't clear before."^^ . . . "<p>I have an app that allows you to take a photo using the device camera - once taken, it proceeds to the next screen, to edit - however, on iOS 16 devices, it crashes as soon as I press the 'Use photo' button from the camera view - it does not happen on iOS 17 devices for some reason, it works fine on them.\nI tried to debug with no success.</p>\n<pre><code>#define IMAGE_FRAME_SIZE 5\n#define FRAME_COLOR_R 1.0\n#define FRAME_COLOR_G 1.0\n#define FRAME_COLOR_B 1.0\n#define FRAME_COLOR_ALPHA 1\n\n//#define VIEW_AREA_WIDTH 320\n//#define VIEW_AREA_HEIGHT 368\n//#define IMAGEVIEW_MARGIN 20\n\n#define VIEW_AREA_WIDTH ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) ? 768 : 320)\n#define VIEW_AREA_HEIGHT ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) ? 800 : 368)\n#define IMAGEVIEW_MARGIN ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) ? 40 : 20)\n#define SHADOW_WIDTH ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) ? 16 : 8)\n\n\n@interface PhotoSelectViewController ()\n\n@end\n\n@implementation PhotoSelectViewController\n\n@synthesize popoverController;\n@synthesize cameraPicker;\n@synthesize backgroundImageView;\n\n- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil\n{\n self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];\n if (self) {\n // Custom initialization\n }\n return self;\n}\n- (void)viewDidLoad\n{\n [super viewDidLoad];\n // Do any additional setup after loading the view from its nib.\n \n if ([UIScreen mainScreen].bounds.size.height == 568)\n self.view.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed: @&quot;background-568h@2x.png&quot;]];\n else\n self.view.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed: @&quot;background.png&quot;]];\n\n}\n\n- (void)viewDidUnload\n{\n [super viewDidUnload];\n // Release any retained subviews of the main view.\n // e.g. self.myOutlet = nil;\n}\n\n- (void)viewWillAppear:(BOOL)animated\n{\n [[UIApplication sharedApplication] setStatusBarHidden:YES];\n \n [self.view setBounds:self.view.frame];\n \n backgroundImageView.image = [[[GlobalData compressImage:[GlobalData sharedData].backgroundImage withSize:CGSizeMake((VIEW_AREA_WIDTH - IMAGEVIEW_MARGIN * 2), (VIEW_AREA_HEIGHT - IMAGEVIEW_MARGIN * 2))] imageAddFrame:IMAGE_FRAME_SIZE withColor:[UIColor colorWithRed:FRAME_COLOR_R green:FRAME_COLOR_G blue:FRAME_COLOR_B alpha:FRAME_COLOR_ALPHA].CGColor] imageWithShadow:SHADOW_WIDTH];\n\n [backgroundImageView setFrame:CGRectMake(([UIScreen mainScreen].bounds.size.width - backgroundImageView.image.size.width) / 2, ([UIScreen mainScreen].bounds.size.height - backgroundImageView.image.size.height) / 2, backgroundImageView.image.size.width, backgroundImageView.image.size.height)];\n \n}\n</code></pre>\n<p>The <code>viewWillAppear</code> section is where the crash occurs, if I move some of the code to <code>viewdidLoad</code> then the app proceeds past the photo stage and continues, however when you go back to try it again, the app will crash out, so it's almost like a one-time fix but crashes the next time, but it gives some idea potentially of what is going wrong.</p>\n<p>I realise it's hardcoded values, it's a very old app, I am just looking to bug fix before improving the other parts</p>\n<pre><code>- (UIImage*)imageWithShadow:(int)shadowSize {\n CGColorSpaceRef colourSpace = CGColorSpaceCreateDeviceRGB();\n CGContextRef shadowContext = CGBitmapContextCreate(NULL, self.size.width + shadowSize, self.size.height + shadowSize, CGImageGetBitsPerComponent(self.CGImage), 0,\n colourSpace, kCGImageAlphaPremultipliedLast);\n CGColorSpaceRelease(colourSpace);\n \n CGContextSetShadowWithColor(shadowContext, CGSizeMake(shadowSize / 2, -shadowSize / 2), 6, [UIColor blackColor].CGColor);\n CGContextDrawImage(shadowContext, CGRectMake(0, 10, self.size.width, self.size.height), self.CGImage);\n \n CGImageRef shadowedCGImage = CGBitmapContextCreateImage(shadowContext);\n CGContextRelease(shadowContext);\n \n UIImage * shadowedImage = [UIImage imageWithCGImage:shadowedCGImage];\n CGImageRelease(shadowedCGImage);\n \n return shadowedImage;\n}\n</code></pre>\n<p>Edit - Stack trace below</p>\n<pre><code>* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)\n frame #0: 0x00000001ad11f4dc libobjc.A.dylib`objc_retain_x2 + 8\n frame #1: 0x00000001e2f2088c TelephonyUI`-[UIImage(TelephonyUI) imageWithShadow:] + 40\n * frame #2: 0x0000000104dea7cc Cut me in`-[PhotoSelectViewController viewWillAppear:](self=0x000000010637ed20, _cmd=&quot;viewWillAppear:&quot;, animated=YES) at PhotoSelectViewController.m:76:33\n frame #3: 0x00000001b5df2880 UIKitCore`-[UIViewController _setViewAppearState:isAnimating:] + 612\n frame #4: 0x00000001b5e8c6a8 UIKitCore`-[UIViewController __viewWillAppear:] + 100\n frame #5: 0x00000001b5df4114 UIKitCore`-[UINavigationController viewWillAppear:] + 280\n frame #6: 0x00000001b5df2880 UIKitCore`-[UIViewController _setViewAppearState:isAnimating:] + 612\n frame #7: 0x00000001b5e8c6a8 UIKitCore`-[UIViewController __viewWillAppear:] + 100\n frame #8: 0x00000001b64e4888 UIKitCore`__56-[UIPresentationController runTransitionForCurrentState]_block_invoke_3 + 740\n frame #9: 0x00000001b5f7391c UIKitCore`-[_UIAfterCACommitBlock run] + 64\n frame #10: 0x00000001b5f73858 UIKitCore`-[_UIAfterCACommitQueue flush] + 184\n frame #11: 0x0000000105c87f08 libdispatch.dylib`_dispatch_call_block_and_release + 24\n frame #12: 0x0000000105c897a0 libdispatch.dylib`_dispatch_client_callout + 16\n frame #13: 0x0000000105c9834c libdispatch.dylib`_dispatch_main_queue_drain + 920\n frame #14: 0x0000000105c97fa4 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 40\n frame #15: 0x00000001b3edd9ac CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12\n frame #16: 0x00000001b3ec1648 CoreFoundation`__CFRunLoopRun + 2080\n frame #17: 0x00000001b3ec5d20 CoreFoundation`CFRunLoopRunSpecific + 584\n frame #18: 0x00000001eb23c998 GraphicsServices`GSEventRunModal + 160\n frame #19: 0x00000001b615780c UIKitCore`-[UIApplication _run] + 868\n frame #20: 0x00000001b6157484 UIKitCore`UIApplicationMain + 312\n frame #21: 0x0000000104de4054 Cut me in`main(argc=1, argv=0x000000016b023670) at main.m:16:16\n frame #22: 0x00000001d167c344 dyld`start + 1860\n</code></pre>\n"^^ . . . . "0"^^ . . "1"^^ . . . "CWInterface for macOS only..."^^ . . . . . . . "0"^^ . "In yours surrounded block mentioned `kDADiskDescriptionMediaEncryptionDetailKey`, but system is arguing for `kDADiskDescriptionMediaEncryptedKey`"^^ . "1"^^ . . "The documentation for `defaultSessionConfiguration` states: *"Modifying the returned session configuration object does not affect any configuration objects returned by future calls to this method, and does not change the default behavior for existing sessions. It is therefore always safe to use the returned object as a starting point for additional customization."*."^^ . . . "<p>I'm trying to create a super thin UIVisualEffectView (2 pixels tall) with a blur effect. I'm attaching it to the bottom of a collection view cell. The issue on scrolling the effect view flickers between a black color and the blur (sometimes it will remain black when I stop scrolling). When I increase the height to 3 pixels, it behaves normally.</p>\n<p>Is there a limitation on how small I can make a UIVisualEffectView before it behaves unpredictably? If so, is there a workaround?</p>\n"^^ . . . "variadic-functions"^^ . . . . . "1"^^ . "1"^^ . . "1"^^ . "No Joy with that - ok, if i remove the `:(BOOL)animated` from the `viewWillAppear` the app no longer crashes...However the selected image does not appear initially - but does AFTER the camera picture is taken."^^ . . "1"^^ . "avplayer"^^ . "1"^^ . . . . . . . . "How to Pass React native components(like View,Button,Text) to native iOS(Objective-c)"^^ . . "@Jorayen Happy to have helped! I'd meant to comment and say thanks for adding detail to your question, because it prompted me to go digging in the runtime to see what was going on. I feel like I've learned some valuable stuff!"^^ . "0"^^ . "0"^^ . "0"^^ . . . . . . . . "0"^^ . . "0"^^ . . "0"^^ . . . . . "doxygen"^^ . . "0"^^ . . "urlsession"^^ . . . "-3"^^ . "0"^^ . "@Codo sry I just add more on my example thx"^^ . "Yes, I have a custom view that derives from NSOutlineView. But none of the functions in the custom view gets called due to dragging and there are no overrides of these functions."^^ . . . . "0"^^ . . . . . . . . . . . . . "1"^^ . . . . . . . . . "ah; SO does that because it interprets it as HTML. You have to be careful to put backticks around it to mark it as literal (or use backslash quoting as you did)"^^ . . . . . . . "uiscrollview"^^ . "0"^^ . "2"^^ . . "So it was as I thought that it's runtime information only, thanks Itai for the wonderful explanation!"^^ . "0"^^ . "0"^^ . "1"^^ . . "<p>I've written code to present a popover from a UICollectionView cell if the cell is selected but is unavailable for whatever reason. It works fine, except the content is never correctly positioned within the popup bubble. Note from the two examples shown, that the content is always shifted toward the caret by about half the thickness of the caret.</p>\n<p><a href="https://i.sstatic.net/tIFni.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tIFni.png" alt="enter image description here" /></a>\n<a href="https://i.sstatic.net/fCr9U.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/fCr9U.png" alt="enter image description here" /></a></p>\n<p>It's clear that the size is being computed properly, but it just seems like the popover controller is simply calculating the position of the popupView incorrectly. Since the direction of shift is out of my control, I can't just shift everything over by a few pixels as a workaround.</p>\n<p>The storyboard simply has a popupView with constraints to center it horizontally and vertically within the scene view:</p>\n<p><a href="https://i.sstatic.net/wyxiz.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wyxiz.png" alt="enter image description here" /></a></p>\n<p>And here's my code... Note I've turned on the border around the view just to accentuate the shift.</p>\n<pre><code>// Inside collectionView:didSelectItemAtIndexPath:\n\n UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:@&quot;Main&quot; bundle:nil];\n MenuUnavailableViewController* muc = [mainStoryboard instantiateViewControllerWithIdentifier:@&quot;MenuOptionUnavailable&quot;];\n muc.modalPresentationStyle = UIModalPresentationPopover;\n\n [self presentViewController:muc animated:NO completion:nil];\n\n MenuCollectionViewCell* menuCell = (MenuCollectionViewCell*) [menuCollection cellForItemAtIndexPath:indexPath];\n muc.popoverPresentationController.sourceView = menuCollection;\n muc.popoverPresentationController.sourceRect = menuCell.frame;\n muc.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;\n</code></pre>\n<pre><code>@implementation MenuUnavailableViewController\n\n- (void) viewWillAppear:(BOOL)animated\n{\n [super viewWillAppear:animated];\n \n [self.view layoutSubviews];\n self.preferredContentSize = self.popupView.bounds.size;\n self.popupView.layer.borderColor = [UIColor blackColor].CGColor;\n self.popupView.layer.borderWidth = 2;\n self.popupView.layer.cornerRadius = 12;\n}\n</code></pre>\n<p>I've been doing popovers successfully using this formula for quite a while, and then one day some iOS or Xcode update silently broke the positioning (not sure, but I think it was around iOS 13 or 14). Anyone have an idea what I'm doing wrong? I've been looking for a complete example implementing popovers under a recent iOS version, but can't find one anywhere.</p>\n"^^ . "<p>Hello everyone I am new in Swift and really need any help. I am working on the music application therefore is crucial to reduce as much as possible a delay between a tap on a button and playing of sound. that is why I try to integrate my React-Native app with AudioKit using Native-Modules.\nI used following example: <a href="https://github.com/AudioKit/Cookbook/blob/main/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/MiniApps/Drums.swift" rel="nofollow noreferrer">AudioKit Drums</a></p>\n<p>Here is my swift code:</p>\n<pre><code>import AudioKit\nimport AudioKitEX\nimport AudioKitUI\nimport AVFoundation\nimport Combine\nimport SwiftUI\n\n\nstruct DrumSample {\n var name: String\n var fileName: String\n var midiNote: Int\n var audioFile: AVAudioFile?\n var color = UIColor.red\n\n init(_ prettyName: String, file: String, note: Int) {\n name = prettyName\n fileName = file\n midiNote = note\n\n guard let url = Bundle.main.url(\n forResource: &quot;closed_hi_hat_F#1&quot;, withExtension: &quot;wav&quot;\n ) else { return }\n do {\n print(&quot;URL&quot;, url)\n audioFile = try AVAudioFile(forReading: url)\n } catch {\n Log(&quot;Could not load: \\(fileName)&quot;)\n }\n }\n}\n@objc(DrumsConductor)\nclass DrumsConductor: NSObject, ObservableObject, HasAudioEngine {\n // Mark Published so View updates label on changes\n @Published private(set) var lastPlayed: String = &quot;None&quot;\n\n let engine = AudioEngine()\n\n let drumSamples: [DrumSample] =\n [\n DrumSample(&quot;HI HAT&quot;, file: &quot;closed_hi_hat_F#1.wav&quot;, note: 30),\n ]\n\n let drums = AppleSampler()\n\n @objc\n func playPad() {\n drums.play(noteNumber: MIDINoteNumber(drumSamples[0].midiNote))\n let fileName = drumSamples[0].fileName\n print(&quot;fileName:&quot;, fileName)\n lastPlayed = fileName.components(separatedBy: &quot;/&quot;).last!\n }\n\n override init() {\n engine.output = drums\n do {\n let files = drumSamples.map {\n $0.audioFile!\n }\n try drums.loadAudioFiles(files)\n\n } catch {\n Log(&quot;Files Didn't Load&quot;)\n }\n }\n}\n</code></pre>\n<p>here is my Objective-C bridge:</p>\n<pre><code>@interface RCT_EXTERN_MODULE(DrumsConductor, NSObject)\n\nRCT_EXTERN_METHOD(playPad)\n\n@end\n</code></pre>\n<p>but when I call my DrumsConductor.playPad() from my JS code I don't hear any sound</p>\n<p>File <code>closed_hi_hat_F#1.wav</code> is added to Resources folder.\nI have tried to use library <code>react-native-sound</code> but it gives a significant delay between tap and playing sound.</p>\n"^^ . . . "0"^^ . "It would be helpful if you posted, as text, some example Swift code you are trying to translate. Also show your attempted Objective-C code."^^ . . . "0"^^ . "0"^^ . . . . "0"^^ . . "1"^^ . . . . . . . . . "2"^^ . . . . . "0"^^ . . . . . "<p>in iOS 17 NSURL parsing changed to use RFC 3986 from RFC 1738/1808\n(<a href="https://developer.apple.com/documentation/foundation/nsurl/1572047-urlwithstring" rel="nofollow noreferrer">https://developer.apple.com/documentation/foundation/nsurl/1572047-urlwithstring</a>). Based on <a href="https://www.ietf.org/rfc/rfc3986.txt" rel="nofollow noreferrer">RFC 3986</a> guidance , the reserved character contains the gen-delims = <code>&quot;:&quot; / &quot;/&quot; / &quot;?&quot; / &quot;#&quot; / &quot;[&quot; / &quot;]&quot; / &quot;@&quot;</code> and sub-delims =</p>\n<pre><code>&quot;!&quot; / &quot;$&quot; / &quot;&amp;&quot; / &quot;'&quot; / &quot;(&quot; / &quot;)&quot;\n / &quot;*&quot; / &quot;+&quot; / &quot;,&quot; / &quot;;&quot; / &quot;=&quot;\n</code></pre>\n<p>in which gen-delims are required to be encoded and sub-delims are optional based on applications .\niOS 17 seems to only encode gen-delims but our application requires sub-delims to be encoded as well in our Macro expansion logic.\nThis is not a problem before iOS 17 since we rely on our own encoding logic for Macro value</p>\n<pre><code>[str stringByAddingPercentEncodingWithAllowedCharacters:[[NSCharacterSet characterSetWithCharactersInString:@&quot; !*'\\&quot;();:@&amp;=+$,/?%#[]^|{}\\\\`&quot;] invertedSet]];\n</code></pre>\n<p>But somehow it's causing issues now that all percentage gets double encoded .</p>\n<p>For example the following url we want to expand the Macro [PARTNER] to abc/dev</p>\n<pre><code>http://google.com/ad/1?asseturl=[ASSETURI]&amp;partner=[PARTNER] \n//Macro expansion only for PARTNER because don't have value for ASSETURI\nhttp://google.com/ad/1?asseturl=[ASSETURI]&amp;partner=abc/dev\n//encode the Macro value with above method\nhttp://google.com/ad/1?asseturl=[ASSETURI]&amp;partner=abc%2Fdev\n//String to NSURL [NSURL URLWithString:url];\nhttp://google.com/ad/1?asseturl=%5BASSETURI%5D&amp;partner=abc%25%2Fdev\n</code></pre>\n<p>You can see there's an additional %25 in the url because percentage got double encoded in IOS 17 , it doesn't exist before iOS 17.</p>\n<p>so why will NSURL encode the percentage (Although it seems like NSURL only do this when there's an invalid character)? Is this a bug because there doesn't seem to be a requirement from RFC 3986 to encode percentage</p>\n"^^ . . . . "Update the screenshot from Xcode with that "images" folder expanded so we can see the m4v file in the tree. Make sure the filename exactly matches, including case. Be sure the file is selected for your target."^^ . . . "0"^^ . "0"^^ . "1"^^ . "To provide an example of this that I commonly see in C++ code: member variables that can be re-initialised. Usually the code will check whether the pointer is null and if not, call some virtual destructor on it, then go on to allocate a new object and initialise it. The initialisation of the new object is what provides the required type information, but you won't get to that until you've skipped over the virtual destructor call. Once you have the type information, you can "go back" and populate the virtual destructor call with the necessary information that you didn't have before."^^ . "0"^^ . . . "<p>The Objective-C runtime ISA pointer is <a href="https://opensource.apple.com/source/objc4/objc4-818.2/runtime/objc-private.h.auto.html" rel="nofollow noreferrer">defined</a> as such:</p>\n<pre class="lang-c prettyprint-override"><code>union isa_t {\n isa_t() { }\n isa_t(uintptr_t value) : bits(value) { }\n\n uintptr_t bits;\n\nprivate:\n // Accessing the class requires custom ptrauth operations, so\n // force clients to go through setClass/getClass by making this\n // private.\n Class cls;\n\npublic:\n#if defined(ISA_BITFIELD)\n struct {\n ISA_BITFIELD; // defined in isa.h\n };\n\n bool isDeallocating() {\n return extra_rc == 0 &amp;&amp; has_sidetable_rc == 0;\n }\n void setDeallocating() {\n extra_rc = 0;\n has_sidetable_rc = 0;\n }\n#endif\n\n void setClass(Class cls, objc_object *obj);\n Class getClass(bool authenticated);\n Class getDecodedClass(bool authenticated);\n};\n</code></pre>\n<p>The bits fields can be read by the definitions <a href="https://opensource.apple.com/source/objc4/objc4-818.2/runtime/isa.h.auto.html" rel="nofollow noreferrer">here</a>.</p>\n<p>When I read a macho from disk and go to the <code>_objc_classlist</code> section and follow a <code>objc_class</code> which is <a href="https://opensource.apple.com/source/objc4/objc4-818.2/runtime/objc-runtime-new.h.auto.html" rel="nofollow noreferrer">defined</a> as such:</p>\n<pre class="lang-c prettyprint-override"><code>\nstruct objc_class : objc_object {\n objc_class(const objc_class&amp;) = delete;\n objc_class(objc_class&amp;&amp;) = delete;\n void operator=(const objc_class&amp;) = delete;\n void operator=(objc_class&amp;&amp;) = delete;\n // Class ISA;\n Class superclass;\n cache_t cache; // formerly cache pointer and vtable\n class_data_bits_t bits; // class_rw_t * plus custom rr/alloc flags\n ...\n</code></pre>\n<p>and <code>objc_object</code> is <a href="https://opensource.apple.com/source/objc4/objc4-818.2/runtime/objc-private.h.auto.html" rel="nofollow noreferrer">defined</a> as such:</p>\n<pre class="lang-c prettyprint-override"><code>struct objc_object {\nprivate:\n isa_t isa;\n\npublic:\n ...\n</code></pre>\n<p>meaning that I should be able to interpret the first 8 bytes of <code>objc_class</code> as the <code>bits</code> field of an <code>isa</code>, but when I do this and try to interpret the bits I get random and false information,\non the other hand if I interpret the first 8 bytes as a pointer, it leads me to another <code>objc_class</code> instance on disk, which is usually the metaclass of the class. I wonder then why is the definition of the <code>isa</code> union from the Objective-C runtime and its <code>bits</code> field. Is this only right to interpret this as <code>isa</code> union with <code>bits</code> when we instantiate an object of a some kind and when reading from disk it's just a pointer to a meta class definition?</p>\n<p><strong>EDIT:</strong><br/>\nThe way I read the <code>objc_class</code> struct from file is with python:</p>\n<pre class="lang-py prettyprint-override"><code>ISA_MASK = 0x0000000ffffffff8\n\n@dataclass\nclass Isa():\n bits: ctypes.c_size_t\n _cls: ctypes.c_size_t\n\n def __init__(self, fp, addr):\n fp.seek(addr)\n self.bits = struct.unpack(&quot;&lt;Q&quot;, fp.read(8))[0]\n self._cls = self.bits\n\n def nonpointer(self):\n return self.bits &amp; 1\n \n def has_assoc(self):\n return (self.bits &gt;&gt; 1) &amp; 1\n \n def has_cxx_dtor(self):\n return (self.bits &gt;&gt; 2) &amp; 1\n \n def shiftcls(self):\n return (self.bits &gt;&gt; 3) &amp; 0x7ffffffff\n \n def magic(self):\n return (self.bits &gt;&gt; 36) &amp; 0x3f\n \n def weakly_referenced(self):\n return (self.bits &gt;&gt; 42) &amp; 1\n \n def unused(self):\n return (self.bits &gt;&gt; 43) &amp; 1\n\n def has_sidetable_rc(self):\n return (self.bits &gt;&gt; 44) &amp; 1\n\n def extra_rc(self):\n return (self.bits &gt;&gt; 45) &amp; 0x7ffff\n\n def get_class(self):\n clsbits = self.bits\n clsbits &amp;= ISA_MASK\n return clsbits\n\n\n@dataclass\nclass ObjcObject:\n isa: Isa\n _addr: ctypes.c_size_t\n\n def __init__(self, fp, addr, isa_class, external_block_addr):\n self.isa = None\n self._addr = addr\n\n fp.seek(addr)\n\n isa_addr = struct.unpack(&quot;&lt;Q&quot;, fp.read(8))[0]\n if isa_addr != 0 and isa_addr &lt; external_block_addr:\n self.isa = Isa(fp, isa_addr, external_block_addr)\n@dataclass\nclass ObjcClass(ObjcObject):\n super_class: ObjcClass\n cache: Cache\n class_ro: ClassRo\n\n def __init__(self, fp, addr, external_block_addr):\n super().__init__(fp, addr, ObjcClass, external_block_addr)\n ...\n ...\n</code></pre>\n<p>I have for example a class lets call it <code>A</code> and after processing the chained fixups on address <code>0x0025eed0</code> I have it it's symbol <code>_OBJC_CLASS_$_A</code> and the <code>objc_class</code> defined in that addres.</p>\n<p>The first 8 bytes of the structure is the ISA as we've established by looking at the sources of the runtime. Following it as a <strong>pointer</strong> and not treating it as the <code>isa_t</code> union I get to another <code>objc_class</code> struct for the symbol <code>_OBJC_METACLASS_$_A</code> which is the metaclass of this class.</p>\n<p>Now if instead of treating the first 8 bytes of the <code>objc_class</code> struct as a pointer to the metaclass, I try to interpret them as the bits of the <code>isa_t</code> union like I have in the code I provided, and for example using the <code>has_cxx_dtor</code> method I get <code>False</code> which is incorrect because I can clearly find this method on the <code>method_list_t</code> structure of the <code>class_ro</code> so it doesn't match up with what I parse and hence the <code>isa_t</code> union seem unrelated to the actual data of the class on disk.</p>\n<p>Note that the method for extracting the data from the bits of <code>isa_t</code> is by looking at the source of <a href="https://opensource.apple.com/source/objc4/objc4-818.2/runtime/isa.h.auto.html" rel="nofollow noreferrer"><code>isa.h</code></a> and assuming I read an ARM64 macho without ptr auth and not from simulator.</p>\n"^^ . "<p>Xcode 15.0 has some bugs related to weak-linking (i.e. symbols not being weak-linked when they should), here is <a href="https://github.com/ronaldoussoren/pyobjc/issues/569" rel="nofollow noreferrer">one I found</a> in PyObjC.</p>\n<p>Try Xcode15.1b1, if that doesn't fix the issue then file a feedback with Apple. And in the meantime, keep building your shipping application with Xcode 14.</p>\n"^^ . "2"^^ . "uiblureffect"^^ . "0"^^ . . "<p>The only thing you can really do would be to swizzle the method (and I can't be 100% certain that you won't run into class cluster weirdness that might prevent doing that).</p>\n<p>At a high level, you'd do something like this:</p>\n<ul>\n<li>Create a method implementation (<code>IMP</code>) using <code>imp_implementationWithBlock</code>. IIRC, its parameters should be:\n<ul>\n<li>The object that is being operated on</li>\n<li>The method parameters in order</li>\n</ul>\n</li>\n<li>Look up the method with <code>class_getInstanceMethod</code>.</li>\n<li>Replace the implementation of that method using <code>method_setImplementation</code>.</li>\n<li>Store the result of that method (the previous <code>IMP</code>) in a static global variable.</li>\n<li>Cast the IMP to a function pointer. IIRC, the arguments the function pointer should be:\n<ul>\n<li>The object that is being operated on</li>\n<li>The selector for the method (<code>@selector(defaultSessionConfiguration)</code>)</li>\n<li>The method parameters in order</li>\n</ul>\n</li>\n<li>Call that function pointer from the custom implementation block, then modify the results before returning them.</li>\n</ul>\n<p>Be sure to do all of this in a dispatch_once block, e.g.</p>\n<pre><code>- (void)load {\n static dispatch_once_t once;\n static id sharedInstance;\n dispatch_once(&amp;once, ^{\n // Code goes here...\n });\n}\n</code></pre>\n<p>to ensure that you cannot do this more than once.</p>\n<p>Note, however, that this is fairly risky to do in a production app. It is better, whenever possible, to ask the framework developer to provide hooks for passing in a session of your own creation (or a configuration of your own creation).</p>\n<p>Documentation links:</p>\n<ul>\n<li><a href="https://developer.apple.com/documentation/objectivec/1418587-imp_implementationwithblock?language=objc" rel="nofollow noreferrer">https://developer.apple.com/documentation/objectivec/1418587-imp_implementationwithblock?language=objc</a></li>\n<li><a href="https://petersteinberger.com/blog/2014/a-story-about-swizzling-the-right-way-and-touch-forwarding/" rel="nofollow noreferrer">https://petersteinberger.com/blog/2014/a-story-about-swizzling-the-right-way-and-touch-forwarding/</a></li>\n</ul>\n"^^ . . . . . . . . . "0"^^ . . . . "I originally typed id<protocol> but the editor only displayed id. Not sure why."^^ . . . . . . . "2"^^ . . . "ios12"^^ . "1"^^ . "Implementing and calling the mentioned methods should do it. Any overrides or custom views in the cells?"^^ . "Which version of doxygen? - "Where should they go?" this is opinion based and not really allowed here, it depends on what you want to provide to the users of the different files, i.e. do they get the `.h` or `.m` files or both? - What is the difference? might result in some different documentation ant different places. What might happen if I document on both sides? Depends on whether the or not the texts are different or identical, identical texts should be filtered out. Double documenting is a bad idea, in my opinion, might lead to inconsistent documentation."^^ . "not unless I finish finding all functions it might give me false positives. Same for the third point, I feel as if I don't find all functions first I can't determine if more than 2 callsites call the same jump target. For example If I have a function `A` that we know for certain it's a function, and it has a branch to target `B` which might be a new function and might be not, and later we have another branch which gets us to *another* the same target 'B' can you say for certain that `B` is a function and not a label in the same function just because it has 2 callsites? I feel like we first"^^ . . . "4"^^ . . "decompiling"^^ . . . "2"^^ . "1"^^ . "Do you really need all of this Objective-C baggage? Swift has its own equivalent of KVC without the need to extend NSObject and it works with both classes and structs with none of the Objective-C stuff. See https://stackoverflow.com/a/52635420/20287183 and look at option #2 in that answer for an example."^^ . "can you please check this \n\nimport CoreWiFi\n// Check the current Wi-Fi network's security type\nfunc getWiFiSecurityType() {\n let wifiInterface = CWInterface()\n if let ssid = wifiInterface.ssid() {\n if let network = CWNetwork(interface: wifiInterface, bssid: nil as String?) {\n if let security = network.security() {\n print("Connected to Wi-Fi SSID: \\(ssid)")\n print("Security Type: \\(security)")\n } else { print("Connected to Wi-Fi SSID: \\(ssid)") print("Security Type: Unknown")}}}else {print("Not connected to a Wi-Fi network.")}}"^^ . "1"^^ . . . . . . "0"^^ . . "1"^^ . "Is it crashing on app launch or at certain point?"^^ . . . . "0"^^ . "1"^^ . . "0"^^ . "drag-and-drop"^^ . . . "0"^^ . . . . . . . "0"^^ . . . . . "1"^^ . . . "0"^^ . . . "2"^^ . . . . . . "1"^^ . "0"^^ . "0"^^ . . . . "0"^^ . . . . . "0"^^ . . . . "0"^^ . "@ItaiFerber I've provided additional information on how I parse the structs and what I see compared to what I expect to see and what I actually see that contradicts other data I extract like the method_list of a class."^^ . . "1"^^ . "1"^^ . . "<p>I have an ios app. I want to modify <code>defaultSessionConfiguration</code> so that every time later in the code when I call <code>[NSURLSessionConfiguration defaultSessionConfiguration]</code> I will get my modified <code>defaultSessionConfiguration</code></p>\n<p>I tried something like this but it didn't work</p>\n<pre><code>NSURLSessionConfiguration *configuration = NSURLSessionConfiguration.defaultSessionConfiguration;\n// Set the proxy configuration options in the connectionProxyDictionary property\nNSDictionary *proxyDict = @{\n @&quot;HTTPSEnable&quot;: [NSNumber numberWithInt:1],\n @&quot;HTTPSProxy&quot;: @&quot;localhost&quot;,\n @&quot;HTTPSPort&quot;: [NSNumber numberWithInt:1234]\n};\nconfiguration.connectionProxyDictionary = proxyDict;\n</code></pre>\n<p>This one gives me a configuration with an empty connectionProxyDictionary</p>\n<pre><code>NSURLSessionConfiguration *configuration2 = [NSURLSessionConfiguration defaultSessionConfiguration];\n</code></pre>\n<p>There is a lib in my app that makes requests to some host. I know that this lib uses <code>NSURLSessionConfiguration defaultSessionConfiguration</code>. I want to modify the &quot;global&quot; <code>defaultSessionConfiguration</code> so that the lib would start sending requests through my proxy.</p>\n"^^ . "You can add an extension to CaseIterable manually in an extension: `extension AdvertType: CaseIterable { static var allCases: [AdvertType] = [...] }`"^^ . . "3"^^ . . . "0"^^ . "0"^^ . "<p>My existing code is working properly in iOS &lt; 17 devices it records the iPhone screen and records audio as well simultaneously, but in iOS 17 devices the screen recording video is captured for only 2 seconds and then stops automatically, As its an extension, i don't have logs to debug the issue.</p>\n<p>I have tested the same code in other iPhones and OS less than 17, its working fine but in iOS 17 devices this issue is coming.</p>\n<pre><code>@try {\n NSLog(@“initAssesWriter”);\n \n \n NSError *error = nil;\n CGRect screenRect = [[UIScreen mainScreen] bounds];\n _videoWriter = [[AVAssetWriter alloc] initWithURL:\n _filePath fileType:AVFileTypeMPEG4\n error:&amp;error];\n NSParameterAssert(_videoWriter);\n\n //Configure video\n NSDictionary* videoCompressionProps = [NSDictionary dictionaryWithObjectsAndKeys:\n [NSNumber numberWithDouble:2048*1024.0], AVVideoAverageBitRateKey,\n nil ];\n \n NSDictionary* videoSettings = [NSDictionary dictionaryWithObjectsAndKeys:\n AVVideoCodecTypeH264, AVVideoCodecKey,\n [NSNumber numberWithInt:screenRect.size.width * 4], AVVideoWidthKey,\n [NSNumber numberWithInt:screenRect.size.height * 4], AVVideoHeightKey,\n videoCompressionProps, AVVideoCompressionPropertiesKey,\n nil];\n \n _writerInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:videoSettings] ;\n _writerInput.expectsMediaDataInRealTime = YES;\n \n NSParameterAssert(_writerInput);\n NSParameterAssert([_videoWriter canAddInput:_writerInput]);\n [_videoWriter addInput:_writerInput];\n \n\n AudioChannelLayout acl;\n bzero( &amp;acl, sizeof(acl));\n acl.mChannelLayoutTag = kAudioChannelLayoutTag_Mono;\n\n \n NSDictionary* audioOutputSettings = [NSDictionary dictionaryWithObjectsAndKeys:\n [ NSNumber numberWithInt: kAudioFormatMPEG4AAC], AVFormatIDKey,\n [ NSNumber numberWithInt: 1 ], AVNumberOfChannelsKey,\n [ NSNumber numberWithFloat: 44100.0 ], AVSampleRateKey,\n [ NSData dataWithBytes: &amp;acl length: sizeof( AudioChannelLayout ) ], AVChannelLayoutKey,\n [ NSNumber numberWithInt: 64000 ], AVEncoderBitRateKey,\n nil];\n \n \n _audioWriterInput = [AVAssetWriterInput\n assetWriterInputWithMediaType: AVMediaTypeAudio\n outputSettings: audioOutputSettings ];\n _audioWriterInput.expectsMediaDataInRealTime = YES; // seems to work slightly better\n\n NSParameterAssert(_audioWriterInput);\n NSParameterAssert([_videoWriter canAddInput:_audioWriterInput]);\n [_videoWriter addInput:_audioWriterInput];\n [_videoWriter setMovieFragmentInterval:CMTimeMake(1, 600)];\n \n [_videoWriter startWriting];\n\n } @catch (NSException *exception) {\n } @finally {\n \n }\n\n</code></pre>\n<pre><code>-(void)processSampleBuffer:(CMSampleBufferRef)sampleBuffer withType:(RPSampleBufferType)sampleBufferType{\n @try {\n if(!_isRecordingStarted){\n [_videoWriter startSessionAtSourceTime:CMSampleBufferGetPresentationTimeStamp(sampleBuffer)];\n _isRecordingStarted = YES;\n [self saveFlurryLogs:@&quot;Assest writer Start Recording&quot; Details:@&quot;&quot;];\n NSLog(@&quot;CMSampleBufferGetPresentationTimeStamp&quot;);\n }\n } @catch (NSException *exception) {\n [self saveFlurryLogs:@&quot;Recording Start Execption&quot; Details:exception.description];\n } @finally {\n \n }\n \n @try {\n switch (sampleBufferType) {\n case RPSampleBufferTypeVideo:\n // Handle video sample buffer\n if([_writerInput isReadyForMoreMediaData]){\n [_writerInput appendSampleBuffer:sampleBuffer];\n NSLog(@&quot;writing matadata Video&quot;);\n }\n break;\n case RPSampleBufferTypeAudioApp:\n // Handle audio sample buffer for app audio\n break;\n case RPSampleBufferTypeAudioMic:\n if([_audioWriterInput isReadyForMoreMediaData]){\n [_audioWriterInput appendSampleBuffer:sampleBuffer];\n NSLog(@&quot;writing matadata Audio&quot;);\n }\n // Handle audio sample buffer for mic audio\n break;\n \n default:\n break;\n }\n } @catch (NSException *exception) {\n [self saveFlurryLogs:@&quot;Packet Write Execption&quot; Details:exception.description];\n } @finally {\n \n }\n}\n</code></pre>\n"^^ . . . . . . "2"^^ . . . . . "1"^^ . . . . . . "0"^^ . . . . . "performance"^^ . . . "0"^^ . . . . "0"^^ . . . "1"^^ . "0"^^ . . "You only posted `viewWillAppear`, not `imageWithShadow`. You are also missing the call to `[super viewWillAppear:animated];`. And yes, this is an old project. You still have the extremely out-of-date `viewDidUnload`."^^ . "<p>Based on the OP's comment...</p>\n<p><code>UIVisualEffectView</code> with blur effect uses adjacent pixels to generate the <em>blur</em> ... using a very small (in this case, 2-points-tall) view <strong>apparently</strong> causes the issue.</p>\n<p>To avoid that, use a slightly larger <code>UIVisualEffectView</code> and mask it to the desired 2-points height.</p>\n"^^ . . . . . "1"^^ . . . . "Single URLSession for all requests versus per request, performance"^^ . . . . "0"^^ . . "0"^^ . . . "iOS 17 NSURL percentage gets double encoded"^^ . "1"^^ . . "0"^^ . . . . "0"^^ . "You can’t, frameworks can’t include frameworks"^^ . . . "<p>I fixed it by modifying the project settings.</p>\n<p>In the <strong>target -&gt; build settings</strong> of <em>.xcodeproj</em> file of the project, I made the following changes:</p>\n<ul>\n<li>add <code>$(inherited)</code> in framework search paths</li>\n<li>add <code>$(inherited)</code> in header search paths</li>\n<li>add <code>${PODS_ROOT}</code> and <code>${PODS_ROOT}/BuildHeaders</code> in user header search paths</li>\n</ul>\n<p>In the build settings of <code>Pods.xcodeproj</code> I had to set &quot;Build Active Architecture Only&quot; to &quot;No&quot;.</p>\n"^^ . . . "You have keen eyes! Alas, this was only a copy/paste error. I have modified the question. Thank you very much for pointing this out!"^^ . . . . . . . . "0"^^ . . . . "2"^^ . "-2"^^ . . . "trust me I agree, but this is some legacy code that Im dealing with and in the background there is a modal view that gets dismissed inside a dispatch async after, and then after its dismissed they want to present this alert. The only way I've found adding it without putting a dispatch queue delay is adding it as a container view controller"^^ . . . . . . . . "0"^^ . . . . . . . "objective-c-runtime"^^ . "Crash on start on iOS 12"^^ . . . . . . . . . . . "I followed these steps but it didn't work. What I found out later that the problem exist for every libraries except for google maps. This old project was running fine. But after updating Mac to Sonoma, Xcode to its latest version, updating CocoaPod and using ```pod update``` this problem happened. Can you please give me an idea where this problem could be? Should I change anything in the Pods.xcodeproj?"^^ . "0"^^ . "0"^^ . . "1"^^ . . . "0"^^ . . . . . "and so I wonder if this is a good assumption to make to check if a jump target is in different section or more specifically a stub section altogether?"^^ . . . . . . "Thank you so much! Xcode 15.1beta (15C5028h) fixes this issue. There are other issues with weak linking, though. I have filed a bug report (FB13289462)."^^ . "Glad it worked... I went ahead and posted it as an answer, for other folks who may come across this."^^ . . . . . . "0"^^ . . . "React native doesn't play sound using Audiokit"^^ . . "1"^^ . . "Nailed it! thank you so much for that link."^^ . "<blockquote>\n<p>When decompiling code from arm64, how can one know if an unconditional branch instruction b is a branch to a label in the same function and not to some other function?</p>\n</blockquote>\n<p>You can't really <em>know</em>. You can at best make an educated guess. In my experience, even state-of-the-art decompilers are quite bad at that. The good ones allow the user to manually override such detection.</p>\n<p>The core problem is that there is no concept of a &quot;function&quot; at the assembly level. Labels that are exported to higher-level languages like C are expected to conform to a certain ABI, but for anything else, all bets are off. And even with exported things, if you're up against a malicious author (consider: malware), then they may choose to break this contract as well, in order to obscure how the binary works. But even with non-malicious binaries, if someone uses <code>-O3 -flto -moutline</code> that Apple supports for arm64 targets, you'll be in a world of hurt.</p>\n<p>Some heuristics that you can use though:</p>\n<ul>\n<li><p>Has x30 been saved somewhere?<br />\nUsually this will happen by an <code>stp x29, x30, [sp, ...]</code> instruction, and go along with decreasing <code>sp</code>. If this is the case, then with <code>b</code> you're likely looking at a branch within the same function. If this is not the case, then you don't know whether this is a tail call or a jump within the same function.</p>\n<p>Assumption: x30 is used as link register. An obfuscator could use something else, e.g. by means of <code>adr x17, ...; b _func</code> for the function call, and then <code>x17</code> would be the link register. This could also be randomised per-function.</p>\n</li>\n<li><p>Are there any functions in between the current address and the jump target?<br />\nMaybe your binary has symbols, maybe LC_FUNCTION_STARTS, maybe your decompilation has already identified function units, etc.</p>\n<p>Assumptions: functions have all their basic blocks next to each other, and aren't fragmented and spread out. Usually this is the case, but again, this assumption could be broken as part of an obfuscation technique.</p>\n</li>\n<li><p>Is the jump target jumped to from any other function?<br />\nIf there are other callsites from code that you have already determined belongs to a different function, then the jump target can't belong to either of those functions.</p>\n<p>Caveat: function outlining, see the next point.</p>\n</li>\n<li><p>Does the called code maintain the ABI in and out that you expect from a function?<br />\nABI violations should be trivial to determine. ABI conformance would need something like explicit register spilling to give you confidence. But if it conforms to the expected ABI, then it most likely is its own function. If not, then it's probably either part of the function that jumps to it, or it's code that was outlined.</p>\n</li>\n</ul>\n<p>But none of these are guaranteed to hit, and there will always be cases where both options remain possible.</p>\n"^^ . . . . . . . . . "<p>change</p>\n<pre><code>pod 'GoogleMaps'\n</code></pre>\n<p>to</p>\n<pre><code>pod 'GoogleMaps', '~&gt; 6.2.1'\n</code></pre>\n<p>and then run <code>pod install</code></p>\n<p>everything will be fine</p>\n"^^ . . . "The crash is coming from code you haven't posted yet. Post the `imageWithShadow` method."^^ . . "0"^^ . "0"^^ . . "<p>When decompiling code from arm64, how can one know if an unconditional branch instruction <code>b</code> is a branch to a label in the same function and not to some other function?</p>\n<p>How do state of the art decompilers recognize if a branch target is still in the function or is it a new function? Do they rely on the branch target's value and see if it lands on a different section in the <code>TEXT</code> segment? <br/>\nWhat about branch targets that are in the same sections but are still considered new functions? Is there a rule of thumb for ARM64 saying that if a branch target is too far by some threshold from the current address it's considered a new boundary thus a new function? Like in x86 where you have different encodings for far jump and short jump, where short jump may be considered a label in a function and far jump probably not.</p>\n<p>I might add that my target binaries I'm inspecting right now are Machos written in Objective-C, and I try to validate my findings using Ghidra, so it might be using some more heuristics like seeing if a jump target is in the <code>__stubs</code> section or the <code>__objc_stubs</code> section, or even analyzing block structures to identify more procedures (Although from Ghidra decompilation the last point seems like it doesn't identify these structures)?</p>\n"^^ . . . . "0"^^ . "Can you share the code you're using to read and interpret these bits? There might be something specific in the access that's leading to unexpected behavior."^^ . . . . . . . . . "0"^^ . . . "@SimonEritsch I edited the answer, there was a mistake here. Unfortunately, there is no such a way to convert them directly."^^ . . . "0"^^ . . . . . . . "mwphotobrowser"^^ . . . . . . . "0"^^ . "Not sure I understand file is selected for your target."^^ . . "Use `NSURLComponents` to build the URLs instead of using`stringByAddingPercentEncodingWithAllowedCharacters`."^^ . . . . . . "objective-c-2.0"^^ . . "1"^^ . "<p>As Martin R mentioned, CABasicAnimation has a custom <code>setValue(_:forKeyPath:)</code> which allows you to set nested properties. I coded a custom <code>setValue(_:forKeyPath:)</code> which does the same thing for a general keyPath containing structs who's types are directly convertible to Objective-C (same property names and types). Here's my solution:</p>\n<pre class="lang-swift prettyprint-override"><code>public extension NSObject {\n func setValueRecursively(_ value: Any?, forKeyPath keyPath: String) {\n var currentKeyPath = keyPath\n var currentValue: Any? = value\n while true {\n guard let lastPeriodIndex = currentKeyPath.lastIndex(of: &quot;.&quot;) else {\n self.setValue(currentValue, forKey: currentKeyPath)\n return\n }\n \n let parentKeyPath = String(currentKeyPath[currentKeyPath.startIndex ..&lt; lastPeriodIndex])\n guard let parentValue = self.value(forKeyPath: parentKeyPath) as? NSObject else { return }\n parentValue.setValue(currentValue, forKey: String(currentKeyPath.suffix(currentKeyPath.count-parentKeyPath.count-1)))\n currentValue = parentValue\n currentKeyPath = parentKeyPath\n }\n }\n}\n</code></pre>\n<p>With the same code as the Question,</p>\n<pre class="lang-swift prettyprint-override"><code>testClass.setValueRecursively(12, forKeyPath: &quot;testStruct.z&quot;)\n</code></pre>\n<p>works as expected :)</p>\n<p><strong>Note:</strong> This will not work with <code>CGSize</code>, <code>CGRect</code>, and all other properties that are represented as <code>NSValue</code></p>\n"^^ . "nsurlsession"^^ . . . . . . . . "0"^^ . "0"^^ . . "<p>I am working on an old project written in Objective-C and its minimum deployment version is iOS 13.0. Recently I've updated the libraries using pod and now the project is showing the error <code>'MWCommon.h' file not found</code> in the line <code>#import &quot;MWCommon.h&quot;</code>\nHere's my pod-file:</p>\n<pre><code>#platform :ios, '13.0'\n\ntarget '&lt;project-name&gt;' do\n use_frameworks!\n project '&lt;project-name&gt;.xcodeproj'\n \n pod 'GoogleMaps', '~&gt; 6.2.1'\n pod 'SDWebImage'\n pod &quot;MWPhotoBrowser&quot;\n pod 'MBProgressHUD'\n \nend\n</code></pre>\n<p>I've also executed the following commands and cleaned the build folder to solve this issue but it didn't work.</p>\n<pre><code>pod deintegrate\npod cache clean --all\npod install\n</code></pre>\n<p>Also, as you can see in the following screenshot, <code>MWCommon.h</code> exists in <em>app -&gt; pods -&gt; MWPhotoBrowser</em>.</p>\n<p><a href="https://i.sstatic.net/H16sM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/H16sM.png" alt="Screenshot of folder tree of pod" /></a></p>\n<p>What can I do to make the project run again?</p>\n"^^ . . . . "0"^^ . . . . . . . "Can you show an example how you *“do the same thing on a CGRect”* ?"^^ . . . . . . "1"^^ . . "Without testing, I'd say it's very possible that 2-point tall `UIVisualEffectView` might not work well. Try using a larger view and masking it to your desired height."^^ . . . "Why did you do it this way instead of presenting it on the child view controller directly?Btw, I think the alert is not tappable because of frame, with clipToBound = false, you still see the alert."^^ . . . . . . "Yes, this is true. I chose this example for brevity, to construct a minimal example which reproduces the problem. Actually I am using a different functionality."^^ . . "3"^^ . . "1"^^ . "0"^^ . "1"^^ . . . . . . "How to create React Native Module in pure Swift"^^ . . . . "0"^^ . "<p>[SKStoreReviewController requestReview] doesn't show the review prompt when debugging on Xcode 14.3.1, macOS 13.6. Why is that? Is it a known bug?</p>\n"^^ . "proxy"^^ . . . . . . "0"^^ . "1"^^ . . . . "Just added stack trace now"^^ . . "2"^^ . . . "SKStoreReviewController requestReview doesn't show the review prompt when debugging on Xcode 14.3.1, macOS 13.6"^^ . . . "1"^^ . . "1"^^ . . "0"^^ . "There is a flag, -ld_classic, (add ```-Wl,-ld_classic``` to OTHER_LDFLAGS) which can force use of the old linker with Xcode 15, which may let you use Xcode 15. Not sure that will work if going back to Xcode 14; you can conditionally add for just sdk=iphoneos17* or sdk-iphonesimulator17* if you need to flip between Xcodes."^^ . . "1"^^ . . "1"^^ . . . . . "0"^^ . . "4"^^ . "0"^^ . "cocoapods"^^ . "react-native-native-module"^^ . . "How to get iOS popover view to position correctly within the bubble"^^ . . "0"^^ . . "I'm having the same problem with MWPhotoBrowser. Can you please check this question and answer? https://stackoverflow.com/q/77272011/8192914"^^ . "masking didn't even cross my mind. this worked. thanks for the feedback"^^ . . "<p>I saw many tutorials by the developers which are not proved to be very helpful for me to in this area. Some of them are old a few are now like year old but when I follow them them the same thing is not happening on my end,\nPlease help me regarding this situation.</p>\n<p>I successfully make the framework and it was successfully invoke by my app and works fine but when I install pod files it build without error in the framework and when I tried to run it in the app it shows error and build is failing.</p>\n<p>Pods like Alamofire and charts</p>\n<p>suppose the name of my framework is X , When I use &quot;Import X&quot; to import the frame in app and pods are install in it it shows Alamofire not found and Algorithm not found and sometime this Multiple commands produce '/Users/ground1/Library/Developer/Xcode/DerivedData/DemoFrameworkApp-brctkulvbepfgafuygquzhveljkr/Build/Products/Debug-iphonesimulator/DemoApp.app/CHANGELOG.md'</p>\n"^^ . . "0"^^ . . "It crashes on startup while loading the symbols. main() is never reached."^^ . . . . "<p>I'd like to document an Objective C project with Doxygen. The intent is to document for the developers. The whole project is open source so viewable by anyone anyway.</p>\n<p>I created a Doxyfile and after a Doxygen 1.9.5 run I can see some (generic) output. So far so good.</p>\n<p>Now I want to enhance the documentation. When writing comments, I am not sure whether they should be in the .h (header) file or the .m (module) file.</p>\n<p>Where should they go? What is the difference? What might happen if I document on both sides?</p>\n"^^ . . . . "objective-c"^^ . . . "0"^^ . "The intent is to document for the developers. From your comment I get that the answer might be opinionated - that means there is no feature gain one one vs the other side?"^^ . . . . . . "@Larme unfortunately it is difficult to convince stakeholders unless it is a performance win."^^ . . . . . . . "Are you making it 2 **pixels** or 2 **points** tall? At that size, do you really notice a difference between using a translucent view vs a "blur" view?"^^ . . "1"^^ . . . . . "<p>I'm working on an old iOS project in Objective-C that had Google Maps with version <code>6.2.1</code>. The app was working correctly.</p>\n<p>But after using <code>pod update</code> I can't build my project. In the line <code>#import &lt;GoogleMaps/GoogleMaps.h&gt;</code> I'm getting the error <em><code>'GoogleMaps/GoogleMaps.h' file not found</code></em>. The current Google Maps version of my project is <code>8.2.0</code>.</p>\n<p>Here's my <strong>Podfile</strong>:</p>\n<pre><code>#platform :ios, '13.0'\nsource 'https://github.com/CocoaPods/Specs.git'\n\nplatform :ios, '14.0'\n\ntarget '&lt;project name&gt;' do\n use_frameworks!\n project '&lt;project name&gt;.xcodeproj'\n \n pod 'GoogleMaps'\n pod 'SDWebImage'\n pod &quot;MWPhotoBrowser&quot;\n pod 'MBProgressHUD'\n \nend\n</code></pre>\n<p>I cleaned the build folder, cleaned the pod cache, installed them again, and restarted Xcode, but none worked. What am I missing here? What should I do to run my project?</p>\n"^^ . "google-maps"^^ . . "0"^^ . "0"^^ . "https://github.com/realm/realm-swift/issues/8369 ?"^^ . "<p>I am new to swift and I am trying to solve the following problem.</p>\n<p>I have a framework, that I use in my application.\nThe framework has multiple enums defined in Objective-C like this:</p>\n<pre class="lang-swift prettyprint-override"><code>typedef NS_ENUM(NSUInteger, AdvertType) {\n AdvertTypeLoading,\n AdvertTypeFinished\n ...\n};\n</code></pre>\n<p>I have a variable <code>eventState</code> with a string like &quot;finished&quot; and need to get the correct ENUM reference automatically.\nFor this I have tried the following code, but I keep getting an error, that <code>AdvertType</code> has no member <code>allCases</code>.</p>\n<pre class="lang-swift prettyprint-override"><code>\n for type in AdvertType.allCases {\n if type.state.caseInsensitiveCompare(eventState) == .orderedSame {\n return type;\n }\n }\n</code></pre>\n<p>Why does my ENUM not have <code>allCases</code> and is there any other way, how I can translate my string into the actual enum value, that I can used in a AdvertType typed method?</p>\n<p>Is there maybe an easier way like?</p>\n<pre><code>let eventState = 'loading';\n\nlet enumState = AdvertType[eventState];\n\n// should return AdvertType.loading\n</code></pre>\n"^^ . "google-maps-sdk-ios"^^ . . . . . . "Check this [Document](https://developer.apple.com/documentation/storekit/skstorereviewcontroller/3566727-requestreview), on Discussion section"^^ . "WiFi Security type in iOS 11/12/13/14?"^^ . . "1"^^ . . "1"^^ . . "0"^^ . . . . "1"^^ . "<p>I am trying to play a local movie in my app when a button is pressed. However when I press the button I get the following error and the app crashes.</p>\n<blockquote>\n<p>'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'</p>\n</blockquote>\n<p>Here is the code I use to play the movie.</p>\n<pre><code>NSString *path=[[NSBundle mainBundle]pathForResource:@&quot;koi swimming&quot; ofType:@&quot;m4v&quot;];\nNSURL *url = [NSURL fileURLWithPath:path];\nAVPlayer *player = [AVPlayer playerWithURL:url];\nAVPlayerViewController *controller = [[AVPlayerViewController alloc]init];\ncontroller.view.frame = self.view.bounds;\n[self.view addSubview:controller.view];\n[controller.player play];\n</code></pre>\n<p>and I am attaching an image of my bundle file structure.</p>\n<p><a href="https://i.sstatic.net/qBWzX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qBWzX.png" alt="image of file structure" /></a></p>\n<p>Could someone help be with getting this to play please?</p>\n<p>Expanded images file.</p>\n<p><a href="https://i.sstatic.net/9mhZ9.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9mhZ9.png" alt="images file expanded" /></a></p>\n"^^ . . . "0"^^ . . "0"^^ . "0"^^ . . . . . "0"^^ . . . . . . . "<p>After digging a bit through the runtime, it appears that non-pointer isas are a runtime-only concept, and that all on-disk isas will always be regular pointers.</p>\n<p>The loading process of Obj-C classes in an object file:</p>\n<ol>\n<li><code>dyld</code> calls <code>_objc_map_images</code> (<code>objc-internal.h</code>/<code>objc-runtime-new.mm</code>), passing in the object headers to read and load classes from</li>\n<li><code>_objc_map_images</code> does a bit of setup before calling <code>map_images</code> (<code>objc-private.h</code>/<code>objc-runtime-new.mm</code>)</li>\n<li><code>map_images</code> takes the runtime lock, then calls <code>map_images_nolock</code> (<code>objc-private.h</code>/<code>objc-os.mm</code>)</li>\n<li><code>map_images_nolock</code> iterates over the mach headers, searching for Obj-C info and performing some validation. It passes all of the headers which contain Obj-C classes to <code>_read_images</code> (<code>objc-private.h</code>/<code>objc-runtime-new.mm</code>)</li>\n<li><code>_read_images</code> is where we actually get to the interesting parts. It first sets up support for non-pointer isas as relevant for the runtime target, and sets up some tables for storing class information. After reading and fixing up selectors, it starts reading class info (<code>OBJC_RUNTIME_DISCOVER_CLASSES_START()</code>)\n<ul>\n<li>For each header, it iterates over the raw <code>classlist</code> stored in the header, receiving direct pointers to each of the classes in the image</li>\n<li>For each class read this way, it calls <code>readClass</code> (<code>objc-runtime-new.mm</code>), which resolves mangled class names, Swift classes, and more — but at the end of the day, the read <code>classref_t</code> (raw pointer to dyld class) is either cast to <code>Class</code> (the class object), or replaced by an allocated <code>Class</code> instance</li>\n</ul>\n</li>\n</ol>\n<p>So, where <em>do</em> non-pointer isas come into play? Only when setting objects' class at runtime:</p>\n<ol>\n<li>When you create an object via either <code>objc_constructInstance</code> or <code>class_createInstance</code> (<code>runtime.h</code>), or set an object's class via <code>object_setClass</code>, the object has either <code>objc_object::initInstanceIsa</code> or <code>objc_object::initIsa</code> (<code>objc-object.h</code>) called on it (and <code>initInstanceIsa</code> just calls through to <code>initIsa</code> anyway)</li>\n<li><code>objc_object::initIsa</code> has two implementations (one for <code>SUPPORT_NONPOINTER_ISA</code> and the other for non-supported), but both call down to <code>isa_t::setClass</code> (<code>objc-private.h</code>/<code>objc-object.h</code>)</li>\n<li><code>isa_t::setClass</code> also has two implementations — when <code>SUPPORT_NONPOINTER_ISA</code> is true, the implementation sets the appropriate bits in the isa value itself, setting <code>shiftcls</code> as necessary; when <code>SUPPORT_NONPOINTER_ISA</code> is false, it just sets the class directly</li>\n</ol>\n<p>(Or in reverse, if you prefer: <code>isa_t::setClass</code> is <em>only</em> called from <code>objc_object::initIsa</code>/<code>objc_object::changeIsa</code>, which themselves are <em>only</em> called from <code>objc_constructInstance</code>/<code>class_createInstance</code>/<code>object_setClass</code>.)</p>\n<p>So, when you read these object files on disk, you will only ever encounter pointer isas for objects and classes; the bits that are actually set inside of isas is done at runtime exclusively. If there are details you're hoping to read from those bits, you'll need to construct that info yourself from the surrounding mach-o data.</p>\n"^^ . . "1"^^ . . . . "<p>Not sure what might have changed, or when... and, maybe you were &quot;getting lucky&quot; with your layouts so you didn't notice it... but...</p>\n<p>We want to set the <code>.preferredContentSize</code> based on the size of the <strong>controller's</strong> view - not your <code>popupView</code> subview.</p>\n<p>Also, we want to make sure the <strong>content</strong> is constrained to the <em><strong>safe-area</strong></em>.</p>\n<p>So, if I setup a <code>MenuUnavailableViewController</code> like this:</p>\n<p><a href="https://i.sstatic.net/alCAB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/alCAB.png" alt="enter image description here" /></a></p>\n<p>With &quot;Unavailable&quot; and &quot;Reason:&quot; labels Content Hugging and Compression Resistance Priorities all set to <code>Required</code> ...</p>\n<ul>\n<li><code>Unavailable Lbl</code> label will determine the Width</li>\n<li>&quot;Reason Lbl` label will determine the Height</li>\n</ul>\n<p>In the calling controller, set string properties for the labels.</p>\n<p>Then, <code>MenuUnavailableViewController</code> class looks like this:</p>\n<pre><code>@implementation MenuUnavailableViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n\n self.unavailableLbl.text = _unavailableString;\n self.reasonLbl.text = _reasonString;\n \n self.preferredContentSize = [self.view systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];\n}\n\n@end\n</code></pre>\n<p>No need to do anything in <code>viewWillAppear</code>.</p>\n<p>Here's how it looks (cycling through 3 sets of strings):</p>\n<p><a href="https://i.sstatic.net/5hVFF.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5hVFF.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/9oMcM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9oMcM.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/ntF1v.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ntF1v.png" alt="enter image description here" /></a></p>\n<p>and if we clear the colors and border:</p>\n<p><a href="https://i.sstatic.net/8hpOs.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8hpOs.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/9RALF.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9RALF.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/HFsg3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HFsg3.png" alt="enter image description here" /></a></p>\n<p>and, just to show it works for different &quot;arrow&quot; directions:</p>\n<p><a href="https://i.sstatic.net/C9Qg3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/C9Qg3.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/WKPk6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WKPk6.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/P9spG.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/P9spG.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/nW9xi.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/nW9xi.png" alt="enter image description here" /></a></p>\n"^^ . "0"^^ . "Try moving all of the `CGXXXRelease` calls to just before the `return`. And call the releases in the opposite order of the creates."^^ . . "0"^^ . . "screen-rotation"^^ . "viewcontroller"^^ . "<p>Since compiling our app for iOS 17, Devices running iOS 12 crash on start. The debugger doesn't even call <code>didFinishLaunchingWithOptions</code> before the crash.</p>\n<p>Seems to point to <code>ImageLoaderMachO::</code> error</p>\n<p>Did I miss a memo on something new we have to do now when supporting images for <code>iOS</code> 12 and below?</p>\n"^^ . "Did you request on a real device? According to Apple document, the ratings and review popup only show up maximum of 3 times a year."^^ . . "0"^^ . . "'GoogleMaps/GoogleMaps.h' file not found after updating GoogleMaps using pod update"^^ . . . . . . "If nil is the only sentinel, then no. If you want to add an argument before the varargs which is a count which could be iterated instead of looking for nil, it could work. You could try to pass NSNulls on the caller to stand in for nil (```[SomeClass doSomethingToVariableArguments:obj1 ?: NSNull.null, obj2 ?: NSNull.null, obj3 ?: NSNull.null, nil]```), and the called method could then check for NSNull and avoid calling doSomething in that case."^^ . "1"^^ . . "The swift KVC only works with literal keyPaths while I need to be able to use String keyPaths"^^ . . . . . "1"^^ . "0"^^ . . "react-native"^^ . . . "0"^^ . . "Yes, I did testing on real Mac"^^ . . "1"^^ . . "0"^^ . . "1"^^ . . . . . "0"^^ . "App crashes on macOS 10.13 with "DYLD, [0x4] Symbol missing" despite symbol being wrapped in @available(macOS 10.14.4, *)"^^ . . . "Do a test with more than 10 requests, like 100 and on real device. On "old" ones too if possible. You might see then the differences."^^ . "0"^^ . . "<p>In <strong>iOS 15</strong> we have following method to check <strong>WiFi security type</strong>:</p>\n<pre><code>@available(iOS 15.0, *)\nopen var securityType: NEHotspotNetworkSecurityType { get }\n</code></pre>\n<p>Do we have anything in iOS 11 to 14 to know WiFi Security type?</p>\n"^^ . . . "react-native-ui-components"^^ . . "1"^^ . . . . . "iOS 17 RPSystemBroadcastPickerView not working"^^ . "1"^^ . "0"^^ . "<p>You need to add the <code>UNNotificationPresentationOptionList</code> option for iOS 14+ to allow the notification to show up while the app is in the foreground.</p>\n<pre><code>if (@available(iOS 14.0, *)) {\n completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionBanner | UNNotificationPresentationOptionList | UNNotificationPresentationOptionBadge);\n} else {\n completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);\n}\n</code></pre>\n"^^ . . . "<p>I have an Objective C app that includes an 'orientation lock' switch, that allows users to switch off response to device orientation changes during some functions, so that rotating the device doesn't affect the screen, while allowing normal rotation during other functions.<br />\nThis has worked fine for 10 years; it still works on iOS 15. However, I've just found that it doesn't work on current iPhones with iOS 16.7 or iPhone simulator with iOS 17: instead, the screen orientation rotates to match the device orientation, when it should be locked.</p>\n<p>When users have set the app's orientation lock switch, at the start of a lockable function the app calls</p>\n<pre><code>[[UIDevice currentDevice]endGeneratingDeviceOrientationNotifications];\n</code></pre>\n<p>It does it repeatedly until</p>\n<pre><code>[UIDevice currentDevice].generatesDeviceOrientationNotifications == NO\n</code></pre>\n<p>I'd expect that there would then be no device orientation notifications, and up to iOS 15 the app's <code>MainViewController viewWillTransitionToSize</code> method and related layout methods are not called when the device rotates. But they are being called in iOS 16 and 17.\nIs it a bug in iOS? Or has Apple changed something, so I need to change the app code (I've checked Apple developer documentation)?</p>\n"^^ . "0"^^ . "0"^^ . . . . "iosdeployment"^^ . . . . . . . . "need to determine if the 2 callsites are different functions or just labels in our original function `A`, so for the first branch it's probably local branch in the function, but for the second branch, since it jumps to another location that then later branch to `B` it'll be hard to determine if this second jump prior jumping to `B` is a function by itself, counting towards 2 different callsites for `B`.\nI feel like looking at the binaries I'm working on that most unconditional jumps that Ghidra identify their jump target as new functions, the jump target resides in some stub section"^^ . . . "0"^^ . . . "2"^^ . . . . "0"^^ . . . "2"^^ . . . . . . . "0"^^ . "@ItaiFerber it's not just something I can share on stackoverflow, it's too big. But its basically walking the load commands of a macho, fixing chained fixups finding the `__objc_classlist` section and getting to the `objc_class` structures defined in the file and reading them according to the definition in the runtime. The only quirk I found is that the ISA field is basically just another pointer to `objc_class` usually a metaclass of the current class, and all this bit field mean nothing atleast when I read the `objc_class` from disk"^^ . . "1"^^ . . . . . . "0"^^ . . . . "endGeneratingDeviceOrientationNotifications not working in iOS 16.7?"^^ . "0"^^ . . . . . . "4"^^ . . "Is it possible to change defaultSessionConfiguration of NSURLSessionConfiguration?"^^ . . . . . . . . . . . . "1"^^ . "0"^^ . . . . "0"^^ . "<p>In a legacy project which has both ObjC and Swift Code I noticed that for each request a new session was created:</p>\n<pre><code>-(void)sendRequest {\n// Some configuration\n\n// New session is created for every request\nNSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] delegate:nil delegateQueue:[NSOperationQueue mainQueue]];\n[session dataTaskWithRequest:self.request completionHandler:^(NSData * _Nullable data, NSURLResponse *_Nullable response, NSError * _Nullable error) {\n// Doing something with response\n}\n}\n</code></pre>\n<p>As per the information shared in past WWDC videos and answer over here: <a href="https://developer.apple.com/forums/thread/84663" rel="nofollow noreferrer">New NSURLSession for every DataTask overkill?</a>, I noticed that this is an anti-pattern and should be avoided. In it's place we should use a single URLSession for all requests:</p>\n<pre><code>-(void)sendRequest:(NSURLReqest *)request {\n// Some configuration\n\n// \n[self.session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse *_Nullable response, NSError * _Nullable error) {\n// Doing something with response\n}\n}\n</code></pre>\n<p>Please note that at server HTTP 1.1 is configured for the rest APIs.</p>\n<p>As per my understanding whenever we create a new session it is equivalent to creating a new TCP connection, since there is a handshake involved at the beginning for each new TCP connection that will add latency so ideally we should use same URLSession for each request.</p>\n<p>In order to validate it I started profiling both the implementations using Instruments for a scenario where after login we are invoking 50 APIs most of which are returning json in response, 10 returning image data.</p>\n<p>Here is my observation:</p>\n<ol>\n<li>There is slight improvement in time taken by each request</li>\n<li>Whenever we use one session per request, internally OS creates parallel connections so it achieves identical results when compared to the single session used for all requests</li>\n<li>If we are directly serializing image using URLSessionDataTask it takes less time versus using URLSessionDownloadTask</li>\n</ol>\n<p>Based on 2nd and 3rd observation it appears to be a bad choice in my case. Am I missing anything over here?</p>\n"^^ . "Objective-C doesn't have associated types in the protocols, so there is no opaque types."^^ . . "I'm surprised that ever worked. The proper way is to make use of [`supportedInterfaceOrientations`](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621435-supportedinterfaceorientations?language=objc) and [`setNeedsUpdateOfSupportedInterfaceOrientations`](https://developer.apple.com/documentation/uikit/uiviewcontroller/4047535-setneedsupdateofsupportedinterfa?language=objc)."^^ . . . "0"^^ . . "0"^^ . . . . . "<p>You almost certainly want to replace this:</p>\n<pre><code>#import &quot;MWCommon.h&quot;\n</code></pre>\n<p>with this:</p>\n<pre><code>#import &lt;MWPhotoBrowser/MWCommon.h&gt;\n</code></pre>\n<p>You may need to apply similar changes to any other Pods. They're part of modules, so you want to use the <code>&lt;...&gt;</code> syntax and <code>&lt;module/file.h&gt;</code>. You may also be able to use the following syntax in some case if it's convenient:</p>\n<pre><code>@import MWPhotoBrowser;\n</code></pre>\n"^^ . "On the Xcode menu select View -> Inspectors -> File. Then select the m4v file. Look at the "Target Membership" section of the file inspector and make sure the checkbox for your target is checked."^^ . . . . . . . . . "0"^^ . "2"^^ . . . . . . . . "Thanks for the insight. So right now I'm using the symbol table, and prolouge analysis to find a set of entry points. I don't mind obfuscation techniques as the binaries I'm working on are system binaries and are not of malware nature. After that I take all these entries and pass them to a branch analyzer to find more functions that we branch and link to (`bl`). So as for your second heuristic point, I feel I can do that check but unless I already know all the functions prior I can't tell if a data between the current address and the jump target is another function, it might be and it might"^^ . "macos"^^ . "@Willeke: Could be. Using a sentinel different from nil would solve this. But it's of course not as pretty"^^ . . "As suggested, did you add `[super viewWillAppear:animated];` ? Did you check if some values are `nil` too?"^^ . . "1"^^ . "0"^^ . "0"^^ . . . . "<p>The biggest misconception about URL encoding is that it encodes URLs. It does not. It's for path components and query parameters only.</p>\n<p>Encoding an entire URL cannot work. If it is already an URL, it needs no encoding. If it's not an URL, then how should it be treated? Which parts are to be treated as the hostname, path and query parameters?</p>\n<p>That's why the behavior of <code>NSURL URLWithString:</code> is problematic. According to the documentation:</p>\n<blockquote>\n<p>NSURL automatically percent- and IDNA-encodes invalid characters to help create a valid URL.</p>\n</blockquote>\n<p>So it tries to fix an <em>invalid</em> URL. But since the URL is invalid, this cannot reliably work.</p>\n<p>For your case, it does not work. You feed it this invalid URL:</p>\n<pre><code>http://google.com/ad/1?asseturl=[ASSETURI]&amp;partner=abc%2Fdev\n</code></pre>\n<p>The query parameter <code>asseturl</code> has an invalid value (square brackets need encoding) while <code>partner</code> has a value that could be valid or invalid. It's basically a guess if the value of <code>partner</code> needs to be URL encoded or not. This is were Apple's implementation has changed.</p>\n<p>It's the invalid <code>asseturl</code> parameter triggering the double encoding. Without the invalid parameter, the value of <code>partner</code> is not encoded a second time.</p>\n<p>The proper way in any programming language and with any framework or library is to encode each path component and each query value separately.</p>\n<p>Using this approach, a valid URL is built in the first place and then passed to <code>NSURL URLWithString:</code>. And it won't be double encoded.</p>\n<pre><code>NSString* partner = [@&quot;abc/dev&quot; stringByAddingPercentEncodingWithAllowedCharacters:[[NSCharacterSet characterSetWithCharactersInString:@&quot; !*'\\&quot;();:@&amp;=+$,/?%#[]^|{}\\\\`&quot;] invertedSet]];\nNSString* asseturi = [@&quot;[ASSETURI]&quot; stringByAddingPercentEncodingWithAllowedCharacters:[[NSCharacterSet characterSetWithCharactersInString:@&quot; !*'\\&quot;();:@&amp;=+$,/?%#[]^|{}\\\\`&quot;] invertedSet]];\nNSURL* url = [NSURL URLWithString: [NSString stringWithFormat:@&quot;http://google.com/ad/1?asseturl=%@&amp;partner=%@&quot;, asseturi, partner]];\n</code></pre>\n<p>The result is:</p>\n<pre><code>http://google.com/ad/1?asseturl=%5BASSETURI%5D&amp;partner=abc%2Fdev\n</code></pre>\n<p><code>NSURLComponents</code> and <code>NSURLQueryItem</code> are usually the best approach to construct URLs with query parameters. They take care of encoding. But since you have the additional requirement of encoding the <em>sub-delims</em> class, they might not be the best fit.</p>\n"^^ . . "If you launch too many calls in parallels, you might overuse your resources, as there might be creating too many threads. While using a single URLSession, you can limit the parallel calls (with `httpMaximumConnectionsPerHost` for instance)."^^ . "0"^^ . . . . . . "0"^^ . "@HangarRash I just corrected the code - my apologies."^^ . . "How can I create a framework with pod dependencies in it?"^^ . "1"^^ . . "4"^^ . . . "mach-o"^^ . . . . "Do you mean import stubs? In that case you can be sure it's a different function, but in any other case, all code is gonna be in the same section (usually `__TEXT.__text`). And yes, quite a bunch of heuristics require you to already have some information, but on the flip side, you will gain a lot of information as decompilation progresses - that is the whole point, after all. What this means is that decompilation should be an iterative process, because expecting to have all the information that you need beforehand is... very unrealistic, to put it mildly."^^ . "Do you call [`setDraggingSourceOperationMask:forLocal:`](https://developer.apple.com/documentation/appkit/nstableview/1527199-setdraggingsourceoperationmask?language=objc)?"^^ . "<p>So I have a <code>UIAlertController</code> which needs to be presented on top of another view controller, so a child view controller. I can get the child view controller to display on top of the parent no problem, but I can't get the alert buttons to respond when I bring this child view controller to the front.</p>\n<pre><code>UIAlertController* alert = [AlertHelper createAlertWithTitle:title\n message:message\n cancelButton:nil\n continueButtonText:Ok\n continueAction:nil\n cancelAction:nil];\n \nalert.view.translatesAutoresizingMaskIntoConstraints = false;\n\n[self addChildViewController:alert];\nalert.view.frame = self.view.bounds;\n[self.view addSubview:alert.view];\n[alert didMoveToParentViewController:self];\n[alert.view.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor].active = YES;\n[alert.view.centerYAnchor constraintEqualToAnchor:self.view.centerYAnchor].active = YES;\n</code></pre>\n"^^ . "1"^^ . . "2"^^ . "react-native-component"^^ . . . . . . "Just adding a reference to this issue https://github.com/apple/swift/issues/68163#issuecomment-1728212881 (should have been solved with xcode 15.1)"^^ . "How to hande premature nils in variadic objective-c functions?"^^ . . "1"^^ . "2"^^ . "0"^^ . . "enums"^^ . . "0"^^ . "0"^^ . "2"^^ . "3"^^ . . "0"^^ . "0"^^ . . . "could you share AlertHelper?"^^ . . . "0"^^ . "You should use (NS)URLComponents, with NSURLQueryItem etc., or if you want to encode yourself, you should do it piece by piece: host (usually not needed), parameter per parameter (usually the value of the parameter), and then append."^^ . . . "Please show your code so we can see how your own encoding code is combined with calling `NSURL` methods. This isn't obvious from the current description."^^ . . . . . "<p><code>CaseIterable</code> is a protocol from Swift that allows you to use <code>allCases</code> property to access all types in the enum as a collection, so there is no way to Objective-c enum can conform it. You have to work around with this.</p>\n<p>Approach 1, define a swift enum which mapping 1-1 with <code>AdvertType</code>. Then declare a property to return same type as in Objective-C or write an extension from Swift to manually implement <code>allCases</code> property. Thanks @Alex for pointing out to me:</p>\n<pre class="lang-swift prettyprint-override"><code>enum Advert: String, CaseIterable {\n case loading\n case finished\n\n var enumAdapter: AdvertType {\n switch self {\n case .loading:\n return AdvertType.loading\n case .finished:\n return AdvertType.finished\n }\n }\n}\n\nif let loadingState = Advert(rawValue: &quot;loading&quot;) {\n //TODO:\n}\n\nextension AdvertType {\n public static var allCases: [AdvertType] = [\n .loading,\n ...\n ]\n}\n</code></pre>\n<p><del>Approach 2, every time you want to get Objective-C <code>AdvertType</code> run a for loop to get the value with condition like you did above <code>type.state...</code> However, changing rawValue from String to UInt (&quot;loading&quot; -&gt; 0) because the enum is defined NSUInteger.</del></p>\n<p>Edited for approach 2: my mistake was that I didn't look at <code>type.state</code> condition, it's also inside <code>AdvertType</code>. So, with String input parameter and UInt as initialization enum parameter, there is no way to convert such a easy way like you did in example above. If I were you, I would create a helper function to convert between them (I prefer approach 1). However, be aware of TYPO and return type in unexpected cases:</p>\n<pre class="lang-swift prettyprint-override"><code>static func getAdvertType(from state: String) -&gt; AdvertType? {\n switch state {\n case &quot;loading&quot;:\n return .loading\n case &quot;finished&quot;:\n return .finished\n default:\n return nil\n }\n}\n</code></pre>\n"^^ . "0"^^ . "'MWCommon.h' file not found"^^ . "<p>If you look into React Native macros <code>RCT_EXTERN_MODULE</code>, <code>RCT_EXTERN_METHOD</code> etc. you can find that they produce additional static methods for React Native to register your module and expose your methods:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#define RCT_EXPORT_MODULE_NO_LOAD(js_name, objc_name) \\\n RCT_EXTERN void RCTRegisterModule(Class); \\\n +(NSString *)moduleName \\\n { \\\n return @ #js_name; \\\n } \\\n __attribute__((constructor)) static void RCT_CONCAT(initialize_, objc_name)() \\\n { \\\n RCTRegisterModule([objc_name class]); \\\n }\n\n#define _RCT_EXTERN_REMAP_METHOD(js_name, method, is_blocking_synchronous_method) \\\n +(const RCTMethodInfo *)RCT_CONCAT(__rct_export__, RCT_CONCAT(js_name, RCT_CONCAT(__LINE__, __COUNTER__))) \\\n { \\\n static RCTMethodInfo config = {#js_name, #method, is_blocking_synchronous_method}; \\\n return &amp;config; \\\n }\n</code></pre>\n<p>You can implement these methods in your Swift code:</p>\n<pre class="lang-swift prettyprint-override"><code>import React\n\nclass Calendar: NSObject, RCTBridgeModule {\n \n @objc func createEvent(_ title: String, location: String) {\n print(title, location)\n }\n \n @objc static func __rct_export__createEvent() -&gt; UnsafePointer&lt;RCTMethodInfo&gt;? {\n struct Static {\n static let jsName = strdup(&quot;createEvent&quot;)\n static let objcName = strdup(&quot;createEvent:(NSString * _Nonnull)title location:(NSString * _Nonnull)location&quot;)\n static var methodInfo = RCTMethodInfo(jsName: jsName, objcName: objcName, isSync: false)\n }\n return withUnsafePointer(to: &amp;Static.methodInfo) {\n $0\n }\n }\n \n @objc class func moduleName() -&gt; String! {\n &quot;\\(self)&quot;\n }\n}\n</code></pre>\n<p>Also you need to register your class manually on app startup to be operable:</p>\n<pre class="lang-swift prettyprint-override"><code>RCTRegisterModule(Calendar.self)\n</code></pre>\n<p><strong>Swift Macro</strong></p>\n<p>As you can see it's possible to write a React Native Module manually in pure Swift but it is not convenient at all. But macro has been started supporting from Swift 5.9 (XCode 15) and you can use <a href="https://github.com/ikhvorost/ReactBridge" rel="nofollow noreferrer">ReactBridge</a> swift macro library for React Native Modules and UI Components. And with this library your code simply becomes to:</p>\n<pre class="lang-swift prettyprint-override"><code>import React\nimport ReactBridge\n\n@ReactModule\nclass Calendar: NSObject, RCTBridgeModule {\n \n @ReactMethod\n @objc func createEvent(title: String, location: String) {\n print(title, location)\n }\n}\n\n</code></pre>\n"^^ . . . "Bot didn't close the question, I accepted it as a suitable answer (I honestly don't believe there is a way of doing this while keeping nil as the sentinel)"^^ . . "0"^^ . "0"^^ . . "Can you include a stack trace of the error/crash you’re experiencing?"^^ . . . . "Please post the error that you are getting"^^ . . "0"^^ . "1"^^ . . . . . . . "0"^^ . . . "<p>In iOS 11 through iOS 14, there is no direct built-in method or property provided by Apple's Network Extension framework or CoreWLAN framework to determine the security type of a Wi-Fi network. These versions of iOS did not offer a native API to retrieve the specific security type (e.g., WPA, WPA2, WEP) of a Wi-Fi network.</p>\n<p>To determine the security type of a Wi-Fi network in those iOS versions, you would typically need to analyze the network's SSID and possibly try to infer the security type based on naming conventions or other available information. However, this method is not guaranteed to be accurate because network names can vary widely and may not provide a clear indication of the security type.</p>\n<p>Starting from iOS 15 and later, as you mentioned, the <code>NEHotspotNetwork</code> class includes the <code>securityType</code> property, which allows you to directly check the security type of a Wi-Fi network, making it more straightforward to determine the security type programmatically.</p>\n"^^ . "@sahilsaini please [edit] your question with additional info, don’t put it in the comments. See also [ask]."^^ . "1"^^ . "0"^^ . "nsurl"^^ . . "I think `URLWithString` just becomes smarter: `[` needs encoding - yes, then passed string is not encoded and entire path is encoded. Please retry by encoding `[` and `]`"^^ . . . . "iOS 14+ UNUserNotificationCenter not presenting foreground notifications as expected"^^ . . "0"^^ . "<p>If you are open to using expo I have used <code>Expo Modules API</code> for native modules before they handle all the nasty objc stuff.</p>\n<p>They expect you to write your modules in <code>Kotlin and Swift</code> but I believe under the hood they are still just generating all the objc code that you need.</p>\n<p><code>Expo Modules API</code> was a great experience especially if you are wanting to write swift code. I wrote a native module without it and felt the objc stuff was hard to keep in sync with the swift code.</p>\n<p><a href="https://docs.expo.dev/modules/overview/" rel="nofollow noreferrer">https://docs.expo.dev/modules/overview/</a></p>\n"^^ . "<p>Say I have the following, very contrived, set up:</p>\n<pre class="lang-objectivec prettyprint-override"><code>@interface SomeClass : NSObject\n+ (void) doSomethingToVariableArguments:(SomeClass*) someObject, ... NS_REQUIRES_NIL_TERMINATION;\n- (void) doSomething;\n@end\n\n@implementation SomeClass\n\n+ (void) doSomethingToVariableArguments:(SomeClass*) someObject, ... NS_REQUIRES_NIL_TERMINATION {\n [someObject doSomething];\n va_list args;\n va_start(args, someObject);\n SomeClass* next;\n while ((next = va_arg(args, SomeClass*))) {\n [next doSomething];\n }\n va_end(args);\n return;\n}\n\n- (void) doSomething {\n // do something\n return;\n}\n</code></pre>\n<p>Now we assume that somewhere, there is a call <code>[SomeClass doSomethingToVariableArguments:obj1, obj2, obj3, nil];</code>.</p>\n<p>What happens if, for some reason, <code>obj2</code> is <code>nil</code>?</p>\n<p>Well, <code>- doSomething</code> is only called for <code>obj1</code>, since we encounter a nil and assume the argument-list has terminated. <code>obj3</code> is completely ignored, and e.g. fails to update.</p>\n<p>Is there any way, besides checking if the arguments are <code>nil</code>, to catch this and maybe issue a warning, or even raise an error?</p>\n"^^ . "1"^^ . . "0"^^ . . . . "nsoutlineview"^^ . . . . "0"^^ . "view"^^ . "thanks for your comment. Would you mind providing a bit more details for example 2? Unfortunately number 1 will not work, because the enum in the lib might change and I need our Code to still work dynamically with changes without having to change it in my enum-copy every time."^^ . . "0"^^ . . . . . . . "<p>I'm working on an iOS app and trying to handle foreground notifications using the UNUserNotificationCenter in iOS 14 and later. However, the notifications are not being presented as expected when the app is in the foreground.</p>\n<p>Here's my code:</p>\n<pre><code>-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {\n NSLog(@&quot;Foreground notification - appdelegate: %@&quot;, notification);\n\n NSDictionary *userInfo = notification.request.content.userInfo;\n // Foreground\n NSLog(@&quot;APP_PUSH from foreground %@&quot;, userInfo);\n\n \n if (@available(iOS 14.0, *)) {\n completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionBanner | UNNotificationPresentationOptionBadge);\n } else {\n completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);\n }\n}\n</code></pre>\n<p>The problem is that the notifications are not showing up as expected when the app is in the foreground but it works when it is in background.</p>\n<p>Any ideas on how to fix this issue and get the notifications to display properly in the foreground?</p>\n"^^ . "1"^^ . . . "0"^^ . "cocoa"^^ . . . . "<p>I'm trying to enable drag and drop functionality for NSOutlineView in my MacOS app. I want to drag a child from a folder to another folder within the outline view.</p>\n<p><a href="https://i.sstatic.net/z8bu3.png" rel="nofollow noreferrer">I want test asset 1 to be dragged and dropped in Group 2</a></p>\n<p>I have myOutlineView and a controller which is a data source and a delegate of my outline view.</p>\n<p>In my outline view controller I have these three methods:</p>\n<pre><code>-(BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard\n\n-(NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id &lt; NSDraggingInfo &gt;)info proposedItem:(id)item proposedChildIndex:(NSInteger)index\n\n-(BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id &lt; NSDraggingInfo &gt;)info item:(id)item childIndex:(NSInteger)index\n</code></pre>\n<p>None of them is being called. My nib is setup properly, my outline view is getting filled and all of the functionality is working except the drag and drop feature.</p>\n<p>I have also registered the drag type in awake from nib:</p>\n<pre><code>[_paraOutlineView registerForDraggedTypes:[NSArray arrayWithObject:@&quot;QStyleSheetModel&quot;]];\n</code></pre>\n<p>I also wrote this:</p>\n<pre><code>[_paraOutlineView setDraggingSourceOperationMask:NSDragOperationMove forLocal:YES];\n</code></pre>\n<p>What could be the reason?</p>\n"^^ . "2"^^ . . . . "@Willeke yes I did. But it still does not work."^^ . . "I don't necessarily mean for you to share the whole code, just a snippet showing off exactly how you're reading and interpreting the isa; without some minimal reproducible code, it'll be hard to help much more... And when you say that the "bit field mean[s] nothing", what are the bits that you expect vs. the bits you're getting? Given that the field is a union, the bits should represent exactly the integer value of the pointer..."^^ . "Get Objective-C enum value in swift"^^ . . . . "1"^^ . "You definitely should not change Pods.xcodedproj. The pod you reference has instructions that call for `#import "MWPhotoBrowser.h"`. Beyond that, I'd probably have to look at the project itself to tell you what to do (which is unfortunately not well suited to SO). I would recommend starting from scratch in a blank project, and just add this one pod, and see if it works there, and then find what is different between the two."^^ . "0"^^ . "2"^^ . . . . "App crashing on iOS 16, but not iOS 17. -"^^ . . . "@CentrumGuy: That works because CALayer has a special implementation of `setValue(forKeyPath:)`, see https://stackoverflow.com/q/48964282/1187415"^^ . "0"^^ . "0"^^ . . "0"^^ . . . "uipopovercontroller"^^ . "0"^^ . "UIAlertController as child view controller not responding to tap"^^ . . . . "1"^^ . . . . . "ios"^^ . . . "0"^^ . . . . . . "0"^^ . "0"^^ . "<blockquote>\n<p>Is the Objective-C equivalent of a Swift opaque type just id?</p>\n</blockquote>\n<p>No. <code>id</code> is equivalent to AnyObject. There is no equivalent to Swift opaque types in ObjC. You could squint really hard and say that both <code>some ThisProtocol</code> and <code>any ThisProtocol</code> are equivalent to <code>id &lt;ThisProtocol&gt;</code>, but they're not. They're fundamentally different (for example, they have different memory layouts in a way that deeply matters), but they have some vague similarities in how they're used.</p>\n<blockquote>\n<p>What's the equivalent of a boxed type?</p>\n</blockquote>\n<p>I assume you mean an existential type here (such as <code>any SomeProtocol</code>). There is no equivalent. In ObjC, everything (except primitives...) is an object. Even classes are objects. Objects can be passed messages. Protocols define a set of methods that can be passed to an object. That's pretty much the entirety of Objective-C. Even things like &quot;lightweight generics&quot; aren't really part of the ObjC language so much as compiler hints that help bridging to Swift. ObjC &quot;properties&quot; are mostly syntactic sugar to create ivars and methods. It's a really simple language. Many things in Swift have no equivalent in ObjC.</p>\n<p>But something like <code>id &lt;ThisProtocol&gt;</code> would again be the closest kind of equivalency. It's really more like <code>AnyObject &amp; ThisProtocol</code> than a &quot;boxed type&quot; in Swift. That would be a weird thing to write in Swift and possibly isn't even legal, but is what <code>id &lt;ThisProtocol&gt;</code> is closest to.</p>\n<p>There <strong>is</strong> a &quot;boxed type&quot; in ObjC, but I doubt it's what you mean. It's <a href="https://developer.apple.com/documentation/foundation/nsvalue?language=objc" rel="nofollow noreferrer">NSValue</a>, and it's used to box up primitive types into an object. In technical ways it works exactly like <code>any</code> types in Swift. But in how it's used, it's conversely nothing like an <code>any</code> type. The languages are just very different.</p>\n"^^ . "Doxygen comments - in header or implementation?"^^ . . . "0"^^ . . "0"^^ . "<p>It seems like the file you are trying to find (<code>koi swimming.m4v</code>) is not added to the target <code>Bundle</code> (which is <code>mainBundle</code> here).</p>\n<p>The bundle is the runtime resources of your app and it's different from the build time resources.</p>\n<p>So make sure to add runtime-needed files to <strong>the desired targets</strong> when you are adding them:</p>\n<p><img src="https://i.sstatic.net/AxoHg.png" alt="Add time" /></p>\n<p>Also, You can add/remove any file from the target from the file inspector like:</p>\n<p><img src="https://i.sstatic.net/7sBWa.png" alt="File inspector" /></p>\n"^^ . . "i'm making it 2 points tall. it's not too noticeable but you can tell"^^ . . . . "0"^^ . . . . . . . "0"^^ . "Post a [mre] please."^^ . . . . . "0"^^ . . . . . . . "ios17"^^ . "Objective-C equivalents of Swift opaque object and boxed type?"^^ . "0"^^ . . . . . . . . . "Notification Center - cannot be used on instance of nested type"^^ . . "I don't think there will be a solution for this. Kind of an opposite problem would also be a command that produces more than one chunk of output data (like `cat largeTextFile`). As is you'd never know when that command is done running either."^^ . "xamarin.forms"^^ . . . . . . . . . . . . . . "0"^^ . "avfoundation"^^ . "<p>I managed to solve it with NSDataAsset. When i pass it the name of the file i get it back and then can either save it with FileManager in Swift or send the bytes to flutter.</p>\n<pre><code> if let asset = NSDataAsset(name:&quot;audio1&quot;) {\n print(asset)\n result(asset.data)\n } else {\n print(&quot;Resource not found for tag: \\(tag)&quot;)\n result(FlutterError(code: &quot;RESOURCE_NOT_FOUND&quot;,\n message: &quot;Resource not found for tag: \\(tag)&quot;,\n details: nil))\n }\n</code></pre>\n<p>or with</p>\n<pre><code>if let asset = NSDataAsset(name:&quot;audio1&quot;) {\n // Get the directory to save the file\n let dir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!\n\n // Specify the file name and type\n let fileURL = dir.appendingPathComponent(&quot;audio1.mp3&quot;)\n\n // Write the NSDataAsset to the file\n do {\n try asset.data.write(to: fileURL)\n print(&quot;File saved to \\(fileURL.absoluteString)&quot;)\n result(fileURL.absoluteString)\n } catch {\n print(&quot;Error saving file: \\(error)&quot;)\n result(FlutterError(code: &quot;ERROR_SAVING_FILE&quot;,\n message: &quot;Error saving file: \\(error)&quot;,\n details: nil))\n }\n } else {\n print(&quot;Resource not found for tag: \\(tag)&quot;)\n result(FlutterError(code: &quot;RESOURCE_NOT_FOUND&quot;,\n message: &quot;Resource not found for tag: \\(tag)&quot;,\n details: nil))\n</code></pre>\n"^^ . . . "0"^^ . "0"^^ . . . "<p>It is annoying. The problem is that when you choose to build the macOS version of the app by selecting a Mac as the build target, then the definitions of <code>TARGET_OS_MACCATALYST</code> and <code>TARGET_OS_IPHONE</code> are both set to <code>1</code>. When you select an iOS device or iOS simulator as the build target, then <code>TARGET_OS_MACCATALYST</code> is set to <code>0</code> while <code>TARGET_OS_IPHONE</code> is set to <code>1</code>.</p>\n<p>I suspect Apple did it this way because a Mac Catalyst app is basically an iOS app, just built with a compatibility layer for macOS.</p>\n<p>In my own iOS app that also supports Mac Catalyst, I use <code>#if TARGET_OS_MACCATALYST</code> around code that is only for the macOS version, and I use <code>#if !TARGET_OS_MACCATALYST</code> around code that is only for the iOS version.</p>\n<p>You can see these definitions easily enough. Right-click on <code>TARGET_OS_MACCATALYST</code> and choose &quot;Jump to Definition&quot;. You will be taken to the TargetConditionals.h file. Depending on your build target, you will be taken to different parts of that header file where several <code>TARGET_OS_XXX</code> macros are set to <code>0</code> or <code>1</code> based on the target. Try it for a Mac target then try it for an iOS target and you will see the appropriate definitions.</p>\n"^^ . . . . . . . "0"^^ . . . "facebook"^^ . . . "<p>I was able to use the rawValue property on the NSEnum. My Autocomplete didn't suggest this to me.</p>\n<pre><code>UInt32(type.rawValue)\n</code></pre>\n"^^ . . . "0"^^ . "struct"^^ . "<p>I have a layer-<em>hosting</em> <code>NSView</code> subclass that draws itself using a <code>CALayer</code> object set as its <code>layer</code>. Since it's not a layer-backed view, it doesn't redraw during <code>drawRect:</code> nor during <code>updateLayer</code>, but during <code>drawLayer:inContext:</code> after I call <code>setNeedsDisplay</code> on its layer.</p>\n<p>The problem is that the layer must adapt to the application appearance (it uses system <code>NSColor</code> objects), and appkit doesn't seem to manage this situation.\nApple <a href="https://developer.apple.com/documentation/uikit/appearance_customization/supporting_dark_mode_in_your_interface?language=objc" rel="nofollow noreferrer">says</a> that one needs to set the layer's content during <code>drawRect:</code> or <code>updateLayer</code>, otherwise the colors don't adapt to the appearance.\nIndeed, they don't update in <code>drawLayer:inContext:</code></p>\n<p>The current (ugly) solution I use is to call <code>-display</code> directly on the layer (which Apple says I should not do) within the <code>updateLayer</code> method (of another view since the view hosting the layer isn't send <code>updateLayer</code>, given that it's not a layer-backed view).</p>\n<p>Calling <code>setNeedsDisplay</code> on the layer rather than <code>display</code> does not work, as the layer would not redraw its content within the <code>updateLayer</code> call, but after.</p>\n<p>Is there another solution?</p>\n"^^ . . "grand-central-dispatch"^^ . . . "1"^^ . "2"^^ . . . . "1"^^ . "0"^^ . . . . . . "unsupported Swift architecture in Objective-C"^^ . "I moved let publisher5 = NotificationCenter.default.publisher(for: NSNotification.Name("COM.CMW.UpdateGreySubText")) to the ProgressBar struct and am still getting the same error. I also tried moving the @Objc func and var GreySubText to the ProgressBar struct but still the same error messages. What am I doing wrong?"^^ . "0"^^ . . . . . . "0"^^ . . . . . "0"^^ . "@adamjansch – The downside is really negligible (hence my hesitancy to engage in the code change unless it was important). The performance change would be unobservable and we’re only talking about three extra lines of code. Sure, if I was doing a code review and saw this, I might tend to be extra cautious looking at the rest of the code. But that’s it. It’s not a “problem,” but rather just an unnecessary bit of code suggesting a conceptual misunderstanding on the part of the author."^^ . "@SAHM – It’s hard to say in the abstract whether you’d want one or two `strongSelf` references. It depends entirely upon the purpose of each of the two separate `strongSelf` references. But you could use two. (I can’t recall a practical, real-world case where I needed two; I frequently didn’t even need one.) But you could often get away with one. And you often don’t need any. (And if you were using it for nullability purposes, there were would be tests that it wasn’t null, too.)"^^ . . "memory-management"^^ . "It is, I've included another image"^^ . . . . "Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/256071/discussion-between-rob-and-user717452)."^^ . "0"^^ . "No need to initialize another object from it. It is redundant.`type.rawValue` would suffice. It returns an `UInt32` object aleeady."^^ . . . "1"^^ . "xcode"^^ . . "crash"^^ . . . . . . . . . "1"^^ . . . "As I said, subclassing is not an option, and because of it, overriding a property getter via the means of the language is not an option. And swizzling here is the only solution it seems."^^ . . . "0"^^ . "<h2>Problem</h2>\n<p>After recently upgrading my Xcode and Swift installs to Xcode 15, when I compile and launch one of my applications, I get the following error:</p>\n<pre><code>dyld[84548]: Symbol not found: _OBJC_CLASS_$_NSError\n Referenced from: &lt;DB944C1D-1AD6-3A8B-8BEC-D8454DC07A6A&gt; /Users/alex/Library/Developer/Xcode/DerivedData/AJRFoundationLinkTest-gypsogziwzwysmepcqeawntjqomo/Build/Products/Debug/AJRInterface.framework/Versions/A/AJRInterface\n Expected in: &lt;94BC2179-161F-39BD-BFB8-D55BBBD3B8DB&gt; /Users/alex/Library/Developer/Xcode/DerivedData/AJRFoundationLinkTest-gypsogziwzwysmepcqeawntjqomo/Build/Products/Debug/AJRFoundation.framework/Versions/A/AJRFoundation\n</code></pre>\n<p>So what's weird here is that <code>AJRInterface</code> seems to be expecting to find <code>NSError</code> in <code>AJRFoundation</code> rather than <code>Foundation</code>. This code all worked fine on the previous version of Xcode. Note that I did have some other changes, but I reverted to a clean copy with <code>git</code>, and the error still reproduced, so the only &quot;change&quot; here is the compiler and linker versions.</p>\n<p>Does anyone have any idea of how to possibly diagnose this?</p>\n<h2>Attempted Diagnostics</h2>\n<p>I'm a bit at a loss as to how to diagnose this one. I did played around with <code>otool</code> using various options trying to see if some piece of code in <code>AJRInterface</code> was somehow referencing something in <code>AJRFoundation</code> rather than <code>Foundation</code>, but I couldn't find anything obvious.</p>\n<p>Likewise, I tried <code>otool</code> on <code>AJRFoundation</code> to see if I was somehow defining a class called <code>NSError</code>, but I also couldn't find anything.</p>\n<p>Note that <code>otool</code> and <code>Swift</code> don't play completely nice with each, especially because <code>otool</code> doesn't de-mangle <code>Swift</code> names, which makes reading the output a little awkward.</p>\n<h2>Hack of a Workaround</h2>\n<p>For the moment, I've managed to work around this by adding the following code to <code>AJRFoundation</code>:</p>\n<pre><code>#pragma clang diagnostic push\n#pragma clang diagnostic ignored &quot;-Wdeprecated&quot;\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored &quot;-Wobjc-property-implementation&quot;\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored &quot;-Wincomplete-implementation&quot;\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored &quot;-Wprotocol&quot;\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored &quot;-Wobjc-designated-initializers&quot;\n\n@implementation NSError\n\n+ (id)allocWithZone:(struct _NSZone *)zone {\n NSBundle *bundle = [NSBundle bundleWithIdentifier:@&quot;com.apple.Foundation&quot;];\n if (bundle != nil) {\n struct objc_object *instance = (__bridge struct objc_object *)([super allocWithZone:zone]);\n Class class = [bundle classNamed:@&quot;NSError&quot;];\n if (class != Nil) {\n AJRLogWarning(@&quot;NSError hack was triggered, swizzling isa pointer.&quot;);\n instance-&gt;isa = class;\n }\n return (__bridge NSError *)(instance);\n }\n return [super allocWithZone:zone];\n}\n\n#pragma clang diagnostic pop\n#pragma clang diagnostic pop\n#pragma clang diagnostic pop\n#pragma clang diagnostic pop\n#pragma clang diagnostic pop\n\n@end\n</code></pre>\n<p>But this is obviously a horrible, horrible hack, and it can't stay in the code long term, even if it will theoretically &quot;fix&quot; an instance of the <code>AJRFoundation</code> <code>NSError</code> to refer to the correct one in <code>Foundation</code>.</p>\n<p>I would submit this to Apple's bug tracker, since the cause of the issue happened due to an upgrade in the tool chain, but the frameworks that reproduce this are rather large (about 26000 lines of code). If I can find out what's causing the issue, and it is a bug rather than something I'm doing wrong, I can hopefully make a smaller test case to submit.</p>\n"^^ . . . . . "0"^^ . . "1"^^ . . . . "0"^^ . "1"^^ . "<p>I have a flutter application which is an audio guide. But i have the audio files in many languages so i want to use on demand resources on the IOS side. I opened the Runner from the ios folder in Xcode and added the assets and gave them tags. The audio files are of the type wav.\n<a href="https://i.sstatic.net/evS65.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/evS65.png" alt="the tags" /></a><a href="https://i.sstatic.net/QXFx2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/QXFx2.png" alt="The asset folder" /></a>\nBut when requesting the images with the tag <code>german</code> i get no results.</p>\n<pre class="lang-swift prettyprint-override"><code>private func getDownloadRessources(tag: String, result: @escaping FlutterResult) {\n let resourceRequest = NSBundleResourceRequest(tags: [tag])\n resourceRequest.beginAccessingResources { (error: Error?) in\n if let error = error {\n // Handle the error.\n print(&quot;Error accessing resources: \\(error)&quot;)\n result(FlutterError(code: &quot;RESOURCE_ERROR&quot;, message: &quot;\\(error) tag:\\(tag)&quot;, details: error.localizedDescription))\n } else {\n guard let resourceURL = resourceRequest.bundle.url(forResource: nil, withExtension: &quot;wav&quot;) else {\n print(&quot;Resource not found for tag: \\(tag)&quot;)\n result(FlutterError(code: &quot;RESOURCE_NOT_FOUND&quot;, message: &quot;Resource not found for tag: \\(tag)&quot;, details: nil))\n return\n }\n print(&quot;Resource URL: \\(resourceURL.absoluteString)&quot;)\n result(resourceURL.absoluteString)\n }\n resourceRequest.endAccessingResources()\n }\n}\n</code></pre>\n<p>In the code i have the tag <code>german</code> which is given, but the <code>resourceRequest.bundle.url</code> does still not find the ressource audio.</p>\n<p>I tried to get the path of Bundle.main and looked there for the audio but that didn't work. I gave the name to the method and it did still not find it. I looked inside the path of the resourcerequest bundle but did still not find the audio files. I tried with the Bundle.main method but still no luck in finding the images.</p>\n"^^ . "1"^^ . . "swiftui"^^ . "<p>Are you using <a href="https://github.com/birkir/react-native-carplay" rel="nofollow noreferrer"><code>react-native-carplay</code></a> for your implementation?\nI was struggling with this topic for some time and added an <a href="https://github.com/birkir/react-native-carplay/pull/158" rel="nofollow noreferrer">example</a> with <a href="https://github.com/birkir/react-native-carplay/pull/158/files#diff-7acbeaeeab36010e6193c0a86a31c4000ef49f57d90aa94eac35b08ca32a2e3f" rel="nofollow noreferrer">documentation</a> on standalone CarPlay launch of react native apps as a pull request to that repo when I finally figured it out. Maybe it helps.</p>\n"^^ . "1"^^ . "-1"^^ . "0"^^ . "I agree @Larme I'm continuing to research a way to wait for completion of dismissal of the popover view controller."^^ . "<p>I have an objective-c project with an image file that I want to convert to base64 string, i don't want to convert it first to NSData and then use <code>base64EncodedStringWithOptions</code>, I want to read the file chunk by chunk. So I create this method:</p>\n<pre><code>-(NSString*) base64EncodeFileAtPath:(NSURL*)url with:(NSUInteger)chunkSize {\n NSMutableString *base64EncodedString = [[NSMutableString alloc] init];\n\n NSString * t = [url.absoluteString stringByReplacingOccurrencesOfString:@&quot;encrypted-file://&quot; withString:@&quot;&quot;];\n\n NSInputStream *inputStream = [NSInputStream inputStreamWithFileAtPath:t];\n if (!inputStream) {\n NSLog(@&quot;Unable to create input stream from file&quot;);\n return nil;\n }\n\n [inputStream open];\n\n @try {\n uint8_t *buffer = (uint8_t *)malloc(sizeof(uint8_t) * chunkSize);\n \n while ([inputStream hasBytesAvailable]) {\n @autoreleasepool {\n NSInteger bytesRead = [inputStream read:buffer maxLength:chunkSize];\n if (bytesRead &lt; 0) {\n NSError *readError = [inputStream streamError];\n if (readError) {\n NSLog(@&quot;Stream read error: %@&quot;, readError);\n }\n break;\n }\n \n NSData *dataBuffer = [NSData dataWithBytes:buffer length:bytesRead];\n \n NSString *base64Chunk = [dataBuffer base64EncodedStringWithOptions:0];\n [base64EncodedString appendString:base64Chunk];\n }\n }\n \n free(buffer);\n }\n @finally {\n [inputStream close];\n }\n\n return base64EncodedString;\n}\n</code></pre>\n<p>This is how i call the method:</p>\n<pre><code>[self base64EncodeFileAtPath:fileURL with:10 * 3600];\n</code></pre>\n<p>The problem is that when I want to decode the file back to the image I get an empty image, so I think that the encoding is broken, because when I use:</p>\n<pre><code>NSData* data = [[NSData alloc] initWithContentsOfURL:fileURL];\nNSString * value = [data base64EncodedStringWithOptions:0];\n</code></pre>\n<p>everything is ok, any idea what can be the problem?</p>\n<p>EDIT</p>\n<hr />\n<p>The fileUrl is linked to a file that was encrypted and maybe this is the problem</p>\n"^^ . . . "nsuserdefaults"^^ . "1"^^ . . "<p>You're re-adding <code>maskImage</code> and <code>maskNameLabel</code> again and again when cells are reused. Try to make it as sub-views of collection cell then reassign frame, color, image, text, etc. i.e:</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (void)viewDidLoad {\n ...\n //Register custom cell with nib\n [_maskGrid registerNib:[UINib nibWithNibName:NSStringFromClass([MaskCollectionViewCell class]) bundle:nil] forCellWithReuseIdentifier:@&quot;MaskCollectionViewCell&quot;];\n}\n\n- (nonnull __kindof UICollectionViewCell *)collectionView:(nonnull UICollectionView *)collectionView cellForItemAtIndexPath:(nonnull NSIndexPath *)indexPath {\n //Dequeu custom cell\n MaskCollectionViewCell *maskCell = [_maskGrid dequeueReusableCellWithReuseIdentifier:@&quot;MaskCollectionViewCell&quot; forIndexPath:indexPath];\n if (noColourFlag == 0) {\n ...\n maskCell.maskImage.image = maskImage2;\n } else {\n [maskCell.maskImage setImage:[UIImage imageNamed:maskName]];\n }\n //The same with maskNameLabel\n}\n</code></pre>\n<p>Notice: always handle <code>else</code> condition.</p>\n<p>This might be the cell layout:</p>\n<p><a href="https://i.sstatic.net/gnycK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gnycK.png" alt="enter image description here" /></a></p>\n"^^ . . "0"^^ . . "1"^^ . . . "0"^^ . "An event without `CGEventKeyboardSetUnicodeString` works for me."^^ . "swift"^^ . "Does XCTest methods generated dynamically by testInvocations work with xcodebuild's -only-testing?"^^ . . "0"^^ . . "0"^^ . . "0"^^ . "<p>Doesn't Apple simd module have a standard function for <a href="https://en.wikipedia.org/wiki/Outer_product" rel="nofollow noreferrer">outer product</a> of two vectors? I see it only has <code>dot_product</code> and <code>cross_product</code> for vectors.</p>\n<p>Using matrix representation of vectors for implementing outer product via matrix multiplication doesn't seem possible also since Apple simd doesn't support 1-dimensional matricies afaik.</p>\n<p>So the only way is to implement outer product themself? Not that it's hard, I just find it amusing that specialized vector library doesn't have outer product as a standard function.</p>\n<p>I use this implementation for now:</p>\n<pre class="lang-swift prettyprint-override"><code>func outer_product(_ a: float2, _ b: float2) -&gt; simd_float2x2 {\n simd_float2x2(a*b.x, a*b.y)\n}\n</code></pre>\n"^^ . "ios-frameworks"^^ . . . . . "0"^^ . . "0"^^ . . . . . "<p>After some digging, I found out that XCTest calls tests differently when <code>-only-testing MyTarget/MyClass/myTest</code> is passed. More specifically, the <a href="https://developer.apple.com/documentation/xctest/xctestcase/1496289-defaulttestsuite?language=objc" rel="nofollow noreferrer"><code>XCTestCase.defaultTestSuite</code></a> is not called when a single test is specified in <code>-only-testing</code>.</p>\n<p>XCTest framework checks if it can run the test passed in <code>-only-testing</code> by sending a message to <a href="https://developer.apple.com/documentation/objectivec/nsobject/1418555-instancesrespondtoselector" rel="nofollow noreferrer"><code>NSObject.instancesRespondToSelector:aSelector:</code></a> (<code>XCTestCase</code> of course inherits from <code>NSObject</code>) and checking what it returns. This seemed like a good hook point to call <code>defaultTestSuite</code> manually, which in turn calls <code>testInvocations</code>, which generates and swizzles-in test methods to the <code>ParametrizedTests</code> class.</p>\n<p>My <code>LandmarksTests</code> class was missing override of that selector. After I added it to my <code>ParametrizedTests</code> class:</p>\n<pre class="lang-objectivec prettyprint-override"><code>\n+ (BOOL)instancesRespondToSelector:(SEL)aSelector {\n [self defaultTestSuite]; // calls testInvocations\n BOOL result = [super instancesRespondToSelector:aSelector];\n return true;\n}\n</code></pre>\n<p>it started working fine!</p>\n<p>Here's the final file that can be copy-pasted into a file <code>ParametrizedTests.m</code> that is inside the <code>LandmarksUITests</code> UI Test Target and it works fine!</p>\n<pre class="lang-objectivec prettyprint-override"><code>@import XCTest;\n@import ObjectiveC.runtime;\n\n@interface ParametrizedTests : XCTestCase\n@end\n\n@implementation ParametrizedTests\n\n+ (BOOL)instancesRespondToSelector:(SEL)aSelector {\n [self defaultTestSuite]; // calls testInvocations\n BOOL result = [super instancesRespondToSelector:aSelector];\n return true;\n}\n\n+ (NSArray&lt;NSInvocation *&gt; *)testInvocations {\n NSLog(@&quot;testInvocations() called&quot;);\n\n /* Prepare dummy input */\n __block NSMutableArray&lt;NSString *&gt; *dartTestFiles = [[NSMutableArray alloc] init];\n [dartTestFiles addObject:@&quot;example_test&quot;];\n [dartTestFiles addObject:@&quot;permissions_location_test&quot;];\n [dartTestFiles addObject:@&quot;permissions_many_test&quot;];\n\n NSMutableArray&lt;NSInvocation *&gt; *invocations = [[NSMutableArray alloc] init];\n\n NSLog(@&quot;Before the loop, %lu elements in the array&quot;, (unsigned long)dartTestFiles.count);\n\n for (int i = 0; i &lt; dartTestFiles.count; i++) {\n /* Step 1 */\n\n NSString *name = dartTestFiles[i];\n\n void (^anonymousFunc)(ParametrizedTests *) = ^(ParametrizedTests *instance) {\n NSLog(@&quot;anonymousFunc called!&quot;);\n };\n\n IMP implementation = imp_implementationWithBlock(anonymousFunc);\n NSString *selectorStr = [NSString stringWithFormat:@&quot;%@&quot;, name];\n SEL selector = NSSelectorFromString(selectorStr);\n class_addMethod(self, selector, implementation, &quot;v@:&quot;);\n\n /* Step 2 */\n\n NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector];\n NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];\n invocation.selector = selector;\n\n NSLog(@&quot;RunnerUITests.testInvocations(): selectorStr = %@&quot;, selectorStr);\n\n [invocations addObject:invocation];\n }\n\n NSLog(@&quot;After the loop&quot;);\n\n return invocations;\n}\n\n@end\n</code></pre>\n<p>See also:</p>\n<ul>\n<li><a href="https://github.com/Quick/Quick/blob/ef9aaf3f634b3a1ab6f54f1173fe2400b36e7cb8/Sources/Quick/QuickSpec.swift#L51-L65" rel="nofollow noreferrer">how Quick framework overrides this method</a></li>\n</ul>\n"^^ . . . . . . . . "0"^^ . "1"^^ . . . "0"^^ . "<p>This code is a bit curious, possibly written by someone who did not entirely understand the purpose of the <code>weakSelf</code> pattern, much less the more complicated <code>weakSelf</code>/<code>strongSelf</code> pattern. Admittedly, these can be daunting to new programmers, and when Objective-C programmers first encounter blocks and strong reference cycles, they often start sprinkling weak references everywhere in their code. This looks suspiciously like that.</p>\n<p>So, let’s step back: We use <code>weakSelf</code> pattern in one of two scenarios:</p>\n<ol>\n<li><p>It is possible that <code>self</code> (the view controller) might be dismissed before the <code>dispatch_after</code> fires in 0.1 seconds; or</p>\n</li>\n<li><p>The use of the non-weak <code>self</code> might result in a strong reference cycle.</p>\n</li>\n</ol>\n<p>In this case, the first seems exceedingly unlikely (but we’d need to know more about the UI to be positive) and the second doesn’t seem applicable at all, as there is no apparent strong reference cycle risk here.</p>\n<p>Setting that aside, let’s discuss those scenarios where you would further complicate that <code>weakSelf</code> pattern with an additional <code>strongSelf</code> inside it (or two, in this case). We do either when:</p>\n<ol>\n<li><p>We need to use that “weak self” reference in some context where a null value would cause an error; or</p>\n</li>\n<li><p>You want to protect yourself against race conditions where you are doing steps A and B and “self” might conceivably become null in the intervening period, but that it is important that if you do A that you also do B.</p>\n</li>\n</ol>\n<p>Again, I am not sure if either of those scenarios apply here. It feels appears that the original programmer was reflexively inserting <code>weakSelf</code>/<code>strongSelf</code> pattern in their asynchronous patterns, possibly not understanding whether it was actually needed or not.</p>\n<hr />\n<p>Bottom line, when dealing with a large legacy codebase, I am not sure I would waste any time on this particular code snippet.</p>\n<p>To my eye, the entire usage of <code>weakSelf</code> looks completely unnecessary, but before you excise all of these <code>weakSelf</code>, <code>strongSelf</code>, and <code>strongSelf2</code> references, you would want to make sure that (a) there are no strong reference cycle risks (which I don’t see in the code that you’ve shared with us here); and (b) there are no scenarios where the view controller might be dismissed from some other mechanism not shown here.</p>\n<p>But, I do wonder if the above could be reduced to the following:</p>\n<pre class="lang-objectivec prettyprint-override"><code>dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n [self presentViewController:self.coverVC animated:NO completion:^{\n [self showWindowWithImage:NO];\n \n dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n [self dismissViewControllerAnimated:YES completion:^{\n self.coverVC = nil;\n [self hideWindow];\n }];\n });\n }];\n});\n</code></pre>\n<p>In short, just because you use a completion handler block, does not mean that you must use <code>weakSelf</code> pattern. We generally only do that when there is an actual strong reference cycle risk. I do not see any such risk here.</p>\n<p>But, if you contemplate this sort of change, you really need to test it to make sure you have not introduced any new strong reference cycles (i.e., use “debug memory graph” debugger feature) and/or contemplated some alternate flows where the view controller was dismissed prematurely. I am not sure all of this development overhead is warranted just to eliminate those three lines of code. And all of this is assuming that you hadn’t simplified the code in the preparation of the example, hiding some other subtle strong reference cycle risk that is not shown in your question.</p>\n<p>When dealing with legacy codebases, you have to weigh the benefit of the change against the development/testing overhead associated with that change. Personally, while the code screams “over-complicated” to me, I might ask whether this is the best use of your resources to validate the change.</p>\n"^^ . "0"^^ . . "Objective-C error message: Multiple methods named 'setBounds:' found with mismatched result, parameter type or attributes"^^ . "1"^^ . . . . "0"^^ . "Xcode linker is confusing symbols that should exist in Foundation as existing in another framework"^^ . "How to make CALayer adapt to the application appearance using drawlayer:inContext:?"^^ . . . . . "axuielement"^^ . . "0"^^ . . "0"^^ . "0"^^ . . . . . . . . . . "1"^^ . "mac-catalyst"^^ . . . . . . . . "3"^^ . "0"^^ . . "How do you decode? As with base64 encoding, there could be new lines inserted (depending on the size), padding, etc. If you compare the content, piece by piece, where does it start to differ?"^^ . . "There’s not enough here for us to reproduce the problem. I use `UITextView` with `dataDetectors` set to `.all` and it detects/calls phone numbers fine. Perhaps you can try doing this in a blank app and see if you can reproduce the problem there. Slowly add stuff to your new, blank project until you are able to reproduce the crash. And perhaps share details about the physical phone on which you are testing this (iOS version, model, etc.). But at this point, you do not appear to have shared any more information than you have in your [prior question](https://stackoverflow.com/q/77553442/1271826)."^^ . "<p>No, it's not possible for a class to know the name of a variable it's been assigned to. Keep in mind that you can assign one instance of <code>BNREmployee</code> (or any other class) to more than one variable.</p>\n<pre class="lang-objc prettyprint-override"><code>BNREmployee *bob = [BNREmployee new];\nBNREmployee *john = bob;\nNSLog(@&quot;employee = %@&quot;, bob);\nNSLog(@&quot;employee = %@&quot;, john);\n</code></pre>\n<p>In this case, how would the <code>description</code> method know the name? The one instance of the class has been assigned to two different variables.</p>\n<p>Relying on the variable name makes little sense. If you want the <code>BNREmployee</code> class to keep track of a name then you must add a <code>name</code> property to the class. That's the whole point of a class - to keep track of state/data.</p>\n<p>tl;dr - you can't do what you want. You must add a <code>name</code> property and optionally a custom <code>init</code> that lets you assign a name on creation.</p>\n"^^ . . "<p>I am trying to use <strong>NSTask</strong> to execute terminal commands using the <strong>standardInput</strong> and <strong>standardOutput</strong>. Everything works for commands like <strong>ls, pwd, etc.</strong> But When I try to run <strong>cd</strong> command, Standard output doesn't write any output. I understand that <strong>standardOutput</strong> won't write any data since cd command doesn't have any response to display. But Is there anyway to check if the command has run successfully? I need this as I am waiting for a response to update the UI. Below is my code. I am using NSFileHandleDataAvailableNotification to read the output as this helps with commands like <strong>ping</strong></p>\n<pre><code>-(void)setupTask {\n @autoreleasepool {\n // Commands are read from standard input:\n NSFileHandle *input = [NSFileHandle fileHandleWithStandardInput];\n \n NSPipe *inPipe = [NSPipe new]; // pipe for shell input\n NSPipe *outPipe = [NSPipe new]; // pipe for shell output\n NSPipe *errorPipe = [NSPipe new];\n \n task = [NSTask new];\n [task setLaunchPath:@&quot;/bin/sh&quot;];\n [task setStandardInput:inPipe];\n [task setStandardOutput:outPipe];\n [task setStandardError:errorPipe];\n \n [task launch];\n \n // Wait for standard input ...\n [input waitForDataInBackgroundAndNotify];\n // ... and wait for shell output.\n [[outPipe fileHandleForReading] waitForDataInBackgroundAndNotify];\n [[errorPipe fileHandleForReading] waitForDataInBackgroundAndNotify];\n \n \n // Wait asynchronously for standard input.\n // The block is executed as soon as some data is available on standard input.\n [[NSNotificationCenter defaultCenter] addObserverForName:NSFileHandleDataAvailableNotification\n object:input queue: [NSOperationQueue mainQueue]\n usingBlock:^(NSNotification *note)\n {\n NSData *inData = [input availableData];\n if ([inData length] == 0) {\n // EOF on standard input.\n [[inPipe fileHandleForWriting] closeFile];\n } else {\n // Read from standard input and write to shell input pipe.\n [[inPipe fileHandleForWriting] writeData:inData];\n \n // Continue waiting for standard input.\n [input waitForDataInBackgroundAndNotify];\n }\n }];\n \n // Wait asynchronously for shell output.\n // The block is executed as soon as some data is available on the shell output pipe.\n [[NSNotificationCenter defaultCenter] addObserverForName:NSFileHandleDataAvailableNotification\n object:[outPipe fileHandleForReading] queue:[NSOperationQueue mainQueue]\n usingBlock:^(NSNotification *note)\n {\n // Read from shell output\n NSData *outData = [[outPipe fileHandleForReading] availableData];\n if ([outData length] &gt; 0) {\n NSString *outStr = [[NSString alloc] initWithData:outData encoding:NSUTF8StringEncoding];\n NSLog(@&quot;Output: %@&quot;, outStr);\n }\n // Continue waiting for shell output.\n [[outPipe fileHandleForReading] waitForDataInBackgroundAndNotify];\n }];\n \n [[NSNotificationCenter defaultCenter] addObserverForName:NSFileHandleDataAvailableNotification\n object:[errorPipe fileHandleForReading] queue:[NSOperationQueue mainQueue]\n usingBlock:^(NSNotification *note)\n {\n // Read from shell output\n NSData *outData = [[errorPipe fileHandleForReading] availableData];\n if ([outData length] &gt; 0) {\n NSString *outStr = [[NSString alloc] initWithData:outData encoding:NSUTF8StringEncoding];\n NSLog(@&quot;Error: %@&quot;, outStr);\n }\n // Continue waiting for shell output.\n [[errorPipe fileHandleForReading] waitForDataInBackgroundAndNotify];\n }];\n }\n}\n\n-(void)executeCommand:(NSString*)command {\n \n NSData* data = [command dataUsingEncoding:NSUTF8StringEncoding];\n NSError* error;\n [[[task standardInput] fileHandleForWriting] writeData:data error:&amp;error];\n if (error != NULL) {\n NSLog(@&quot;%@&quot;, [error localizedDescription]);\n }\n \n NSData* newLine = [@&quot;\\n&quot; dataUsingEncoding:NSUTF8StringEncoding];\n [[[task standardInput] fileHandleForWriting] writeData:newLine error:&amp;error];\n if (error != NULL) {\n NSLog(@&quot;%@&quot;, [error localizedDescription]);\n }\n}\n\n-(void)runCommand {\n [self setupTask];\n [self executeCommand:@&quot;cd Users&quot;];\n}\n</code></pre>\n"^^ . . . . . . . . . "0"^^ . "0"^^ . . . "0"^^ . . "0"^^ . "0"^^ . . "Convert to UInt32 in Swift from NS_ENUM uint32_t in Objective-C"^^ . "Yes, I understand that is your problem. But it works fine for us. We can make calls or send the messages via the text view data detector. So we need more details about your configuration and/or show us the precise steps where we can reproduce your crash on our devices. It is hard to help you if we cannot reproduce it (or at least understand how your configuration differs from ours). Please edit the question to include more info. E.g., physical iPhone or simulator? What Xcode version? What macOS version? What iOS version? Etc."^^ . "0"^^ . . . "I defined using suite name for both do you see any issues with the code?"^^ . . . . . "0"^^ . . "0"^^ . . . . . "1"^^ . . . . . "Can NSUserDefaults work across different code bases?"^^ . . . . . . "0"^^ . "Yes, I have tried without CGEventKeyboardSetUnicodeString (By just putting in "a" in the previous API), that had no effect. Replacing s with あ works, but that is not what I am trying to do. I want to simulate keystrokes, so I want "a" to act as if that key was pressed, going through whatever language is configured (could be Chinese, Korean, etc.) To phrase it another way, I want my app to just do exactly what pressing "a" on a keyboard does."^^ . . . . . . . . . . "0"^^ . . . . "Is _itemGrid attached to its IBOutlet? I've noticed that you're dequeuing a cell using ivar: CollectionViewCell *cell1 = [_itemGrid dequeueReusableCellWithReuseIdentifier:@"cell1" forIndexPath:indexPath]; , and usually it is done by referring the collectionView param from delegate method like: CollectionViewCell *cell1 = [collectionView dequeueReusableCellWith... If your collection has dataSource set in NIB, but it's not attached to itemGrid outlet, your "number of cells" will return correct count, but dequeuing from nil collection will result to nil cell"^^ . . . . . . "How to find the Ressource Path/Ressource itself in swift with on demand resources"^^ . . . . . "0"^^ . "2"^^ . . "0"^^ . . . . . . "<p>I am using the Texture/AsyncDisplayKit library in an app for iOS and macOS Catalyst. It has this known issue on macOS:</p>\n<p><a href="https://github.com/TextureGroup/Texture/issues/1549" rel="nofollow noreferrer">https://github.com/TextureGroup/Texture/issues/1549</a></p>\n<p>It basically throws the error <code>Use of undeclared identifier 'CAEAGLLayer'</code> when building for macOS Catalyst. Error comes from this block of code:</p>\n<pre><code>// CAEAGLLayer\nif([[view.layer class] isSubclassOfClass:[CAEAGLLayer class]]){\n_flags.canClearContentsOfLayer = NO;\n}\n</code></pre>\n<p>If I comment this code out, then it builds successfully on macOS Catalyst.</p>\n<p>So, I figured that I could use the <code>TARGET_OS_IPHONE</code> macro to exclude this code when building for Catalyst:</p>\n<pre><code>#if TARGET_OS_IPHONE\n // CAEAGLLayer\n if([[view.layer class] isSubclassOfClass:[CAEAGLLayer class]]){\n _flags.canClearContentsOfLayer = NO;\n }\n#endif\n</code></pre>\n<p>However, Xcode still continues to attempt to build this code and then fails.</p>\n<p>Why is <code>#if TARGET_OS_IPHONE</code> not excluding this code on macOS Catalyst?</p>\n<p><strong>EDIT:</strong> While I did find a workaround solution from this link:</p>\n<p><a href="https://github.com/nickaroot/Texture/commit/05a486e3275de53f2b0dfb24925fa528e2b610e6" rel="nofollow noreferrer">https://github.com/nickaroot/Texture/commit/05a486e3275de53f2b0dfb24925fa528e2b610e6</a></p>\n<p>by using <code>#if !TARGET_OS_MACCATALYST</code> instead of <code>#if TARGET_OS_IPHONE</code>, I still want to know why my original way doesn't work? The <code>!</code> (not) way seems weird.</p>\n"^^ . . . "0"^^ . "Why is TARGET_OS_IPHONE not skipping over the code when building for Mac Catalyst?"^^ . . . "undefined-symbol"^^ . . "If you compare `value` & `base64EncodedString`, how much do they differ? Try by outputting only the n first characters, and go one?"^^ . "0"^^ . . . . "1"^^ . . . "html"^^ . . . . "0"^^ . "@HangarRash `WKContentView` is a private `UIView` subclass that has a getter `inputAccessoryView`. This getter is only implemented in the superclass `UIResponder`. I need, however, to change this implementation, but not for the entire `WKContentView` class, but merely for a single instance of it. I can not subclass this class directly since it's not exported from UIKit."^^ . . . . . "0"^^ . "2"^^ . . "Other than making the code look more complex, what is the downside of using the `weakSelf` pattern when it isn't needed?"^^ . . . "0"^^ . . "Convert image file to base64 string in chunks Objective-c"^^ . . "0"^^ . "0"^^ . . "<p>I usually use <code>[NSNull new</code>] if I want a <code>NSNull</code> object, but today I noticed that <code>NSNull</code> class provided a class method <code>[NSNull null] </code> to create a <code>NSNull</code> object.</p>\n<p>I wonder what is the difference between <code>[NSNull new]</code> and <code>[NSNull null]</code>? is it a wrong way to use <code>[NSNull new]</code> to create an <code>NSNull</code> object?</p>\n"^^ . "0"^^ . "<p>I'm trying to use a Swift class in a mostly Objective-C project. This revolves around <code>UIContentConfiguration</code> for use with <code>UITableViewCell</code>.</p>\n<p>Here's my Swift code:</p>\n<pre class="lang-swift prettyprint-override"><code>@objc class MyCellConfiguration: NSObject, UIContentConfiguration {\n let label: String\n\n @objc init(label: String) {\n self.label = label\n }\n\n func makeContentView() -&gt; UIView &amp; UIContentView {\n return MyCellContent(self)\n }\n\n func updated(for state: UIConfigurationState) -&gt; Self {\n return self\n }\n}\n\nclass MyCellContent: UIView, UIContentView {\n // Implementation of this class is not relevant to the question\n}\n</code></pre>\n<p>When I try to setup the cell in some Objective-C code, I get a compiler warning. If I ignore the warning, the app hangs at runtime when the code is reached.</p>\n<p>Here's the Objective-C code:</p>\n<pre class="lang-objective-c prettyprint-override"><code>#import &quot;MyApp-Swift.h&quot; // The bridging header is being imported\n\nUITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:key forIndexPath:indexPath];\n\nMyCellConfiguration *config = [[MyCellConfiguration alloc] initWithLabel:@&quot;Some Label&quot;];\ncell.contentConfiguration = config; // warning here\n</code></pre>\n<p>The compiler warning I receive is:</p>\n<blockquote>\n<p>Assigning to 'id&lt;UIContentConfiguration&gt; _Nullable' from incompatible type 'MyCellConfiguration *__strong'</p>\n</blockquote>\n<p>Why doesn't the compiler recognize that <code>MyCellConfiguration</code> conforms to the <code>UIContentConfiguration</code> protocol in the Objective-C code?</p>\n<p>Swift code recognizes the conformance just fine. For example, the following compiles without issue:</p>\n<pre class="lang-swift prettyprint-override"><code>let cell = UITableViewCell(style: .default, reuseIdentifier: &quot;foo&quot;)\ncell.contentConfiguration = MyCellConfiguration(label: &quot;foo&quot;)\n</code></pre>\n<p>I'm using Xcode 15.0 on macOS 13.6.1.</p>\n"^^ . . . . . "<pre><code>@implementation Circle\n\n- (void) setFillColor: (ShapeColor) c\n{\n fillColor = c;\n}\n\n- (void) setBounds: (ShapeRect) b\n{\n bounds = b;\n}\n\n- (void) draw\n{\n NSLog (@&quot;drawing a circle at (%d %d %d %d) in %@&quot;,\n bounds.x, bounds.y,\n bounds.width, bounds.height,\n colorName(fillColor));\n}\n\n@end // Circle\n\nvoid drawShapes (id shapes[], int count)\n{\n int i;\n for (i = 0; i &lt; count; i++) {\n id shape = shapes[i];\n [shape draw];\n }\n}\n\nint main (int argc, const char * argv[])\n{\n id shapes[1];\n ShapeRect rect0 = { 0, 0, 10, 30 };\n shapes[0] = [Circle new];\n [shapes[0] setBounds: rect0];\n [shapes[0] setFillColor: kRedColor];\n drawShapes (shapes, 1);\n return (0);\n}\n</code></pre>\n<p>I wrote this code block from the book called &quot;Learn Objective-C on the mac and I got the error message from the title and this error &quot;Passing '__strong id *' to parameter of type '__unsafe_unretained id *' changes retain/release properties of pointer&quot;</p>\n<p>As a warning, I got this &quot;Expression which evaluates to zero treated as a null pointer constant of type 'CGColorRef _Nullable' (aka 'struct CGColor *')&quot;</p>\n<p>I would like to know how can I solve that.\nHere is the &quot;@interface&quot;</p>\n<pre><code>@interface Circle : NSObject\n{\n \n ShapeColor fillColor;\n ShapeRect bounds;\n \n}\n- (void) setFillColor: (ShapeColor) fillColor;\n- (void) setBounds: (ShapeRect) bounds;\n- (void) draw;\n\n@end // Circle\n\n</code></pre>\n"^^ . "1"^^ . . "didn't know that was a thing. Always hated having to use NSStringWithFomat"^^ . "What is the difference between [NSNull new] and [NSNull null]?"^^ . . . "1"^^ . . . . . . . "<p>I want to show skip forward, skip backward, previous track, next track on the locked screen. But seems skip forward/backward will just override previous/next track. That is only skip forward and skip backward controls will appear on the locked screen. I tried reordering and it is the same effect.</p>\n<pre><code>- (void)setupRemoteTransportControls {\n // Get the shared MPRemoteCommandCenter\n [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];\n MPRemoteCommandCenter* commandCenter = [MPRemoteCommandCenter sharedCommandCenter];\n \n // Add handler for Play Command\n [commandCenter.playCommand setEnabled:YES];\n [commandCenter.playCommand addTarget:self action:@selector(playVideo)];\n //\n [commandCenter.pauseCommand setEnabled:YES];\n [commandCenter.pauseCommand addTarget:self action:@selector(pauseVideo)];\n \n //try put skip first\n //[commandCenter.skipBackwardCommand setEnabled:YES];\n //[commandCenter.skipBackwardCommand addTarget:self action:@selector(skipBackward)];\n \n //[commandCenter.skipForwardCommand setEnabled:YES];\n //[commandCenter.skipForwardCommand addTarget:self action:@selector(skipForward)];\n\n [commandCenter.previousTrackCommand setEnabled:YES];\n [commandCenter.previousTrackCommand addTarget:self action:@selector(prevTrack)];\n \n [commandCenter.nextTrackCommand setEnabled:YES];\n [commandCenter.nextTrackCommand addTarget:self action:@selector(nextTrack)];\n \n [commandCenter.skipBackwardCommand setEnabled:YES];\n [commandCenter.skipBackwardCommand addTarget:self action:@selector(skipBackward)];\n \n [commandCenter.skipForwardCommand setEnabled:YES];\n [commandCenter.skipForwardCommand addTarget:self action:@selector(skipForward)];\n \n [commandCenter.changePlaybackPositionCommand setEnabled:true];\n [commandCenter.changePlaybackPositionCommand addTarget:self action:@selector(changedThumbSliderOnLockScreen:)];\n \n [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];\n}\n\n</code></pre>\n"^^ . . . "2"^^ . . "@Larme good idea! there is a difference between the two, the new function is 76568 size and the base64EncodedStringWithOptions is 76544. Any idea what can cause it?"^^ . "1"^^ . . "@Alexander, no. Outer product of two vectors does form a matrix and it supports multiplication of vectors of different sizes. It's not much harder to implement then "point-wise multiplication", but it's not the same."^^ . "<p>I had a similar problem. In my case the problem was, when searching the .xcarchive file I noticed that the .framework file was not in</p>\n<blockquote>\n<p>/.xcarchive/Products/Library/Frameworks/</p>\n</blockquote>\n<p>but in</p>\n<blockquote>\n<p>/.xcarchive/Products/@rpath/</p>\n</blockquote>\n<p>You can either change this in your script for it to find your .framework file or change it in Xcode under Build Settings -&gt; Installation Directory</p>\n"^^ . . "<p>I let my user choose a font from their installed fonts, then use that font in three different contexts in my macOS app.</p>\n<ol>\n<li>The list of fonts itself uses <code>NSFontDescriptor</code> to create an attributed string, then displays that in the list of choices:</li>\n</ol>\n<pre><code> NSFontDescriptor *fontDescriptor = [NSFontDescriptor fontDescriptorWithName:@&quot;Candara&quot; size:14];\n NSDictionary *attributes = @{NSFontAttributeName: [NSFont fontWithDescriptor:fontDescriptor size:14]};\n attributedString = [[NSAttributedString alloc] initWithString:@&quot;New Attributed String&quot; attributes:attributes];\n</code></pre>\n<ol start="2">\n<li>In some places I have a very small HTML document where I set the body font to the selected font, convert to an attributed string, and display in an <code>NSTextField</code>.</li>\n</ol>\n<pre><code> NSString *htmlString = @&quot;&lt;!DOCTYPE html&gt;&quot;\n &quot;&lt;html&gt;&quot;\n &quot;&lt;head&gt;&quot;\n &quot;&lt;style&gt;&quot;\n &quot;body { font-family: 'Candara', serif; font-size: 14px; }&quot;\n &quot;&lt;/style&gt;&quot;\n &quot;&lt;/head&gt;&quot;\n &quot;&lt;body&gt;&quot;\n &quot;&lt;p&gt;Text with &lt;b&gt;bold&lt;/b&gt; or &lt;i&gt;italics&lt;/i&gt; maybe.&lt;/p&gt;&quot;\n &quot;&lt;/body&gt;&quot;\n &quot;&lt;/html&gt;&quot;;\n NSData *htmlData = [htmlString dataUsingEncoding:NSUTF8StringEncoding];\n NSDictionary *options = @{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,\n NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)};\n NSError *error;\n NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:htmlData\n options:options\n documentAttributes:nil\n error:&amp;error];\n</code></pre>\n<ol start="3">\n<li>Finally, I have places where I have longer HTML documents with the same font used as the body font and displayed in a <code>WKWebView</code>.</li>\n</ol>\n<p>This was all working well for years. When macOS 14 came along, what I find is that option 1 (initializing an <code>NSAttributedString</code> with some text using the Candara font) works fine, as does option 3 (displaying a lot of HTML that uses the Candara font in a <code>WKWebView</code>). But option 2 doesn't work at all. The output is all the &quot;undefined character&quot; glyph — a box containing a question mark, one for each character in the string.</p>\n<p>I'm seeing this behavior when the user selects Calibri or Candara, which are both Microsoft fonts. I'm also seeing it with SF Pro, which is an Apple font. Any other font is fine. (At least from what I've seen so far.)</p>\n<p>Providing a fallback font (as shown above with &quot;<code>serif</code>&quot;) doesn't change anything. The rendering does not fall back to the fallback font; it seems to really think it can use Candara when obviously it can't.</p>\n<p>This behavior very definitely appeared with the introduction of macOS 14, and mostly affects those who have chosen one of the Microsoft Office fonts (Calibri and Candara for sure). But as I said, other fonts can produce these results.</p>\n"^^ . . "nsattributedstring"^^ . . "0"^^ . . . . . "filehandle"^^ . . . . . "3"^^ . "1"^^ . "<p>I declare the variable <code>ue</code> in my global.h file as <code>Extern int ue;</code>. I have <code>#include &quot;global.h&quot;</code> on all view controllers where I want to use the variable. If I don't assign a value to <code>ue</code> my project builds and runs. If I assign a value to <code>ue</code> I get the following errors and the build fails;</p>\n<blockquote>\n<p>undefined symbol: _ue<br />\nLinker command failed with exit code 1 (use -v to see invocation)</p>\n</blockquote>\n<p>I have searched for the resolution and tried some suggestions, but I keep getting the same errors. I have declared multiple variables in &quot;global.h&quot; previously and had no issues.</p>\n"^^ . "0"^^ . . . . "1"^^ . . . . . . "0"^^ . "@Larme Adding a check to see if the presentingViewController == contentViewController seems to prevent the race condition and thus prevents the crash."^^ . . . "0"^^ . . . . "You can always test `[Utility topViewController] == volumeVC` before calling the method. For the rest, it's hard to tell I guess... You get the error by spamming the button to show the volume VC. Avoid spamming the button? Disable it if needed, or skip its action? Make a `completion` on your method to match the `completion:` of `presentViewController:animated:completion:`?"^^ . . . "FYI - It is standard practice to name classes, structs, and enums to start with uppercase letters and to name variables, functions, and cases to start with lowercase letters. Following those standards makes your code much easier to read."^^ . "It would be easier to get help on this if you provide a [mre]."^^ . . "0"^^ . . . . "Historically the integers from [-1 to 12 have been cached values](https://github.com/stevestreza/CoreFoundation/blob/38a055167790581012eabc29972f60f801efcd1a/CFNumber.c#L1014-L1017). (Which led to really mind-bending bug when working on a code-base that over-released "the number 4" so that the next time 4 showed up elsewhere in the system, it would crash...) Today they're often tagged pointers, so == will happen to work. https://alwaysprocessing.blog/2023/03/19/objc-tagged-ptr "@" literals (`@42`) are stored directly in the binary. So `@1` does not `==` `[NSNumber numberWithInt:1]`."^^ . "0"^^ . . "1"^^ . "The exception message says that you are associating your nib file with an instance of `UICollectionViewCell`not `CollectionViewCell`. You have probably messed up your "files owner" or something."^^ . "<p>By the documentation, <code>[... new]</code> equals <code>[[... alloc] init]</code> and creates and returns a new instance for any class that inherits from the <code>NSObject</code>.</p>\n<p><code>[NSNull null]</code> is a singleton instance that always returns the same instance which is the <code>kCFNull</code>. but if you see the documentation of the <code>NSNull</code>, you can see:</p>\n<blockquote>\n<p><code>NSNull</code> (itself) is a singleton object used to represent null values in collection objects that don’t allow nil values.</p>\n</blockquote>\n<p>So because of the nature of the <code>NSNull</code>, all of them are the same by the instance:</p>\n<pre><code>NSNull* null = [NSNull null];\nNSNull* init = [[NSNull alloc] init];\nNSNull* new = [NSNull new];\nNSNull* kcf = kCFNull;\n</code></pre>\n<p><img src="https://i.sstatic.net/BfbUF.png" alt="Demo" /></p>\n<p>Note how all of them are pointing to the exact same location</p>\n"^^ . . "0"^^ . "Can you provide some details about why you need to change the implementation of the readonly property for only a single instance of the class? Knowing what you are really trying to do can help you get better answers."^^ . . "1"^^ . . . . "macos-sonoma"^^ . . . . "<p>My app simply displays a phone number in a UITextView. I have made sure that the text view is enabled to detect phone numbers. And, indeed, when the user long presses on it, it will give the option to call or Send Message. If I click either one of these, the app simply crashes. As there is no code to handle anything and is just relying on built-in functionality, I get no error messages when the app crashes. The only thing remotely close I get is this:</p>\n<blockquote>\n<p>Updating selectors after delegate removal failed with: Error\nDomain=NSCocoaErrorDomain Code=4099 &quot;The connection to service with\npid 99 named com.apple.commcenter.coretelephony.xpc was invalidated\nfrom this process.&quot; UserInfo={NSDebugDescription=The connection to\nservice with pid 99 named com.apple.commcenter.coretelephony.xpc was\ninvalidated from this process.}</p>\n</blockquote>\n<p>&quot;Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.&quot;</p>\n<p>Desired behavior is after I click the checkmark in inspector for it to detect phone numbers, a user can long press the number, choose send message, and have it open messages. The specific problem is this crashes it. The shortest code necessary to reproduce the problem is to add a Textview, click it, and in inspector, tel it to detect phone numbers. There, does that help others answer the question?</p>\n<pre><code> cell.text = @&quot;555-867-5309&quot;;\n</code></pre>\n<p><a href="https://i.sstatic.net/5kQEc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5kQEc.png" alt="enter image description here" /></a></p>\n"^^ . . . "1"^^ . . . . . . . . "It isn't. The crash message tells you that."^^ . "ios-library"^^ . . "nstask"^^ . "Thanks @HangarRash I copied their code. I edited."^^ . "2"^^ . . . . . "It seems that the cell is of class `UICollectionViewCell` and not of the subclass `CollectionViewCell`"^^ . "0"^^ . . . "<p><code>extern</code> modifier means the value is assigned to variable in some other file, so you should not perform it in-place. There are two options to solve your issue.</p>\n<p>Option 1: Declare your variable in global.h as static instead of extern.</p>\n<pre><code>static int ue = 1;\n</code></pre>\n<p>Option 2: Create an Obj-C class with global.h and global.m files. Remove all contents (interface/implementation) from both files (you should only keep the <code>#import</code> directive in .m file). In your .h file declare an extern variable.</p>\n<pre><code>extern int ue;\n</code></pre>\n<p>In your .m file assign the value:</p>\n<pre><code>int ue = 1;\n</code></pre>\n"^^ . . "-1"^^ . . . . . . . . . . . "I tried to reproduce the issue and I get "Unknown type name 'Extern'; did you mean 'extern'?""^^ . "0"^^ . "-1"^^ . "Perhaps check for the task `terminationStatus` in its `terminationHandler`?"^^ . . "0"^^ . . . . . "<p>Since the upgrade from iOS 15 to iOS 17, my iPad app has been crashing when I try to display modal popovers with the following error and I am unable to resolve the issue:</p>\n<pre><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modal view controller on itself. Presenting controller is &lt;VolumeVC: 0x7fc81882c520&gt;.'\n</code></pre>\n<p>For context, I've been using the following utility class throughout my app to first get the top most view controller in the window so that I can then display a modal popover with a view controller in it.</p>\n<p><strong>Utility.m</strong></p>\n<pre><code>+ (UIViewController*)topViewController {\n \n UIViewController *topVC = [[UIApplication sharedApplication] keyWindow].rootViewController;\n NSLog(@&quot;Utility::topViewController(): topVC is: %@&quot;, topVC);\n \n int countLoops = 0;\n while (topVC.presentedViewController != nil) {\n topVC = topVC.presentedViewController;\n NSLog(@&quot;Utility::topViewController(): In loop, topVC is: %@, countLoops is: %i&quot;, topVC, countLoops);\n countLoops++;\n if (countLoops &gt; 25) { break; }\n } \n return topVC;\n}\n\n+ (void)showDialogiPad:(UIViewController *)contentVC\n fromPresentingVC:(UIViewController *)presentingVC\n inView:(UIView *)view\n atFrame:(CGRect)frame\n withDirection:(UIPopoverArrowDirection)direction {\n \n // Choose the presentation style in which the content is displayed in a popover view\n contentVC.modalPresentationStyle = UIModalPresentationPopover;\n \n // Set the popover size, anchor location and direction\n contentVC.popoverPresentationController.sourceRect = frame;\n contentVC.popoverPresentationController.sourceView = view;\n contentVC.popoverPresentationController.permittedArrowDirections = direction;\n \n // Set the arrow direction for the popover\n popoverVC.permittedArrowDirections = direction;\n \n // Present the popover presentation controller\n [presentingVC presentViewController:contentVC animated:YES completion:nil];\n}\n</code></pre>\n<p>An example of how this gets called from elsewhere in the code is the following:</p>\n<pre><code> // Show the volume view controller in a popover\n [Utility showDialogiPad:volumeVC // volumeVC is a simple view controller I want to show in the popup\n fromPresentingVC:[Utility topViewController]\n inView:view\n atFrame:frame\n withDirection:UIPopoverArrowDirectionAny];\n</code></pre>\n<p><strong>A few notes:</strong></p>\n<ul>\n<li>This code will work 1 to N times of opening &amp; closing the popover but it will always eventually crash as of iOS 17. The crash always seems to happen when I open and close the popover quickly in succession.</li>\n<li><code>frame</code> and <code>view</code> are always populated with the correct values, and <code>volumeVC</code> and <code>presentingVC</code> are always non-nil when I print them out in the <code>Utility::showDialogiPad</code> dialog method.</li>\n<li>When it crashes, the output of the debug statements in <code>+ (UIViewController*)topViewController</code> are:</li>\n</ul>\n<pre><code>Utility::topViewController(): topVC is: &lt;UITabBarController: 0x7fc22d81ae00&gt;\nUtility::topViewController(): In loop, topVC is: &lt;VolumeVC: 0x7fc22d01f460&gt;, countLoops is: 0\n</code></pre>\n<ul>\n<li>The main window of the app is a UITabBarController with a UISplitViewController in each tab.</li>\n<li>This app does not have multiple scenes in it nor does it use UIWindowScene.</li>\n<li>I know <code>keyWindow</code> is deprecated as of iOS 13. When I replace the <code>topViewController</code> code with the following:</li>\n</ul>\n<pre><code>+ (UIViewController*)topViewController {\n UIWindowScene *windowScene = (UIWindowScene *)[UIApplication sharedApplication].connectedScenes.allObjects.firstObject;\n UIViewController *topVC = windowScene.windows.firstObject.rootViewController; \n return topVC;\n}\n</code></pre>\n<p>It will work 1 to N times but eventually it will crash with this error:</p>\n<pre><code>*** Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController (&lt;UIPopoverPresentationController: 0x7ff05c156890&gt;) should have a non-nil sourceView or barButtonItem set before the presentation occurs.'\n</code></pre>\n<p>Thanks for any assistance with this.</p>\n"^^ . . . . "on-demand-resources"^^ . "0"^^ . . . "0"^^ . "0"^^ . "<React/RCTBridgeModule.h> file not found in Xcode 15"^^ . "Ah, I understand the issue now. Basically, the value is different for native macOS as compared to Catalyst macOS. Thanks."^^ . . . . . . . . . . "How to dynamically set a getter for an Objective-C object property?"^^ . "0"^^ . . "Creating keyboard events that interact with different language input methods"^^ . "<p>Your <code>ProgressBar</code> struct does not have any access to any instance members of <code>ContentView</code> or <code>CMWSTUploadViewV2Controller</code>. Just as <code>ContentView</code> does not have any access to any instance members of <code>CMWSTUploadViewV2Controller</code>.</p>\n<p><code>CMWSTUploadViewV2Controller.ContentView</code> should only declare the <code>publisherX</code> properties that it needs. Your <code>CMWSTUploadViewV2Controller.ContentView.ProgressBar</code> struct should declare its own <code>publisherX</code> properties as needed.</p>\n<p>In other words, move the declarations for <code>publisher5</code>, <code>publisher6</code>, and <code>publisher7</code> to be inside the <code>ProgressBar</code> struct instead of the <code>ContentView</code> struct.</p>\n<hr />\n<p>On a separate note, you should avoid hardcoding each of your notification names multiple times. It's too easy to make a typo for one of the names which will lead to a hard-to-find bug in your code. Define a constant for each notification name and use that constant in each place that it is needed.</p>\n"^^ . . "0"^^ . . "@Rob Xcode 15.0.1, macOS 14.1.1, iOS 17, minimum deployment iOS 15."^^ . "1"^^ . . . . "nsview"^^ . . "<p>Ok, worked out why this was happening and its kind of dumb. I had a search bar attached to my collection view and I couldn't correctly allocate the view as an outlet because whenever I dragged my viewcontroller to my collectionview it kept trying to attach to the search bar instead of the collection view. of course I didn't have an outlet for the search bar so it kept showing up at nothing to attach and as a result because it wasn't attached the code wasn't working properly. I removed the search bar and attached it correctly then it worked fine. Thanks for the help though guys.</p>\n"^^ . . "<p>I've been trying to get a collection view working properly in iOS.\nI've been following this question:\n<a href="https://stackoverflow.com/questions/40633613/how-to-create-custom-uicollectionviewcell">how to create custom UICollectionViewCell</a></p>\n<p>I think I have most of it correct, I'm using the tutorials custom cell class exactly (see the link for the code for that) but I keep running into an error when I access the view controller with the collection view.</p>\n<p>Here is my code:</p>\n<pre><code>#import &quot;BackPackController.h&quot;\n#import &quot;UICollectionViewCell+CollectionViewCell.h&quot;\n\n@interface BackPackController () &lt;UICollectionViewDelegate, UICollectionViewDataSource&gt;\n\n@end\n\n@implementation BackPackController\n\nNSArray *itemArray; //our item array\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n itemArray = [[NSUserDefaults standardUserDefaults] objectForKey:@&quot;PlayerItems&quot;]; //get the players items from the user defaults and make an array of them\n _itemGrid.delegate = self;\n _itemGrid.dataSource = self;\n //[_itemGrid setDataSource:self];\n //[_itemGrid registerClass:CollectionViewCell.self forCellWithReuseIdentifier:@&quot;cell1&quot;];\n\n}\n\n\n- (nonnull __kindof UICollectionViewCell *)collectionView:(nonnull UICollectionView *)collectionView cellForItemAtIndexPath:(nonnull NSIndexPath *)indexPath {\n NSLog(@&quot;Got this far&quot;);\n CollectionViewCell *cell1 = [_itemGrid dequeueReusableCellWithReuseIdentifier:@&quot;cell1&quot; forIndexPath:indexPath];\n [cell1.customLabel setText:itemArray[indexPath.row]];\n return cell1;\n \n}\n\n\n\n- (NSInteger)collectionView:(nonnull UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { \n return itemArray.count;\n \n}\n\n- (CGSize)collectionView:(UICollectionView *)collectionView layout: (UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{\n return CGSizeMake(100, 100);\n}\n</code></pre>\n<p>I have correctly attached the controller as delegate and data source as far as I know. the NSLog in the code above does print its message so I know that cellForItemAtIndexPath method is being called. However as soon as it is called I am getting this error back and I am struggling to understand exactly what is causing it:</p>\n<pre><code>2023-11-16 08:36:19.163928+1300 Matoran Quest[7698:1793467] *** Assertion failure in -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:], UICollectionView.m:3389\n2023-11-16 08:36:19.164525+1300 Matoran Quest[7698:1793467] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'the collection view's data source returned nil from -collectionView:cellForItemAtIndexPath: for index path &lt;NSIndexPath: 0x8db3e297ef8cf73e&gt; {length = 2, path = 0 - 0}'\n</code></pre>\n<p>The list that is being accessed is a simple list of strings and I know that it is functioning correctly as I am accessing it elsewhere without problems. I've tried changing the text being added to the cell to just @&quot;test&quot; but this changes nothing</p>\n"^^ . "0"^^ . "0"^^ . "0"^^ . . "0"^^ . . . . "0"^^ . . "base64"^^ . "0"^^ . "0"^^ . . "fonts"^^ . . . . . . "0"^^ . . . . "React Native App with implemented Carplay doesnt show content on carplay screen if IPhone App is terminated"^^ . "2"^^ . . . "Can't assign instance of a Swift class conforming to a protocol to an Objective-C property expecting that protocol"^^ . . . . "1"^^ . "0"^^ . . . "then why does it show up as collectionviewcell in the navigator in the 2nd picture? And why do the outlets connect to it?"^^ . "0"^^ . . . . "0"^^ . "Updated with some code."^^ . "Indeed, but it's rather a bandaid fix than a real fix."^^ . . . "1"^^ . "0"^^ . "You don't need to do anything with plist file, the AppGroup ID is unique already. Define UserDefault with suiteName (not standard) and get/set normally."^^ . . "Does this answer your question? [3 questions about extern used in an Objective-C project](https://stackoverflow.com/questions/7330048/3-questions-about-extern-used-in-an-objective-c-project)"^^ . "simd"^^ . . . "0"^^ . . "0"^^ . "2"^^ . . . . "Yes that is true and I know that. This question is about something non-related, it's how my PCH file is no longer applied to my ojective-c file."^^ . . "1"^^ . . . "1"^^ . "Store or copy AXUIElementRef from callback"^^ . . . . . "<p>Definitively this looks like a bug, some fonts exhibit the buggy behavior some don't. For example non-existing fonts, or maybe fonts with typos in names, work just file, the system falls back to the Times New Roman font.</p>\n<p>Printing a problematic attributed string outputs this:</p>\n<pre class="lang-none prettyprint-override"><code>&gt; po attributedString\n</code></pre>\n<pre class="lang-none prettyprint-override"><code>Text with bold or italics maybe.\n{\n NSFont = &quot;\\&quot;LastResort 14.00 pt. P [] (0x7ff575f14980) fobj=0x7ff575f14980, spc=16.06\\&quot;&quot;;\n NSKern = 0;\n NSParagraphStyle = &quot;Alignment Natural, LineSpacing 0, ParagraphSpacing 14, ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0, LineBreakMode WordWrapping, Tabs (\\n), DefaultTabInterval 36, Blocks (\\n), Lists (\\n), BaseWritingDirection LeftToRight, HyphenationFactor 0, TighteningForTruncation YES, HeaderLevel 0 LineBreakStrategy 0 PresentationIntents (\\n) ListIntentOrdinal 0 CodeBlockIntentLanguageHint ''&quot;;\n NSStrokeColor = &quot;sRGB IEC61966-2.1 colorspace 0 0 0 1&quot;;\n NSStrokeWidth = 0;\n}\n</code></pre>\n<p>For some fonts (or perhaps some string values), macOS falls back to <a href="https://en.wikipedia.org/wiki/Fallback_font#Apple.27s_Last_Resort_font" rel="nofollow noreferrer">Apple's Last Resort font</a> font. This is clearly the incorrect behaviour for some of the existing fonts, and this is why you see those odd glyphs, as macOS incorrectly maps the font to the <code>LastResort</code> one, instead to the specified font, or at least to the second font specified in the CSS rule.</p>\n"^^ . . "accelerate-framework"^^ . "0"^^ . . . . "0"^^ . . . "@Rob the problem isn’t that it doesn’t detect. It detects them fine. The system menu that gives options to call or send message pops up fine as well. The problem is that the whole thing crashes with no error given in console at all for why it crashed when selecting send message."^^ . "The terminationHandler is just a completion block that gets called when the task terminates. You can use that or maybe check if the task is still running and see if it terminated normally."^^ . . "May I suggest using modern Objective-C syntax. `cell.maskImage.image = maskImage2;` and no need for `NSStringWithFormat`. Just use `[UIImage imageNamed:maskName]`."^^ . . . "Can you clarify what you mean by "works"? If you do the character "a" do you see characters in other languages come up? If so, which languages have you tested with?"^^ . . "0"^^ . . . . . . . . . "<p>I have this code...</p>\n<p>Objective-c:</p>\n<pre><code>typedef NS_ENUM(uint32_t, EXType) {\n EXTypeBad = 0,\n EXTypeOK,\n EXTypeGood\n};\n\nEXType type = EXTypeOK;\n</code></pre>\n<p>Swift</p>\n<pre><code> UInt32(type)\n</code></pre>\n<p>But I get:</p>\n<blockquote>\n<p>initializer 'init(_:radix:)' requires that 'EXType' conform to\n'StringProtocol'\ntype: UInt32(type)</p>\n</blockquote>\n<p>What am I doing wrong? Thanks.</p>\n"^^ . . "If you moved the declaration of `publisher5` inside the `ProgressBar` struct then you can't be getting the same error. Update your question showing your updated `ProgressBar` struct and the exact complete new error message."^^ . . . . . . "1"^^ . . . "2"^^ . "0"^^ . . "2"^^ . . "2"^^ . "terminal"^^ . . "As mentioned in the previous command terminationHandler doesn't get called. I have tried it. I will be happy if you could show me a sample code with terminationHandler working for cd command along with above the code."^^ . . . "keyboard-events"^^ . . . . "FYI - Not directly related to your issue but `CAEAGLLayer` was deprecated back in iOS 12."^^ . . . . . "0"^^ . "0"^^ . "<p>I am trying to set up my Swift text and labels to work with notification center so what is displayed can be changed using an objective C file. My UpdateConnectionTypeText and UpdateStatusText works but I am getting the following errors for UpdateGreySubText, Text(&quot;Uploading memory model to controller&quot;): &quot;Instance member 'publisher5' of type 'ViewController.ContentView' cannot be used on instance of nested type 'ViewController.ContentView.ProgressBar'&quot;</p>\n<p>My Objective C code:</p>\n<pre><code>\n{\n UploadViewController* myView = [[UIStoryboard storyboardWithName:@&quot;MainStoryboard_iPhone&quot; bundle:nil] instantiateViewControllerWithIdentifier:@&quot;ID_VIEWV2_VIEW&quot;];\n // myView.delegate = self;\n [self presentViewController:myView animated:YES completion:^{\n [myView UpdateUploadProgressWithProgressValue:0.7];\n [myView UpdateInitialTextWithInitialTextParameter:@&quot;Initial text here&quot;];\n [myView UpdateAddressTextWithAddressTextParameter:@&quot;Address text here&quot;];\n [myView UpdateOrangeTextWithOrangeTextParameter:@&quot;Orange text here&quot;];\n [myView UpdateGreySubTextWithGreySubTextParameter:@&quot;Grey sub text here&quot;];\n [myView UpdateControllerTypeTextWithControllerTypeTextParameter:@&quot;Controller text here&quot;];\n [myView UpdateConnectionTypeTextWithConnectionTypeTextParameter:@&quot;Connection text here&quot;];\n [myView UpdateStatusTextWithStatusTextParameter:@&quot;Status text here&quot;];\n \n }];\n}\n</code></pre>\n<p>My Swift code:</p>\n<pre><code>\nimport Foundation\nimport SwiftUI\n\n@objc public protocol ViewDelegate: NSObjectProtocol {\n @objc func ButtonPushed()\n \n}\n\n@objc class ViewController: UIViewController {\n \n @IBOutlet var ProgressBarView: UIView!\n \n // embed SwiftUI into the UIKit storyboard view controller\n override func viewDidLoad() {\n super.viewDidLoad()\n \n let childView = UIHostingController(rootView: ContentView())\n addChild(childView)\n childView.view.frame = ProgressBarView.bounds\n ProgressBarView.addSubview(childView.view)\n childView.didMove(toParent: self)\n \n }\n \n @objc weak var delegate: ViewDelegate?\n \n //creating function for dictionary to store changes and create notification\n //This takes a value between 0 and 1 \n @objc func UpdateUploadProgress(progressValue: Float)\n {\n //First, we need to normalize the value which is between 0 and 0.99 to 0 and 0.8999996\n let normalizedValue = progressValue * 0.8999996\n let valueUpdate:[String: Float] = [&quot;ProgressValue&quot;: normalizedValue]\n NotificationCenter.default.post(name:NSNotification.Name(&quot;COM.WWW.UpdateText0&quot;), object: nil, userInfo:valueUpdate)\n }\n \n @objc func UpdateText1(Text1Parameter: String)\n {\n let textUpdate:[String: String] = [&quot;Text1Parameter&quot;: Text1Parameter]\n NotificationCenter.default.post(name:NSNotification.Name(&quot;COM.WWW.UpdateText1&quot;), object: nil, userInfo:textUpdate)\n }\n \n @objc func UpdateText2(AddressTextParameter: String)\n {\n let textUpdate:[String: String] = [&quot;Text2Parameter&quot;: Text2Parameter]\n NotificationCenter.default.post(name:NSNotification.Name(&quot;COM.WWW.UpdateText2&quot;), object: nil, userInfo:textUpdate)\n }\n \n @objc func UpdateText3(Text3Parameter: String)\n {\n let textUpdate:[String: String] = [&quot;Text3Parameter&quot;: Text3Parameter]\n NotificationCenter.default.post(name:NSNotification.Name(&quot;COM.WWW.UpdateText3&quot;), object: nil, userInfo:textUpdate)\n }\n \n @objc func UpdateText4(Text4Parameter: String)\n {\n let textUpdate:[String: String] = [&quot;Text4Parameter&quot;: Text4Parameter]\n NotificationCenter.default.post(name:NSNotification.Name(&quot;COM.WWW.UpdateText4&quot;), object: nil, userInfo:textUpdate)\n }\n \n \n @objc func UpdateText5(Text5Parameter: String)\n {\n let textUpdate:[String: String] = [&quot;TextParameter&quot;: Text5Parameter]\n NotificationCenter.default.post(name:NSNotification.Name(&quot;COM.WWW.UpdateText5&quot;), object: nil, userInfo:textUpdate)\n }\n \n @objc func UpdateText6(Text6Parameter: String)\n {\n let textUpdate:[String: String] = [&quot;TextParameter&quot;: Text6Parameter]\n NotificationCenter.default.post(name:NSNotification.Name(&quot;COM.WWW.UpdateText6&quot;), object: nil, userInfo:textUpdate)\n }\n \n @objc func UpdateText7(StatusTextParameter: String)\n {\n let textUpdate:[String: String] = [&quot;Text7Parameter&quot;: Text7Parameter]\n NotificationCenter.default.post(name:NSNotification.Name(&quot;COM.WWW.UpdateText7&quot;), object: nil, userInfo:textUpdate)\n }\n \n struct ContentView: View {\n //creating vars\n @State var progressValue: Float = 0.3\n //let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()\n @State private var degress: Double = -110\n @State var Text1 = &quot;&quot;\n let label = UILabel()\n @State var Text2 = &quot;&quot;\n @State var Text3 = &quot;&quot;\n @State var Text4 = &quot;&quot;\n @State var fourLinesText = &quot;More status text here. dlkfjglkdfjglkdfjglkdfjglk. This text will be 4 lines in length. 1234567891011121314151617181920. Controller responding. This text will be 4 lines in length. 1234567891011121314151617181920. Controller responding. This text will be 4 lines in length. 1234567891011121314151617181920&quot;\n @State var Text5 = &quot;&quot;\n \n //setting up notification center to listen to addresses\n let publisher = NotificationCenter.default.publisher(for: NSNotification.Name(&quot;COM.WWW.UpdateText0&quot;))\n let publisher8 = NotificationCenter.default.publisher(for: NSNotification.Name(&quot;COM.WWW.UpdateText1&quot;))\n let publisher6 = NotificationCenter.default.publisher(for: NSNotification.Name(&quot;COM.CMW.COM.WWW.UpdateText2&quot;))\n let publisher7 = NotificationCenter.default.publisher(for: NSNotification.Name(&quot;COM.WWW.UpdateText3&quot;))\n let publisher5 = NotificationCenter.default.publisher(for: NSNotification.Name(&quot;COM.WWW.UpdateText4&quot;))\n let publisher2 = NotificationCenter.default.publisher(for: NSNotification.Name(&quot;COM.WWW.UpdateText5&quot;))\n let publisher3 = NotificationCenter.default.publisher(for: NSNotification.Name(&quot;COM.WWW.UpdateText6&quot;))\n let publisher4 = NotificationCenter.default.publisher(for: NSNotification.Name(&quot;COM.WWW.UpdateText7&quot;))\n \n //display\n var body: some View {\n VStack {\n Spacer()\n .frame(height: 70)\n \n if #available(iOS 16.0, *) {\n Label(&quot;Resetting to upload mode.&quot;, systemImage: &quot;icon&quot;)\n .font(.title)\n .foregroundColor(Color(hex: &quot;000&quot;))\n .fontWeight(.bold)\n .onReceive(publisher8) { obj in\n let statusTextVal = obj.userInfo?[&quot;Text0Parameter&quot;] as? String\n fourLinesText = Text0Val!\n }\n\n } else {\n // Fallback on earlier versions\n Label(&quot;Resetting to upload mode.&quot;, systemImage: &quot;icon&quot;)\n .font(.title)\n .foregroundColor(Color(hex: &quot;000&quot;))\n }\n \n \n ZStack{\n //background rectangle\n RoundedRectangle(cornerRadius: 25)\n .fill(Color(hex: &quot;494949&quot;))\n .frame(width: 300, height: 300)\n \n ProgressBar(progress: self.$progressValue)\n .frame(width: 250.0, height: 250.0)\n .padding(40.0)\n .onReceive(publisher) { obj in\n let progVal = obj.userInfo?[&quot;ProgressValue&quot;] as? Float\n progressValue = progVal!\n }\n \n ProgressBarTriangle(progress: self.$progressValue).frame(width: 280.0, height: 290.0).rotationEffect(.degrees(degress), anchor: .bottom)\n .offset(x: 0, y: -150)\n }\n \n \n Spacer()\n .frame(height: 20)\n VStack(alignment :.leading, spacing: 30) {\n HStack {\n if #available(iOS 16.0, *) {\n Label(&quot;text:&quot;, image: &quot;Icon&quot;)\n .foregroundColor(Color(hex: &quot;000&quot;))\n .fontWeight(.bold)\n } else {\n // Fallback on earlier versions\n Label(&quot;Controller type:&quot;, image: &quot;Icon&quot;)\n .foregroundColor(Color(hex: &quot;000&quot;))\n }\n Text(Text1)\n //app crashes when following code active:\n //onReceive(publisher2) { obj in\n //let Text1Val = obj.userInfo?[&quot;Text1Parameter&quot;] as? String\n //Text1 = Text1Val!\n //}\n }\n \n HStack {\n if #available(iOS 16.0, *) {\n Label(&quot;text:&quot;, image: &quot;Icon&quot;)\n .foregroundColor(Color(hex: &quot;000&quot;))\n .fontWeight(.bold)\n } else {\n // Fallback on earlier versions\n Label(&quot;text:&quot;, image: &quot;IconSmall&quot;)\n .foregroundColor(Color(hex: &quot;000&quot;))\n }\n Text(Text2)\n .onReceive(publisher3) { obj in\n let Text2Val = obj.userInfo?[&quot;Text2Parameter&quot;] as? String\n Text2 = connectionTextVal!\n }\n }\n \n HStack {\n if #available(iOS 16.0, *) {\n Label(&quot;text:&quot;, image: &quot;Icon&quot;)\n .foregroundColor(Color(hex: &quot;000&quot;))\n .fontWeight(.bold)\n } else {\n // Fallback on earlier versions\n Label(&quot;text:&quot;, image: &quot;Icon&quot;)\n .foregroundColor(Color(hex: &quot;000&quot;))\n }\n \n }\n \n //four lines of status text\n Text(fourLinesText)\n .foregroundColor(Color(hex: &quot;000&quot;))\n .lineLimit(4)\n .multilineTextAlignment(.leading)\n .onReceive(publisher4) { obj in\n let Text3Val = obj.userInfo?[&quot;Text3Parameter&quot;] as? String\n fourLinesText = Text3Val!\n }\n \n Spacer()\n }\n .padding(.leading, 20)\n .padding(.trailing, 20)\n }\n }\n \n public struct ProgressBar: View {\n //creating vars\n @Binding var progress: Float\n @State var addressText = &quot;00000&quot;\n @State var orangeText = &quot;Orange Text&quot;\n \n public func UpdateProgressValue(progressValue: Float)\n {\n progress = progressValue\n }\n \n var body: some View {\n \n VStack (alignment :.center, spacing: 30){\n HStack {\n Label(&quot;Address:&quot;, systemImage: &quot;target&quot;)\n .foregroundColor(Color(hex: &quot;8f8f8f&quot;))\n .padding(.top, 15)\n Text(addressText)\n .foregroundColor(Color(hex: &quot;8f8f8f&quot;))\n .padding(.top, 15)\n //.onReceive(publisher6) { obj in\n //let addressTextVal = obj.userInfo?[&quot;AddressTextParameter&quot;] as? String\n //addressText = addressTextVal!\n //}\n }\n ZStack {\n \n Circle()\n .trim(from: 0.35, to: 0.85)\n .stroke(style: StrokeStyle(lineWidth: 12.0, lineCap: .round, lineJoin: .round))\n .opacity(0.3)\n .foregroundColor(Color.gray)\n .rotationEffect(.degrees(54.5))\n \n Circle()\n .trim(from: 0.35, to: CGFloat(self.progress))\n .stroke(style: StrokeStyle(lineWidth: 12.0, lineCap: .round, lineJoin: .round))\n .fill(AngularGradient(gradient: Gradient(stops: [\n .init(color: Color.init(hex: &quot;daff00&quot;), location: 0.39000002),\n .init(color: Color.init(hex: &quot;00ff04&quot;), location: 0.5999999),\n .init(color: Color.init(hex: &quot;32E1A0&quot;), location: 0.8099997)]), center: .center))\n .rotationEffect(.degrees(54.5))\n \n VStack(alignment :.center, spacing: 10) {\n \n Text(&quot;824&quot;).font(Font.system(size: 44)).bold().foregroundColor(Color.init(hex: &quot;ffffff&quot;))\n \n if #available(iOS 16.0, *) {\n Label(orangeText, systemImage: &quot;clock&quot;)\n .foregroundColor(Color(hex: &quot;FF6600&quot;))\n .fontWeight(.bold)\n //.onReceive(publisher7) { obj in\n //let statusTextVal = obj.userInfo?[&quot;Text5Parameter&quot;] as? String\n //orangeText = statusTextVal!\n //}\n } else {\n // Fallback on earlier versions\n Label(orangeText, systemImage: &quot;clock&quot;)\n .foregroundColor(Color(hex: &quot;FF6600&quot;))\n //.onReceive(publisher7) { obj in\n //let statusTextVal = obj.userInfo?[&quot;Text5Parameter&quot;] as? String\n //orangeText = statusTextVal!\n //}\n }\n \n Text(&quot;Uploading memory model to controller&quot;)\n .foregroundColor(Color(hex: &quot;8f8f8f&quot;))\n .multilineTextAlignment(.center)\n .onReceive(publisher5) { obj in\n let GreySubTextVal = obj.userInfo?[&quot;Text4Parameter&quot;] as? String\n connectionTypeText = GreySubTextVal!\n }\n \n }\n }\n \n }\n \n }\n \n }\n \n struct ProgressBarTriangle: View {\n @Binding var progress: Float\n \n \n var body: some View {\n ZStack {\n Image(&quot;triangle&quot;).resizable().frame(width: 10, height: 10, alignment: .center)\n }\n }\n }\n }\n \n struct ContentView_Previews: PreviewProvider {\n static var previews: some View {\n ContentView()\n }\n }\n}\n extension Color {\n init(hex: String) {\n let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)\n var int: UInt64 = 0\n Scanner(string: hex).scanHexInt64(&amp;int)\n let a, r, g, b: UInt64\n switch hex.count {\n case 3: // RGB (12-bit)\n (a, r, g, b) = (255, (int &gt;&gt; 8) * 17, (int &gt;&gt; 4 &amp; 0xF) * 17, (int &amp; 0xF) * 17)\n case 6: // RGB (24-bit)\n (a, r, g, b) = (255, int &gt;&gt; 16, int &gt;&gt; 8 &amp; 0xFF, int &amp; 0xFF)\n case 8: // ARGB (32-bit)\n (a, r, g, b) = (int &gt;&gt; 24, int &gt;&gt; 16 &amp; 0xFF, int &gt;&gt; 8 &amp; 0xFF, int &amp; 0xFF)\n default:\n (a, r, g, b) = (1, 1, 1, 0)\n }\n \n self.init(\n .sRGB,\n red: Double(r) / 255,\n green: Double(g) / 255,\n blue: Double(b) / 255,\n opacity: Double(a) / 255\n )\n }\n \n }\n</code></pre>\n"^^ . . . . . "5"^^ . "xctest"^^ . . . . . "did you check if `cell1` is null in the cellForItem method ?"^^ . . . "@Larme I think you are correct about the race condition. It looks like the view controller ("volumeVC") has not been dismissed completely by the time I try to present it again - so "volumeVC" incorrectly becomes the top most view controller as I am trying to present it again. Are there ways to wait for the view controller to be completely dismissed in the completion block?"^^ . "2"^^ . "0"^^ . . "Apple simd: outer product of two vectors"^^ . . . "2"^^ . "0"^^ . "0"^^ . . . . . . . "1"^^ . . . "0"^^ . . . . . . . "1"^^ . . . "0"^^ . "0"^^ . . "0"^^ . "0"^^ . . . . "0"^^ . "Other fonts seem to behave in a similar manner, `Proxima Nova` doesn't work either, at least not on my side."^^ . "<p>I've been working with a static library in iOS written in Swift. Below is the script I've been using to build the library into a fat framework (universal).</p>\n<pre><code># Type a script or drag a script file from your workspace to insert its path.\n\n#1. After then, make a fresh directory directory \n\nUNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal\n\n# make sure the output directory exists\n\nmkdir -p &quot;${UNIVERSAL_OUTPUTFOLDER}&quot;\n\n# 2. Copy Device (arm64) Framework to a fresh universal folder location \n\ncp -a &quot;${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework&quot; &quot;${UNIVERSAL_OUTPUTFOLDER}/&quot;\n\n#3. Copy Sim (x86_64) Frameworks's &quot;MyFramework.swiftmodule&quot; folder content and paste it in Fat (x86_64 + arm64) Frameworks's &quot;MyFramework.swiftmodule&quot; folder.\n\nSIMULATOR_SWIFT_MODULES_DIR=&quot;${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule/.&quot;\n\nif [ -d &quot;${SIMULATOR_SWIFT_MODULES_DIR}&quot; ]; then\n\ncp -R &quot;${SIMULATOR_SWIFT_MODULES_DIR}&quot; &quot;${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule&quot;\n\nfi\n\n# Step 4: Create universal binary file using lipo and place the combined executable in the copied framework directory\n\nlipo -create -output &quot;${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}&quot; &quot;${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}&quot; &quot;${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}&quot;\n\n# Step 5: Copy output to the project directory.\n\ncp -R &quot;${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework&quot; &quot;${PROJECT_DIR}&quot;\n\n# Step 6: Open Project Directory\n\nopen &quot;${PROJECT_DIR}&quot;#1. After then, make a fresh directory directory \n\nUNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal\n\n# make sure the output directory exists\n\nmkdir -p &quot;${UNIVERSAL_OUTPUTFOLDER}&quot;\n\n# 2. Copy Device (arm64) Framework to a fresh universal folder location \n\ncp -a &quot;${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework&quot; &quot;${UNIVERSAL_OUTPUTFOLDER}/&quot;\n\n#3. Copy Sim (x86_64) Frameworks's &quot;MyFramework.swiftmodule&quot; folder content &amp; paste it in Fat(x86_64 + arm64) Frameworks's &quot;MyFramework.swiftmodule&quot; folder.\n\nSIMULATOR_SWIFT_MODULES_DIR=&quot;${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule/.&quot;\n\nif [ -d &quot;${SIMULATOR_SWIFT_MODULES_DIR}&quot; ]; then\n\ncp -R &quot;${SIMULATOR_SWIFT_MODULES_DIR}&quot; &quot;${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule&quot;\n\nfi\n\n# Step 4: Create universal binary file using lipo and place the combined executable in the copied framework directory\n\nlipo -create -output &quot;${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}&quot; &quot;${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}&quot; &quot;${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}&quot;\n\n# Step 5: Copy output to the project directory.\n\ncp -R &quot;${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework&quot; &quot;${PROJECT_DIR}&quot;\n\n# Step 6. Open Project Directory\n\nopen &quot;${PROJECT_DIR}&quot;\n</code></pre>\n<p>When integrated with a Swift app, the library works seamlessly for both the simulator and the device. However, I'm encountering an issue when trying to use the library in an Objective-C app on the simulator. The error message states &quot;unsupported Swift architecture.&quot; Strangely, it works fine on the device.</p>\n<p>If anyone could provide assistance with this issue, I would greatly appreciate it. Thanks in advance.</p>\n"^^ . "0"^^ . . "0"^^ . . "1"^^ . . "<p>What is chunkSize? Base64 increases original size at 4/3 rounded up. So if yours chunkSize is not divided at 3, result will have dummy characters. To avoid dummy characters in the result you should use chunkSize dividable to 3.</p>\n"^^ . "objective-c-runtime"^^ . "Agreed. You certainly should use `isEqual:` in general and only use `==` when you specifically want to compare pointers. It's odd that using `==` is common for `NSNull`. I found a post about `==` vs `isEqual:` for `NSNull` at [Testing equality to NSNull](https://stackoverflow.com/questions/16600350/testing-equality-to-nsnull). BTW - `NSNumber`, as I recall, returns constants for the numbers 0 - 9, possibly others. I guess it's an optimization."^^ . . . "0"^^ . "That answer is not saying to define `TARGET_OS_IPHONE` as `0`. That answer is pointing out than when you build a native macOS app (not using Mac Catalyst), that `TARGET_OS_IPHONE` will be defined as `0` for you in TargetConditionals.h. I didn't mention that case because your question was about Mac Catalyst, not a pure native macOS app."^^ . . "My Framework's PCH file isn't applied after adding a Swift file to the project, Podfile"^^ . . "99% of the code that you have in `cellForItemAtIndexPath` should be in your custom cell class. The only code in `cellForItemAtIndexPath` should be giving data to the cell."^^ . . . . "4"^^ . "[<UICollectionViewCell 0x14fd06a80> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key"^^ . "I think for this basic questions can answer Stackoverlow's AI: https://stackoverflow.com/ai/search"^^ . "0"^^ . . "Did you try using `setValue(_:forKey:)`? I don't know if that will work in this case but it's easy to try. And please update your question with the details you put in that comment. It makes the information easier to find in your question."^^ . . . . . . . . . . . "mpremotecommandcenter"^^ . . . . . . "uitabbarcontroller"^^ . "1"^^ . . . . . . "0"^^ . "1"^^ . "@Rob out of curiosity, if I did need each of the strongSelf cases (i.e. if the code were different and the need was actually there), would it be proper to simply use the original strongSelf inside the second level of the nested block? I think this shows my understanding is still... weak. But I am trying."^^ . . . . . "1"^^ . . . . . "properties"^^ . . . "0"^^ . . . "<p>I have an app which needs to dynamically generate test methods in its <code>XCTestCase</code> subclass. I'm using <code>+(NSArray&lt;NSInvocation*&gt;*)testInvocations</code> to dynamically generate test methods at runtime with the following (dummy) names: <code>example_test</code>, <code>permissions_location_test</code> and <code>permissions_many_test</code>. Below is a simplified, ready-to-be-pasted-into-Xcode code.</p>\n<pre class="lang-objectivec prettyprint-override"><code>@import XCTest;\n@import ObjectiveC.runtime;\n\n@interface ParametrizedTests : XCTestCase\n@end\n\n@implementation ParametrizedTests\n+ (NSArray&lt;NSInvocation *&gt; *)testInvocations {\n NSLog(@&quot;testInvocations() called&quot;);\n\n /* Prepare dummy input */\n __block NSMutableArray&lt;NSString *&gt; *dartTestFiles = [[NSMutableArray alloc] init];\n [dartTestFiles addObject:@&quot;example_test&quot;];\n [dartTestFiles addObject:@&quot;permissions_location_test&quot;];\n [dartTestFiles addObject:@&quot;permissions_many_test&quot;];\n\n NSMutableArray&lt;NSInvocation *&gt; *invocations = [[NSMutableArray alloc] init];\n\n NSLog(@&quot;Before the loop, %lu elements in the array&quot;, (unsigned long)dartTestFiles.count);\n\n for (int i = 0; i &lt; dartTestFiles.count; i++) {\n /* Step 1 */\n\n NSString *name = dartTestFiles[i];\n\n void (^anonymousFunc)(ParametrizedTests *) = ^(ParametrizedTests *instance) {\n NSLog(@&quot;anonymousFunc called!&quot;);\n };\n\n IMP implementation = imp_implementationWithBlock(anonymousFunc);\n NSString *selectorStr = [NSString stringWithFormat:@&quot;%@&quot;, name];\n SEL selector = NSSelectorFromString(selectorStr);\n class_addMethod(self, selector, implementation, &quot;v@:&quot;);\n\n /* Step 2 */\n\n NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector];\n NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];\n invocation.selector = selector;\n\n NSLog(@&quot;RunnerUITests.testInvocations(): selectorStr = %@&quot;, selectorStr);\n\n [invocations addObject:invocation];\n }\n\n NSLog(@&quot;After the loop&quot;);\n\n return invocations;\n}\n\n@end\n</code></pre>\n<p>I can run all these tests at once using:</p>\n<pre><code>xcodebuild test \\\n -scheme Landmarks \\\n -destination 'platform=iOS Simulator,name=iPhone 15'\n</code></pre>\n<p>Excerpt from above command's stdout:</p>\n<pre><code>Test Suite 'Selected tests' passed at 2023-11-16 13:44:59.148.\n Executed 3 tests, with 0 failures (0 unexpected) in 0.246 (0.248) seconds\n</code></pre>\n<h3>Problem</h3>\n<p>The problem I'm facing now is that I cannot select just one test to run using <code>xcodebuild</code>'s <code>-only-testing</code> flag. For example:</p>\n<pre><code>xcodebuild test \\\n -scheme Landmarks \\\n -destination 'platform=iOS Simulator,name=iPhone 15' \\\n -only-testing 'LandmarksUITests/ParametrizedTests/example_test'\n</code></pre>\n<p>does not work - no tests are executed:</p>\n<pre><code>Test Suite 'ParametrizedTests' passed at 2023-11-16 13:45:58.472.\n Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds\n</code></pre>\n<p>I also tried doing:</p>\n<pre><code>xcodebuild test \\\n -scheme Landmarks \\\n -destination 'platform=iOS Simulator,name=iPhone 15' \\\n -only-testing 'LandmarksUITests/ParametrizedTests/testInvocations'\n</code></pre>\n<p>but the result is the same.</p>\n<p>So the question is: <strong>how can I select a subset of tests (that were generated dynamically at runtime using testInvocations) with the -only-testing option?</strong>. Is is even possible?</p>\n"^^ . . . "iOS 17 crash with presenting modal view controller on itself using deprecated keyWindow"^^ . . . . "0"^^ . . . . "0"^^ . . "0"^^ . . "0"^^ . . . "<p>I have an iPhone 12 Pro and I wrote code to access two cameras at same time. But it is only possible with the widecamera and frontcamera. Widecamera and ultrawide cameras at same time do not work. Do you know if it is possible with an iPhone 15 Pro? I use the functions with AVCaptureMultiCamSession.</p>\n<p>I have tried it with AVCaptureMultiCamSession on iPhone 12 Pro.</p>\n"^^ . . . "2"^^ . . . . "<p>I've been working on a collection game using apple maps in Objective C. Each item you collect appears in a uicollectionview. it works perfectly fine until you get around 15 or so and have to start scrolling down the view, then I get this weird stacking effect seen in the picture. The kanohi found variable is working correctly and there are 21 cells there for 21 items.\nHere is my code (or at least the important bits):</p>\n<pre><code>//\n// wallOfMasksController.m\n// Matoran Quest\n//\n// Created by Job Dyer on 12/11/23.\n//\n\n#import &quot;wallOfMasksController.h&quot;\n#import &quot;UICollectionViewCell+CollectionViewCell.h&quot;\n\n@interface wallOfMasksController ()&lt;UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout&gt;\n\n@end\n\n@implementation wallOfMasksController\n\nNSArray *maskArray; //our mask array\nNSArray *selectedMaskArray; //the mask we want to know more about\nUIImage *maskImage2; //the colourized mask image\nUIImage *outPutMask; //the mask we take to the individual mask viewer\nNSMutableArray *imagesInCollection; //an array of all the images\nNSMutableArray *collectedMasks2; //a list of the kinds of masks the player has collected. 1 entry for each unique kind of mask (colour as well as type)\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n maskArray = [[NSUserDefaults standardUserDefaults] objectForKey:@&quot;PlayerMasks&quot;]; //get the players masks from the user defaults and make an array of them\n //NSLog(@&quot;monkey: %@&quot;, [[NSUserDefaults standardUserDefaults] objectForKey:@&quot;PlayerMasks&quot;]);\n _maskGrid.delegate = self;\n _maskGrid.dataSource = self;\n //NSLog(@&quot;%@&quot;, maskArray);\n [_maskCount setText:[NSString stringWithFormat:@&quot;Kanohi found: %d&quot;, (int)maskArray.count]]; // how many masks do we have?\n imagesInCollection = [[NSMutableArray alloc] init];\n \n collectedMasks2 = [[NSUserDefaults standardUserDefaults] objectForKey:@&quot;PlayerMaskCollectionList&quot;];\n if(collectedMasks2 == NULL){ //if there is no player masks collection key yet\n collectedMasks2 = [[NSMutableArray alloc] init];\n //NSLog(@&quot;refreshing2&quot;);\n [[NSUserDefaults standardUserDefaults] setObject:collectedMasks2 forKey:@&quot;PlayerMaskCollectionList&quot;]; //set it if it doesnt exist\n \n }\n [_collectionCount setText:[NSString stringWithFormat: @&quot;Collection: %d/183&quot;, (int)collectedMasks2.count]];\n}\n\n\n- (nonnull __kindof UICollectionViewCell *)collectionView:(nonnull UICollectionView *)collectionView cellForItemAtIndexPath:(nonnull NSIndexPath *)indexPath {\n //NSLog(@&quot;Got this far&quot;);\n CollectionViewCell *cell3 = [_maskGrid dequeueReusableCellWithReuseIdentifier:@&quot;cell3&quot; forIndexPath:indexPath];\n //[cell1.customLabel setText:itemArray[indexPath.row]];\n //make a label\n //UILabel *itemName = [[UILabel alloc]initWithFrame:CGRectMake(91, 15, 0, 0)];\n //\n \n NSArray *maskInterior = [maskArray objectAtIndex:indexPath.row]; //get the mask list to get out the name of the mask\n //NSLog(@&quot;%@&quot;, maskInterior)\n NSString *maskNameAndColour = maskInterior[0];\n NSArray *maskColourAndName; //array of seperated name and colour\n NSString *maskName;\n int noColourFlag = 0; //check if mask is special and skip colourizing\n if([maskNameAndColour isEqualToString: @&quot;vahi&quot;]){ //seperate things out if needed\n maskName = @&quot;vahi&quot;;\n noColourFlag = 1;\n }\n else if([maskNameAndColour isEqualToString: @&quot;avohkii&quot;]){\n maskName = @&quot;avohkii&quot;;\n noColourFlag = 1;\n }\n else if([maskNameAndColour isEqualToString: @&quot;infected hau&quot;]){\n maskName = @&quot;infected hau&quot;;\n noColourFlag = 1;\n }\n\n else{\n maskColourAndName = [maskNameAndColour componentsSeparatedByString:@&quot; &quot;];\n maskName = maskColourAndName[1];\n }\n /*\n //check and replace problem names (legacy). this will cause the app to crash if the string does not have a hyphen added\n if([maskNameAndColour containsString:@&quot;light green&quot;]){\n [maskInterior replaceObjectAtIndex:0 withObject:@&quot;light green&quot;];\n [maskArray replaceObjectAtIndex:indexPath.row withObject:maskInterior];\n }\n */\n \n UIImageView *maskImage=[[UIImageView alloc]initWithFrame:CGRectMake(18, 18, 64, 64)];\n if(noColourFlag == 0){ //if its not a special flag, then colourize it\n UIColor *tempColor = [self colourCaser: maskColourAndName[0]]; //colour the image\n maskImage2 = [UIImage imageNamed:[NSString stringWithFormat: @&quot;%@&quot;, maskName]];\n //[maskImage2 imageWithTintColor:tempColor];\n maskImage2 = [self colorizeImage:maskImage2 color:tempColor];\n [maskImage setImage:maskImage2]; //set an image with a colour\n [maskImage2 setAccessibilityIdentifier: maskNameAndColour];\n if(maskImage2 != nil){\n [imagesInCollection addObject: maskImage2];\n }\n else{\n NSLog(@&quot;adding to collection error&quot;);\n }\n //NSLog(@&quot;%@&quot;, imagesInCollection);\n }\n else{\n [maskImage setImage:[UIImage imageNamed:[NSString stringWithFormat: @&quot;%@&quot;, maskName]]]; //get the image named the name of the mask without the colour\n }\n\n [cell3 addSubview:maskImage];//Add it to the view of your choice.\n \n UILabel *maskNameLabel =[[UILabel alloc]initWithFrame:CGRectMake(25, 70, 50, 50)];//Set frame of label in your view\n //[itemName setBackgroundColor:[UIColor lightGrayColor]];//Set background color of label.\n\n @try {\n [maskNameLabel setText: [NSString stringWithFormat: @&quot;%@&quot;,maskNameAndColour]];\n }\n @catch (NSException *exception) {\n [maskNameLabel setText: @&quot;&quot;];\n }\n @finally {\n //Display Alternative\n }\n //NSLog(@&quot;here: %@&quot;, maskArray);\n \n //[maskName setText: @&quot;mask&quot;];\n [maskNameLabel setAdjustsFontSizeToFitWidth:true];\n [maskNameLabel setFont:[UIFont fontWithName:@&quot;Goudy Trajan Regular&quot; size:10]];\n [maskNameLabel setTextColor:[UIColor whiteColor]];//Set text color in label.\n [maskNameLabel setTextAlignment:NSTextAlignmentCenter];//Set text alignment in label.\n [maskNameLabel setBaselineAdjustment:UIBaselineAdjustmentAlignBaselines];//Set line adjustment.\n [maskNameLabel setLineBreakMode:NSLineBreakByCharWrapping];//Set linebreaking mode..\n [maskNameLabel setNumberOfLines:1];//Set number of lines in label.\n //[itemName.layer setCornerRadius:40.0];//Set corner radius of label to change the shape.\n //[itemName.layer setBorderWidth:1.0f];//Set border width of label.\n [maskNameLabel setClipsToBounds:YES];//Set its to YES for Corner radius to work.\n [maskNameLabel.layer setBorderColor:[UIColor blackColor].CGColor];//Set Border color.\n [cell3 addSubview:maskNameLabel];//Add it to the view of your choice.\n \n \n \n return cell3;\n \n}\n\n\n\n- (NSInteger)collectionView:(nonnull UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {\n return maskArray.count;\n \n}\n\n- (CGSize)collectionView:(UICollectionView *)collectionView layout: (UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{\n return CGSizeMake(100, 100);\n}\n\n- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ //tap brings up delete dialog\n //NSLog(@&quot;Tapped %d&quot;, (int)indexPath.row);\n selectedMaskArray = maskArray[indexPath.row]; //assign the new mask to a temporary holding cell\n for (int i = 0; i &lt;= (imagesInCollection.count -1); i++)\n {\n UIImage *tempImage = imagesInCollection[i]; //some technical wizardry to get the correct mask and colour displaying in the individual mask display screen\n //NSLog(@&quot;A: %@&quot;, maskName);\n //NSLog(@&quot;B: %@&quot;, tempImage.accessibilityIdentifier);\n if([tempImage.accessibilityIdentifier isEqualToString: selectedMaskArray[0]] ){\n outPutMask = tempImage;\n }\n }\n \n [self performSegueWithIdentifier:@&quot;selectedMask&quot; sender:self];\n}\n</code></pre>\n<p>Anyone know how to stop this happening? (Objective C answers please, Swift is a bit of a pain to translate to Obj-C sometimes)</p>\n<p><a href="https://i.sstatic.net/taKqX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/taKqX.png" alt="enter image description here" /></a></p>\n"^^ . . . "Cells that have scrolled out of view are reused so you are constantly re-adding the image views to cells that already have an image view in them."^^ . . . . "@Rob added code and image, happens on physical device"^^ . . . . . . . "pch"^^ . "1"^^ . "uitabbar"^^ . "1"^^ . . . . . "0"^^ . "Ok, so where then should I go about creating the imageview and label variables?"^^ . "0"^^ . . . "0"^^ . . "MPRemoteCommandCenter how to show all controls/commands"^^ . "0"^^ . "If I read the wikipedia page correctly, isn't the outer product just the same as "point-wise multiplication"? That is, every cell in the output matrix is just the multiplication of the same positioned elements from the two input matrices. Is that right?"^^ . . . . . "0"^^ . "0"^^ . "Update: I have explicit disabled seek button like commandCenter.skipBackwardCommand setEnabled:NO and now track buttons are shown correctly"^^ . "1"^^ . "hah yeah it worked. I swear I tried that. My dang autocomplete doesn't work"^^ . . . "Oh gosh, none taken. I really should be further along for how long I've been doing this. I'm just happy for the help. GCD has always been a little confusing to me."^^ . . "You commented out the line for registering the cell class with the collection view. You need that line."^^ . . "Because the cell you are dequeuing isn't what you think it is."^^ . . . . . "in my implementation I have added next and prev button and it work on CarPlay simulator and also some cars ... but on a BMW (and I suppose in some other car) it show Seek buttons even if I don't added that buttons !!! Do you have found some workaround about that ?"^^ . "cell dequeuing works fine. the cell functions fine without the label and image with programatically generated labels, but it has an issue when I add the labels and image to the NIB"^^ . . . "1"^^ . . . . . "Does this mean that answers on questions such as below are incorrect when they say "...for macOS: #define TARGET_OS_IPHONE 0"\nhttps://stackoverflow.com/a/39442872/1634905"^^ . . "0"^^ . . . . . . . "<p>I am relatively new to iOS and have been trying really hard to diagnose and find a way to start generating XCFramework instead of .Framework that was being built earlier until xCode 10.</p>\n<p>I have went through many different blogs and answers on SO as well but could not find a solution to my issue. I need to build XCFramework with support for both iOS device as well as iOS Simulator on M1 architecture.</p>\n<p>I have pasted below, the old as well as the new build scripts that I have been experimenting with.</p>\n<p><em><strong>OLD SCRIPT:</strong></em></p>\n<pre><code>set -e\n\n# If we're already inside this script then abort\n`if [ -n &quot;$RW_MULTIPLATFORM_BUILD_IN_PROGRESS&quot; ]; then\nexit 0\nfi\nexport RW_MULTIPLATFORM_BUILD_IN_PROGRESS=1\n\nRW_FRAMEWORK_NAME=${PROJECT_NAME}\nRW_INPUT_STATIC_LIB=&quot;lib${PROJECT_NAME}.a&quot;\nRW_FRAMEWORK_LOCATION=&quot;${BUILT_PRODUCTS_DIR}/${RW_FRAMEWORK_NAME}.framework&quot;\nfunction build_static_library {\n # Will rebuild the static library as specified\n # build_static_library sdk\n xcrun xcodebuild -project &quot;${PROJECT_FILE_PATH}&quot; \\\n -target &quot;${TARGET_NAME}&quot; \\\n -configuration &quot;${CONFIGURATION}&quot; \\\n -sdk &quot;${1}&quot; \\\n ONLY_ACTIVE_ARCH=NO \\\n BUILD_DIR=&quot;${BUILD_DIR}&quot; \\\n OBJROOT=&quot;${OBJROOT}/DependentBuilds&quot; \\\n BUILD_ROOT=&quot;${BUILD_ROOT}&quot; \\\n SYMROOT=&quot;${SYMROOT}&quot; $ACTION\n}`\n\n`function make_fat_library {\n # Will smash 2 static libs together\n # make_fat_library in1 in2 out\n xcrun lipo -create &quot;${1}&quot; &quot;${2}&quot; -output &quot;${3}&quot;\n}`\n\n# 1 - Extract the platform (iphoneos/iphonesimulator) from the SDK name\n`if [[ &quot;$SDK_NAME&quot; =~ ([A-Za-z]+) ]]; then\nRW_SDK_PLATFORM=${BASH_REMATCH[1]}\nelse\necho &quot;Could not find platform name from SDK_NAME: $SDK_NAME&quot;\nexit 1\nfi`\n\n# 2 - Extract the version from the SDK\n`if [[ &quot;$SDK_NAME&quot; =~ ([0-9]+.*$) ]]; then\nRW_SDK_VERSION=${BASH_REMATCH[1]}\nelse\necho &quot;Could not find sdk version from SDK_NAME: $SDK_NAME&quot;\nexit 1\nfi`\n\n# 3 - Determine the other platform\n`if [ &quot;$RW_SDK_PLATFORM&quot; == &quot;iphoneos&quot; ]; then\nRW_OTHER_PLATFORM=iphonesimulator\nelse\nRW_OTHER_PLATFORM=iphoneos\nfi`\n\n# 4 - Find the build directory\n`if [[ &quot;$BUILT_PRODUCTS_DIR&quot; =~ (.*)$RW_SDK_PLATFORM$ ]]; then\nRW_OTHER_BUILT_PRODUCTS_DIR=&quot;${BASH_REMATCH[1]}${RW_OTHER_PLATFORM}&quot;\nelse\necho &quot;Could not find other platform build directory.&quot;\nexit 1\nfi`\n\n\n# Build the other platform.\n`build_static_library &quot;${RW_OTHER_PLATFORM}${RW_SDK_VERSION}&quot;\n`\n# If we're currently building for iphonesimulator, then need to rebuild\n# to ensure that we get both i386 and x86_64\n`if [ &quot;$RW_SDK_PLATFORM&quot; == &quot;iphonesimulator&quot; ]; then\nbuild_static_library &quot;${SDK_NAME}&quot;\nfi`\n\n# Join the 2 static libs into 1 and push into the .framework\n`make_fat_library &quot;${BUILT_PRODUCTS_DIR}/${RW_INPUT_STATIC_LIB}&quot; \\\n&quot;${RW_OTHER_BUILT_PRODUCTS_DIR}/${RW_INPUT_STATIC_LIB}&quot; \\\n&quot;${RW_FRAMEWORK_LOCATION}/Versions/A/${RW_FRAMEWORK_NAME}&quot;\n`\n# Ensure that the framework is present in both platform's build directories\n`cp -a &quot;${RW_FRAMEWORK_LOCATION}/Versions/A/${RW_FRAMEWORK_NAME}&quot; \\\n&quot;${RW_OTHER_BUILT_PRODUCTS_DIR}/${RW_FRAMEWORK_NAME}.framework/Versions/A/${RW_FRAMEWORK_NAME}&quot;\n`\n# Copy the framework to the user's desktop\n`ditto &quot;${RW_FRAMEWORK_LOCATION}&quot; &quot;${HOME}/Desktop/${RW_FRAMEWORK_NAME}.framework&quot;\n`\n\n\n</code></pre>\n<p><em><strong>NEW SCRIPT THAT I AM USING TO GENERATE XCFRAMEWORK</strong></em></p>\n<pre><code>\nSIMULATOR_ARCHIVE_PATH=&quot;${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphonesimulator.xcarchive&quot;\nDEVICE_ARCHIVE_PATH=&quot;${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphoneos.xcarchive&quot;\n\necho &quot;Simulator Path:$SIMULATOR_ARCHIVE_PATH&quot;\necho &quot;Device Archive Path: $DEVICE_ARCHIVE_PATH&quot;\necho &quot;Build DIR: $BUILD_DIR&quot;\necho &quot;Configuration Path: $CONFIGURATION&quot;\n\nOUTPUT_DIR=&quot;./Products/&quot;\n\n# Simulator xcarchive (arm64 + x86_64)\nxcodebuild archive \\\n ONLY_ACTIVE_ARCH=NO \\\n -scheme ${SCHEME_NAME} \\\n -project &quot;${SCHEME_NAME}.xcodeproj&quot; \\\n -archivePath ${SIMULATOR_ARCHIVE_PATH} \\\n -sdk iphonesimulator \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO\n\n# Device xcarchive (arm64)\nxcodebuild archive \\\n -scheme ${SCHEME_NAME} \\\n -project &quot;${SCHEME_NAME}.xcodeproj&quot; \\\n -archivePath ${DEVICE_ARCHIVE_PATH} \\\n -sdk iphoneos \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO\n\n# Clean-up any existing instance of this xcframework from the Products directory\nrm -rf &quot;${OUTPUT_DIR}${SCHEME_NAME}.xcframework&quot;\n\n# Create final xcframework\nxcodebuild -create-xcframework \\\n -framework ${DEVICE_ARCHIVE_PATH}/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -framework ${SIMULATOR_ARCHIVE_PATH}/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -output ${BUILD_DIR}/${FRAMEWORK_NAME}.xcframework\n\n</code></pre>\n<p><em><strong>ERROR THAT I AM GETTING:</strong></em></p>\n<pre><code>2023-11-20 23:44:06.736 xcodebuild[8267:239962] Writing error result bundle to /var/folders/ps/r75vk_f95tl2wh16jj2syv7c0000gr/T/ResultBundle_2023-20-11_23-44-0006.xcresult\nxcodebuild: error: Unknown build action '.xcodeproj'.\nerror: the path does not point to a valid framework: /Users/coder/Library/Developer/Xcode/DerivedData/CoderSDK-cjavkiibuxlwhgftpsbjmlkavwpx/Build/Products/Debug/-iphoneos.xcarchive/Products/Library/Frameworks/.framework\n</code></pre>\n<p>The archive that is getting generated does not have .framework in it. I also tried using the -library parameter in the xcodebuild -create-xcframework command but that did not help either.</p>\n<p>Can anyone please help me understand what is the issue here?</p>\n"^^ . . . . . . . . "0"^^ . . "xcframework"^^ . "terminationHandler never gets called for the above code. It might work when we run the task with arguments. But since I am using standard input and output and never close the files as well, I am not receiving terminated notification. Correct me if I'm wrong."^^ . . . "Thanks, got it working! Feel free to put in a formal answer if you want credit. Technically the problem here was that I wasn't using the keycode. It turns out CGEventKeyboardSetUnicodeString doesn't really matter here (I am still using that)."^^ . "2"^^ . "0"^^ . . "0"^^ . . "So the error is that in `+showDialogiPad: fromPresentingVC:...` `contentVC` == `presentingVC`. It's hard to tell why, but since showing/dimissing (especially with `animated` true) takes "times", and unless you reach `completion` the next line of code might be called before the completion ends. I think that's your issue issue. A race condition"^^ . "0"^^ . . "Access to two Back Cameras on iphone 15 with AVCaptureMultiCamSession"^^ . "<p>I'm trying to store an <a href="https://developer.apple.com/documentation/applicationservices/axuielementref?language=objc" rel="nofollow noreferrer">AXUIElementRef</a> provided by an <code>AXObserverCallback</code> callback. When the callback scope ends, I believe the struct gets freed and I'm no longer able to use it elsewhere.</p>\n<p>Is there a way to retain or copy this ref into my own data structure?</p>\n<p>Here is the relevant code:</p>\n<pre class="lang-objectivec prettyprint-override"><code>AXObserverCreate(..., &amp;observer_callback, ...);\nAXObserverAddNotification(..., ..., kAXWindowCreatedNotification, this);\n...\nvoid observer_callback(AXObserverRef observer, AXUIElementRef windowRef,\n CFStringRef notificationName, void* inUserData) {\n applications* apps = (applications*)inUserData;\n\n if (CFEqual(notificationName, kAXWindowCreatedNotification)) {\n // memory error when trying to use windowRef outside of callback\n apps-&gt;add_window_ref(windowRef);\n } else if (CFEqual(notificationName, kAXUIElementDestroyedNotification)) {\n apps-&gt;remove_window_ref(windowRef);\n }\n}\n</code></pre>\n<p>I know this is easily possible in Swift since <a href="https://github.com/lwouis/alt-tab-macos/blob/9e03d5f6659f0bf2327712e1e70851267acf01c1/src/logic/events/AccessibilityEvents.swift#L62" rel="nofollow noreferrer">this project</a> does it.</p>\n"^^ . . . . . "I found I had a typo for Text("Uploading memory model to controller") connectionTypeText = GreySubTextVal! and changed it to GreySubText = GreySubTextVal! and also implemented your suggestions of moving publisher5, publisher6 and publisher7 to be in the ProgressBar struct instead which proved to be the answer."^^ . "2"^^ . "1"^^ . . . . "notificationcenter"^^ . . "1"^^ . "My test app posts a keydown event with key code `kVK_ANSI_A`. If the input method is Dutch then "a" is inserted, if the input method is Japanse-Kana then "ち" is inserted. Japanese-Romaji: "あ", Greek: "α", Arabic: "ش"، I didn't test them all. The language setting doesn't matter."^^ . "0"^^ . . "iOS - UITabBarItem long titles overlap using UITabBarAppearance"^^ . . . . . . "1"^^ . . . "Proper use of strongSelf / weakSelf in nested dispatch_after blocks"^^ . "<p>As Mojtaba notes, every NSNull is the same object. It's implemented this way:</p>\n<pre><code>CoreFoundation`+[NSNull allocWithZone:]:\n 0x18cf7aeb8 &lt;+0&gt;: adrp x8, 368436\n-&gt; 0x18cf7aebc &lt;+4&gt;: add x8, x8, #0x210 ; kCFNull\n 0x18cf7aec0 &lt;+8&gt;: ldr x0, [x8]\n 0x18cf7aec4 &lt;+12&gt;: ret \n</code></pre>\n<p>When you call <code>+[NSNull alloc]</code> (which is called by <code>+new</code>), it just returns the singleton <code>kCFNull</code>. That is a toll-free bridged object, so can be used identically in CoreFoundation and Foundation. It's defined in <a href="https://github.com/apple-oss-distributions/CF/blob/dc54c6bb1c1e5e0b9486c1d26dd5bef110b20bf3/CFBase.c#L831-L834" rel="nofollow noreferrer">CFBase</a> as an empty CoreFoundation object:</p>\n<pre><code>static struct __CFNull __kCFNull = {\n INIT_CFRUNTIME_BASE()\n};\nconst CFNullRef kCFNull = &amp;__kCFNull;\n</code></pre>\n<p>All memory management calls are ignored:</p>\n<pre><code> -[NSNull autorelease]:\n0000000180506ec8 ret\n -[NSNull retain]:\n0000000180506ecc ret\n -[NSNull release]:\n0000000180506ed0 ret\n -[NSNull retainCount]:\n0000000180635104 mov x0, #0xffffffffffffffff\n0000000180635108 ret\n -[NSNull dealloc]:\n000000018063510c ret\n</code></pre>\n<p>It's based on the <a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html#//apple_ref/doc/uid/TP40002974-CH4-SW32" rel="nofollow noreferrer">&quot;strict singleton&quot; pattern</a> in Cocoa. (Most of the time you don't want strict singletons, and we just create shared instances, but when you need there to be precisely one instance, this is how it's done.)</p>\n<p><code>+[NSNull null]</code> is implemented identically (it just returns kCFNull):</p>\n<pre><code> +[NSNull null]:\n0000000180501558 adrp x8, #0x1da43a000 ; 0x1da43a210@PAGE\n000000018050155c add x8, x8, #0x210 ; 0x1da43a210@PAGEOFF, _kCFNull\n0000000180501560 ldr x0, [x8] ; _kCFNull,___kCFNull\n0000000180501564 ret\n</code></pre>\n<p>So <code>+[NSNull null]</code> is ever-so-slightly faster to call, since it skips some intermediate calls and (ignored) memory management. More importantly, it is better style to use <code>+null</code> rather than <code>+new</code> to make it clear that it's a singleton and you are using it that way.</p>\n<p>In fact, <a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/FoundationTypesandCollections/FoundationTypesandCollections.html#//apple_ref/doc/uid/TP40011210-CH7-SW34" rel="nofollow noreferrer">the common way</a> to check for NSNull is using <code>==</code> (pointer equality) rather than <code>isEqual:</code> (object equality), which is unusual in Cocoa.</p>\n"^^ . . . . . . . . . . . "1"^^ . . . . "getter"^^ . "uitabbaritem"^^ . . "You were probably getting a warning in the runtime console that `CollectionViewCell` wasn't found. In that case `UICollectionViewCell` is used."^^ . "NSTask standardOutput for "cd" command - Cocoa Objective C"^^ . . . . . . . . "cocoapods"^^ . . . "2"^^ . . "You may wish to rethink your setup then. Only a view controller should present other view controllers. Something derived from NSObject should not do anything related to the UI. At most it should pass a message (probably via delegate or NotificationCenter), that it has a message or an event took place. Let the view controller decide how to handle that (such as presenting an alert)."^^ . . . . "Hi, no i am not using this lib... The problem was -> I had to move RNSplashScreen.show() into the SceneDelegate file, usually this call is in AppDelegate, but with implemented scenes it blocks the main thread and carplay scene delegate cannot connect"^^ . . . . . . . "4"^^ . "<p>I have a Mac app which needs to generate keystrokes and am doing this with CGEventCreateKeyboardEvent(), CGEventKeyboardSetUnicodeString() and CGEventPost(). This works fine with English, however if I change the keyboard input method to a non-English language, the keystrokes I am creating show up as English instead of going through the language I have set.</p>\n<p>For example, when I put in a &quot;a&quot; keystroke, if I set Japanese I am expecting to see a &quot;あ&quot;, but instead I see a &quot;a&quot;.</p>\n<p>Is it possible to get these APIs to pass through whatever input method is currently enabled? Or do I need a different API for that?</p>\n<p>Here is the relevant code. The variable 's' is a string that contains the character in question. In the example above, it is simply &quot;a&quot;.</p>\n<pre><code>NSRange composedRange = [s rangeOfComposedCharacterSequencesForRange:NSMakeRange(0, s.length)];\nunichar *characters = malloc(sizeof(unichar) * composedRange.length);\n[s getCharacters:characters range:composedRange];\nCGEventRef eventRef = CGEventCreateKeyboardEvent( nil, 0, true );\nCGEventKeyboardSetUnicodeString(eventRef, composedRange.length, characters);\nCGEventPost(kCGSessionEventTap, eventRef);\n</code></pre>\n"^^ . . "0"^^ . "0"^^ . "0"^^ . . . . . . . . . . "objective-c"^^ . . . . . . . "0"^^ . . . "linker"^^ . . "1"^^ . . . . . . . . . . . . "ok, worked out the problem. I couldn't attach the collectionview as an outlet because I had attached a search bar to the controller and whenever I tried to attach it it kept trying to attach to the search bar and so wouldn't show up the collection view. solved that bug. However now I'm getting this: 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier cell1 - must register a nib or a class for the identifier or connect a prototype cell in a storyboard' but my storyboard does contain a prototype cell"^^ . "when I don't have it commented out it fails with a symbols error"^^ . . . . . . "0"^^ . . "0"^^ . . "0"^^ . . "I tried that. Both full project cleans as well as removing the entire ~/Library/Developer/Xcode folder. Same problem persisted. I'm suspicious that some Swift "glue" code for the Obj-C bridging maybe at fault, but I can't verify that. I'll also note that I've had the same issue on Catalina and now Sonoma."^^ . . . "nsnull"^^ . "I've checked that. That doesnt seem to be the issue either. Here's my code for the dequeing:- (nonnull __kindof Celler1 *)collectionView:(nonnull UICollectionView *)collectionView cellForItemAtIndexPath:(nonnull NSIndexPath *)indexPath {\n //NSLog(@"Got this far");\n Celler1 *cell3 = [_maskGrid dequeueReusableCellWithReuseIdentifier:@"Celler1" forIndexPath:indexPath];"^^ . . . . . . "0"^^ . . "0"^^ . . "<p>Navigate one level up in the documentation to <a href="https://developer.apple.com/documentation/applicationservices/axuielement_h?language=objc" rel="nofollow noreferrer">AXUIElement.h</a> where it says:</p>\n<blockquote>\n<p>Each accessible user interface element in an application is represented by an AXUIElementRef, which is a CFTypeRef. AXUIElementRefs (like all CFTypeRefs) can be used with all the Core Foundation polymorphic functions, such as CFRetain, CFRelease, and CFEqual.&quot;</p>\n</blockquote>\n"^^ . "Have you tried `type.rawValue`?"^^ . . "2"^^ . "keyboard"^^ . . "2"^^ . . "Have you checked [this](https://stackoverflow.com/questions/44672419/how-to-import-existing-objective-c-pch-file-in-swift-class) and [this](https://stackoverflow.com/questions/26408612/implicitly-import-specific-swift-module) ?"^^ . . "0"^^ . . . . "See [How to convert ASCII character to CGKeyCode?](https://stackoverflow.com/questions/1918841/how-to-convert-ascii-character-to-cgkeycode)"^^ . . . . . . "<p>Start simple...</p>\n<p>Use the following code:</p>\n<hr />\n<p><strong>UICollectionViewCell+CollectionViewCell.h</strong> - *note: not sure why you named your file like that... generally, a &quot;Class+Name&quot; is used for a <strong>Category</strong> ... but, assuming the code in the class looks like this:</p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface CollectionViewCell : UICollectionViewCell\n@property (strong, nonatomic) IBOutlet UILabel *customLabel;\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<hr />\n<p><strong>UICollectionViewCell+CollectionViewCell.m</strong></p>\n<pre><code>#import &quot;UICollectionViewCell+CollectionViewCell.h&quot;\n\n@implementation CollectionViewCell\n\n@end\n</code></pre>\n<hr />\n<p><strong>BackPackController.h</strong></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface BackPackController : UIViewController\n@property (strong, nonatomic) IBOutlet UICollectionView *itemGrid;\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<hr />\n<p><strong>BackPackController.m</strong></p>\n<pre><code>#import &quot;BackPackController.h&quot;\n#import &quot;UICollectionViewCell+CollectionViewCell.h&quot;\n\n@interface BackPackController () &lt;UICollectionViewDelegate, UICollectionViewDataSource&gt;\n\n@end\n\n@implementation BackPackController\n\nNSMutableArray *itemArray;\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n \n itemArray = [NSMutableArray new];\n \n // let's generate a simple string array\n for (int i = 0; i &lt; 40; i++) {\n NSString *s = [NSString stringWithFormat:@&quot;%i&quot;, i];\n [itemArray addObject:s];\n }\n \n _itemGrid.dataSource = self;\n _itemGrid.delegate = self;\n}\n\n- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {\n return itemArray.count;\n}\n\n- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {\n CollectionViewCell *c = [collectionView dequeueReusableCellWithReuseIdentifier:@&quot;cell1&quot; forIndexPath:indexPath];\n [c.customLabel setText:itemArray[indexPath.item]];\n return c;\n}\n\n@end\n</code></pre>\n<hr />\n<p>Now, in your Storyboard, add a <code>UIViewController</code> and assign its class to <code>BackPackController</code></p>\n<p>Assign the class of the cell Prototype to <code>CollectionViewCell</code>, and set its Identifier to &quot;cell1&quot; (without the quotes).</p>\n<p>Add a <code>UICollectionView</code> and constrain it with 20-points on all 4 sides. Give it and its default cell contrasting background colors so we can see it.</p>\n<p>Add a <code>UILabel</code> to the cell prototype, and constrain it centered.</p>\n<p>Connect the <code>IBOutlet UILabel *customLabel</code> to the label in the cell.</p>\n<p>Connect the <code>IBOutlet UICollectionView *itemGrid</code> to the collection view in the controller.</p>\n<p>Should look like this (ignore the other controllers I have in my storyboard):</p>\n<p><a href="https://i.sstatic.net/m8Vte.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/m8Vte.png" alt="enter image description here" /></a></p>\n<p>When you run the app, you should see this:</p>\n<p><a href="https://i.sstatic.net/UkxhH.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/UkxhH.png" alt="enter image description here" /></a></p>\n<p>Now you can start implementing your &quot;PlayerItems&quot; in UserDefaults, add your Search Bar, etc.</p>\n"^^ . "0"^^ . . . "uicollectionviewcell"^^ . . "1"^^ . "lipo"^^ . . "<p><code>FooClass</code> has a property called <code>foo</code>.</p>\n<p>It's declared as <code>@property (nullable, nonatomic, readonly, strong) id foo</code> and it has NO underlying storage, it's not synthesized. It's just a getter that by default returns <code>nil</code>.</p>\n<p>I would like to change the implementation of this getter. I would like to create a new block/function and inject it into an object so that it replaces the original implementation.</p>\n<p>IMPORTANT: subclassing is NOT an option. I need to take the object as is.</p>\n<p>ALSO: I need to do it for only one, single instance, not the whole class!</p>\n<p>How can I do it?</p>\n"^^ . . . . . . "<p>I am trying to create a Custom Module for my React Native app, and I've followed <a href="https://reactnative.dev/docs/native-modules-ios#create-custom-native-module-files" rel="nofollow noreferrer">the guide</a> However, when I create the header file and import **&lt;React/RCTBridgeModule.h&gt; ** I am getting error as <strong>'React/RCTBridgeModule.h'</strong> file not found. I Googled and tried various solution from SO, however, none of them works.</p>\n<p>One thing I've noticed is that I am able to import the &lt;React/{any-header-file.h}&gt; file in the AppDelegate.mm, but when I try it in my <strong>Custom Module</strong> I can't get the completition suggestions too. Any help is really appreciated.</p>\n<p><strong>Info:</strong>\nI am using react-native 0.72.7.\nand Xcode 15.</p>\n<p><strong>Solutions I tried:</strong></p>\n<ol>\n<li>Clean Pods and Cache.</li>\n<li>Re-installed node modules.</li>\n<li>Configured Header Search Paths.</li>\n<li>Edits Schemes.</li>\n</ol>\n<p><strong>Expected behaviour</strong>\nWill able to import RCTBridgeModule header file.</p>\n"^^ . . . "0"^^ . . . "uipopoverpresentationcontroller"^^ . "I won't be terminating the NSTask as I would like to keep it for consecutive executions"^^ . . . . "Nice! I had noticed the weird documentation links between Swift and ObjC for `UIContentConfiguration` but I hadn't noticed the significance nor the lack of `NSObjectProtocol` conformance for the Swift version. Very interesting even if I need to study these details a bit more to fully understand. I just tried your work around and it works perfectly. And just 10 minutes ago I finished testing my reimplementation of `MyCellConfiguration` in Objective-C to avoid the issue. I should have been more patient."^^ . "<p>In the below <code>BNREmployee.m</code> implementation file I am trying to override the default <code>description</code> and would like to be able to access the object name <code>john</code> assigned at instantiation in the main.m file. Is there a way to do this WITHOUT creating a separate &quot;name&quot; property or instance variable, and WITHOUT creating a separate init method where that name would be passed in?</p>\n<p><strong>main.m file:</strong></p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n#import &quot;BNRPerson.h&quot;\n#import &quot;BNREmployee.h&quot;\n#import &quot;BNREmployer.h&quot;\n\nint main(int argc, const char * argv[]) {\n @autoreleasepool {\n BNREmployee *john = [BNREmployee new];\n BNREmployer *costco = [BNREmployer new];\n [john setEmployer:costco];\n [costco setEmployeesList:[NSMutableSet setWithObject:john]];\n \n NSLog(@&quot;employee: \\n%@&quot;, john);\n }\n return 0;\n}\n</code></pre>\n<p><strong>BNREmployee.m file:</strong></p>\n<pre><code>#import &quot;BNREmployee.h&quot;\n\n@implementation BNREmployee\n\n-(NSString*) description\n{\n return [NSString stringWithFormat:@&quot;&lt;Employee %@ with id: %d and employer: %@&quot;, [self ???***???], self.employeeId, self.employer];\n}\n@end\n</code></pre>\n"^^ . . . "Though there is no need to add anything to info.plist, you should add the key into Entitlements.plist."^^ . "0"^^ . "0"^^ . "0"^^ . . "0"^^ . . . "Unable to build XCFramework for my existing project that was building .Framework file from Static Library"^^ . "0"^^ . "Find solution without calling `addSubview` in `cellForItemAtIndexPath`"^^ . . . . . . "2"^^ . . "1"^^ . "-1"^^ . . . . . "0"^^ . "1"^^ . . . "react-native"^^ . . . . . "0"^^ . . "Those are related to Swift. As I just mentioned, I am talking about applying PCH to Objective-C files."^^ . . . . . . . "uikit"^^ . . "0"^^ . . . . . "0"^^ . . "2"^^ . . . "0"^^ . . . "0"^^ . "Ok, finally worked out what was wrong. For some reason, telling the cell that it inherited its module from its target was causing it to crash. I unticked that and now it works fine. Weird."^^ . "<p>Ever since iOS 15+, developers have had to explicitly set the UITabBar Appearance. Before this, longer titles on tabs would dynamically resize a bit to make sure they didn't overlap. Now, they just overlap. We've been handling it by truncating too-long-titles but I want to make sure there's not some way to do this that I've missed.</p>\n<p>Our ApplicationDelegate class is in Objective-C so the code for the UITabBar Appearance is here:</p>\n<pre><code>UITabBarAppearance *tabBarAppearance = [[UITabBarAppearance alloc] init];\n[[UITabBar appearance] performSelector:@selector(setScrollEdgeAppearance:) withObject:tabBarAppearance];\n</code></pre>\n<p>In these pictures you can see tab bar items with the same titles. Before iOS 15, the title text was resized to prevent overlap. But clearly after iOS 15, the third title overlaps. Is there any possible way to reproduce the pre-iOS 15 behavior in terms of tab bar titles, or do we tell our customers &quot;too bad?&quot;</p>\n<p>Tab bar items before iOS 15:</p>\n<p><img src="https://i.sstatic.net/UxbBf.png" alt="Tab bar items before iOS 15" /></p>\n<p>Tab bar items after iOS 15:</p>\n<p><img src="https://i.sstatic.net/nG0LX.png" alt="Tab bar items after iOS 15" /></p>\n"^^ . "I've changed my custom cell class to be called Celler1, I've associated it with the cell I'm using. I've reconstructed the entire view controller and all its subviews and I'm still getting the same issue"^^ . "<p>Apps like Spotify, Tidal etc show content if the phone apps are terminated and i click on the App Icon in Carplay Simulator. My App doesnt so, it shows an empty screen. If the phone app is in background or active, everything is working well. I have no idea what i am doing wrong. Please help! Thanks in advance!</p>\n<p>Some code:</p>\n<pre><code>import Foundation\nimport CarPlay\nclass SceneDelegateCarPlay: UIResponder, CPTemplateApplicationSceneDelegate {\n...\nfunc templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, didConnect interfaceController: CPInterfaceController) {\n print(&quot;SceneDelegateCarPlay.templateApplicationScene(), didConnect&quot;)\n // start render content\n ...\n}\n</code></pre>\n<p>&quot;templateApplicationScene is called and render content when:</p>\n<ol>\n<li>Carplay App is closed &amp; Iphone App is active or in background -&gt; Click on Carplay App Icon</li>\n<li>Carplay App is open (no content visible) &amp; Iphone App is terminated -&gt; Start Iphone App</li>\n</ol>\n<p>I wonder how i can render content outside of a case like these</p>\n"^^ . . . "0"^^ . "<p>Some observations:</p>\n<ul>\n<li>The documentation page for <a href="https://developer.apple.com/documentation/uikit/uicontentconfiguration" rel="noreferrer"><code>UIContentConfiguration</code></a> doesn't have an Objective-C version that you can choose using the &quot;Language: Swift&quot; selector. The Objective-C version is <a href="https://developer.apple.com/documentation/uikit/uicontentconfiguration?language=objc" rel="noreferrer">here</a>.</li>\n<li><code>UIContentConfiguration</code> doesn't inherit <code>NSObjectProtocol</code>, like other Objective-C protocols do, when they are imported into Swift.</li>\n<li>The Swift version of <code>UIContentConfiguration</code> has a <code>makeContentView</code> method that returns an intersection type, which cannot be represented in Objective-C. (The Objective-C version returns <code>__kindof UIView&lt;UIContentView&gt; *</code>)</li>\n</ul>\n<p>These all suggest that <code>UIContentConfiguration</code> in Swift is an entirely different protocol from its Objective-C version. Just conforming to it in Swift doesn't mean you conformed to it in Objective-C.</p>\n<p>You can also see a similar pattern in other related types like <code>UIContentView</code> and <code>UIConfigurationState</code>.</p>\n<p>In fact, try setting <code>contentConfiguration</code> to an instance of <code>MyCellConfiguration</code> in Swift and see what happens on the Objective-C's side. Try printing out <code>[cell.contentConfiguration class]</code> in Objective-C. The output is not <code>MyCellConfiguration</code>!</p>\n<p>All of that is to say, you have to re-implement the Objective-C version of <code>UIContentConfiguration</code> in Objective-C, or you can just add a method like this in Swift:</p>\n<pre><code>@objc\nfunc addToCell(_ cell: UITableViewCell) {\n cell.contentConfiguration = self\n}\n</code></pre>\n<pre class="lang-objectivec prettyprint-override"><code>UITableViewCell *cell = ...;\nMyCellConfiguration *config = [[MyCellConfiguration alloc] initWithLabel:@&quot;Some Label&quot;];\n[config addToCell:cell];\n</code></pre>\n"^^ . . . . "0"^^ . "0"^^ . . . . . "How to remove "undefined symbol" error in Objective-C?"^^ . "Access name of instantiated object without additional property nor init method"^^ . . . "Yep, it is, so using `isEqual:` is equivalent, which is good. But generally you wouldn't use `==` with a immutable value object. `==` is generally only used for mutable objects, where you want to check that it's the specific one you mean (rather than just having the same property values). For example, you can't use `==` on NSNumber, even though it "works" in a surprising number of cases. But for NSNull, it's pretty common to use `==` since it's guaranteed to be a singleton."^^ . . . . . "0"^^ . . . . . . . "2"^^ . "<p>I've been getting the error message &quot;[&lt;UICollectionViewCell 0x14fd06a80&gt; setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key&quot; for an image attached to a custom cell in a UICollectionView.\nThe cell's IBoutlets are correctly linked up in the interface editor. There are no warning icons next to them.\nI'm not quite sure whats going on.</p>\n<p>Here's the code for the custom cell:</p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n\n\n@interface CollectionViewCell : UICollectionViewCell\n@property (nonatomic, weak) IBOutlet UILabel *maskName3;\n@property (nonatomic, weak) IBOutlet UIImageView *maskImage;\n\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<p>Here's what I've got in the interface builder:</p>\n<p><a href="https://i.sstatic.net/o5Gyh.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/o5Gyh.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/L0HQo.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/L0HQo.png" alt="enter image description here" /></a></p>\n"^^ . "0"^^ . . . . "1"^^ . . "1"^^ . "0"^^ . . . . . . . "0"^^ . "Your posted code is not using a [terminationHandler](https://developer.apple.com/documentation/foundation/nstask/1408746-terminationhandler?language=objc) - you must set the property."^^ . . . . . "protocols"^^ . . . . "uicollectionview"^^ . . . . . "0"^^ . . . . . . "I couldn't attach the grid to iboutlet as it wouldn't let me. I've now gone and made it just a regular variable. Can you please answer this question with how you would set it out programmatically Mykyta iOS?"^^ . . . . . . . . "0"^^ . . . . . "1"^^ . . . . . . "0"^^ . "<p>I have a complicated launch and I need to present and dismiss multiple view controllers. I have this bit of code where I need to use delays in presentation; I was wondering if my use of <code>strongSelf</code> / <code>weakSelf</code> was proper in the following code with these <code>dispatch_after</code> blocks, or if there are improvements that I should make to the code. I know it's outdated Objective-C, I am working with an old, large code base.</p>\n<pre><code>__weak typeof(self) weakSelf = self;\n\ndispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{//CURRENT\n \n __strong typeof(self) strongSelf = weakSelf;\n \n [strongSelf presentViewController:strongSelf.coverVC animated:NO completion:^{\n \n [strongSelf showWindowWithImage:NO];\n \n dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n \n __strong typeof(self) strongSelf2 = weakSelf;\n\n [strongSelf2 dismissViewControllerAnimated:YES completion:^{\n\n strongSelf2.coverVC = nil;\n [strongSelf2 hideWindow];\n }];\n });\n }];\n});\n</code></pre>\n"^^ . . "3"^^ . "xcuitest"^^ . "calayer"^^ . . "The proper way to get the correct root view controller from some view controller is `self.view.window.rootViewController`. No need to access anything via the App Delegate, keyWindow, window scene, or shared UIApplication. This gets the correct root view even if your app has multiple scenes on display at the same time. Then you can walk up the chain of `presentedViewController` to find the top-most view controller."^^ . . . . "0"^^ . "1"^^ . . . . . . . . . "0"^^ . . . "1"^^ . "0"^^ . . . . . . . "keywindow"^^ . "macos"^^ . . . . . "0"^^ . "0"^^ . . . . . "iOS UITextView Not Properly Handling Phone Number in Field"^^ . . "0"^^ . . . . "1"^^ . . "0"^^ . "0"^^ . . . "0"^^ . "maybe, its all working now at least."^^ . "Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . "uint32-t"^^ . . . . . . "internationalization"^^ . "0"^^ . "1"^^ . . . . "Why am I seeing different behavior in macOS 14 when creating NSAttributedString from HTML vs doing the same thing with initWithString:attributes:?"^^ . "No, the `NSNull` itself is *a singleton object used to represent null values in collection objects that don’t allow nil values*. `new` is from the `NSObject` class, and the `NSNull` inherited it."^^ . "uint32"^^ . . . . . "1"^^ . "0"^^ . "2"^^ . . . . . . . "1"^^ . "enums"^^ . "@Jobalisk Create a custom UICollectionViewCell and put it on this cell, you decide whether to do it programmatically or with an IBOutlet. [UIImage imageNamed] takes a string as an input parameter, so you can use it directly instead of wrapping it again with "%@". `stringWithFormat` is used for kind of string interpolation"^^ . "0"^^ . . . . "No I don't think it would since it's not a problem with my code. I'm looking for a solution to make a CALayer that draws its contents adapt to the application appearance. What I do in drawLayer:inContext is irrelevant."^^ . . . . . . "0"^^ . "0"^^ . . . "@SAHM – Well, no offense was intended. We’ve all been there. (Literally.) I’m glad you took it in the spirit intended."^^ . . . . "0"^^ . "@Rob thank you so much. That makes perfect sense. Unfortunately, the "new programmer" is me, I am self-taught and do this barely even part time, have one very old, large app, and haven't been able to even look at code in 4 plus years because I was caring for someone who was ill. But I really learned from what you said. I think I can do it with just self. I was actually looking at an answer of yours to another question on this just a few minutes ago. You have a great wealth of knowledge and quite a way of explaining things. I really appreciate you taking the time to answer my question."^^ . . . . . . . . . . . "0"^^ . . . "I can only confirm having this issue seen in our code elsewhere, more precisely in SwiftUI previews. Maybe there is a corrupt module in the cache. In all helplessness, you may deleting the DerivedData folder and hope for the best. In any case, please file a bug report."^^ . . . . . . . "0"^^ . "0"^^ . "0"^^ . . . . "compilation"^^ . "flutter"^^ . . . . "0"^^ . . "Do you recommend any book for Objective-C?"^^ . . . . "0"^^ . . "Tu call swift from Objective-C you need to include the project-Swift.h file in Objective-C code that use swift. You must also create a bridging header to enable swift to know about Objective-C classes."^^ . . . "1"^^ . . "0"^^ . "<p>I am trying to share data between an objective c iOS appliation and a c# xamarin forms application using app groups.</p>\n<p>I am setting up the initial data in the objective c project and passing the data using the shared data &quot;clipboard&quot; available for app groups.</p>\n<p>This is my objective c code that initializes and posts the string.</p>\n<pre><code>NSString *appGroupId = @&quot;group.sample&quot;;\nNSUserDefaults *groupUserDefaults = [[NSUserDefaults alloc] initWithSuiteName:appGroupId];\n[groupUserDefaults setValue:offlineMsg forKey:@&quot;RunwayRequest&quot;];\n[groupUserDefaults synchronize];\n</code></pre>\n<p>This is my c# code in a Xamarin.Forms application.</p>\n<pre><code>string groupName = &quot;group.sample&quot;;\nNSUserDefaults shared = new NSUserDefaults();\nshared.AddSuite(groupName);\n</code></pre>\n<p>var test = shared.ValueForKey((NSString)&quot;RunwayRequest&quot;);</p>\n<p>It is always returning a null values but I think I am adding the string to the shared folder, but I am unable to retrieve the data in the other project.</p>\n<p>I have added the app group identifier to both provisioning profiles. I don't think I have to add anything to the plist file but I am not positive.</p>\n"^^ . . . . "<p>Yeah, you don't have to add anything into <em>info.plist</em>. But there are also some details.</p>\n<p><strong>First</strong>, you should enable <a href="https://learn.microsoft.com/en-us/xamarin/ios/deploy-test/provisioning/capabilities/app-groups-capabilities" rel="nofollow noreferrer">App Group Capabilities</a> for both iOS apps on <strong>Apple Developer portal</strong>.</p>\n<p>To sum up,</p>\n<ol>\n<li><p>Create a App Group, suppose the Identifier is <em>group.sample</em>.</p>\n</li>\n<li><p>Create an App ID for each app separately, enable App Group Capabilities and add each App ID in the App Group.</p>\n</li>\n<li><p>Generate a Provisioning Profiles for each app separately. Don't forget to include the correct Certificate and physical devices you want to deploy in Profiles.</p>\n</li>\n</ol>\n<p><strong>Second</strong>, add a key value for Entitlements.plist for each app. For more info, you could refer to <a href="https://learn.microsoft.com/en-us/xamarin/ios/deploy-test/provisioning/entitlements?tabs=macos#app-groups" rel="nofollow noreferrer">App Groups</a>.</p>\n<p>After the above steps, you could deploy the each app on your iOS device and share the data with app group now.</p>\n<p>Hope it helps!</p>\n"^^ . "0"^^ . . . "2"^^ . . . . . . . "0"^^ . . . "0"^^ . . "0"^^ . "1"^^ . . "<p>I have a Workspace with 2 projects, where one is a &quot;common&quot; project with code to share between projects and targets and the other is my main IOS app.\nSo, I have a podspec for it, and use that in my &quot;main&quot; projects podfile. This has worked well for years.</p>\n<p>Now, my &quot;common&quot; project has only contained objective-c files, and both it and my main project have PCH files where I have common imports.</p>\n<p>I am about to migrate to Swift (long overdue) so, I tried to just add a Test.swift to my common project.</p>\n<p>When I tried to do pod install, I got this error:</p>\n<blockquote>\n<p>The Swift pod X depends upon <code>JSONModel</code>, which do not define modules.\nTo opt into those targets generating module maps (which is necessary\nto import them from Swift when building as static libraries), you may\nset <code>use_modular_headers!</code> globally in your Podfile, or specify\n<code>:modular_headers =&gt; true</code> for particular dependencies.</p>\n</blockquote>\n<p>So, I did that, but what happens now is that the project doesn't compile. More specifically, the #import's in my PCH files don't seem to be applied for some reason. PCH extract:</p>\n<pre><code>#ifdef __OBJC__\n #import &quot;MyConstants.h&quot;\n#endif\n</code></pre>\n<p>Error example:</p>\n<blockquote>\n<p>projects/iphone/Pods/Headers/Public/MyCommons/Status.h:47:30: Unknown\ntype name 'Role'</p>\n</blockquote>\n<p>, which is an enum, defined in MyConstants.h</p>\n<p>The weird thing is that I put a #warning inside the #ifdef and it IS logged when every file is compiled, including Status.h that I mention above.</p>\n<p>This is definitely not my expertise, so if someone knows more than me, pointers are appreciated. Optimally, I would like to be able to mix Swift and Objective-C in my commons module but still have the PCH file applied to the Objective-C files, until I have moved on 100%.</p>\n"^^ . . . "cocoa"^^ . "2"^^ . . . . . "Have you tried with `s` is `あ`? Or have you tried without `CGEventKeyboardSetUnicodeString`?"^^ . . "0"^^ . . . . "5"^^ . . . "@LucaRocchiThat is great thinking. Will try it. Thx!"^^ . . . . . . . . . . "0"^^ . "@LucaRocchi No. In my app, most of the time it shows Prev and Next for the locked screen. But sometimes it automatically changes to Seek buttons. I am not sure why it happens as I specifically use the Prev and Next button in my code."^^ . . . "0"^^ . "0"^^ . "2"^^ . . "carplay"^^ . . "<p>This is a generic response why not using the delegate pattern ?</p>\n<ul>\n<li>Add a delegate object for your class</li>\n</ul>\n<h3>Override Property getter</h3>\n<pre class="lang-objectivec prettyprint-override"><code>- (id)foo {\n if (delegate) { \n [self performSelector:@Selector(someMethod) withObject:nil];\n }\n return nil;\n}\n</code></pre>\n<p>When you want to change the method purpose set the delegate and provide your custom method impl...</p>\n<h3>Hardcore (not rec)</h3>\n<p>You can achieve this by using method swizzling in Objective-C. Swizzling involves swapping the implementation of methods at runtime</p>\n"^^ . . "prevent cell stacking in UIcollectionView"^^ . . . "1"^^ . "0"^^ . "0"^^ . . . "2"^^ . "ios"^^ . . . . "0"^^ . . . . . . "Correctly create uicollection view in iOS using Objective C"^^ . . . . . . . "3"^^ . . . . . "0"^^ . . . . "0"^^ . "0"^^ . . . "I'm working with a string (i.e. "a"), how do I get a key code from the string? I have logic to do this using kTISPropertyUnicodeKeyLayoutData, but that isn't available for languages like Japanese."^^ . "0"^^ . . . . "1"^^ . "c#"^^ . "The book is a bit old. If you switch off "Objective-C Automatic Reference Counting" in the build settings, the error will go away."^^ . . . . . . . "@LucaRocchiActually I already did that: [commandCenter.previousTrackCommand setEnabled:YES];\n [commandCenter.nextTrackCommand setEnabled:YES];\n [commandCenter.skipBackwardCommand setEnabled:NO]; \n [commandCenter.skipForwardCommand setEnabled:NO]; So not sure why it still sometimes shows Skip buttons."^^ . . . . . "To add to your last point about `==` vs `isEqual:`, isn't the default implementation of `isEqual:` from `NSObject` a simple pointer equality (`==`) check?"^^ . "Post your code please."^^ . . . . . . "I edited the answer and included the cell, you may want to take a look."^^ . . . "core-image"^^ . "<p>I am using a NSTask to execute shell command like terminal. I want to run the command in root level so I am switching the sh to root user. This works fine until I want to interrupt a running process like ping command. Below is my code,</p>\n<pre><code>#import &quot;ViewController.h&quot;\n\n@interface ViewController()\n{\n NSTask* task;\n}\n@end\n\n@implementation ViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n [self setupTask];\n [self executeCommand:@&quot;sudo -S -i&quot;];\n [self executeCommand:@&quot;password&quot;];\n\n [self executeCommand:@&quot;ping www.google.com&quot;];\n [self performSelector:@selector(terminateTask) withObject:nil afterDelay:3];\n}\n\n-(void)setupTask {\n @autoreleasepool {\n \n NSPipe *inPipe = [NSPipe new]; // pipe for shell input\n NSPipe *outPipe = [NSPipe new]; // pipe for shell output\n NSPipe* errorPipe = [NSPipe new];\n \n task = [NSTask new];\n [task setLaunchPath:@&quot;/bin/sh&quot;]; //\n [task setStandardInput:inPipe];\n [task setStandardOutput:outPipe];\n [task setStandardError:errorPipe];\n [task launch];\n \n \n // ... and wait for shell output.\n [[outPipe fileHandleForReading] waitForDataInBackgroundAndNotify];\n [[errorPipe fileHandleForReading] waitForDataInBackgroundAndNotify];\n\n // Wait asynchronously for shell output.\n // The block is executed as soon as some data is available on the shell output pipe.\n [[NSNotificationCenter defaultCenter] addObserverForName:NSFileHandleDataAvailableNotification\n object:[outPipe fileHandleForReading] queue:nil\n usingBlock:^(NSNotification *note)\n {\n // Read from shell output\n NSData *outData = [[outPipe fileHandleForReading] availableData];\n if ([outData length] &gt; 0) {\n NSString *outStr = [[NSString alloc] initWithData:outData encoding:NSUTF8StringEncoding];\n \n if ([outStr isEqualToString:@&quot;Password:&quot;]) {\n NSLog(@&quot;Password asked&quot;);\n [[outPipe fileHandleForReading] waitForDataInBackgroundAndNotify];\n } else {\n NSLog(@&quot;output: %@&quot;, outStr);\n }\n // Continue waiting for shell output.\n }\n [[outPipe fileHandleForReading] waitForDataInBackgroundAndNotify];\n }];\n }\n}\n\n-(void)executeCommand:(NSString*)command {\n [task resume];\n NSData* data = [command dataUsingEncoding:NSUTF8StringEncoding];\n NSError* error;\n [[[task standardInput] fileHandleForWriting] writeData:data error:&amp;error];\n if (error != NULL) {\n NSLog(@&quot;%@&quot;, [error localizedDescription]);\n }\n \n NSData* newLine = [@&quot;\\n&quot; dataUsingEncoding:NSUTF8StringEncoding];\n [[[task standardInput] fileHandleForWriting] writeData:newLine error:&amp;error];\n if (error != NULL) {\n NSLog(@&quot;%@&quot;, [error localizedDescription]);\n }\n \n}\n\n-(void)terminateTask {\n [task interrupt];\n}\n\n@end\n</code></pre>\n<p>How can I run the commands in root mode with signals like interrupt, suspend handled?</p>\n"^^ . . . . . . . . . . . . . . . . . . . "0"^^ . . "Why is currentRenderPassDescriptor taking 8ms in my Metal draw routine?"^^ . "<p>I tried to delete entries from an NSMutableOrderedSet. The behavior is inconsistent, sometimes it works and sometimes it does not.</p>\n<pre><code> NSMutableOrderedSet* detailPlaylist;\n\n [detailPlaylist removeObjectAtIndex:indexPath.row];\nbefore the removal:\n\n(lldb) po [detailPlaylist objectAtIndex:0]\n{\n videoDuration = &quot;5:15&quot;;\n videoId = &quot;i-bu47QpWWc&quot;;\n videoSelected = n;\n videoThumbnailData = {length = 10595, bytes = 0xffd8ffe0 00104a46 49460001 01000001 ... 84200421 0801ffd9 };\n videoThumbnailUrl = &quot;https://i.ytimg.com/vi/i-bu47QpWWc/hqdefault.jpg?sqp=-oaymwEiCKgBEF5IWvKriqkDFQgBFQAAAAAYASUAAMhCPQCAokN4AQ==&amp;rs=AOn4CLDbkeqgCWR4RSyTpUhI9IM2Gd2poA&quot;;\n videoTitle = &quot;\\U5f35\\U60e0\\U59b9 A-Mei - \\U7ad9\\U5728\\U9ad8\\U5d17\\U4e0a \\U5b98\\U65b9MV (Official Music Video)&quot;;\n}\n(lldb) po detailPlaylist.count\n1\n\n///////\nafter the removal:\n\n(lldb) po detailPlaylist.count\n1\n(lldb) po [detailPlaylist objectAtIndex:0]\nerror: warning: couldn't get cmd pointer (substituting NULL): no variable named '_cmd' found in this frame\nerror: Execution was interrupted, reason: internal ObjC exception breakpoint(-7)..\nThe process has been returned to the state before expression evaluation.\n</code></pre>\n"^^ . . "1"^^ . "0"^^ . . . "rendering"^^ . . . "avfoundation"^^ . "0"^^ . . . . . "1"^^ . . . "0"^^ . "0"^^ . . . . . "Bind to the array controller, arrangedObjects, `@sum.modelKey`?"^^ . "@Willeke I use `CGEventTapCreate` with the `NSEventMaskMouseMoved` mask to listen the mouse movement event. And after the callback called, my mouse pointer doesn't get inverted"^^ . . . . "1"^^ . "@RobNapier Thank you I will look through that. Do you see Edit 2? Why might that be the case? Or is that spooky behavior just odd because I am doing it the wrong way?"^^ . . . "metalkit"^^ . . . "Calculate/Display NSTableView column sum"^^ . . . . "<p>The text color starts out as red and changes to blue after clearing the text.</p>\n<pre><code>@interface ViewController ()\n\n@property (nonatomic, strong) UITextField *textField;\n\n@end\n\n@implementation ViewController\n\n- (void)viewDidLoad\n{\n [super viewDidLoad];\n \n self.textField = [[UITextField alloc] initWithFrame:CGRectMake(100, 100, 100, 30)];\n self.textField.textColor = UIColor.blueColor;\n self.textField.text = @&quot;hello world&quot;;\n NSAttributedString *attributedText = self.textField.attributedText;\n NSMutableAttributedString *mAttributedText = attributedText.mutableCopy;\n [attributedText enumerateAttribute:NSForegroundColorAttributeName inRange:NSMakeRange(0, attributedText.length) options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) {\n [mAttributedText addAttribute:NSForegroundColorAttributeName value:UIColor.redColor range:range];\n }];\n self.textField.attributedText = mAttributedText;\n \n [self.view addSubview:self.textField];\n}\n\n@end\n\n</code></pre>\n<p>The expectation is that the text should always remain red. Why does UITextField textColor changed after clearing the text?</p>\n"^^ . "@CarlLindberg This one is totally my overlook. I forgot the set was part of another data structure."^^ . . "Use SPM and forget about user header search paths"^^ . . . . "<p>I have a crash in some code from an <code>XCFramework</code> binary that I have embedded in my app.\nWhen I symobilicate the the code, the name of the methods in the call stack of the crash are replaced with the name of a C function in an objective-C class.\ne.g.</p>\n<pre><code>7 &lt;redacted&gt; 0x335988 &lt;redacted&gt;_PINRemoteImageManagerSubclassOverridesSelector + 1729336\n</code></pre>\n<p>For different crashes it seems to pick a random C Function from the code and uses it for the name of the method in the call stack.</p>\n<p>I have no idea why this would be happening.\nAny thoughts or suggestions would be welcome.\nThanks</p>\n<pre><code> Crashed: com.apple.main-thread\n0 libsystem_kernel.dylib 0xa01c __pthread_kill + 8\n1 libsystem_pthread.dylib 0x5680 pthread_kill + 268\n2 libsystem_c.dylib 0x75b90 abort + 180\n3 libswiftCore.dylib 0x3a24d8 swift::fatalError(unsigned int, char const*, ...) + 126\n4 libswiftCore.dylib 0x3a24f8 swift::warningv(unsigned int, char const*, char*) + 30\n5 libswiftCore.dylib 0x3a26b4 swift::swift_abortRetainUnowned(void const*) + 32\n6 libswiftCore.dylib 0x3ff018 swift_unknownObjectUnownedTakeStrong + 74\n7 &lt;redacted&gt; 0x335988 &lt;redacted&gt;_PINRemoteImageManagerSubclassOverridesSelector + 1729336\n8 &lt;redacted&gt; 0x280f40 &lt;redacted&gt;_PINRemoteImageManagerSubclassOverridesSelector + 989424\n9 &lt;redacted&gt; 0x298024 &lt;redacted&gt;_PINRemoteImageManagerSubclassOverridesSelector + 1083860\n10 &lt;redacted&gt; 0x297b68 &lt;redacted&gt;_PINRemoteImageManagerSubclassOverridesSelector + 1082648\n11 libdispatch.dylib 0x26a8 _dispatch_call_block_and_release + 32\n12 libdispatch.dylib 0x4300 _dispatch_client_callout + 20\n13 libdispatch.dylib 0x12998 _dispatch_main_queue_drain + 984\n14 libdispatch.dylib 0x125b0 _dispatch_main_queue_callback_4CF + 44\n15 CoreFoundation 0x3720c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16\n16 CoreFoundation 0x33f18 __CFRunLoopRun + 1996\n17 CoreFoundation 0x33668 CFRunLoopRunSpecific + 608\n18 GraphicsServices 0x35ec GSEventRunModal + 164\n19 UIKitCore 0x22c2b4 -[UIApplication _run] + 888\n20 UIKitCore 0x22b8f0 UIApplicationMain + 340\n</code></pre>\n"^^ . . . "@DonMag I’m writing. This code and this is the whole code"^^ . . "struct"^^ . "<p>I was now able to solve the problem by creating a strong reference from the FunSDKWrapper and the CompletionHandler.</p>\n<pre><code>var funSDKWrapper: FunSDKWrapper?\n\n@objc func initXMSDK(_ call: CAPPluginCall) {\n \n let wrapper = FunSDKWrapper();\n self.funSDKWrapper = wrapper;\n \n let strongCompletionHandler: (([AnyHashable: Any]) -&gt; Void) = { result in\n NSLog(&quot;Completion von iniXMSDK&quot;);\n }\n \n let resp = wrapper.iniXMSDK(1, completion: strongCompletionHandler);\n \n call.resolve([\n &quot;status&quot;: resp\n ])\n\n}\n</code></pre>\n"^^ . "network.framework"^^ . . . "grand-central-dispatch"^^ . . . "1"^^ . "0"^^ . "<p>I need open the native camera app when a function was called. I just need redirect to native camera app. I don't want to get any image.</p>\n<p>I am trying with this code:</p>\n<pre><code> NSURL *url = [NSURL URLWithString:@&quot;some-camera-deep-link://&quot;];\n \n if ([[UIApplication sharedApplication] canOpenURL:url]) {\n [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];\n } else {\n NSLog(@&quot;some error&quot;);\n }\n</code></pre>\n<p>However, I don't know the exact URL I need to set and how configure this in my <code>Info.plist</code>.</p>\n<p>Is possible do this kind of navigation?\nCan you show some example?</p>\n<p>I don't want to use <code>UIImagePickerController</code>.</p>\n"^^ . "1"^^ . . "0"^^ . . "0"^^ . . . . . . . . . "1"^^ . . "0"^^ . "0"^^ . "https://www.biteinteractive.com/sherlock-holmes-and-the-mystery-of-the-untappable-button/"^^ . . . . . . . "Ah, I see your edit. Yes, Metal is synced to the display cycle. `enableSetNeedsDisplay` (together with `paused`) is just used to allow you to update **less** often, not more often. Generally you want a CADisplayLink to drive your rendering loop, so you'll sync with it. This sample code may be helpful: https://developer.apple.com/documentation/metal/onscreen_presentation/creating_a_custom_metal_view?language=objc"^^ . . "You set the entire sell alpha to 0.5, and the cell obviously includes its textLabel. I suppose you could try to add a solid-color subview to the cell with alpha 0.5, and the text as another subview with alpha 1.0."^^ . . . . . "ionic-framework"^^ . . . "Exit command line Network.framework app that uses dispatch_main()"^^ . . "Reuse a tableview cell with CALayer"^^ . . . . . "0"^^ . "1"^^ . . "xcode"^^ . . "1"^^ . . . . "How can I open native camera from my app on iOS?"^^ . "No member in framework target: Swift class as forward class in ObjC, accessed in Swift through ObjC class"^^ . . . . "0"^^ . . "0"^^ . . . "Extract the 3D stereo images from a 3D video in MV-HEVC format"^^ . . . . . . . "dynamic-frameworks"^^ . . . . . . . . . . . . . "0"^^ . . . . "once you clear the text, you no longer have the attributed text attributes applied, you need to re apply them while you were typing the text."^^ . . . . . . . "swift"^^ . "How is it not working fine?"^^ . "1"^^ . "0"^^ . . . . . . "It works! Thanks for answer. How did you come to the answer? Can you tell me what I needs to study to understand more about this?"^^ . . . . . . . . "0"^^ . . . "Google Map layer snapshot in iOS 17.2 is blank"^^ . . . . "When I set it to 10, 15, and 30 I render frames to be 0ms. So everything is taking less than 1ms to finish."^^ . "0"^^ . "2"^^ . . "<p>I have developed an iOS app (way back with ObjectiveC) which creates an image of the current Google Map on the screen. I always have used this code, which ran fine:</p>\n<pre><code>UIGraphicsBeginImageContextWithOptions(self.map.frame.size, NO, 0.0);\n[self.map.layer renderInContext:UIGraphicsGetCurrentContext()];\nUIImage *image = UIGraphicsGetImageFromCurrentImageContext();\nUIGraphicsEndImageContext();\nreturn image;\n</code></pre>\n<p>Now I have the problem that since iOS 17.2 the image is empty (only the Google logo is shown, but no map information at all).</p>\n<p>Does anybody know what the issue is?</p>\n<p>Thx,\nDanny</p>\n"^^ . "0"^^ . . . . "1"^^ . . . . . . . . . "<p>Stack Overflow similar questions hints gave me some more ideas and one of it worked )..\nAll was needed is just to increase iOS Deployment Target. From 12.0 to 12.4 worked in my case.</p>\n<p><a href="https://stackoverflow.com/questions/64707510/flutter-xcode-12-archive-build-fails-with-undefined-symbol-objc-class-stpapi">Flutter Xcode 12 archive build fails with Undefined symbol: _OBJC_CLASS_$_STPAPIClient</a></p>\n"^^ . "gpu"^^ . "<p>Apple provides the <code>NS_ENUM</code> and <code>NS_OPTION</code> macros (<a href="https://developer.apple.com/library/archive/releasenotes/ObjectiveC/ModernizationObjC/AdoptingModernObjective-C/AdoptingModernObjective-C.html#//apple_ref/doc/uid/TP40014150-CH1-SW6" rel="nofollow noreferrer">link to docs</a>) to define enumerations in Objective-C. Here's an example how this looks like for <code>NS_ENUM</code>:</p>\n<pre><code>--- EnumName.h ---\n\n#pragma once\n#import &lt;Foundation/NSObjCRuntime.h&gt;\n\ntypedef NS_ENUM(NSUInteger, EnumName)\n{\n EnumMemberA,\n EnumMemberB,\n EnumMemberC,\n};\n</code></pre>\n<p>What is the syntax to write Doxygen documentation for such an enumeration type definition (and also for the enumeration members)?</p>\n<p>At first I tried the intuitive thing: Write a <code>@brief</code> documentation block just before the definition.</p>\n<pre><code>--- EnumName.h ---\n\n#pragma once\n#import &lt;Foundation/NSObjCRuntime.h&gt;\n\n/// @file\n\n/// @brief A brief description.\ntypedef NS_ENUM(NSUInteger, EnumName)\n{\n EnumMemberA,\n EnumMemberB,\n EnumMemberC,\n};\n</code></pre>\n<p>Result: Doxygen includes the documentation block in its generated output (✅), but parses the definition as a function (❌). Places where the enumeration type is used, such as in function/method arguments, are not linked (❌).</p>\n<p>Next I tried adding an <code>@enum EnumName</code> command in front.</p>\n<pre><code>--- EnumName.h ---\n\n#pragma once\n#import &lt;Foundation/NSObjCRuntime.h&gt;\n\n/// @file\n\n/// @enum EnumName\n/// @brief A brief description.\ntypedef NS_ENUM(NSUInteger, EnumName)\n{\n EnumMemberA,\n EnumMemberB,\n EnumMemberC,\n};\n</code></pre>\n<p>Result: Doxygen issues this warning: <code>warning: Documentation for undefined enum 'EnumName' found</code> and does not include the documentation block in its generated output at all (❌).</p>\n<p>I can understand that Doxygen may be unable to parse the <code>typedef NS_ENUM</code> construct, but in that case I would like to be able to write a documentation block decoupled from actual source code.</p>\n<p>I'm using Doxygen 1.10.0, installed via Homebrew on macOS 13.5.2 on an Intel Mac.</p>\n"^^ . "0"^^ . "0"^^ . . . "frameworks"^^ . "To get helpful answers, please show your code. Please read [How to create a Minimal, Reproducible Example.](https://stackoverflow.com/help/minimal-reproducible-example), then [edit] your question."^^ . "1"^^ . "<p>In iOS 16+, when the <code>NSData *data</code> ranges between 0 and 255, the <code>int16_t buff</code> retrieves values not within the range of 0 to 255, but rather 29440 to 29696.</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (void)system:(id)system features:(void (^)(NSArray*))features\n{\n [self read:TAPropertyTypeAvailableFeatures system:system handler:^(NSDictionary* data, NSError* error){\n \n NSArray* datas = [data objectForKey:@&quot;value&quot;];\n NSMutableArray* numbers = [[NSMutableArray alloc] init];\n \n for(NSData* data in datas)\n {\n int16_t buff;\n [data getBytes:&amp;buff length:sizeof(buff)];\n NSNumber* number = [NSNumber numberWithInteger:buff];\n [numbers addObject:number];\n }\n \n features(numbers);\n }];\n}\n</code></pre>\n<p>When I upgraded my MacBook to 14.1.2 and Xcode to 15.0.1, I encountered an issue with this function that I rebuilt.</p>\n<p>In iOS 16+, when the <code>NSData *data</code> ranges between 0 and 255, the <code>int16_t buff</code> retrieves values not within the range of 0 to 255, but rather 29440 to 29696.</p>\n<p>However, in iOS 15, it still remains between 0 and 255.</p>\n<p>This problem never occurred before. Changing int16_t to int resolves the issue.</p>\n<p>What is causing this issue?\nIs it possible to continue using <code>int16_t</code> without encountering this problem?</p>\n"^^ . . . "0"^^ . "0"^^ . . "cordova"^^ . "0"^^ . "0"^^ . . . . . . . "1"^^ . "1"^^ . . . . "0"^^ . . "core-data"^^ . "define steps of 250 to leftAxis using iOS-charts"^^ . . . . . . . "No. You don't need to manage purgeability for that. Purgeable state is for resources that your application might want to let go because it can easily restore them, such as textures that can be streamed from storage, when the memory pressure increases."^^ . "0"^^ . "UIButton visible but cannot be pressed"^^ . "0"^^ . "1"^^ . . . . . "I haven't tried to integrate C++ with Objective-C in a long time. Swift/Objective C use ARC, (Automatic Reference Counting.) If you return dynamically allocated objects to Swift, you need to set up the memory semantics of your function header such that Swift knows it needs to take ownership of the object(s). I know how to do that between Objective-C and Swift, but not C++. I suggest adding a C++ tag to your question and change your subject to ask about using C++ frameworks from Swift/Objective-C"^^ . . . "0"^^ . . . . "0"^^ . . . . "0"^^ . "<p>I'm working in Objective-C, but this question is ubiquitous to swift too (I think). If I have buffer <code>id&lt;MTLBuffer&gt; my_buffer</code> and a render command currently queued on the GPU that reads from <code>my_buffer</code>. If I set <code>my_buffer</code>'s purgeable state to be empty, i.e.</p>\n<pre><code>[my_buffer setPurgeableState:MTLPurgeableStateEmpty];\n</code></pre>\n<p>BEFORE or DURING the command being processed on the GPU, what will happen? Will the GPU still use the resource without a problem and then discard it once it is done? Or will it not know that that buffer exists anymore? Does <code>purgeableState</code> even affect the device's allocation of memory?</p>\n<p>If this is not the case, how do I set a buffer to discard it's memory when there are no outstanding render command queued that reference it (but the program is oblivious to whether or not there are outstanding render commands referencing it)?</p>\n"^^ . . . . . "0"^^ . . . "0"^^ . . . . . "Most common reason is that the buttons are outside the bounds of their superview. set `boardView.clipsToBounds = YES;` and see if your buttons disappear."^^ . . "<h1><strong>Report</strong></h1>\n<p><strong>What did I do?</strong></p>\n<p>I tried to run the <strong>pod install</strong> or <strong>arch -x86_64 pod install</strong> command</p>\n<p><strong>What did you expect to happen?</strong></p>\n<p>I want to pod install Facebook with <strong>use framework!</strong>.\nCurrently, I am using a static library.</p>\n<p><strong>What happened instead?</strong></p>\n<blockquote>\n<p>[!] The following Swift pods cannot yet be integrated as static libraries:</p>\n<p>The Swift pod <code>FacebookCore</code> depends upon <code>FBSDKCoreKit</code>, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set <code>use_modular_headers!</code> globally in your Podfile, or specify <code>:modular_headers =&gt; true</code> for particular dependencies.</p>\n<p>The Swift pod <code>FacebookLogin</code> depends upon <code>FBSDKCoreKit</code> and <code>FBSDKLoginKit</code>, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set <code>use_modular_headers!</code> globally in your Podfile, or specify <code>:modular_headers =&gt; true</code> for particular dependencies.</p>\n<p>The Swift pod <code>FacebookShare</code> depends upon <code>FBSDKCoreKit</code> and <code>FBSDKShareKit</code>, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set <code>use_modular_headers!</code> globally in your Podfile, or specify <code>:modular_headers =&gt; true</code> for particular dependencies.</p>\n</blockquote>\n<p><a href="https://i.sstatic.net/pfTB7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/pfTB7.png" alt="enter image description here" /></a></p>\n<p><strong>CocoaPods Environment</strong></p>\n<pre><code>CocoaPods : 1.15.1\n</code></pre>\n<p><a href="https://i.sstatic.net/UiSfw.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/UiSfw.png" alt="enter image description here" /></a></p>\n<p><strong>Podfile</strong></p>\n<pre><code># Uncomment the next line to define a global platform for your project\nplatform :ios, '11.0'\n\ndef facebook_pods\n# pod 'Bolts'\n# pod 'FBSDKLoginKit', :modular_headers =&gt; true\n# pod 'FBSDKShareKit', :modular_headers =&gt; true\n pod 'FacebookLogin'\n pod 'FacebookShare'\nend\n\ndef all_pods\n pod 'Firebase', :modular_headers =&gt; true\n pod 'FirebaseCoreInternal', :modular_headers =&gt; true\n pod 'GoogleUtilities', :modular_headers =&gt; true\n pod 'FirebaseCore', :modular_headers =&gt; true\n pod 'GoogleMaps'\n pod 'GooglePlaces'\n pod 'GoogleSignIn'\n pod 'FirebaseCoreInternal'\n pod 'Firebase/Analytics'\n pod 'Firebase/DynamicLinks'\n pod 'AFNetworking', '~&gt; 3.0'\n pod 'StreamingKit', '0.1.29'\n pod 'TYMActivityIndicatorView'\n pod 'IQKeyboardManager','~&gt; 6.0.1'\n pod 'iOS-Slide-Menu', '~&gt; 1.5'\n pod 'TwitterKit'\n pod 'TwitterCore'\n pod 'Fabric'\n pod 'Crashlytics'\n pod 'MBProgressHUD'\n pod 'UCZProgressView'\n pod 'BIZActivityButton'\n pod 'TagCellLayout'\n pod 'AnimatedCollectionViewLayout'\n pod 'CardsLayout'\n pod 'SegmentedProgressView'\n pod 'VIMediaCache'\n pod 'ZFTokenField'\n pod &quot;CleverTap-iOS-SDK&quot;\n pod 'SDWebImageFLPlugin'\n pod 'FlexiblePageControl'\n pod 'YoutubePlayer-in-WKWebView'\n pod 'PayUIndia-Custom-Browser'\n pod 'PayUIndia-PG-SDK'\n# pod 'lottie-ios'\n# pod 'PromiseKit'\n pod 'Adjust', '~&gt; 4.29.2'\n pod 'Toast-Swift', '~&gt; 5.0.1'\n pod 'RealmSwift', '~&gt; 10.5.2', :modular_headers =&gt; true\n pod 'Realm', '~&gt; 10.5.2', :modular_headers =&gt; true\n\n facebook_pods\nend\n\n\n\n# Service Extension Use All Available pods\n\ndef serviceExtensionAllTargetPods\n# pod &quot;CleverTap-iOS-SDK&quot;\nend\n\n\n\ntarget 'MyApp' do\n all_pods\nend\n\ntarget 'MyApp Development Stage' do\n all_pods\nend\n\ntarget 'MyApp Development Stage Simulator' do\n all_pods\nend\n\ntarget 'MyApp Development Live' do\n all_pods\nend\n\ntarget 'MyApp Development Live Simulator' do\n all_pods\nend\n\ntarget 'MyApp Enterprise Stage' do\n all_pods\nend\n\ntarget 'MyApp Enterprise Live' do\n all_pods\nend\n\ntarget 'ServiceExtension' do\n serviceExtensionAllTargetPods\nend\n\ntarget 'MyApp ServiceExtension' do\n serviceExtensionAllTargetPods\nend\n\ntarget 'MyApp Enterprise ServiceExtension' do\n serviceExtensionAllTargetPods\nend\n\n</code></pre>\n<p>I want to pod install Facebook without <strong>use framework!</strong>.</p>\n<p>Currently, I am using a static library.</p>\n<p>And I don't want use <code>use_modular_headers!</code> globally.</p>\n"^^ . . "An in-flight command buffer cannot reference any resources other than `NonVolatile`. Otherwise, you are basically invoking an undefined behavior. If you want to use purgable states, it's your job to track which resources are used by in-flight command buffers and make sure that all of them are non-volatile before a command buffer is submitted."^^ . . "0"^^ . . "2"^^ . . . . . "1"^^ . . . . "0"^^ . . . . "You aren't really doing anything in code that matches the description of what you **want** to do. Take a look at this answer - it may have all the parts you need: https://stackoverflow.com/a/12399760/6257435"^^ . "Xcode Crash Log - Call Stack replaced with C Function name"^^ . . . "0"^^ . . "<p>Unfortunately, you can't. There are a few URL schemes that are supported by the system. And the camera is none of them. You have to use a built-in component such as <code>UIImagePickerController</code> or create a new one on your own.</p>\n<p>AFAIK, at most, you can able to open the gallery with this <code>photos-redirect://</code>.</p>\n<p>This <a href="https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference" rel="nofollow noreferrer">document</a> indicates all these supported links.</p>\n<p><strong>Updated</strong>: I've found this helpful <a href="https://github.com/bhagyas/app-urls" rel="nofollow noreferrer">repo</a> if you're curious.</p>\n"^^ . . . . "command line tool Mac app. 1、new plist file with Info.plist. 2、setting <dict>\n <key>CFBundleIdentifier</key>\n <string>com.mycorp.myapp</string>\n <key>CFBundleName</key>\n <string>My App</string>\n <key>NSContactsUsageDescription</key>\n <string>record from the camera</string>\n </dict> . 3、Build Setting - Create Info.plist Section in Binary with YES. 4、Build Setting - Info.plist file set your file path. 5、Build Phases - Copy Files - Destination to Products Directory, and add your info file with `add`"^^ . "NSLog( @"%d", 123456) produces 123,456"^^ . . . "0"^^ . . . . "<p>I have a simple draw routine to draw a rotating triangle. And have diagnosed that most of the time getting the current MTLRenderPassDescriptor from the MTKView is taking 8ms. My code is in Objective-C and using manual reference counting. This is so I can communicate with my C++ game loop.</p>\n<p>I'm calling this draw routine in an external while loop in C++ and there are no wait functions, so the loop restarts as soon as the last one is finished. At the end of my C++ loop, I manually poll all Cocoa events similar to GLFW.</p>\n<p>Here is my code for the draw routine:</p>\n<pre><code>- (void)commitWithMTKView:(nonnull MTKView *)mtk_view CommandQueue:(nonnull id&lt;MTLCommandQueue&gt;)command_queue {\n NSLog(@&quot;Begin Frame&quot;);\n [self updateState];\n NSLog(@&quot;Updated State&quot;);\n \n @autoreleasepool {\n NSLog(@&quot;Probe 1&quot;);\n MTLRenderPassDescriptor* render_pass_descriptor = mtk_view.currentRenderPassDescriptor;\n NSLog(@&quot;Probe 2&quot;);\n if (render_pass_descriptor != nil) {\n id&lt;MTLCommandBuffer&gt; command_buffer = [command_queue commandBuffer];\n \n// Command Encoding\n id&lt;MTLRenderCommandEncoder&gt; render_encoder = [command_buffer renderCommandEncoderWithDescriptor:render_pass_descriptor];\n [render_encoder setRenderPipelineState:_render_pipeline_state];\n// \n [render_encoder setVertexBuffer:_vertex_buffers[_current_buffer]\n offset:0\n atIndex:ParallelTriangleRotate_vertexIndexVertices];\n \n [render_encoder setVertexBytes:&amp;_aspect_ratio\n length:sizeof(_aspect_ratio)\n atIndex:ParallelTriangleRotate_vertexIndexAspectRatio];\n \n [render_encoder drawPrimitives:MTLPrimitiveTypeTriangle\n vertexStart:0\n vertexCount:3];\n// \n [render_encoder endEncoding];\n NSLog(@&quot;Finished Encoded&quot;);\n//\n// Commit in Drawable\n [command_buffer presentDrawable:mtk_view.currentDrawable];\n NSLog(@&quot;Before Commit&quot;);\n [command_buffer commit];\n NSLog(@&quot;After Commit&quot;);\n [command_buffer waitUntilScheduled];\n NSLog(@&quot;Just Scheduled&quot;);\n [command_buffer waitUntilCompleted];\n NSLog(@&quot;Completed Scheduled&quot;);\n }\n }\n NSLog(@&quot;End Frame&quot;);\n}\n\n</code></pre>\n<p>By visual inspection I found two bottlenecks. The primary one is between &quot;Probe 1&quot; and &quot;Probe 2&quot;, which is getting the currentRenderPassDescriptor from the MTKView. We can see this in the time stamps of the log below.</p>\n<pre><code>2023-12-29 16:38:29.733 debug[64019:15574119] Begin Frame\n2023-12-29 16:38:29.733 debug[64019:15574119] Updated State\n2023-12-29 16:38:29.733 debug[64019:15574119] Probe 1\n2023-12-29 16:38:29.741 debug[64019:15574119] Probe 2\n2023-12-29 16:38:29.741 debug[64019:15574119] Finished Encoded\n2023-12-29 16:38:29.741 debug[64019:15574119] Before Commit\n2023-12-29 16:38:29.741 debug[64019:15574119] After Commit\n2023-12-29 16:38:29.741 debug[64019:15574119] Just Scheduled\n2023-12-29 16:38:29.742 debug[64019:15574119] Completed Scheduled\n2023-12-29 16:38:29.742 debug[64019:15574119] End Frame\n</code></pre>\n<p>And the other is very rare and between &quot;After Commit&quot; and &quot;Just Scheduled&quot;. This one makes more sense.</p>\n<pre><code>2023-12-29 16:45:50.024 debug[64199:15579939] Updated State\n2023-12-29 16:45:50.024 debug[64199:15579939] Probe 1\n2023-12-29 16:45:50.024 debug[64199:15579939] Probe 2\n2023-12-29 16:45:50.024 debug[64199:15579939] Finished Encoded\n2023-12-29 16:45:50.024 debug[64199:15579939] Before Commit\n2023-12-29 16:45:50.024 debug[64199:15579939] After Commit\n2023-12-29 16:45:50.024 debug[64199:15579939] Just Scheduled\n2023-12-29 16:45:50.032 debug[64199:15579939] Completed Scheduled\n2023-12-29 16:45:50.032 debug[64199:15579939] End Frame\n</code></pre>\n<p>This case happened extremely rarely and when it did, currentRenderPassDescriptor ran instantly.</p>\n<p>Lastly I am setting (what I'm pretty sure is v-sync) to be turned off with <code>mtk_view.enableSetNeedsDisplay = NO;</code></p>\n<p>So after this rudimentary diagnosis, it looks like the stall is primarily coming from a simple pointer retrieval with the line <code>MTLRenderPassDescriptor* render_pass_descriptor = mtk_view.currentRenderPassDescriptor;</code></p>\n<p>Why is this? Can I optimize this? Should I store the pointer as a constant and update it when the view render pass descriptor changes?</p>\n<p>EDIT:</p>\n<p>I have also found that despite disabling <code>mtk_view.enableSetNeedsDisplay</code>, I am still getting v-sync behavior. I am manually measuring the frames per second in my C++ loop, and see that I am getting ~140 frames when the window is on my MacBook Retina display and ~70 frames when the window is on my Samsung display. This means that despite calling the draw function every loop in the unrestrained C++ loop, Metal is still stalling to maintain the frame rate. And from my diagnostic, it looks like it is stalling at <code>MTLRenderPassDescriptor* render_pass_descriptor = mtk_view.currentRenderPassDescriptor;</code> because this is taking 8ms and each frame of the C++ loop is taking 8ms. (This is 15ms when on the Samsung display).</p>\n<p>EDIT 2:</p>\n<p>For some reason when I set <code>mtk_view.preferredFramesPerSecond = 10;</code> when initializing the MTKView, I am getting extremely fast frames. But when I increase the frame rate to say <code>mtk_view.preferredFramesPerSecond = 60;</code> I get frames that still last to be 8ms. This seems to be inverted from what I expect.</p>\n"^^ . "1"^^ . "3"^^ . . . . . . "1"^^ . . . "3d"^^ . . . "why you need to have two colors when you always want red ?"^^ . . "1"^^ . "<p>You can put this either in <code>cellForRowAtIndexPath</code> or <code>willDisplayCell</code>:</p>\n<pre><code>cell.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];\n</code></pre>\n<p>Output:</p>\n<p><a href="https://i.sstatic.net/TpPRs.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TpPRs.png" alt="enter image description here" /></a></p>\n<p>Set the label text color as you normally would (in <code>cellForRowAtIndexPath</code>), and adjust the <code>colorWithAlphaComponent:0.5</code> to suit your needs.</p>\n"^^ . "1"^^ . . . . "0"^^ . "0"^^ . . . . "Core Data, yes. The table populates as intended. And I can display (in a textField) the total number entries that populate the table using count. model key path binding. One column includes currency values. I need to display the sum of the column entries in a textfield as well. How would I set up bindings for textField to display the sum of column entries? Is there more to it than implementing @sum. model key path binding?"^^ . . . . . "textcolor"^^ . "0"^^ . . . . . . . . . "It's worth keeping in mind: Almost every framework you might consume allocates private, global-ish data structures that you cannot explicitly release, except by virtue of your process terminating. WebKit is a great example: it allocates hundreds of MB of internal data structures that you have no way to force it to clean up, other than by terminating the process. I suggest explicitly handling the things you own/create, and trusting that the framework either handles its own cleanup, or *doesn't care* about not cleaning up."^^ . "0"^^ . . . . "doxygen"^^ . "core-video"^^ . . "0"^^ . "When you say "extremely fast frames" I assume you mean that `currentRenderPassDescriptor` returns quickly? My assumption is that when you set it to 10, it's possibly ignoring it because it's too low. Try 15 or 30. You might check CADisplayLink.preferredFrameRateRange. You're probably outside of it."^^ . "flutter plugin does not execute background iOS code with lock"^^ . "<p>I would advise you to subclass <code>UITableViewCell</code>, assign these layers as properties, and manage their visibility using <code>hidden</code> property of <code>CALayer</code>.</p>\n<p>Create a custom cell class</p>\n<pre><code>@interface StatusCell: UITableViewCell\n\n@property (nonatomic, strong) CAShapeLayer *progressLayer;\n@property (nonatomic, strong) CAShapeLayer *sentLayer;\n\n@end\n</code></pre>\n<p>Assign <code>StatusCell</code> class name to your cell prototype in storyboard.</p>\n<p>Create the layers – as you could notice, <code>cellForRowAtIndexPath</code> method is not the best place to do it, as it is called often during cell life cycle. I usually create properties in <code>init</code> methods, as your cell is storyboard-based, you can also use the <code>awakeFromNib</code> method, it is also called only once during nib-based cells' life cycle.</p>\n<pre><code>@implementation StatusCell\n\n- (void)awakeFromNib {\n [super awakeFromNib];\n\n CAShapeLayer *progressLayer;\n // configuraion\n progressLayer.hidden = YES;\n self.progressLayer = progressLayer;\n\n // repeat for sentLayer.\n}\n\n@end\n</code></pre>\n<p>In your cellForRow method you set one layer to be hidden, and other to be visible. You can adjust layers' positions, if required.</p>\n<pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\n StatusCell *cell = [tableView dequeueReusableCellWithIdentifier:@&quot;StatusCell&quot;];\n\n // Optionally adjust your layers' frames if your cell has dynamic height. \n\n NSManagedObject *object = [self.fetchedResultsController objectAtIndexPath:indexPath];\n\n cell.progressLayer.hidden = ![[object valueForKey:@&quot;status&quot;] isEqualToString:@&quot;sending&quot;];\n cell.sentLayer.hidden = ![[object valueForKey:@&quot;status&quot;] isEqualToString:@&quot;sent&quot;];\n\n return cell;\n}\n</code></pre>\n"^^ . . . "Tip: don't ignore return values."^^ . "Is this mystery text box a regular Cocoa control, or rendered from something like a HTML document?"^^ . . . . "<p>I have a problem with <code>captureOutput</code> method not being called during the session. I tried adding <code>NSLog</code> to it but it seems that method is never called. Moreover, I tried searching for the solution, but didn't find any.</p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &lt;AVFoundation/AVFoundation.h&gt;\n#import &lt;UIKit/UIImage.h&gt;\n\n@interface Cam : NSObject &lt;AVCaptureVideoDataOutputSampleBufferDelegate&gt;\n-(void)captureOutput:(AVCaptureOutput *)output\n didOutputSampleBuffer:(CMSampleBufferRef)buffer\n fromConnection:(AVCaptureConnection *)connection;\n@end\n\n@interface Cam ()\n{\n}\n\n-(BOOL)start: (int)deviceIndex;\n-(void)stop;\n-(NSData *)getFrame;\n@end\n\n@implementation Cam\n\nCam *cam;\nCVImageBufferRef head;\nAVCaptureSession *session;\nint count;\n\n-(id)init\n{\n self = [super init];\n head = nil;\n count = 0;\n return self;\n}\n\n-(void)dealloc\n{\n @synchronized (self)\n {\n if (head != nil)\n {\n CFRelease(head);\n }\n }\n}\n\n-(BOOL)start:(int)deviceIndex\n{\n int index;\n NSArray *devices;\n AVCaptureDeviceDiscoverySession *discoverySession;\n\n AVCaptureDevice *device;\n AVCaptureDeviceInput *input;\n AVCaptureVideoDataOutput *output;\n NSError *error;\n dispatch_queue_t queue;\n\n session = [[AVCaptureSession alloc] init];\n session.sessionPreset = AVCaptureSessionPresetMedium;\n\n discoverySession = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[AVCaptureDeviceTypeBuiltInWideAngleCamera]\n mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];\n devices = discoverySession.devices;\n index = deviceIndex;\n\n if (index &lt; 0 || index &gt;= [devices count])\n {\n log_debug(&quot;* Failed to open device (%d)\\n&quot;, index);\n return NO;\n }\n\n device = devices[index];\n input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&amp;error];\n\n if (!input)\n {\n log_debug(&quot;* Failed to capture input (%s)\\n&quot;, [error.localizedDescription UTF8String]);\n return NO;\n }\n\n [session addInput:input];\n output = [[AVCaptureVideoDataOutput alloc] init];\n [session addOutput:output];\n\n queue = dispatch_queue_create(&quot;cam_queue&quot;, NULL);\n [output setAlwaysDiscardsLateVideoFrames:YES];\n [output setVideoSettings:@{(NSString *)kCVPixelBufferPixelFormatTypeKey:@(kCVPixelFormatType_32BGRA)}];\n [output setSampleBufferDelegate:self queue:queue];\n [session startRunning];\n\n return YES;\n}\n\n-(void)stop\n{\n [session stopRunning];\n}\n\n-(NSData *)getFrame\n{\n int timer;\n\n CIImage *ciImage;\n CIContext *temporaryContext;\n CGImageRef videoImage;\n UIImage *uiImage;\n NSData *frame;\n\n for (timer = 0; timer &lt; 500; timer++)\n {\n if (count &gt; 5)\n {\n break;\n }\n\n usleep(10000);\n }\n\n @synchronized (self)\n {\n if (head == nil)\n {\n log_debug(&quot;* Head is somehow nil (count: %d)\\n&quot;, count);\n return nil;\n }\n\n ciImage = [[CIImage imageWithCVPixelBuffer:head] imageByApplyingOrientation:6];\n temporaryContext = [CIContext contextWithOptions:nil];\n videoImage = [temporaryContext createCGImage:ciImage fromRect:CGRectMake(0, 0,\n CVPixelBufferGetHeight(head),\n CVPixelBufferGetWidth(head))];\n uiImage = [[UIImage alloc] initWithCGImage:videoImage];\n frame = UIImageJPEGRepresentation(uiImage, 1.0);\n CGImageRelease(videoImage);\n\n return frame;\n }\n\n return nil;\n}\n\n-(void)captureOutput:(AVCaptureOutput *)output\n didOutputSampleBuffer:(CMSampleBufferRef)buffer\n fromConnection:(AVCaptureConnection *)connection\n{\n CVImageBufferRef frame;\n CVImageBufferRef prev;\n\n frame = CMSampleBufferGetImageBuffer(buffer);\n CFRetain(frame);\n\n @synchronized (self)\n {\n prev = head;\n head = frame;\n count++;\n }\n\n if (prev != nil)\n {\n CFRelease(prev);\n }\n}\n\n@end\n</code></pre>\n<p>So, what I do is basically:</p>\n<pre class="lang-objectivec prettyprint-override"><code>...\nNSData *frame;\n\n@autoreleasepool\n{\n cam = [[Cam alloc] init];\n\n if ([cam start:camID])\n {\n frame = [cam getFrame];\n if (frame == nil)\n log_debug(&quot;* Frame is somehow nil?\\n&quot;);\n }\n else\n {\n cam = nil;\n }\n}\n...\n</code></pre>\n<p>As a result I get <code>* Frame is somehow nil?</code> and <code>* Head is somehow nil (count: 0)</code></p>\n<p>I don't know what else I can do or fix. Please help me with this issue.</p>\n<p>Thanks in advance</p>\n"^^ . . . "Do not implement `heightForRowAtIndexPath` if you return the same value for all rows. Simply set the `rowHeight` property of the table view to that one value."^^ . "As you can see from [these search results](https://stackoverflow.com/search?q=%5Bios%5D+open+camera+app), it is not possible."^^ . "0"^^ . "0"^^ . "@TejaNandamuri It's just a demo. I will change textColor using setAttributedText: at specific time. After clearing the text, I wish textColor remains the same."^^ . "0"^^ . "@HangarRash - meh... figured since the OP hadn't tried using `colorWithAlphaComponent` they probably wouldn't get that from the linked answer (which only referenced `clearColor`)."^^ . "0"^^ . "I've seen the debugger lie before, caching the description from a previous "po" command and repeating it, even though the reality is different if the method was actually called."^^ . . . . . . . "automatic-ref-counting"^^ . . . "0"^^ . . "And what happens if you set `setVoiceProcessingEnabled` on one of the input/output nodes only?"^^ . . "<p>When I finally figured out what was wrong, it had to do with the version of the pod that the code was using.</p>\n<p>Therefore, if you're still having these problems, I advise you to:</p>\n<ul>\n<li>Verify the pod's compatibility to see whether that's the problem.</li>\n<li>Reinstall pods after uninstalling them.</li>\n</ul>\n<p>OR</p>\n<ul>\n<li>Delete the derived data.</li>\n<li>Quit Xcode.</li>\n<li>Reopen Xcode.</li>\n<li>Clean build.</li>\n<li>Build</li>\n<li>Update your packages to the latest version</li>\n<li>Check if the framework's repository has released a version that adds\nsupport for arm64</li>\n<li>Upgrade to the highest patch for your minor or latest and\nverify if the issue persists</li>\n</ul>\n<p>OR</p>\n<p>Visit this links :</p>\n<ul>\n<li><a href="https://github.com/facebook/react-native/issues/28777" rel="nofollow noreferrer">https://github.com/facebook/react-native/issues/28777</a></li>\n<li><a href="https://github.com/facebook/react-native/issues/40932" rel="nofollow noreferrer">https://github.com/facebook/react-native/issues/40932</a></li>\n<li><a href="https://forums.developer.apple.com/forums/thread/691640" rel="nofollow noreferrer">https://forums.developer.apple.com/forums/thread/691640</a></li>\n</ul>\n"^^ . . . . . . . . . . . "<p>As the title suggests I am using AVAudioEngine for SFSpeechRecognition input &amp; AVAudioPlayer for sound output.</p>\n<p>Apple says in this <a href="https://developer.apple.com/videos/play/wwdc2019/510" rel="nofollow noreferrer">talk</a> that the setVoiceProcessingEnabled function very usefully cancels the output from speaker to the mic. I set voiceProcessing on the AVAudioInputNode and AVAudioOutputNode.</p>\n<p>When running xcode when speechRecognitionEnabled:YES throws the following error:</p>\n<pre><code>throwing 18,446,744,073,709,551,615\n from AU (0x13bf98dd0): auou/vpio/appl, render err: 18,446,744,073,709,551,615\n\n</code></pre>\n<p>There is no error thrown when setting up the nodes and it seems to work however the volume is low, even when the system volume is turned up. Any solution to this would be much appreciated.</p>\n<p>I tried various AVAudioEngine node setups. One setup with a mixer node and one without. I am expecting the audio levels to be loud, in conjunction with the system volume.</p>\n"^^ . . . . "Download DSYMs from appstoreconnect.apple.com"^^ . . "Try `NSLog(@"%@", @(123456))` or `NSLog(@"%@", [[NSString alloc] initWithFormat:@"%d", 123456])`."^^ . "1"^^ . . . . . "It is unclear to me how OnFunSDKResult actually gets called. In your code, you create an instance of FunSDKWrapper, retain count of 1. But there are no other references to that wrapper, so as soon as it goes out of scope, ARC will release it. Retain count of zero, the object will be dealloced. You have a non-memory-managed pointer in msgHandle internally, but you need to find a way to keep a managed reference around until OnFunSDKResult is called. If that is guaranteed, you could have FunSDKWrapper have a retained reference to itself in the ini method, then nil it out in OnFunSDKResult."^^ . . "0"^^ . . "<pre><code>PHAuthorizationStatus authorizationStatus = [PHPhotoLibrary authorizationStatusForAccessLevel:PHAccessLevelReadWrite];\nif (authorizationStatus != PHAuthorizationStatusAuthorized) {\n return;\n}\nPHFetchOptions *fetchOptions = [[PHFetchOptions alloc] init];\nfetchOptions.predicate = [NSPredicate predicateWithFormat:@&quot;title == %@&quot;, &quot;MyAlbum&quot;];\nPHFetchResult *collections = [PHAssetCollection fetchAssetCollectionsWithType: PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAny options:fetchOptions];\n</code></pre>\n<p>The above code crashed when fetchAssetCollectionsWithType is called on iOS 17, and the error is &quot;Access to the photo library is not allowed until the photo library is obtainable.&quot;\nWhat's wrong with my code?</p>\n<p>I thought the reason is that I called the function too early, because the system printed the log, &quot;Error returned from daemon: Error Domain=com.apple.accounts Code=7 &quot;(null)&quot; when I called the function before the UIViewController#viewDidLoad is called on my own device which is iOS 17.0.2.\nSo I called the function after UIViewController#viewDidLoad is called, and I got the above error, &quot;Access to the photo library is not allowed until the photo library is obtainable&quot;</p>\n"^^ . . . . . . "Haha, when I rebuilt with `int`, it fails now."^^ . . . "0"^^ . "<p>XCode 15.1 (15C65) was used, add new plist file with &quot;Info.plist&quot;.\nturned on Info.plist,add <code>NSContactsUsageDescription</code>, and setting build and phaes.\n<a href="https://i.sstatic.net/EofHl.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EofHl.png" alt="enter image description here" /></a>\n<a href="https://i.sstatic.net/brovq.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/brovq.png" alt="enter image description here" /></a>\nOpen Mac App with code.\n<a href="https://i.sstatic.net/Hclgu.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Hclgu.png" alt="enter image description here" /></a></p>\n"^^ . . "0"^^ . . "Why are you trying to instantiate a class that doesn't have a public initializer? The initialisers are not public for a reason - `SCWindow` should only be initialised by the system."^^ . . . . . . "1"^^ . . . . . . . . . "1"^^ . "Another way \n\nSet automaticDimention in viewDidLoad - \n\n tableView.rowHeight = UITableView.automaticDimension\n tableView.estimatedRowHeight = 44"^^ . "There is something wrong with the symbols. It's finding the nearest one, that random function, but then the offset numbers are huge so that symbol is nowhere near the crash. It doesn't have names for any symbols closer than that."^^ . "1"^^ . . . . . . "0"^^ . "<p>I am trying to get the raw audio data from the system microphone using AudioToolbox and CoreFoundation frameworks. So far the writing packets to file logic works but when I try to capture the raw data into a file, some values are 0.</p>\n<pre><code>static void MyAQInputCallback(void *inUserData, AudioQueueRef inQueue,\n AudioQueueBufferRef inBuffer,\n const AudioTimeStamp *inStartTime,\n UInt32 inNumPackets,\n const AudioStreamPacketDescription *inPacketDesc)\n{\n MyRecorder *recorder = (MyRecorder *)inUserData;\n \n if (inNumPackets &gt; 0)\n {\n \n CheckError(AudioFileWritePackets(recorder-&gt;recordFile, FALSE, inBuffer-&gt;mAudioDataByteSize,\n inPacketDesc, recorder-&gt;recordPacket, &amp;inNumPackets, \n inBuffer-&gt;mAudioData), &quot;AudioFileWritePackets failed&quot;);\n \n recorder-&gt;recordPacket += inNumPackets;\n int sampleCount = inBuffer-&gt;mAudioDataBytesCapacity / sizeof(AUDIO_DATA_TYPE_FORMAT);\n \n AUDIO_DATA_TYPE_FORMAT* samples = (AUDIO_DATA_TYPE_FORMAT*)inBuffer-&gt;mAudioData;\n FILE *fp = fopen(filename, &quot;a&quot;);\n for (int i = 0; i &lt; sampleCount; i++){\n fprintf(fp, &quot;%i;\\n&quot;,samples[i]);\n }\n fclose(fp);\n \n }\n \n if (recorder-&gt;running)\n CheckError(AudioQueueEnqueueBuffer(inQueue, inBuffer,\n 0, NULL), &quot;AudioQueueEnqueueBuffer failed&quot;);\n}\n</code></pre>\n<p>And some properties: <br/></p>\n<p>NumberRecordBuffers = 3 <br/>\nbuffer duration = 0.1 <br/>\nformat-&gt;mFramesPerPacket = 1024 <br/>\nsamplerate = 44100 <br/>\ninNumPackets = 4 <br/></p>\n<p>Out of 1024 samples, only about 400 is filled. Increasing the buffer duration increases the valid numbers proportionally but the overall data still contains gaps. The audio file that is written has no such error. Any help is appreciated. Thank you in advance.</p>\n"^^ . "photokit"^^ . "then why bother with purgeability? Just let the reference go"^^ . . . . . "interrupt"^^ . "<p>changing -</p>\n<pre><code>&quot;EXCLUDED_ARCHS[sdk=iphonesimulator*]&quot; = arm64 i386;\n</code></pre>\n<p>inside Pods project and</p>\n<pre><code>&quot;EXCLUDED_ARCHS[sdk=iphonesimulator*]&quot; = i386;\n</code></pre>\n<p>inside iOS app project of my app compiles the code. hope this helps anyone facing the same issue</p>\n"^^ . . "1"^^ . "1"^^ . . "0"^^ . . . . . "1"^^ . "0"^^ . . "1"^^ . . . . "You mean, PHAssetCollection#fetchAssetCollectionsWithType would crash before PHPhotoLibrary#requestAuthorization is called, even if the result of PHPhotoLibrary#authorizationStatusForAccessLevel is PHAuthorizationStatusAuthorized?"^^ . "2"^^ . . "1"^^ . . . . . . . . "0"^^ . "0"^^ . . . "@son I tried setting NULL to DISPATCH_QUEUE_SERIAL in dispatch_queue_create, but still problem stays the same. It does not seem like it fixes the problem :("^^ . "FYI - consider using `NSURLComponents` to more easily and safely build URLs."^^ . . . "I faced this issue before, and I researched it. That's it, haha. Btw, if you're interested in ARC, you may want to take a look at this old [documentation](https://developer.apple.com/library/archive/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html). And I think briding always has issues, and you have to find a way to work around them."^^ . "0"^^ . "0"^^ . . . . . . "How to get raw audio data from AudioQueueRef in MacOS?"^^ . . . . "Unfortunately macOS Accessibility can be inconsistent, and have broken hierarchies, as you see. What I have been doing in some cases is get the deepest reliable element, and then make a mouse click relative to it's AXFrame to get to the Button/TextField I want. Depends on individual conditions."^^ . . "c"^^ . "<p>Playing with low-level networking code in several languages on several platforms, <a href="https://developer.apple.com/forums/thread/711731" rel="nofollow noreferrer">I followed this example from the Apple developer forum</a> to get a <a href="https://developer.apple.com/documentation/network" rel="nofollow noreferrer">Network.framework</a> example working.</p>\n<p>It works great but the app never exits back to the commandline due to using <a href="https://developer.apple.com/documentation/dispatch/1452860-dispatch_main" rel="nofollow noreferrer"><code>dispatch_main()</code></a>.</p>\n<p>The documentation is very sparse, examples are not common, and tutorials barely exist at all. Hunting around the internet all I find is mentions that this never returns, but I can't find anything about how to break out of it when I actually want to return.</p>\n<p>I'm assuming this relies on background knowledge of GCD (grand central dispatch) and runloops and such that I don't have and that isn't easy to find. Perhaps it's only relevant for a commandline app but most Apple code is for GUI?</p>\n<p>So is there a way to break out of/return from the loop/thread/etc that <code>dispatch_main</code> puts me in? Or is there some alternative API or method other than <code>dispatch_main</code> that you're supposed to use when you intend to return?</p>\n"^^ . "1"^^ . . . "nstask"^^ . "command-line-tool"^^ . . . . . . "0"^^ . . . . "Can you navigate to the text box using the arrow/tab keys? Can the Accessibility Inspector select the text box?"^^ . "0"^^ . "1"^^ . . . . "1"^^ . . . "0"^^ . . . . . . . . . . . . . "2"^^ . "What is the question, how to calculate the sum from your data or how to display a text field at the bottom of the column? Core Data? Have you tried anything?"^^ . . . "1"^^ . . . . "0"^^ . . "1"^^ . "0"^^ . . . . "@timbretimbre The first thing is when you remove **use framework!** in Podfile pod can't install. Specifically **pod 'FacebookShare'**"^^ . "0"^^ . "May be by printing number with `NSNumberFormatter`? Why number format in NSLog is bothering you?"^^ . "<p>For this, you probably want to use the C function <code>void exit(int status);</code> See the output of <code>man 3 exit</code>. This will run various standard C cleanup processes and cause your process to exit cleanly with the status code you call it with.</p>\n<p>What's perhaps more interesting is the question: &quot;How does your process know <em>when</em> to call <code>exit()</code>?&quot; Is it going to receive a network payload that tells it when to quit? Will you send it a UNIX <code>SIGTERM</code> signal? (If this feels like a misuse of <code>SIGTERM</code> to you, you could consider using <code>SIGUSR1</code> or <code>SIGUSR2</code>.) GCD has signal handling capabilities built in (see <code>DispatchSource.makeSignalSource</code> <a href="https://developer.apple.com/documentation/dispatch/dispatchsource/2300045-makesignalsource" rel="nofollow noreferrer">here</a>). To be more explicit, you could add a GCD signal handler for <code>SIGTERM</code> do whatever other cleanup you need to do, and then call <code>exit()</code> at the end of the handler block, and that should do the trick.</p>\n<p>Hope that helps!</p>\n"^^ . . . "It only works when voice processing is enabled on both input and output. Doesn't work if it is enabled on just one of them. I think they also mentioned this in the WWDC 2019 session where they first unveiled voice processing. I didn't get a crash though, just the background sound didn't get cancelled."^^ . "<p>You can play with <code>CGEvent</code> and send event like the new mouse position and keystrokes for instance:</p>\n<h3>Move the mouse programmatically:</h3>\n<pre><code>private func moveMouseTo(x: Int, y: Int) {\n let moveEvent = CGEvent(mouseEventSource: nil, mouseType: .mouseMoved, mouseCursorPosition: CGPoint(x: x, y: y), mouseButton: .left)\n moveEvent?.post(tap: .cghidEventTap)\n}\n</code></pre>\n<h3>Send keystrokes programmatically:</h3>\n<pre><code>let keyDownEvent = CGEvent(keyboardEventSource: nil, virtualKey: rightArrowKeyCode, keyDown: true)\nkeyDownEvent?.flags = CGEventFlags.maskCommand\nkeyDownEvent?.post(tap: CGEventTapLocation.cghidEventTap)\n\nlet keyUpEvent = CGEvent(keyboardEventSource: nil, virtualKey: rightArrowKeyCode, keyDown: false)\nkeyUpEvent?.flags = CGEventFlags.maskCommand\nkeyUpEvent?.post(tap: CGEventTapLocation.cghidEventTap)\n</code></pre>\n<p>Note that in order to use both events (mouse and keyboard) you need to configure the &quot;Accessibility&quot; option in macOS Settings for your app, like <strong><a href="https://developer.apple.com/documentation/applicationservices/1460720-axisprocesstrusted?language=objc" rel="nofollow noreferrer">AXIsProcessTrusted</a></strong></p>\n<hr />\n<p>You can use also, OCR or a machine learning model using CreateML (for image recognition) to identify the correct bounding box of your 3rd party app (in particular to your textfield).</p>\n<p>In this way you can move the mouse and click in a precise position than send keystrokes.</p>\n"^^ . . "0"^^ . . . . . . . . . . "Does this answer your question? [Pass commands as input to another command (su, ssh, sh, etc)](https://stackoverflow.com/questions/37586811/pass-commands-as-input-to-another-command-su-ssh-sh-etc)"^^ . "In general, no, you shouldn't "attach metadata" to random Objective C objects. If you really need to do this, you can use `NSDictionary` or, better yet `NSMapTable`. But I would just pass the index as part of the closure that you would pass to `addCompletedHandler`."^^ . . . "audioqueueservices"^^ . . . "<p>I would like extract the both 3D stereo images (left/right) from a 3D spatial video in MV-HEVC format. I use code, iOS, Objective-C.</p>\n<p>Here is my code to read a 2D video:</p>\n<pre class="lang-objc prettyprint-override"><code>NSURL *inputVideoURL = [NSURL fileURLWithPath:inputVideoPath]; \nAVURLAsset *inputAsset = [AVURLAsset URLAssetWithURL:inputVideoURL options:nil]; AVAssetImageGenerator *imageGenerator = [AVAssetImageGenerator assetImageGeneratorWithAsset:inputAsset]; \n\nfor (int i=1;i&lt;=maxx;i++) { \n CMTime time = CMTimeMake(i, (int32_t)frameRate); \n CGImageRef imageRef = [imageGenerator copyCGImageAtTime:time actualTime:NULL error:&amp;error]; \n UIImage *image=nil; \n image = [UIImage imageWithCGImage:imageRef];\n}\n</code></pre>\n"^^ . . "I read errors in error pipe. With different task configurations, "Password:" is read from error pipe and I am writing the password there. That's another way of passing the password."^^ . . "<p>I am trying to create a line chart using the <a href="https://github.com/danielgindi/ios-charts" rel="nofollow noreferrer">danielgindi/ios-charts</a> library.\n<a href="https://i.sstatic.net/ldnvD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ldnvD.png" alt="enter image description here" /></a></p>\n<p>This works quite well so far. However, I cannot set the values on the left axis in 250 steps as desired.You can see my last attempt here:</p>\n<pre><code>ChartYAxis *leftAxis = self.lineChartView.leftAxis;\nleftAxis.labelTextColor = [UIColor colorNamed:@&quot;ColorGraphSD&quot;];\nleftAxis.axisMinimum = 0;\nleftAxis.axisMaximum = ceil(maxValue / 250.0) * 250;\nleftAxis.drawGridLinesEnabled = YES;\nleftAxis.drawZeroLineEnabled = NO;\nleftAxis.granularityEnabled = NO;\nleftAxis.granularity = .1;\nleftAxis.axisRange = 250;\nleftAxis.labelCount = ceil(maxValue / 250.0);\n</code></pre>\n<p>Debugger tells me leftAxis.labelCount = 8; and leftAxis.axisMaximum = 2000;</p>\n<p>All I want is a line at 250,500,750....</p>\n<p>How to do that?</p>\n"^^ . . . . "<p>I have a react native sdk inside which all of the code is written in objective C, now we are migrating it to swift, i followed the official react native guide on how to migrate to swift, did everything as suggested there but it's not working, i will explain where the main problem is happening -\nso inside my objective c file my code is written like this -</p>\n<pre class="lang-swift prettyprint-override"><code>#import &lt;React/RCTBridgeModule.h&gt;\n#import &lt;SCDoorway/SCDoorway.h&gt;\n#import &lt;SCDoorway/SCDoorway-Swift.h&gt;\n#import &lt;Loans/Loans.h&gt;\n#import &lt;React/RCTBridge.h&gt;\n\n@interface RCT_EXTERN_MODULE(BigTreeDoorway, NSObject)\n\n//MARK: SDK version helpers\n//MARK: SDK setup\nRCT_REMAP_METHOD(setConfigEnvironment,\n envName:(NSString *)envName\n gateway:(NSString *)gateway\n isLeprechaunActive: (BOOL *)isLeprechaunActive\n isAmoEnabled: (BOOL *)isAmoEnabled\n preProvidedBrokers: (NSArray *)preProvidedBrokers\n setConfigEnvironmentWithResolver:(RCTPromiseResolveBlock)resolve\n rejecter:(RCTPromiseRejectBlock)reject) {\n NSInteger environment = EnvironmentProduction;\n\n if([envName isEqualToString:@&quot;production&quot;]) {\n environment = EnvironmentProduction;\n }\n else if([envName isEqualToString:@&quot;development&quot;]) {\n environment = EnvironmentDevelopment;\n } else {\n environment = EnvironmentStaging;\n }\n\n GatewayConfig *config = [[GatewayConfig alloc]\n initWithGatewayName:gateway\n brokerConfig:preProvidedBrokers\n apiEnvironment:environment\n isLeprechaunActive:isLeprechaunActive\n isAmoEnabled:isAmoEnabled];\n\n [SCDoorway.shared setupWithConfig: config completion:^(BOOL success,NSError * error) {\n if(success) {\n resolve(@(YES));\n } else {\n NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];\n [responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@&quot;errorCode&quot;];\n [responseDict setValue:error.domain forKey:@&quot;errorMessage&quot;];\n\n NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];\n\n reject(@&quot;setConfigEnvironment&quot;, @&quot;Env setup failed&quot;, err);\n }\n\n }];\n}\n//and many more functions ...\n\n</code></pre>\n<p>now even in my objective-C file when i open up the xcode project of my SDK it gives me errors like -</p>\n<p><a href="https://i.sstatic.net/EsF7C.png" rel="noreferrer"><img src="https://i.sstatic.net/EsF7C.png" alt="enter image description here" /></a></p>\n<p>now if i comment out that particular import it starts to give me error for -</p>\n<p><a href="https://i.sstatic.net/sNnKB.png" rel="noreferrer"><img src="https://i.sstatic.net/sNnKB.png" alt="enter image description here" /></a></p>\n<p>but then inside the podspec file of my react sdk i have added the dependency SCDoorway -</p>\n<p><a href="https://i.sstatic.net/qcgs2.png" rel="noreferrer"><img src="https://i.sstatic.net/qcgs2.png" alt="enter image description here" /></a></p>\n<p>moving on, when i build my react project it all builds well, and functions work\ni started migrating to swift by adding a swift file with the same name as my objective-C file that is - BigTreeDoorway, so now i have 3 files in total inside my project which are the bridging header class, and BigTreeDoorway.swift and BigTreeDoorway.m\ni have checked my objective c bridging header file path and it is alright</p>\n<p>now when i converted all the objective functions to swift functions like this -</p>\n<pre><code>import RCTBridgeModule\nimport Foundation\nimport SCDoorway\nimport React\nimport Loans\n\n@objc(BigTreeDoorway)\nclass BigTreeDoorway: NSObject {\n \n @objc func setConfigEnvironment(_ envName: String,\n gateway: String,\n isLeprechaunActive: Bool,\n isAmoEnabled: Bool,\n preProvidedBrokers: [Any],\n resolver resolve: @escaping RCTPromiseResolveBlock,\n rejecter reject: @escaping RCTPromiseRejectBlock) {\n \n var environment = EnvironmentProduction\n\n switch envName {\n case &quot;production&quot;:\n environment = EnvironmentProduction\n case &quot;development&quot;:\n environment = EnvironmentDevelopment\n default:\n environment = EnvironmentStaging\n }\n\n let config = GatewayConfig(gatewayName: gateway,\n brokerConfig: preProvidedBrokers,\n apiEnvironment: environment,\n isLeprechaunActive: isLeprechaunActive,\n isAmoEnabled: isAmoEnabled)\n\n SCDoorway.shared.setup(with: config) { success, error in\n if success {\n resolve(true)\n } else {\n var responseDict: [String: Any] = [\n &quot;errorCode&quot;: error?.code ?? 0,\n &quot;errorMessage&quot;: error?.localizedDescription ?? &quot;&quot;\n ]\n\n let err = NSError(domain: error?.domain ?? &quot;&quot;, code: error?.code ?? 0, userInfo: responseDict)\n reject(&quot;setConfigEnvironment&quot;, &quot;Env setup failed&quot;, err)\n }\n }\n }\n \n</code></pre>\n<p>and then i changed my objectiveC file like this -</p>\n<pre><code>#import &lt;React/RCTBridgeModule.h&gt;\n#import &lt;SCDoorway/SCDoorway.h&gt;\n#import &lt;SCDoorway/SCDoorway-Swift.h&gt;\n#import &lt;Loans/Loans.h&gt;\n#import &lt;React/RCTBridge.h&gt;\n\n@interface RCT_EXTERN_MODULE(BigTreeDoorway, NSObject)\n\nRCT_EXTERN_METHOD(setConfigEnvironment,\n envName:(NSString *)envName\n gateway:(NSString *)gateway\n isLeprechaunActive: (BOOL *)isLeprechaunActive\n isAmoEnabled: (BOOL *)isAmoEnabled\n preProvidedBrokers: (NSArray *)preProvidedBrokers\n setConfigEnvironmentWithResolver:(RCTPromiseResolveBlock)resolve\n rejecter:(RCTPromiseRejectBlock)reject)\n//many more \n@end\n\n\n</code></pre>\n<p>basically i changed it to a RCT_EXTERN_METHOD from RCT_REMAP_METHOD and removed the function definition just the name and params as described in the react native site</p>\n<p>i was still getting errors inside xcode for these imports -\n<a href="https://i.sstatic.net/2MzHx.png" rel="noreferrer"><img src="https://i.sstatic.net/2MzHx.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/hZ2Vg.png" rel="noreferrer"><img src="https://i.sstatic.net/hZ2Vg.png" alt="enter image description here" /></a></p>\n<p>but then the same was happening inside objectiveC file so i tried building my react project and it won't build now, once it starts building the app after 30 seconds it gives me this error -</p>\n<pre><code>The following build commands failed:\n SwiftCompile normal arm64 Compiling\\ BigTreeDoorway.swift /Users/aadityasingh/../../../node_modules/my-sdk-name/ios/BigTreeDoorway.swift (in target 'my-sdk-name' from project 'Pods')\n SwiftCompile normal arm64 /Users/aadityasingh/../../my sample app name where am trying to integrate the sdk/node_modules/my-sdk-name/ios/BigTreeDoorway.swift (in target 'my-sdk-name' from project 'Pods')\n(2 failures)\n</code></pre>\n<p>Am stuck on this problem for the last two weeks now, i don't understand how does the objective file works with the same imports but my swift file fails to do so, please help, i tried few things -</p>\n<ul>\n<li>I tried changing the &quot;EXCLUDED_ARCHS[sdk=iphonesimulator*]&quot; = &quot;arm64 i386&quot;\ninside both the sample app, later i tried it with the my sdk ios project too\nthe build error was still there</li>\n<li>i deleted the xcode project from ios folder of the my sdk and the sample app still works perfectly fine, hence only 3 files left - bridging header, swift (swift file being empty with just the class defined) and objc file</li>\n<li>when i import Loans (which is a submodule inside SCDoorway) inside the swift file of my sdk, it does not throw any error and the react project builds but then when i uncomment it's functions which involve using Loans classes (and then i put the RCT_EXTERN_METHODS for the same inside objectiveC class commenting everything else out) it throws another error -</li>\n</ul>\n<pre><code>The following build commands failed:\n CompileC /Users/aadityasingh/Library/Developer/Xcode/DerivedData/sample-app-name-dnrqbqkvgavrbjasjmzapzzrvjtq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/my-sdk-name.build/Objects-normal/arm64/BigTreeDoorway-5f1feec19880e569a1329e3d7cbede9a.o /Users/aadityasingh/../new/sample app name/node_modules/sdk name/ios/BigTreeDoorway.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'my-sdk-name' from project 'Pods')\n(1 failure)\n</code></pre>\n<p>Please help me with this</p>\n"^^ . . "0"^^ . . . . . "Please don't post pictures of text. You should edit your question and replace the pictures with the actual text, copied and pasted. Text in pictures can't be searched or referenced and the text is much harder to read. It's also more work to post."^^ . "<p>I've got a CoreData database and I'm fetching a list of Animals from it, sorted by a <code>namesortable</code> field. But namesortables that start with <code>'</code> and with <code>`</code> are being treated as if they are the same and producing results like this:</p>\n<pre><code>'affirm'\n‘california’\n'grasshopper'\n'no doubt&quot;\n‘relentless’\n...\n</code></pre>\n<p>This wouldn't inherently be a problem, but I'm fetching these with an <code>NSFetchedResultsController</code> which is sectioned by <code>-namefirstletter</code> and it's crashing because the sections are out of order. It thinks the sections are out of order because it keeps switching back and forth between <code>'</code> and with <code>`</code>.</p>\n<p>I know that I could alter the <code>-namefirstletter</code> method to swap smart quotes for single quotes to bludgeon it into working, but I'd rather not have to start creating a longer and longer list of exception characters that I need to swap. I'd prefer to get CoreData to just sort the data without treating <code>'</code> and with <code>`</code> as the same.</p>\n<p>Any suggestions?</p>\n<hr />\n<pre><code>NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];\nNSEntityDescription *entity = [NSEntityDescription entityForName:Animal.entityname inManagedObjectContext:self.managedObjectContext];\n[fetchRequest setEntity:entity];\n\nNSArray&lt;NSSortDescriptor *&gt; *sortdescriptors = @[\n [NSSortDescriptor sortDescriptorWithKey:Animal.fieldname_namesortable \n ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)]\n];\n\n[fetchRequest setSortDescriptors:sortdescriptors];\n\n\nfetchRequest.predicate = [NSPredicate predicateWithFormat:@&quot;...&quot;];\n\nNSError *error = nil;\nNSArray&lt;Animal*&gt; *animals = [self.managedObjectContext executeFetchRequest:fetchRequest error:&amp;error];\n</code></pre>\n"^^ . "ios-charts"^^ . "0"^^ . . "0"^^ . . "<p>Did you enable voice processing on both the input and output nodes?</p>\n<p>Here is what I tried and it worked (somewhat):</p>\n<pre><code>audioInputNode=engine.inputNode \n audioInputNode.volume=0\n do{\n try audioInputNode.setVoiceProcessingEnabled(true)\n }\n catch{\n print(&quot;Could not enable voice processing in audioinputnode&quot;)\n }\n let outputNode = engine.outputNode\n do{\n try outputNode.setVoiceProcessingEnabled(true)\n }\n catch{\n print(&quot;Could not enable voice processing in output&quot;)\n }\n</code></pre>\n<p>I say worked &quot;somewhat&quot; because when I record the mic input, the sound from the speaker is definitely cancelled out, but the mic audio recorded to a file is a little choppy</p>\n"^^ . . . . "0"^^ . . . "Willeke, thanks! Cy, I also log strings of comma-separated numbers, so commas within numbers are visually confusing."^^ . . . . . . "<p>My app is trying to choose an image, and replace a given color with a separate image (green-screen). It uses Obj-C. So far, I'm attempting to replace a specific color (sky-blue) on this image with a space background. As you can see from the images below, I'm getting a washed out picture in which almost everything gets replaced instead of the intended sky color only. What am I handling wrong? I know there are some libraries with Swift that will do this, but I need to stay in Obj-C.</p>\n<p>My NSObject</p>\n<pre><code>+ (UIImage *)replaceWhiteColorWithImage:(UIImage *)image backgroundImage:(UIImage *)backgroundImage {\n CGImageRef rawImageRef = image.CGImage;\n const CGFloat colorMasking[6] = {130/255.0, 1.0, 151/255.0, 1.0, 186/255.0, 1.0};\n UIGraphicsBeginImageContext(image.size);\n\n CGContextRef context = UIGraphicsGetCurrentContext();\n\n // Flip the context to match the UIKit coordinate system\n CGContextTranslateCTM(context, 0.0, image.size.height);\n CGContextScaleCTM(context, 1.0, -1.0);\n\n // Draw the background image\n [backgroundImage drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];\n\n // Clip to the raw image using the white color as a mask\n CGContextClipToMask(context, CGRectMake(0, 0, image.size.width, image.size.height), rawImageRef);\n\n // Clear the white color with a transparent background\n CGContextClearRect(context, CGRectMake(0, 0, image.size.width, image.size.height));\n\n UIImage *result = UIGraphicsGetImageFromCurrentImageContext();\n UIGraphicsEndImageContext();\n return result;\n}\n</code></pre>\n<p>My code to call this from my ViewController</p>\n<pre><code> -(IBAction)chooseImage {\n // Assuming ImageProcessor is the class with the replaceWhiteColorWithImage method\n\n // Picking an image using UIImagePickerController (as mentioned in the previous response)\n UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];\n imagePicker.delegate = self;\n [self presentViewController:imagePicker animated:YES completion:nil];\n\n}\n- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary&lt;UIImagePickerControllerInfoKey,id&gt; *)info {\n \n UIImage *pickedImage = info[UIImagePickerControllerOriginalImage];\n\n // Provide the background image you want to use\n UIImage *backgroundImage = [UIImage imageNamed:@&quot;space.jpg&quot;];\n\n // Call the method to replace white color with the background image\n UIImage *processedImage = [ImageProcessor replaceWhiteColorWithImage:pickedImage backgroundImage:backgroundImage];\n\n // Update the UIImageView with the processed image\n self.yourImageView.image = processedImage;\n\n [picker dismissViewControllerAnimated:YES completion:nil];\n}\n</code></pre>\n<p>The image I'm attempting to edit:\n<a href="https://i.sstatic.net/H0pxY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/H0pxY.png" alt="enter image description here" /></a></p>\n<p>The image I want to be the new background:\n<a href="https://i.sstatic.net/vKJmu.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vKJmu.jpg" alt="enter image description here" /></a></p>\n<p>What I get:\n<a href="https://i.sstatic.net/yGO3h.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/yGO3h.png" alt="enter image description here" /></a></p>\n"^^ . "-1"^^ . . "But with wrong DSYMs"^^ . "1"^^ . "0"^^ . . "0"^^ . "@KennyWyland I suspect that the way you do that is to file a bug with Apple and hope that a future release of iOS does what you need. In the meantime there are workarounds."^^ . . . . . "*"sometimes it works and sometimes it does not"* -- not much we can do to help with that... You need to try to determine a pattern of actions that causes it ... then update your questions with code / description of actions that reproduces the issue."^^ . "1"^^ . . . "I see the thousands separators for `NSLog()` but only when running from inside Xcode."^^ . . "0"^^ . . . . . "0"^^ . . "0"^^ . . "The type of the text box is Text Field, and the Element Class is NSTextFieldCell. I can inspect it with the Accessibility Inspector. However, when I check its Parent, I find that the Parent’s Children do not include it, and the Parent only contains an AXGroup."^^ . . "0"^^ . . . . . . "2"^^ . . . . . "0"^^ . . . . . . . "NSTask interrupt not working - Cocoa Objective C"^^ . . "Memory management issue while Call Obj-C in Swift"^^ . . . . . "1"^^ . . . . . . "0"^^ . . . . . . . . . . "1"^^ . "0"^^ . "core-audio"^^ . . "0"^^ . "<p>My requirement is to launch a third-party application from my application and auto-fill the username into a specified text box. Currently, I am able to launch the application and have tried using the Cocoa framework but I can only get the window information, not the elements inside. I’ve also attempted using the Accessibility API, and when I analyzed with Accessibility Inspector, I found that the parent role of the element I needed was Window, but this element didn’t appear in the Window’s children. I don’t know how to proceed. Is there any other method that could help me accomplish this?</p>\n<p>I’ve tried using the Cocoa framework but can only obtain the information of the window, without knowing how to grab the elements inside. I’ve also attempted to use the Accessibility API to retrieve them.</p>\n"^^ . . "I just realized this could be a byte ordering issue. If you expect a 16-bit (2-byte) value to only have values in the range 0-255 then that means one byte will always be zero and the other will be 0-255. If you are getting 29440 then that's the bytes 0 and 114 in the wrong order. 29696 is 0 and 115 in the wrong order."^^ . . . . "@Willeke True. I think I was originally concerned about the extra complexity but I'll test it out."^^ . "<p>I'm using React Native with the <code>react-native-webview</code> library. My code is like this:</p>\n<pre><code>&lt;SafeAreaView style={backgroundStyle}&gt;\n &lt;WebView\n useWebKit={true}\n scrollEnabled={false}\n hideKeyboardAccessoryView={true}\n keyboardDisplayRequiresUserAction={false}\n nestedScrollEnabled={!useContainer}\n style={[styles.webview, style]}\n {...rest}\n menuItems={[{ key: 'test0001', label: 'Bold Test' }]}\n onCustomMenuSelection={(event) =&gt; {\n console.log('hehehe');\n }}\n /&gt;\n&lt;/SafeAreaView&gt;\n</code></pre>\n<p>It's work well with iOS &lt;= 15, but cannot run on iOS &gt;= 16. I figured out the reason is UIMenuController has been deprecated and we should use UIEditMenuInteraction instead.</p>\n<p>Any suggestion or document/links for me? Please help me, thank you so much.</p>\n<p>P/s: I tried to edit the library native code but it seems Objective-C is so strange to me :(((</p>\n"^^ . . "stringByAddingPercentEncodingWithAllowedCharacters encodes colons"^^ . . "Inverting the MacOS's mouse X axis doesn't work with CGEventSetIntegerValueField"^^ . "are you reusing those later?"^^ . . . . . "1"^^ . "optimization"^^ . . . . . . "url"^^ . "0"^^ . . "0"^^ . . . . "1"^^ . . "0"^^ . "0"^^ . . . "0"^^ . . "<p>I have a tableview cell with a reuse-identifier set in storyboard.\nAfter checking some conditions I want to draw different things on the contentView of the cell.\nMy problem is when the tableview re-uses the cell, the CAShapeLayer from another cell persists, so it's showing the new drawing over the (re-used) drawing.</p>\n<pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\n UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@&quot;StatusCell&quot;];\n\n NSManagedObject *object = [self.fetchedResultsController objectAtIndexPath:indexPath];\n\n if ([[object valueForKey:@&quot;status&quot;] isEqualToString:@&quot;sending&quot;]) {\n CAShapeLayer *progressLayer;\n //...Configure and draw Layer with UIBezierPath\n [cell.contentView.layer addSublayer:progressLayer];\n } else if ([[object valueForKey:@&quot;status&quot;] isEqualToString:@&quot;sent&quot;]) {\n CAShapeLayer *sentLayer;\n //...Configure and draw Layer with UIBezierPath\n [cell.contentView.layer addSublayer:sentLayer];\n }\n\n return cell;\n}\n</code></pre>\n<p>So I tried to give the CAShapeLayer a name and delete the layer from the re-used cell before creating a new CAShapeLayer.</p>\n<pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\n UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@&quot;StatusCell&quot;];\n\n NSManagedObject *object = [self.fetchedResultsController objectAtIndexPath:indexPath];\n\n for (CALayer *layer in cell.contentView.layer.sublayers) {\n if ([layer.name isEqualToString:@&quot;sending&quot;] || [layer.name isEqualToString:@&quot;sent&quot;]) {\n [layer removeFromSuperlayer];\n }\n }\n\n if ([[object valueForKey:@&quot;status&quot;] isEqualToString:@&quot;sending&quot;]) {\n CAShapeLayer *progressLayer;\n progressLayer.name = @&quot;sending&quot;;\n //...Configure and draw Layer with UIBezierPath\n [cell.contentView.layer addSublayer:progressLayer];\n } else if ([[object valueForKey:@&quot;status&quot;] isEqualToString:@&quot;sent&quot;]) {\n CAShapeLayer *sentLayer;\n sentLayer.name = @&quot;sent&quot;;\n //...Configure and draw Layer with UIBezierPath\n [cell.contentView.layer addSublayer:sentLayer];\n }\n\n return cell;\n}\n</code></pre>\n<p>But with this method I get an exception when scrolling the tableview <code>CALayerArray was mutated while being enumerated</code></p>\n<p>Can someone point me in the right direction how to do it the correct way?</p>\n"^^ . . "But that's the link you posted in your answer where you said you found the solution."^^ . . . . . "1"^^ . . "0"^^ . . "5"^^ . . . "Error using Objective-C structure in Swift (Cannot find type 'XXX' in scope)"^^ . . "0"^^ . "the attributes you apply initially will get cleared as you removed the text by backspacing, at this point it will fallback to blue color, as that is what you set the text color of your text field."^^ . . . . . . . . "<p>How do I get the text in my cells to show as solid text while still fading the cell background so I can see the image behind?</p>\n<p>I have the following in my ViewController:\n`</p>\n<pre><code>- (void)viewDidLoad {\n // Used to see the background image\n self.tableView.backgroundColor = [UIColor clearColor];\n self.tableView.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@&quot;background.png&quot;]];\n self.tableView.backgroundView.contentMode = UIViewContentModeScaleAspectFill;\n}\n\n-(void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *) cell forRowAtIndexPath:(NSIndexPath *)indexPath { \n cell.alpha=0.5; \n cell.textLabel.alpha=1.0; \n}\n</code></pre>\n<p>The result is shown in the image where the background image can be seen through the text and cell background. I only want to see the image through the cell background and have the text solid.</p>\n<p>Is there a way to set the text to have an alpha of 1.0 while the background is 0.5?</p>\n<p><a href="https://i.sstatic.net/WgIJ4.jpg" rel="nofollow noreferrer">app screenshot</a></p>\n"^^ . . . . . . . . . "0"^^ . . . "1"^^ . . . . . . . "1"^^ . . . . . . . . "metal"^^ . . . "0"^^ . . "3"^^ . . "nstableview"^^ . . . "background"^^ . "Have a hint and have a solution - very different things. The "solution answer" not accepted there.\nJust I read near 5 provided for review questions. Checked all other solutions and recommendations.\nI have no idea how it is possible Deployment Target to have such influence here to "loose" some symbols. So I consider it is not "duplicate" question and of cause there is no strict solution."^^ . . . . . . . "Swift and Objective-C interoperability"^^ . . . . . "0"^^ . . "<p>The <a href="https://developer.apple.com/documentation/screencapturekit/scwindow" rel="nofollow noreferrer">SCWindow</a> class has all its initializers marked as unavailable. In Objective-C, I can get around it using class extensions:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &lt;ScreenCaptureKit/ScreenCaptureKit.h&gt;\n\n@interface SCWindow (InitWithId)\n\n@property CGWindowID windowID;\n\n- (instancetype _Nonnull)initWithId:(CGWindowID)windowID;\n\n@end\n\n@implementation SCWindow (InitWithId)\n\n@dynamic windowID;\n\n- (instancetype _Nonnull)initWithId:(CGWindowID)windowID {\n self = [super init];\n if (self) {\n [self setValue:[NSNumber numberWithInteger:windowID] forKey:@&quot;windowID&quot;];\n }\n return self;\n}\n\n@end\n</code></pre>\n<p>Is there a technique to do this in Swift? I believe Swift extensions only allow <code>convenience</code> initializers, not designated ones like Objective-C.</p>\n"^^ . . . "1"^^ . . "2"^^ . "1"^^ . "0"^^ . . . "0"^^ . "1"^^ . "1"^^ . . "0"^^ . "1"^^ . . . . . "jailbreak"^^ . . . . . . . . . . "How can I access text box elements in a specific third-party application window?"^^ . "0"^^ . "0"^^ . "<p>hello i start learning obj-c and want to increase call log cells after write this code i have many issues with cell heights\ni want to have same default cell heights for all cells</p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n#import &lt;UIKit/UITableViewController.h&gt;\n#import &lt;Foundation/Foundation.h&gt;\n\n\n@interface MPRecentsTableViewCell\n@property (readwrite, strong, nonatomic) UITableView * tableView;\n@property (readwrite, assign, nonatomic) long long tableViewDisplayMode;\n@property (readwrite, strong, nonatomic) UISegmentedControl * tableViewDisplayModeSegmentedControl;\n@property (readwrite, assign, nonatomic) bool tableViewNeedsReload;\n@end\n\n\n%hook MPRecentsTableViewController\n//-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section\n\n-(NSInteger)tableView:(UITableView *)arg1 numberOfRowsInSection:(NSInteger)arg2 {\n return 200;\n }\n-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {\n return 60.5;\n}\n\n%end\n</code></pre>\n<p>result:-\n<a href="https://i.sstatic.net/xuHWZ.jpg" rel="nofollow noreferrer">enter image description here</a></p>\n<p>many size no one work</p>\n"^^ . . "0"^^ . . . "0"^^ . . . "0"^^ . "<p><code>currentRenderPassDescriptor</code> of the <code>MTKView</code> asks its internal <code>CAMetalLayer</code> for the <code>nextDrawable</code>, which blocks waiting for the next drawable to be available.</p>\n<p><code>enableSetNeedsDisplay</code> does not have anything to do with V-Sync and more so to do with when and how <code>MTKView</code> calls its delegate.</p>\n<p>The actual setting you are after is <code>displaySyncEnabled</code>. Keep in mind that it's only available on macOS.</p>\n<p>The reason you are seeing <code>currentRenderPassDescriptor</code> take 8 ms is because you are probably either running on an internal display on a MacBook Pro, which has a ProMotion display, which runs at up to 120 Hz or you are running on an external monitor which is also capable of 120 Hz. 120 Hz is equivalent to a screen being redrawn approximately every 8 ms.</p>\n<p>The reason you get &quot;very fast frames&quot; is because of how you are measuring it. Your frames are fast but they run not very often, because you are asking for 10 Hz updates and the compositor can basically give you all of the drawables instantly because the interval between you asking for drawables is more than the interval between the screen being drawn, so you always have at least two drawables, which means you will always get a new drawable instantly.</p>\n<p>Keep in mind that some behavior might change when running Direct or Composited, so enable Metal HUD to see which mode you are running in.</p>\n"^^ . . . "@Spo1ler Cool, I started implementing a reference counter on CPU. However, Is there any way to attach meta-data to a command buffer. I want to set an index to each command buffer so when it completes, I can decrement the buffer associated with that index"^^ . . . . "0"^^ . . . . "0"^^ . "0"^^ . . . "0"^^ . "0"^^ . . . . . "0"^^ . "0"^^ . . . "0"^^ . . "I think you need to `import FacebookCore` before you import the other 2 pods"^^ . "Yes. I tried. It was throwing an exception and freezing the table. Not sure why. I solved it by unhooking the binding and adding code for value, object, and keyPath in awakeFromNib. Now it all works? I'm not exactly sure whey the binding in IB was problematic."^^ . "In this situation, It's up to you to do whatever cleanup you need to do. `dispatch_main()` is clearly documented as "This function never returns." so you're going to need some sort of heavier hand to exit from a process that uses that as its main loop (i.e. `exit()` or `abort()` etc.)"^^ . "Thanks, I've added more info and questions as an update to my question above."^^ . "<p>I have flutter plugin (<a href="https://github.com/mapp-digital/Mapp-Intelligence-Flutter-Tracking" rel="nofollow noreferrer">https://github.com/mapp-digital/Mapp-Intelligence-Flutter-Tracking</a>) which contains native iOS code background execution, which works fine until last update of Flutter version:\nFlutter 3.16.3 • channel stable • <a href="https://github.com/flutter/flutter.git" rel="nofollow noreferrer">https://github.com/flutter/flutter.git</a>\nFramework • revision b0366e0a3f (7 days ago) • 2023-12-05 19:46:39 -0800\nEngine • revision 54a7145303\nTools • Dart 3.2.3 • DevTools 2.28.4</p>\n<p>iOS part of code:</p>\n<pre><code> ^(void) {\n // Background Thread\n [self-&gt;_conditionUntilGetFNS lock];\n while (!self-&gt;_isReady)\n [self-&gt;_conditionUntilGetFNS wait];\n [self enqueueRequestForEvent:event];\n [self-&gt;_conditionUntilGetFNS signal];\n [self-&gt;_conditionUntilGetFNS unlock];\n });\n</code></pre>\n<p>this one line <code>[self enqueueRequestForEvent:event];</code> is never executed.\nwhat I can do?</p>\n"^^ . . "https://stackoverflow.com/a/44395835/7833793"^^ . . . . . . . "2"^^ . . . . . . "0"^^ . . "<p>I have a qr code from which i want to read and extract 180 byte hexadecimal value, mine is an ionic app, and i am using phonegap barcode scanner in my app. When tried with this qr c<a href="https://i.sstatic.net/ZbIIA.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ZbIIA.png" alt="enter image description here" /></a>ode scanner i am not getting any response, when i tried to debug this in xcode i found that its actually reading the qr code, and when i went to AVMetadataMachineReadableCodeObject -&gt; _internal -&gt; basicDescriptor -&gt; BarCodeRawData</p>\n<p>There was a data present there which was,</p>\n<p>[40 0B 45 55 73 60 10 00 10 03 13 23 33 43 53 63 73 83 93 03 13 23\n33 43 53 63 73 83 93 03 03 13 22 05 24 54 54 62 02 33 10 00 01 90 5E\n70 70 DO EO A3 F4 20 FO 03 F4 20 FO 00 7B 20 10 09 FB BO DO 00 10\n00 1010 1B BO 8E 90 90 1F F6 90 05 06 20 2B C0 00 17DO 00 06 25\n93 5635 06 2B CO 00 07 EO 07 EO 07 DO 00 27 DO O7 DO 07DO 07 DO\n07 DO 07 DO 07 EO 07 DO 07 DO 07DO 06 25 9F FB BO 86 25 96 20 16\n80 0356 30 17 DO 00 10 20 AO 26 25 97 E0 06 25 97 EO 00 17 DO 07 FO\n07 DO 00 17 DO 07 DO 08 30 07 EO 07 EO 07 E0 00 08 06 50 06 50 06\n40 06 25 9F FO EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11]</p>\n<p>But this is not the data we are expecting as raw bytes</p>\n<p>We are expecting a byte array which have a decimal values,</p>\n<p>I was able to get the intended result in android by using some properties,\nintent.getByteArrayExtra('SCAN_RESULT_BYTE_SEGMENTS_0').</p>\n<p>&quot;SCAN_RESULT_BYTE_SEGMENTS_0&quot; when i haven't given this property for Android ,result was not intended byte array with decimal values.</p>\n<p>The actual data I want to get from this Qr code is a hexadecimal, that is:</p>\n<p>555736010001003132333435363738393031323334353637383930303132205245454620233100001905E7070D0E0A3F420F003F420F0007B201009FBB0D000100010101BB08E90901FF6900506202BC00017D0000625935635062BC00007E007E007D00027D007D007D007D007D007D007E007D007D007D006259FFBB086259620168003563017D0001020A0262597E0062597E00017D007F007D00017D007D0083007E007E007E0000806500650064006259FF</p>\n<p>So basically in short i am really stuck here in for ios, can someone help me out.</p>\n"^^ . . "0"^^ . . . . "0"^^ . . "I can't help with the question itself, but FYI macOS lets you take screenshots of individual windows. It makes them perfectly cropped, without needing to spend the effort to crop a full-screen screenshot yourself. See "How to capture a window or menu " on https://support.apple.com/en-us/102646"^^ . . . . . . . . "Your `NSLog` line produces `123456` for me."^^ . "NSMutableOrderedSet removeObjectAtIndex not working consistently"^^ . . . "UITextField textColor changed after clearing the text"^^ . . "Since you already guessed that it might be linked to the `FunSDKWrapper` object life-time, have you already tried to prolong it (e.g. by making it a property of the enclosing class). Also, could you please explain how the `OnFunSDKResult` method is called?"^^ . "avaudioengine"^^ . "I get `123.456`, it's the notation in System Prefs."^^ . "1"^^ . . . . . . . . . . . . . "Are you aware that you never make use of `colorMasking` in `replaceWhiteColorWithImage`? And `CGContextClipToMask` only works with a grayscale image, not some arbitrary image."^^ . . . "0"^^ . . "0"^^ . . . . . . . "0"^^ . . "camera"^^ . . "You should try to debug UI to see the view hierarchy. It will show exactly where the button is."^^ . . . . . "0"^^ . . . "How to document with Doxygen: typedef NS_ENUM(NSUInteger, EnumType)"^^ . . "0"^^ . . . . . . "1"^^ . . "uiimage"^^ . "Sorry, what I meant is you need to have `pod FacebookCore` before the other 2 pods. See: https://cocoapods.org/pods/FacebookCore"^^ . . "0"^^ . . . "0"^^ . "0"^^ . "0"^^ . . . . "1"^^ . . . . . . . . "How can I access contacts using Mac CLI app (XCode 14)?"^^ . "0"^^ . . "0"^^ . . . . "Metal resource "purgeable state" mechanics"^^ . . "nssortdescriptor"^^ . "<p>Solved it using <code>recordFormat.mFormatID = kAudioFormatLinearPCM</code> for recording and using</p>\n<pre><code>int sampleCount = inBuffer-&gt;mAudioDataByteSize / sizeof(AUDIO_DATA_TYPE_FORMAT)\n</code></pre>\n"^^ . . "android"^^ . "4"^^ . "1"^^ . . "0"^^ . "0"^^ . . . . . "The linked duplicate already covers this. Why not vote to close instead of posting an answer?"^^ . . "This is on a release build"^^ . . . . . "1"^^ . "If I let the reference go will the space still be allocated on the device??"^^ . . "Just to clarify, this crash log has been deSymbolicated."^^ . . . "<p>You need <strong>9</strong> labels, not <strong>8</strong>, because you need to include the Zero label.</p>\n<p>Also, setting <code>.granularity = 250.0;</code> will give you &quot;steps&quot; at 250 increments.</p>\n<p>Example:</p>\n<pre><code>ChartYAxis *leftAxis = _chartView.leftAxis;\nleftAxis.labelFont = [UIFont systemFontOfSize:10.f];\nleftAxis.labelPosition = YAxisLabelPositionOutsideChart;\nleftAxis.axisMinimum = 0.0;\nleftAxis.axisMaximum = 2000.0;\n\n// use .granularity\nleftAxis.granularity = 250.0;\n\n// we need 9 labels to include the Zero label\nleftAxis.labelCount = 9;\n</code></pre>\n<p>Output:</p>\n<p><a href="https://i.sstatic.net/jnFsP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jnFsP.png" alt="enter image description here" /></a></p>\n"^^ . "Can't you get the `SCWindow`s from `SCShareableContent` and handle them in the order from `CGWindowListCopyWindowInfo`?"^^ . "5"^^ . . "1"^^ . . . . . . . "cocoapods"^^ . . "Mac cli app is command line tool?"^^ . . "I was able to change the comma to a space, but there's no option without a comma, period, or space. Raptor, what's your setting to get 123456? Xcode 15.0.1, Sonoma 14.1.1, in case it matters."^^ . . "Are you by any means capturing the Google Map within the UI itself?"^^ . . . . "<p>So I am creating an ObjC framework which has mix of ObjC and Swift code: UtilitiesFramework.</p>\n<p>Here is my StringUtilities class in Swift:</p>\n<pre><code>@objc \npublic class StringUtilities: NSObject { }\n</code></pre>\n<p>I am accessing StringUtilities class in Utilities which is an ObjC class.</p>\n<p>Here is Utilities.h which is returning StringUtilities and has a forward class declaration for same:</p>\n<pre><code>@class StringUtilities; // Forward Declaration\n\n@interface Utilities: NSObject\n- (StringUtilities *)stringUtilities;\n@end\n</code></pre>\n<p>Here is Utilities.m which imports generated swift header file:</p>\n<pre><code>#import &lt;UtilitiesFramework/UtilitiesFramework-Swift.h&gt; // This should provide concrete implementation of StringUtilities\n\n@implementation Utilities\n- (StringUtilities *)stringUtilities {\n return [StringUtilities new];\n}\n@end\n</code></pre>\n<p>I am exposing Utilites.h file to Swift through module.modulemap:</p>\n<pre><code>module PrivateObjC {\nheader &quot;Utilities.h&quot;\n}\n</code></pre>\n<p>I have set the import path accurately in build settings as:\n<code>$(SRCROOT)/$(PRODUCT_NAME)</code></p>\n<p>Now when I try to access Utilities class in some other swift class it just compiles fine:</p>\n<pre><code>import PrivateObjC\n\nclass SomeOperations {\nfunc doSomething() {\n _ = Utilities() // This compiles fine\n}\n</code></pre>\n<p>However when I try to access the StringUtilities through its method, it gives compilation error:</p>\n<pre><code>import PrivateObjC\n\nclass SomeOperations {\nfunc doSomething() {\n _ = Utilities().stringUtilities() // This gives compilation error\n}\n</code></pre>\n<p>Here are the errors:</p>\n<pre><code>value of type Utilities has no member stringUtilities: _ = Utilities().stringUtilities()\nnote: method stringUtilities not imported\n- (StringUtilities *)stringUtilities\n^\nnote: return type not imported\n- (StringUtilities *)stringUtilities\n^\nnote: interface StringUtilities is incomplete\n- (StringUtilities *)stringUtilities\n^\nnote: interface StringUtilites forward declared here\n@class StringUtilities\n</code></pre>\n<p>I thought this scenario is fixed as part of proposal:</p>\n<p><a href="https://github.com/apple/swift-evolution/blob/main/proposals/0384-importing-forward-declared-objc-interfaces-and-protocols.md" rel="nofollow noreferrer"># 0384-importing-forward-declared-objc-interfaces-and-protocols.md</a></p>\n<p>However it is not working for me. May be it is due to it being approved as part of Swift 5.9, whereas in my machine 5.8.1 is used or am I missing anything else over here?</p>\n<p>How can I make it work in older versions of Swift? Any suggestions?</p>\n"^^ . . "0"^^ . . . . . . "0"^^ . . . . "1"^^ . "0"^^ . . "0"^^ . "bridging-header"^^ . . "0"^^ . "0"^^ . . . . . . "@TejaNandamuri Fine, but it's confusing. After invoke setAttributedText:, property textColor also changes to red color, Why did it turn back to blue in the end?"^^ . . . "objective-c"^^ . "0"^^ . . "iOS Access to the photo library is not allowed until the photo library is obtainable"^^ . "<p>I found the solution. I am now using:</p>\n<p><em>[self.map drawViewHierarchyInRect:self.map.bounds afterScreenUpdates:YES];</em></p>\n<p>Code:</p>\n<pre><code>UIGraphicsBeginImageContext(self.map.bounds.size);\n[self.map drawViewHierarchyInRect:self.map.bounds afterScreenUpdates:YES];\nUIImage *image = UIGraphicsGetImageFromCurrentImageContext();\nUIGraphicsEndImageContext();\nreturn image;\n</code></pre>\n"^^ . . . "<p>Objective C, Xcode 15.0.1</p>\n<p>Is there a way to eliminate the pretty comma? &quot;%i&quot; doesn't help.</p>\n"^^ . "crash-log"^^ . . "0"^^ . . . "0"^^ . . . "Actually, what problem are you trying to solve with purgable states?"^^ . . . . "0"^^ . "0"^^ . "Thank you, adding this to build phases fixed this issue, and app is now requesting permissions to contacts."^^ . . "1"^^ . "[Here](https://imgur.com/a/oVOp3L6) is my picture. I can see there is a file named `ViewController` in your project. This seems a bit odd for CLI app. Are you sure you didn't select regular multiplatform project instead of mac->cli?\n\nPS. Yup, CLI is command line tool."^^ . . . . . . "Are you designing cells in Storyboard or through code? If code, show us your cell class code. If you're using Storyboard Prototype cells, show us how you've configured the constraints."^^ . "Please edit your post and include the QR code image of your sample data so we can see what data format you use."^^ . . . . . "0"^^ . . . "0"^^ . . "0"^^ . . . . "0"^^ . "0"^^ . . "0"^^ . "<p>I'm currently developing a native plugin for a Capcitor app. I have very little experience with native iOS development, Swift and Obj-C.</p>\n<p>I use a framework (FunSDK) which is written in C++.\nI call this in an Objective-C++ wrapper.\nAs described here: <a href="https://medium.com/@cecilia.humlelu/set-up-c-library-dependencies-in-swift-projects-5dc2ccd2ddaf" rel="nofollow noreferrer">https://medium.com/@cecilia.humlelu/set-up-c-library-dependencies-in-swift-projects-5dc2ccd2ddaf</a></p>\n<p>The wrapper is then available in Swift via the bridging header.\nThis works so far, I can call the functions from the framework and they are executed correctly.\nHowever, the functions of the framework are executed asynchronously. When a result is obtained, the “OnFunSDKResult” method is always executed.</p>\n<p>During this step I get an EXC_BAD_ACCESS error while debugging. Then I ticked “Zombie objects” under the diagnostics settings. This causes execution to stop with an EXC_BREAKPOINT.</p>\n<p>As I understand it, after executing the iniXMSDK method, the FunSDKWrapper class is cleared from memory before executing the &quot;OnFunSDKResult&quot; method?</p>\n<p>I have also already integrated a completionHandler, which is only called in the &quot;OnFunSDKResult&quot; method so that data is transferred to the Swift class. However, that doesn't help either.</p>\n<p>I have no idea how to proceed.\nI hope somebody can help me.</p>\n<p>If you need any more information, I would be happy to provide it.</p>\n<p>The FunSDKWrapper.mm</p>\n<pre><code>//\n// FunSDKWrapper.m\n// App\n//\n// Created by Sysprobs on 12/8/23.\n//\n\n#import &quot;FunSDKWrapper.h&quot;\n#import &quot;FunSDK/FunSDK.h&quot;\n\n#import &lt;XMNetInterface/Reachability.h&gt;\n\n@implementation FunSDKWrapper\n\n-(NSString *)iniXMSDK:(int)test completion:(void (^)(int result))completionHandler{\n \n self.initCompletionHandler = completionHandler;\n \n self.msgHandle = FUN_RegWnd((__bridge void *)self);\n \n FUN_Init();\n Fun_LogInit(self.msgHandle, &quot;&quot;, 0, &quot;&quot;, LOG_UI_MSG);\n FUN_XMCloundPlatformInit(&quot;xxx&quot;, &quot;xxx&quot;, &quot;xxx&quot;, 1);\n FUN_InitNetSDK();\n \n FUN_SetFunStrAttr(EFUN_ATTR_SAVE_LOGIN_USER_INFO,SZSTR([self GetDocumentPathWith:@&quot;UserInfo.db&quot;]));\n \n FUN_SetFunStrAttr(EFUN_ATTR_USER_PWD_DB, SZSTR([self GetDocumentPathWith:@&quot;password.txt&quot;]));\n \n FUN_SetFunStrAttr(EFUN_ATTR_UPDATE_FILE_PATH,SZSTR([self GetDocumentPathWith:@&quot;&quot;]));\n FUN_SetFunStrAttr(EFUN_ATTR_TEMP_FILES_PATH,SZSTR([self GetDocumentPathWith:@&quot;&quot;]));\n \n FUN_SetFunIntAttr(EFUN_ATTR_AUTO_DL_UPGRADE, 0);\n \n FUN_SetFunStrAttr(EFUN_ATTR_CONFIG_PATH,SZSTR([self GetDocumentPathWith:@&quot;APPConfigs&quot;]));\n \n FUN_SetFunIntAttr(EFUN_ATTR_SUP_RPS_VIDEO_DEFAULT, 1);\n \n FUN_SetFunIntAttr(EFUN_ATTR_SET_NET_TYPE, [self getNetworkType]);\n \n FUN_SysInit(&quot;arsp.xmeye.net;arsp1.xmeye.net;arsp2.xmeye.net&quot;, 15010);\n FUN_InitNetSDK();\n\n FUN_SysGetDevList(self.msgHandle, SZSTR(@&quot;xxxx&quot;) , SZSTR(@&quot;xxxx&quot;),0);\n \n return @&quot;test&quot;;\n}\n\n- (void)searchLanDevices {\n FUN_DevSearchDevice(self.msgHandle, 4000, 0);\n}\n\n\n// NSDocument/fileName\n- (NSString *)GetDocumentPathWith:(NSString *) fileName {\n NSString* path = [self documentsPath];\n if (fileName != nil) {\n path = [path stringByAppendingString:@&quot;/&quot;];\n path = [path stringByAppendingString:fileName];\n }\n return path;\n}\n//NSDocument\n- (NSString *)documentsPath {\n NSArray *pathArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);\n NSString *path = [pathArray lastObject];\n return path;\n}\n\n-(int)getNetworkType {\n Reachability*reach=[Reachability reachabilityWithHostName:@&quot;www.apple.com&quot;];\n \n //判断当前的网络状态\n switch([reach currentReachabilityStatus]){\n \n case ReachableViaWiFi:\n return 1;\n \n case ReachableViaWWAN:\n return 2;\n \n default:\n return 0;\n break;\n }\n}\n\n\n- (void)OnFunSDKResult:(NSNumber *) pParam {\n NSInteger nAddr = [pParam integerValue];\n MsgContent *msg = (MsgContent *)nAddr;\n switch (msg-&gt;id) {\n case EMSG_SYS_GET_DEV_INFO_BY_USER:{\n self.initCompletionHandler(1); \n if (msg-&gt;param1 &lt; 0){\n //fehler\n NSLog(@&quot;Fehler beim XMCloud login&quot;);\n }else{\n \n char devJson[750*500];\n FUN_GetFunStrAttr(EFUN_ATTR_GET_USER_ACCOUNT_DATA_INFO, devJson, 750*500);\n NSLog(@&quot;Geraeteliste: = %s&quot;,devJson);\n }\n }\n break;\n }\n}\n\n\n@end\n</code></pre>\n<p>The Swift Class</p>\n<pre><code>import Foundation\nimport Capacitor\n\n/**\n * Please read the Capacitor iOS Plugin Development Guide\n * here: https://capacitorjs.com/docs/plugins/ios\n */\n@objc(xmsdkPlugin)\npublic class xmsdkPlugin: CAPPlugin {\n private let implementation = xmsdk()\n\n @objc func echo(_ call: CAPPluginCall) {\n let value = call.getString(&quot;value&quot;) ?? &quot;&quot;\n call.resolve([\n &quot;value&quot;: implementation.echo(value)\n ])\n }\n \n @objc func initXMSDK(_ call: CAPPluginCall) {\n //let devId = call.getString(&quot;devId&quot;) ?? &quot;&quot;\n \n \n let wrapper = FunSDKWrapper();\n let resp = wrapper.iniXMSDK(1, completion: {(result) -&gt; Void in\n NSLog(&quot;Completion von iniXMSDK&quot;)\n });\n \n call.resolve([\n &quot;status&quot;: resp\n ])\n\n } \n \n}\n</code></pre>\n<p>Errorlog with EXC_BREAKPOINT:</p>\n<pre><code>App`invocation function for block in UI_SendMsg(int, XMSG*):\n 0x102bed8f4 &lt;+0&gt;: sub sp, sp, #0x70\n 0x102bed8f8 &lt;+4&gt;: stp x22, x21, [sp, #0x40]\n 0x102bed8fc &lt;+8&gt;: stp x20, x19, [sp, #0x50]\n 0x102bed900 &lt;+12&gt;: stp x29, x30, [sp, #0x60]\n 0x102bed904 &lt;+16&gt;: add x29, sp, #0x60\n 0x102bed908 &lt;+20&gt;: mov x19, x0\n 0x102bed90c &lt;+24&gt;: ldr x8, [x0, #0x20]\n 0x102bed910 &lt;+28&gt;: ldr w9, [x8, #0x18]\n 0x102bed914 &lt;+32&gt;: str w9, [sp, #0x8]\n 0x102bed918 &lt;+36&gt;: ldr q0, [x8, #0x20]\n 0x102bed91c &lt;+40&gt;: stur q0, [sp, #0xc]\n 0x102bed920 &lt;+44&gt;: ldr x9, [x8, #0x38]\n 0x102bed924 &lt;+48&gt;: ldr x10, [x8, #0x50]\n 0x102bed928 &lt;+52&gt;: stp x10, x9, [sp, #0x20]\n 0x102bed92c &lt;+56&gt;: ldr w9, [x8, #0x30]\n 0x102bed930 &lt;+60&gt;: str w9, [sp, #0x34]\n 0x102bed934 &lt;+64&gt;: str x8, [sp, #0x38]\n 0x102bed938 &lt;+68&gt;: adrp x0, 6283\n 0x102bed93c &lt;+72&gt;: add x0, x0, #0x60 ; g_wndIndexLock\n 0x102bed940 &lt;+76&gt;: bl 0x102bdd34c ; XBASIC::CLock::Lock at Lock.cpp:58:29\n 0x102bed944 &lt;+80&gt;: adrp x8, 6283\n 0x102bed948 &lt;+84&gt;: ldr x10, [x8, #0x38]\n 0x102bed94c &lt;+88&gt;: cbz x10, 0x102bed98c ; &lt;+152&gt; at UIInterface.mm:130:24\n 0x102bed950 &lt;+92&gt;: ldr w9, [x19, #0x28]\n 0x102bed954 &lt;+96&gt;: adrp x11, 6283\n 0x102bed958 &lt;+100&gt;: add x11, x11, #0x38 ; g_id_wnd + 8\n 0x102bed95c &lt;+104&gt;: mov x8, x11\n 0x102bed960 &lt;+108&gt;: ldr w12, [x10, #0x20]\n 0x102bed964 &lt;+112&gt;: cmp w12, w9\n 0x102bed968 &lt;+116&gt;: cset w12, lt\n 0x102bed96c &lt;+120&gt;: csel x8, x8, x10, lt\n 0x102bed970 &lt;+124&gt;: ldr x10, [x10, w12, uxtw #3]\n 0x102bed974 &lt;+128&gt;: cbnz x10, 0x102bed960 ; &lt;+108&gt; [inlined] std::__1::less&lt;int&gt;::operator()(int const&amp;, int const&amp;) const at operations.h:487:17\n 0x102bed978 &lt;+132&gt;: cmp x8, x11\n 0x102bed97c &lt;+136&gt;: b.eq 0x102bed98c ; &lt;+152&gt; at UIInterface.mm:130:24\n 0x102bed980 &lt;+140&gt;: ldr w10, [x8, #0x20]\n 0x102bed984 &lt;+144&gt;: cmp w9, w10\n 0x102bed988 &lt;+148&gt;: b.ge 0x102bed9dc ; &lt;+232&gt; at UIInterface.mm:126:21\n 0x102bed98c &lt;+152&gt;: adrp x0, 6283\n 0x102bed990 &lt;+156&gt;: add x0, x0, #0x60 ; g_wndIndexLock\n 0x102bed994 &lt;+160&gt;: bl 0x102bdd354 ; XBASIC::CLock::Unlock at Lock.cpp:63:31\n 0x102bed998 &lt;+164&gt;: adrp x0, 4324\n 0x102bed99c &lt;+168&gt;: add x0, x0, #0xb00 ; @&quot;NO MSG Object.....&quot;\n 0x102bed9a0 &lt;+172&gt;: bl 0x1038af9a0 ; symbol stub for: NSLog\n 0x102bed9a4 &lt;+176&gt;: ldr x0, [x19, #0x20]\n 0x102bed9a8 &lt;+180&gt;: ldr x9, [x0, #0x8]\n 0x102bed9ac &lt;+184&gt;: ldaxr x8, [x9]\n 0x102bed9b0 &lt;+188&gt;: sub x10, x8, #0x1\n 0x102bed9b4 &lt;+192&gt;: stlxr w11, x10, [x9]\n 0x102bed9b8 &lt;+196&gt;: cbnz w11, 0x102bed9ac ; &lt;+184&gt; [inlined] InterlockedDecrement(long*) at OS.h:120:9\n 0x102bed9bc &lt;+200&gt;: sub w8, w8, #0x1\n 0x102bed9c0 &lt;+204&gt;: cmp w8, #0x0\n 0x102bed9c4 &lt;+208&gt;: b.gt 0x102beda24 ; &lt;+304&gt; at UIInterface.mm:143:5\n 0x102bed9c8 &lt;+212&gt;: tbnz w8, #0x1f, 0x102beda18 ; &lt;+292&gt; [inlined] XBASIC::IReferable::Release() at Referable.h:95:17\n 0x102bed9cc &lt;+216&gt;: ldr x8, [x0]\n 0x102bed9d0 &lt;+220&gt;: ldr x8, [x8, #0x8]\n 0x102bed9d4 &lt;+224&gt;: blr x8\n 0x102bed9d8 &lt;+228&gt;: b 0x102beda24 ; &lt;+304&gt; at UIInterface.mm:143:5\n 0x102bed9dc &lt;+232&gt;: ldp x20, x21, [x8, #0x28]\n 0x102bed9e0 &lt;+236&gt;: adrp x0, 6283\n 0x102bed9e4 &lt;+240&gt;: add x0, x0, #0x60 ; g_wndIndexLock\n 0x102bed9e8 &lt;+244&gt;: bl 0x102bdd354 ; XBASIC::CLock::Unlock at Lock.cpp:63:31\n 0x102bed9ec &lt;+248&gt;: cbz x20, 0x102bed998 ; &lt;+164&gt; at UIInterface.mm:139:13\n 0x102bed9f0 &lt;+252&gt;: adrp x8, 4330\n 0x102bed9f4 &lt;+256&gt;: ldr x0, [x8, #0x5e8]\n 0x102bed9f8 &lt;+260&gt;: add x2, sp, #0x8\n 0x102bed9fc &lt;+264&gt;: bl 0x1038b5a00 ; objc_msgSend$numberWithUnsignedInteger:\n 0x102beda00 &lt;+268&gt;: mov x3, x0\n 0x102beda04 &lt;+272&gt;: mov x0, x20\n 0x102beda08 &lt;+276&gt;: mov x2, x21\n 0x102beda0c &lt;+280&gt;: mov w4, #0x1\n 0x102beda10 &lt;+284&gt;: bl 0x1038b5aa0 ; objc_msgSend$performSelectorOnMainThread:withObject:waitUntilDone:\n-&gt; 0x102beda14 &lt;+288&gt;: b 0x102bed9a4 ; &lt;+176&gt; at UIInterface.mm:142:9\n 0x102beda18 &lt;+292&gt;: adrp x0, 3297\n 0x102beda1c &lt;+296&gt;: add x0, x0, #0xd93 ; &quot;Check Please Error(IReferable)!&quot;\n 0x102beda20 &lt;+300&gt;: bl 0x1038b2364 ; symbol stub for: puts\n 0x102beda24 &lt;+304&gt;: ldp x29, x30, [sp, #0x60]\n 0x102beda28 &lt;+308&gt;: ldp x20, x19, [sp, #0x50]\n 0x102beda2c &lt;+312&gt;: ldp x22, x21, [sp, #0x40]\n 0x102beda30 &lt;+316&gt;: add sp, sp, #0x70\n 0x102beda34 &lt;+320&gt;: ret \n</code></pre>\n<p><a href="https://i.sstatic.net/vknhn.png" rel="nofollow noreferrer">Image with Error Message</a></p>\n<p><strong>Update after Comments:</strong></p>\n<p>Thanks in advance for the information.</p>\n<p>Unfortunately, the documentation for the FunSDK is not really good.\nThis is the documentation: <a href="https://developer.jftech.com/docs/?menusId=8af0e7f3d4af49eab71cfdd8d7e47cef&amp;siderid=6caa41621abd4e689b21a3c0339e8cd6&amp;lang=en" rel="nofollow noreferrer">https://developer.jftech.com/docs/?menusId=8af0e7f3d4af49eab71cfdd8d7e47cef&amp;siderid=6caa41621abd4e689b21a3c0339e8cd6&amp;lang=en</a></p>\n<p>And this is a demo app in which all functions of the framework are used: <a href="https://gitlab.xmcloud.io/demo/FunSDKDemo_iOS" rel="nofollow noreferrer">https://gitlab.xmcloud.io/demo/FunSDKDemo_iOS</a></p>\n<p>The documentation does not describe exactly how to call the &quot;OnFunSDKResult&quot; method.\nAt one point in the DemoApp there is only this comment: &quot;All FUN interfaces with callback information will call back into this method.&quot;</p>\n<p>The EXC_BAD_ACCESS error also only occurs when I implement the &quot;OnFunSDKResult&quot; method. So I assume that the framework somehow returns the data to the &quot;OnFunSDKResult&quot; method via the &quot;UI_SendMsg&quot;.</p>\n<p>I now basically understand that ARC released the wrapper. From the tutorials on memory management I still haven't figured out how to change this in my case.</p>\n<p>Can someone give me a code example of how I can ensure that ARC only releases the wrapper at a certain time?\nI also read that I can explicitly disable ARC for individual classes and take over memory management myself. Is this an option so that I only release the memory manually again in the &quot;OnFunSDKResult&quot;?</p>\n"^^ . . "<p>I wrote the following test code in objective-c:</p>\n<pre class="lang-objectivec prettyprint-override"><code> NSCharacterSet *pathAllowedCharacterSet = [NSCharacterSet URLPathAllowedCharacterSet];\n\n // Check if colon is a member of URLPathAllowedCharacterSet\n if ([pathAllowedCharacterSet characterIsMember:':']) {\n NSLog(@&quot;Colon is allowed in URL path&quot;);\n } else {\n NSLog(@&quot;Colon is not allowed in URL path&quot;);\n }\n \n NSString* test = [@&quot;:&quot; stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLPathAllowedCharacterSet]];\n NSLog(@&quot;%@&quot;, test);\n</code></pre>\n<p>What gets logged is</p>\n<pre><code>Colon is allowed in URL path\n%3A\n</code></pre>\n<p>The documentation for <code>stringByAddingPercentEncodingWithAllowedCharacters</code> states:</p>\n<blockquote>\n<p>Returns a new string made from the receiver by replacing all characters not in the specified set with percent-encoded characters.</p>\n</blockquote>\n<p>That implies to me that if a character is in the specified set, it will <em>not</em> be percent-encoded. Why is the colon being percent-encoded? Is there a way for it not to be?</p>\n"^^ . . "0"^^ . . "google-maps-sdk-ios"^^ . "<p>In my sample project, I tried using the Objective-C classes and struct in the Swift file using the bridging headers. I get an error using the struct:</p>\n<blockquote>\n<p>Cannot find type 'XXX' in scope</p>\n</blockquote>\n<p>However, classes are used without any error.</p>\n<p>My Objective-C file looks like:</p>\n<pre class="lang-objc prettyprint-override"><code>#import &lt;Cocoa/Cocoa.h&gt;\n\nstruct ObjCStruct {\n NSMenu* sMenu;\n int8_t menuID;\n};\n\n@interface ObjCClass : NSObject {\n NSMenu* cMenu;\n}\n\n@end\n</code></pre>\n<p>In my bridging header, I have used it as:</p>\n<pre class="lang-objc prettyprint-override"><code>#import &quot;ObjC.h&quot;\n</code></pre>\n<p>Finally, I used struct and classes in Swift file as:</p>\n<pre class="lang-swift prettyprint-override"><code>struct Model {\n var c : ObjCClass;\n var s : ObjCStruct;\n}\n</code></pre>\n<p>If <code>NSMenu* sMenu;</code> has been commented out from ObjC.h, then it works fine.</p>\n<p>How can I use the Objective-C struct in the Swift file?</p>\n<p>I have imported the Objective-C headers in the bridging header and the bridging header has been referred correctly in the build settings.</p>\n"^^ . . . . . . "0"^^ . "no once they are purged, and all of the frames in flight that reference it have finished I do not use that buffer anymore. It is after all of an obsolete size because we resize the buffer."^^ . . "0"^^ . "0"^^ . . . "1"^^ . . . . "1"^^ . . . . . . . . . . "1"^^ . . . . . . "1"^^ . "1"^^ . "0"^^ . . . . "0"^^ . . "0"^^ . "1"^^ . "<p>I got it to work by changing Doxygen's preprocessor expansion settings:</p>\n<pre><code>ENABLE_PREPROCESSING YES\nMACRO_EXPANSION YES\nEXPAND_ONLY_PREDEF YES\nPREDEFINED &quot;NS_ENUM(enum_type,enum_name)=enum enum_name&quot;\n</code></pre>\n<p>This changes the original definition</p>\n<pre><code>typedef NS_ENUM(NSUInteger, EnumName)\n</code></pre>\n<p>to look like this:</p>\n<pre><code>typedef enum EnumName\n</code></pre>\n<p>This is sufficiently good for the Doxygen parser so that regular documentation blocks can be written.</p>\n"^^ . . . . "1"^^ . "Have you called `PHPhotoLibrary requestAuthorization:`? Have you added the needed `NSPhotoLibraryUsageDescription` key to your Info.plist?"^^ . . "It worked\nThanks"^^ . . "0"^^ . . "Thanks. I guess that answer is what I need. However, I think this may be just a pure bug, since colon is included in `URLPathAllowedCharacterSet` but the function percent-encodes it anyway."^^ . . "0"^^ . . "0"^^ . "Doesn't look trustworthy even in Objective-C. Are you sure that just using own class with `@property CGWindowID windowID;` won't be enough?"^^ . "0"^^ . . "Likely duplicate of https://stackoverflow.com/questions/72427842/ibaction-not-firing-for-button-in-subview"^^ . "1"^^ . "0"^^ . . . . . "0"^^ . "0"^^ . "1"^^ . . "How to scan and get byte array with decimal values from qr code in ios?"^^ . . . . . "0"^^ . "@TomHarrington Paulw11 As I mentioned in the post, I know that I can hardcode some exceptions to swap certain characters for other certain characters, but I'm not excited about a potentially growing list of exceptions. The underlying iOS code obviously has some way of treating them the same because that's what happens when the NSFetchRequest does it's work. But the NSFetchedResultsController does NOT treat them the same way which is what causes the crash. I would like to know how to have both of them do the same thing; either both treat them the same or neither treat them the same."^^ . "0"^^ . . "Is this within your debugger, or on a release build? A debugger should be able to drop you into the actual call-site, regardless of whatever is being reported here."^^ . . . "react-native"^^ . . . . "<p>I'm having some problems accessing contacts inside of mac cli app.\nThe main issue is that the app is not triggering a dialog requesting access to contacts. Some sources state that <a href="https://developer.apple.com/documentation/bundleresources/information_property_list/nscontactsusagedescription" rel="nofollow noreferrer">NSContactsUsageDescription</a> should be added to info.plist. This info.plist is nowhere to be found inside the project in xcode. Then, some sources are stating that there was a xcode update, and now permissions are added on <code>Targets -&gt; Info</code> tab, but this tab does not exist on mac cli project.</p>\n<p>Here is a code snippet:</p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n#import &lt;Contacts/Contacts.h&gt;\n\nint main(int argc, const char * argv[]) {\n @autoreleasepool {\n CNAuthorizationStatus status = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts];\n\n if (status == CNAuthorizationStatusNotDetermined) {\n NSLog(@&quot;Contact access not determined.&quot;);\n CNContactStore *contactStore = [[CNContactStore alloc] init];\n \n [contactStore requestAccessForEntityType:CNEntityTypeContacts completionHandler:^(BOOL granted, NSError * _Nullable error) {\n NSLog(@&quot;Got response&quot;);\n NSLog(granted ? @&quot;Yes&quot; : @&quot;No&quot;);\n CFRunLoopStop(CFRunLoopGetCurrent());\n }];\n \n } else if (status == CNAuthorizationStatusAuthorized) {\n NSLog(@&quot;Access granted&quot;);\n \n } else {\n NSLog(@&quot;Access to contacts is denied or restricted.&quot;);\n }\n }\n CFRunLoopRun();\n return 0;\n}\n\n\n</code></pre>\n<p>Running this outputs: <code>Contact access not determined.</code> and app exits with code <code>0</code>.</p>\n<p>How would one access contacts inside of mac cli app project? Or setup proper permissions so that dialog would trigger?</p>\n<p>PS. I have also tried adding info.plist manually, but there was no difference. Maybe I did something wrong? Is info.plist even used in mac cli project?</p>\n"^^ . . . . . . . "Because someone wants points obviously. :)"^^ . . . . . "0"^^ . "0"^^ . "<p>Added Swift code to Objective-C project.\nBuilt and working for simulator. Failing with Undefined symbol error for Archive.</p>\n<p>Deep investigation of compiled files</p>\n<p>Objective-C &quot;*.o&quot; file wants symbol:</p>\n<pre><code>_OBJC_CLASS_$_AClass\n</code></pre>\n<p>But AClass.swift &quot;AClass.o&quot; file have only (per nm output):</p>\n<pre><code>0000000000002318 D _OBJC_METACLASS_$_AClass\n</code></pre>\n<p>Comparing with simulator compilation I see that AClass.swift compiled into AClass.o with:</p>\n<pre><code>0000000000002890 S _OBJC_CLASS_$_AClass\n0000000000002398 D _OBJC_METACLASS_$_AClass\n</code></pre>\n<p>I do not understand why Archive not puts that &quot;S <em>OBJC_CLASS</em>$_AClass&quot;.</p>\n<p>What I already did:</p>\n<ul>\n<li>cleared/removed and restarted all possible;</li>\n<li>having @objc attributes of cause and</li>\n<li>re-added swift files to Xcode (first the were placed there strange - not in group and one file showed in several places. But removed completely and re-added so compiled to simulator);</li>\n<li>experimented with all possible arch settings in build config;</li>\n<li>compared build logs in attempt to find some special flags preventing this (no special, just -DDEBUG=1 and like that). And of cause compilation and linking used different &quot;sdk&quot; folders. One for simulator and one for iPhone devices;</li>\n<li>set Debug for Archive and do not remove debug symbols. Set all ONLY_ACTIVE_ARCH to No. No effect;</li>\n<li>Symbols Hidden by Default is set to No.</li>\n</ul>\n<p>How to build Archive finally?</p>\n"^^ . . . . . "uikit"^^ . . . "auto resize cell heights"^^ . . "@son I don't think I understand. :( May I ask you to show me how it's usually done?"^^ . "avaudioplayer"^^ . . "1"^^ . . "0"^^ . "Does this answer your question? [Flutter Xcode 12 archive build fails with Undefined symbol: \\_OBJC\\_CLASS\\_$\\_STPAPIClient](https://stackoverflow.com/questions/64707510/flutter-xcode-12-archive-build-fails-with-undefined-symbol-objc-class-stpapi)"^^ . . "0"^^ . . "The following Swift pods cannot yet be integrated as static libraries in iOS Project Objective C Language"^^ . . . . . . . . "deep-linking"^^ . . . . . "0"^^ . . . . . "1"^^ . . "I think you should make custom views for each cell state to avoid redrawing continuously."^^ . "Does this answer your question? [UITableView / UITableViewCell challenge with transparent background on iPad with iOS7](https://stackoverflow.com/questions/18901394/uitableview-uitableviewcell-challenge-with-transparent-background-on-ipad-with)"^^ . . . . . "0"^^ . . "0"^^ . . . . "0"^^ . . "nsmutableorderedset"^^ . "iOS Solid text over a background image and low alpha cell background"^^ . "0"^^ . "Any possible solutions??"^^ . . . . . "0"^^ . . . "2"^^ . . "1"^^ . . . "The code sends a network request and receives the response. So I would stop upon either getting an error from a network call or after receiving the response. BUT I'd also worry that `exit()` might be too low-level and not allow for proper cleanup of the higher level mac-specific stuff, since I'm out of my environment and don't really know which parts of the rabbithole to go down (-:"^^ . "1"^^ . . . . "0"^^ . . . . . . . . . . "I assume I've gotten something out of whack with my environment, some setting somewhere. I'm hoping someone has run into this."^^ . . "1"^^ . . . "objective-c++"^^ . . . "0"^^ . "0"^^ . . . . "0"^^ . "OK so I'm not bypassing anything internal, only code I specifically put there? Gotcha. By the way, after posting here I got an answer I couldn't verify from an AI chatbot saying I should use `dispatch_after(dispatch_get_main_queue(), ^{ exit(0); });` In an effort to explain my confusion, when I was playing with `NSApplication` some time ago I found out I should use `NSApp.stop()` to return back to the main code after launching the GUI loop with `NSApplication.shared.run()` rather than just call `exit(0)`."^^ . . . "0"^^ . "screencapturekit"^^ . . "React Native Webview menuItems prop cannot use on iOS >= 16"^^ . . . "No, I mean you should try to create a serial queue, then enqueue the setup code to this queue, running also need to dequeue on this queue."^^ . "0"^^ . . "Undefined symbol in linking archive Xcode 15 in mixed Swift/Objective-C"^^ . "0"^^ . . . "0"^^ . . "What's the current status you got then? Have you called at all `requestAuthorizationForAccessLevel:handler:`?"^^ . . . . . "+1 for sanitising the data, but see also https://stackoverflow.com/questions/8776781/what-is-the-difference-between-localizedcaseinsensitivecompare-and-caseinsensit"^^ . . . . "1"^^ . . "0"^^ . "A couple of things: If you just call `exit()` without cleaning up stuff your code created (i.e. objects created using the `create_*` functions of Network.framework) then things may not be cleaned up "correctly". You created those objects, you should destroy them. If you want to use `atexit()` to schedule cleanup, that's another option. That said, when you call `exit` your process will terminate. All sockets closed, all file handles closed, all memory given back to the OS, etc. It's a big hammer. But if you created temporary files not managed by `tmpfile()`, you'd need to delete them, etc."^^ . "0"^^ . . . . . . "macos"^^ . "<p>My buttons can’t be pressed. When I press them there is no animation or highlight, and the onPressed method never gets called either.</p>\n<p>I strongly suspect there’s something wrong with the way I’m adding subviews.</p>\n<p>My buttons are in a UIView called QuickMove.\nMy objects are like this: BoardView contains EvilEndgame instance, EvilEndgame instance contains QuickMove instance.</p>\n<p>EvilEndgame UIView init’s QuickMove and adds it to the subview:</p>\n<pre><code>EvilEndgame.m\n\n-(void) initializeChessBoard: (UIView*) boardView boardDict: (NSMutableDictionary*) board {\n // Properties\n self.engine = [[NSMutableDictionary alloc] init];\n\n // ScoresLayer\n self.scoresLayer = [ScoresLayer sharedInstance];\n self.scoresLayer.boardView = boardView;\n self.scoresLayer.board = board;\n \n// \n\n // QuickMove\n self.quickMove = [QuickMove sharedInstance];\n [self.quickMove startNewGame];\n [boardView addSubview: self.quickMove];\n self.quickMove.delegate = self;\n}\n</code></pre>\n<p>QuickMove creates multiple buttons and adds them via [self addSubview: button]:</p>\n<pre><code>QuickMove.m\n\n+ (instancetype)sharedInstance {\n static QuickMove *sharedInstance = nil;\n static dispatch_once_t onceToken;\n dispatch_once(&amp;onceToken, ^{\n sharedInstance = [[QuickMove alloc] init];\n // Set the bounds to match the screen bounds\n sharedInstance.bounds = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);\n // Set the center to adjust the position\n sharedInstance.center = CGPointMake([UIScreen mainScreen].bounds.size.width / 2, 415 + [UIScreen mainScreen].bounds.size.height / 2);\n });\n return sharedInstance;\n}\n\n- (instancetype)initWithFrame:(CGRect)frame {\n self = [super initWithFrame:frame];\n if (self) {\n self.backgroundColor = [UIColor grayColor];\n }\n return self;\n}\n\n- (void)startNewGame {\n for (UIButton *button in self.buttons) {\n [button removeFromSuperview];\n }\n for (UIButton *button in self.smartMoveButtons) {\n [button removeFromSuperview];\n }\n [self.buttons removeAllObjects];\n [self.smartMoveButtons removeAllObjects];\n \n [self createButtons];\n}\n\n- (void)createButtons {\n self.buttons = [[NSMutableArray alloc] init];\n self.smartMoveButtons = [[NSMutableArray alloc] init];\n CGFloat buttonWidth = self.bounds.size.width / 8; // 8 original buttons\n CGFloat buttonHeight = 50;\n CGFloat smartMoveWidth = 50; // 3 smartMove buttons\n\n // Create smartMove buttons with spacing\n CGFloat spacing = 1;\n int tag = 100; // Start smart button tags from 100\n for (int i = 1; i &lt;= 3; i++) {\n CGFloat offset = (i - 1) * (smartMoveWidth + spacing);\n UIButton *smartMoveButton = [self createButtonWithTitle:[NSString stringWithFormat:@&quot;SM%d&quot;, i]\n frame:CGRectMake(offset, 0, smartMoveWidth, buttonHeight)\n tag:tag++];\n [self.smartMoveButtons addObject:smartMoveButton];\n }\n\n // Create original buttons with spacing\n tag = 0; // Start original button tags from 0\n for (int i = 1; i &lt;= 8; i++) {\n CGFloat offset = (i - 1) * (buttonWidth + spacing);\n UIButton *originalButton = [self createButtonWithTitle:[NSString stringWithFormat:@&quot;B%d&quot;, i]\n frame:CGRectMake(offset, buttonHeight, buttonWidth, buttonHeight)\n tag:tag++];\n [self.buttons addObject:originalButton];\n }\n}\n\n- (UIButton *)createButtonWithTitle:(NSString *)title frame:(CGRect)frame tag:(NSInteger)tag {\n UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];\n button.frame = frame;\n [button setTitle:title forState:UIControlStateNormal];\n [self configureButton:button];\n [button addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchDown];\n \n // Assign tag to button\n button.tag = tag;\n \n [self addSubview:button];\n return button;\n}\n\n- (void)configureButton:(UIButton *)button {\n button.titleLabel.font = [UIFont systemFontOfSize:13];\n button.titleLabel.lineBreakMode = NSLineBreakByWordWrapping;\n button.titleLabel.numberOfLines = 4;\n // Fixes label position\n button.contentVerticalAlignment = UIControlContentVerticalAlignmentTop;\n button.backgroundColor = self.backgroundColor;\n}\n</code></pre>\n<p>Everything is visible but I cannot click on any buttons.</p>\n<p>Can anyone see what’s wrong here?</p>\n<p>In my old project, which was working fine many years ago I did this instead:</p>\n<pre><code> UIViewController *rootViewController = (UIViewController*)[[[UIApplication sharedApplication] keyWindow] rootViewController];\n// And in quickMove I would add the buttons via:\n[rootViewController.view addSubview:button];\n</code></pre>\n<p>This approach no longer works because it’s deprecated(?) Nothing at all is visible if I try this.</p>\n"^^ . "accessibility"^^ . . . . "uibutton"^^ . "You seem to be assuming that `sudo -s -i` will accept the following shell commands as input, but that's not how it works. You are running `sudo` and `passwd` as separate, unrelated subprocesses."^^ . . . "@DonMag Thx for replying! There is no pattern as I can find. The code is that single line removeObjectAtIndex. By executing that line, the count of items in the set should be one less. But sometimes, the count remains the same as I print in the console. But if I try to print the object at that index (0 in the example posted), an error comes up (as in what was posted above)."^^ . "0"^^ . . . "@DonMag No worries. I think I found what caused the issue. The detailPlaylist is not an independent object."^^ . "0"^^ . "0"^^ . "1"^^ . . . "0"^^ . "0"^^ . "<p>To enable dynamic cell height with Auto Layout constraints in Swift, you need to set up your cell with constraints that define its size based on the content. Here's an example of how you can achieve this:</p>\n<pre><code>- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath\n{\n return UITableViewAutomaticDimension;\n}\n</code></pre>\n<p>or in swift</p>\n<pre><code>func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -&gt; CGFloat {\n return UITableView.automaticDimension\n }\n</code></pre>\n"^^ . . . "1"^^ . . . . "Not sure Profile-swift.h exists . May be you can try to add the swift header file in the prefix pch file"^^ . . . "<p>Bind the text field to the array controller</p>\n<p>Controller key: <code>arrangedObjects</code></p>\n<p>Model Key Path: <code>@sum.modelKey</code></p>\n<p>The sum value is the same type as the summed values. Add a number formatter to the text field with the same settings as the formatter of the cell in the column.</p>\n"^^ . . . "alpha"^^ . . "0"^^ . "<p>Using struct with objects is very tricky for memory management. Struct in objective-c is not the same as struct in Swift. You may reconsider declaring it a class. However, I think this is a workaround:</p>\n<pre><code>struct ObjCStruct {\n __unsafe_unretained NSMenu* sMenu; //It's __strong by default\n int8_t menuID;\n};\n</code></pre>\n<p>In Swift:</p>\n<pre class="lang-swift prettyprint-override"><code>//Manage NSMenu manually by Unmanaged. Keep in mind to release this menu \n//object later or you will get a leak here.\n\nlet menu: Unmanaged&lt;NSMenu&gt; = Unmanaged.passRetained(NSMenu(title: &quot;2&quot;))\nlet model = Model(c: .init(), s: .init(sMenu: menu, menuID: 2))\n</code></pre>\n<pre class="lang-swift prettyprint-override"><code>//To get the NSMenu\nlet menuUI = menu.takeRetainedValue()\n</code></pre>\n"^^ . . . . . . . . . "AVAudioEngine & AVAudioPlayer. setVoiceProcessingEnabled low volume output"^^ . . "0"^^ . . . . . . . . . "0"^^ . . . "0"^^ . . . . . . "2"^^ . "0"^^ . "0"^^ . . . . . . . "0"^^ . . . "8ms is how long it takes between two drawables being submitted when the display is at 120 Hz. `enableSetNeedsDisplay` has nothing to do with v-sync, the actual setting is `displaySyncEnabled`, which is only available on macOS."^^ . "uitableview"^^ . . . "@Cy-4AH I tried just using that, but the program kept crashing. Maybe the internal implementation has checks to prevent using the setter?"^^ . "0"^^ . . "Try `int16_t *buff = (int16_t*)data.bytes`"^^ . . "0"^^ . "That not answers my question, but have a hint to check Deployment Target."^^ . . . "To solve this, I just kept a counter on each `MTLBuffer` that track how many frames in flight read from that buffer. Then I set a handler on the end of each frame draw command that check if a resize (edit) has occurred and if there are zero frames referencing the old buffer. If that number is zero, the old sized buffer is finally purged to save space."^^ . "1"^^ . "4"^^ . . . . . . . . . "0"^^ . . . "0"^^ . . "Forcefully initialize class with unavailable init in Swift"^^ . "0"^^ . . . . "The mouse pointer and the events are both driven by the mouse or trackpad. Changing the events does not change the mouse pointer."^^ . . . "If it was me, I'd sanitize the data before saving it, by either removing the quote marks or standardizing them on one type of quote mark. Or if I needed the original formatting for some reason, I'd add a secondary field with sanitized data and use that for sorting."^^ . . . . . "0"^^ . "@Robert I have edited the question, as u suggested. And i have added the intended output also."^^ . "CoreData sorting is treating single straight quote and single smart quote as the same, how to treat them differently?"^^ . "`[data getBytes:&buff length:sizeof(buff)]` got wrong bytes"^^ . . "0"^^ . . . . . "I have already solved it, but for context i wanted to nicely abstract resizing `MTLBuffer`s by making a class that has two revolving `MTLBuffer*`s. When resizing, we format the back buffer while drawing from the front until the back is prepared. Once the back is done (reallocated) we swap buffers and draw (and edit) the new one. I could not just purge the old buffer because there may be frames in flight that read from it."^^ . "0"^^ . "0"^^ . "flutter"^^ . . . . . . "FYI - the Apple project at https://developer.apple.com/documentation/avfoundation/media_reading_and_writing/reading_multiview_3d_video_files?language=objc does have what you need. The important file is StereoViewModel.swift. It's trivial to make that work for iOS. Change `NSImage` to `UIImage` and `NSSize` to `CGSize`. Then of course you need to convert to Objective-C. Focus on the APIs used, not the language. Focus on just the parts that extract each pair of images for each frame. All of the AVFoundation and VideoToolBox APIs are there in both languages."^^ . . . . "Without knowing how the value was encoded into `NSData` to begin with, it's hard to know what the best solution is. But if `int` works, why try to use `int16_t`? If all you're doing is wrapping the result in `NSNumber`, then use whatever works."^^ . . "1"^^ . "`We are expecting a byte array which have a decimal values,` A byte array contains bytes. Only bytes. No values. Every byte is eight bits. How you interpret the bits is up to you. You can display them as decimal, hexadecimal, octal value, what ever you want. But a byte is only eight bits."^^ . "0"^^ . . . . . . "1"^^ . "AVFoundation (Objective-C, iOS 16): captureOutput not called"^^ . . "Do you read the data from `errorPipe`?"^^ . "Error SwiftCompile normal arm64 Compiling .. in target '' from project pods while migrating from objective C to Swift in my react native app"^^ . "1"^^ . . . . "2"^^ . "How do you check the mouse movement event?"^^ . . "0"^^ . . . . . "0"^^ . "cocoa"^^ . . . . . . . . . . . "0"^^ . "2"^^ . . "1"^^ . "0"^^ . . . "0"^^ . "0"^^ . . "sh"^^ . . . "As I remember, setting up input and output should be done in a serial queue before startRunning."^^ . "command-line-interface"^^ . "@DávidPásztor Honestly, I'm just not satisfied with `SCShareableContent` since it doesn't return the windows in z-index order. I'm using `CGWindowListCopyWindowInfo` to do this."^^ . "uitextfield"^^ . . . "1"^^ . "UIImage Replace Color with Background Image Washing Out and Overlaying everything Instead of Replacing"^^ . . . . . . . . . "1"^^ . . . . . "0"^^ . . . . . "1"^^ . . . . "ios"^^ . . "0"^^ . . . . . . "@Alexander\nIts macOS sonoma 14.1.1.\nwhen I remove podfile **use framework!** in the demo project pod install giving me an error.\n\n>you may set use_modular_headers! globally in your Podfile, or specify :modular_headers => true for particular dependencies.\n\nIf I use **use_modular_headers!** then not issue mut my other pods change and **FacebookShare** pod not working **:modular_headers => true**."^^ . "0"^^ . . . "Thanks for all the ideas provided. Now the way I’m using is through AXUIElementCopyElementAtPosition to get it. First, I get the coordinates of the main window, and then calculate the coordinates of the control I want to get. I have been able to get it. Thank you very much for your help. You are the best."^^ . "cgimage"^^ . . . "0"^^ . . . . "1"^^ . . . . . . "<p>I'm trying to invert the mouse movement (specifically my Magic Trackpad 2) on X axis on Mac OS, AFAIK I will have to listen to the <code>NSEventMaskMouseMoved</code>, and do the modification on the <code>callback</code>. Here is what I have</p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &lt;Foundation/Foundation.h&gt;\n#import &lt;CoreGraphics/CoreGraphics.h&gt;\n#import &lt;CoreFoundation/CoreFoundation.h&gt;\n#import &lt;AppKit/AppKit.h&gt;\n\n\nstatic CGEventRef callback(CGEventTapProxy proxy,\n CGEventType type,\n CGEventRef eventRef,\n void *userInfo) {\n if (type == kCGEventMouseMoved) {\n // Get the original delta X value\n int64_t deltaX = CGEventGetIntegerValueField(eventRef, kCGMouseEventDeltaX);\n\n // Invert the delta X value\n int64_t invertedDeltaX = -deltaX;\n\n // Set the inverted delta X value back on the original event\n CGEventSetIntegerValueField(eventRef, kCGMouseEventDeltaX, invertedDeltaX);\n\n NSLog(@&quot;Original Delta X: %lld&quot;, deltaX);\n NSLog(@&quot;Inverted Delta X: %lld&quot;, invertedDeltaX);\n\n return eventRef;\n }\n\n return eventRef;\n}\n\n\nint main(int argc, const char * argv[]) {\n @autoreleasepool {\n CFMachPortRef tapPort = (CFMachPortRef)CGEventTapCreate(kCGSessionEventTap,\n kCGTailAppendEventTap,\n kCGEventTapOptionDefault,\n NSEventMaskMouseMoved,\n callback,\n nil);\n\n if (tapPort) {\n NSLog(@&quot;tapPort created %p&quot;, tapPort);\n \n CFRunLoopSourceRef tapSource = (CFRunLoopSourceRef)CFMachPortCreateRunLoopSource(kCFAllocatorDefault, tapPort, 0);\n \n if (tapSource) {\n NSLog(@&quot;tapSource created %p&quot;, tapSource);\n \n CFRunLoopAddSource(CFRunLoopGetMain(), tapSource, kCFRunLoopCommonModes);\n \n// CGEventTapEnable(tapSource, true);\n \n CFRunLoopRun();\n } else {\n NSLog(@&quot;tapSource NOT created&quot;);\n }\n } else {\n NSLog(@&quot;tapPort NOT created&quot;);\n }\n \n \n }\n return 0;\n}\n</code></pre>\n<p>On the log console, it seems everything's correct (I gave the Accessibiity permission). But the mouse movement event is not changed, unfortunately. Seems the <code>CGEventSetIntegerValueField</code> is not making any different.</p>\n<p>Maybe I'm doing in a wrong way?</p>\n<p>Thanks!</p>\n"^^ . . . "0"^^ . . "<p>I am working on a project in which we are migrating from iOS project to framework. I am facing issues with Objective-C and Swift interoperability.</p>\n<p>I have one Swift class named <code>Profile</code>. It has been exposed to Objective-C.</p>\n<pre class="lang-swift prettyprint-override"><code>import Foundation\n\n@objc public class Profile: NSObject {\n @objc public var name : String?\n\n @objc public func getName() -&gt; String{\n return &quot;XYZ&quot;\n }\n}\n</code></pre>\n<p>When I am importing “ProductName-Swift.h” it is showing me an error in generated header for the module map like “@import ModuleMapPrivate not found”.</p>\n<p>I wanted to know if there is any way in which I can import “Profile-Swift.h” instead of “ProductName-Swift.h”?</p>\n<p><img src="https://i.sstatic.net/b89qR.png" alt="Screenshot" /></p>\n<p>I tried by adding User Header search paths</p>\n"^^ . "Without digging too deeply into this, be very careful about profiling with NSLog. It is extremely slow itself, and has a synchronization lock that can significantly throw off these kinds of measurements. I doubt this is your full problem; but it can throw you onto the wrong path quite easily, especially since the synchronization is non-deterministic . See `os_signpost` for a much more accurate way to measure this kind of profiling information. `os_log` is also quite low-latency. https://developer.apple.com/documentation/os/logging/recording_performance_data?language=objc"^^ . "0"^^ . . . . . . . . . . "sfspeechrecognizer"^^ . . . . . "<p>I’m updating an Objective-C app. I have an NSTableView w/ 2 columns. Column 2 binding: set to arrayController, arrangedObjects, and the Model Key is set to a defined Entity Attribute.</p>\n<p>I have Attribute type set to “Float.” I added a numberFormatter to the column with its format set to “Currency.” Everything (Add, Delete, Save, etc.) works as expected. What I would like to do is update an independent textField below the table column to display the running sum of the currency values populating the column.</p>\n<p>The updating in the sum textField doesn’t need to update dynamically. I can set up a separate action to manually initialize a calculation of the existing column values.</p>\n<p>How can I get this done?</p>\n"^^ . . . . "0"^^ . "`Targets -> Info` is not present when creating cli app project."^^ . . "<p>Apparently, the <code>sudo -i</code> command opens another bash, hence the signals are not passed. Solution is to launch my app in root level hence the bash will be launched in root level by default and I don't have to change to sudo manually. Another drawback of using <code>sudo -i</code> is that the user can use <code>exit</code> command to exit from sudo mode which I don't want. So launching the bash from root level is the right solution.</p>\n"^^ . . . . . "0"^^ . "1"^^ . "1"^^ . "0"^^ . . . "1"^^ . . . . . "1"^^ . . . . . . "kotlin-multiplatform"^^ . . "<p>Loading up a (very) old objective-c project, to do some bug fixes and it crashes out before I have gotten the chance to even load it to test, the line it crashes on is indicated below;</p>\n<pre><code>- (void)viewDidLoad {\n \n activeViewController = [self loadStartViewController]; \n [self.view addSubview:activeViewController.view]; //Crashing on this line\n [activeViewController viewDidAppear:NO];\n \n}\n</code></pre>\n<p>the <code>loadStartViewController</code> method is;</p>\n<pre><code>- (UIViewController*) loadStartViewController {\n StartViewController *viewController = [StartViewController alloc];\n return viewController;\n}\n</code></pre>\n<p>Appreciate this will likely need far further fixing, but wanted to get at least into the app first.</p>\n"^^ . "I have removed that"^^ . . . . "That shouldn't be it. The message is complaining that the very first byte isn't 0x03 (which is the "header" in question.) Here's the file format; it's very simple: https://github.com/RNCryptor/RNCryptor-Spec/blob/04378bc27c604e97353badbead8c435698abe97a/RNCryptor-Spec-v3.md"^^ . . "<p>Depending on the type of video you are capturing, you should investigate the use of <code>UIImagePickerController</code>.</p>\n<p>A lot of people don't realize that not only does it have a camera-capture mode, but that mode supports video:</p>\n<p><a href="https://developer.apple.com/documentation/uikit/uiimagepickercontroller/cameracapturemode/video" rel="nofollow noreferrer">https://developer.apple.com/documentation/uikit/uiimagepickercontroller/cameracapturemode/video</a></p>\n<p>A couple limitations:</p>\n<ol>\n<li><p>This is the older/legacy interface. It is still supported, but has not gotten many revisions for new hardware since the AV* frameworks were added. There maybe newer camera/video features that can't be accessed.</p>\n</li>\n<li><p>The docs do not describe the use of temp files and full disks, so you should still test this feature before committing to its use.</p>\n</li>\n<li><p>It does has a built in &quot;video clip&quot; feature, so users have some ways of limiting their use of storage when capturing the file.</p>\n</li>\n</ol>\n"^^ . . . . . . . . . . . . . . "Coordinating the padding of structs in C++ and Objective-C"^^ . "-1"^^ . . . "avfoundation"^^ . . . . . . "1"^^ . . . . . . "Detect if volume down button is pressed twice OBJC iOS"^^ . "0"^^ . . . "0"^^ . . . . "0"^^ . "How do I declare an extern variable in a Cocoapods framework?"^^ . "0"^^ . . . . . . . "struct"^^ . . "0"^^ . . "grand-central-dispatch"^^ . . "macvim"^^ . . "<p>If your SDP offer negotiates BUNDLE generating only candidates with sdpMid 0 is the expected and correct behavior as all m-lines in the BUNDLE group are going to use those candidates.</p>\n"^^ . . . . "retain-cycle"^^ . . "1"^^ . "2"^^ . . "Clean/Remove derived data? When converting code, there is sometimes some old cache for the compiler..."^^ . . . . "2"^^ . . "@Willeke no it isnt the same!"^^ . . "@Willeke It's still useful to know if it works in a more complete app. I plan to add it to a java swing app to replace the crappy choices for file open dialogs. Before I do that, I was thinking it would be good to know if I could make NSOpenPanel behave better than the current choices. Sounds like I should proceed and hope for the best."^^ . "1"^^ . . . . "No, NSMenu[Item] normally handles that. You are free to change the target of any menu item. You can change Command-A to not invoke selectAll: if you really want just by editing it, or add new menu items (or change key bindings) to call other responder methods you define for your app. Most people would drop the standard Edit menu into their app and get the functionality that way."^^ . "1"^^ . . . . "1"^^ . . . "0"^^ . . . . "I tested on a macOS app and got `-1 (-1) ((-1)) -1 -> -1)` in Xcode 14.3 and `-1 (-1) ((-1,0000)) -1 -> -1)`in Xcode 15"^^ . . "How to dynamically controls constraint to active them without manually doing calculation and set active by my self?"^^ . . "Another opus player!? You're not the OP?"^^ . . "<p>I have an older project with a mixed ObjC + Swift codebase. I'm in the process of converting everything to Swift in the hopes that Xcode will work better again when the Codebase is not mixed anymore.</p>\n<p>This is an example of the issues I'm currently facing:</p>\n<p><a href="https://i.sstatic.net/KLfXp.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/KLfXp.png" alt="Screenshot of Xcode Autocomplete" /></a></p>\n<p>The class <code>IVMapViewController</code> is defined in ObjC and the property <code>mapViewModel</code> is declared in the ObjC Header fine. The ObjC Header file is included in the bridging header. I'm trying to access the property <code>mapViewModel</code> in an swift extension on the same class.</p>\n<p>I can actually compile &amp; run the code just fine, but Xcode Autocompletion does not work, and Xcode generates &quot;Phantom&quot; errors in the Issue Navigator (those errors also stay there when a build completes successful)</p>\n<p>On the other hand, if I put an actual error in the code, compilation fails, but the actual error will NOT show up in the Issue Navigator. I'll have to dig through the build log to find the actual error.</p>\n<p>Am I doing anything wrong? Do I need to adjust some project setting?</p>\n"^^ . "0"^^ . . . "xcode"^^ . "0"^^ . . "0"^^ . . . "0"^^ . "tvos"^^ . "1"^^ . "<p>Matt's response pushed me in the right direction and this is ultimately how I was able to solve the problem:</p>\n<pre><code>CGAffineTransform transform = CGAffineTransformMakeScale(newSize.width / initialSize.width, newSize.height / initialSize.height);\n \nif (flipped)\n{\n transform = CGAffineTransformTranslate(transform, 0, initialSize.height / 2.0);\n transform = CGAffineTransformScale(transform, 1, -1);\n transform = CGAffineTransformTranslate(transform, 0, -initialSize.height / 2.0);\n}\n</code></pre>\n"^^ . . "@jnpdx no, but when I add a `@NSApplicationDelegateAdaptor` I start to get errors like: `-[_TtCV13Notifications16NotificationsApp11AppDelegate sleepListener]: unrecognized selector sent to instance 0x600003670290`"^^ . . . . . . "0"^^ . . . . . . . . . . . "0"^^ . . . . "It looks like the particular issue in your screen cap is caused by you defining a local variable that shadows the property `mapViewModel`."^^ . . . "3"^^ . . "swiftui"^^ . . . . "Thats just great. Thanks!"^^ . . . . . "It isn't `NotificationCenter.default` it's `NSWorkspace.shared`"^^ . . "swift"^^ . "Better yet, since you're using SwiftUI, you _could_ just use `onReceive` on your `View`..."^^ . "Possible to write video directly to iOS Camera Roll or album without copying?"^^ . . . . . . . "0"^^ . . . "0"^^ . . "1"^^ . "0"^^ . "0"^^ . . . . . "@HangarRash iOS"^^ . . . . . . . . "1"^^ . . . . . . . "0"^^ . . . . . "1"^^ . "1"^^ . . "frameworks"^^ . . . . . . . "0"^^ . "0"^^ . . . . . "1"^^ . "0"^^ . . . . "0"^^ . "0"^^ . . "0"^^ . . . . . . . "0"^^ . . "I tried your code and Command-A selects all files and folders. Is there a "Select All" menu item with key equivalent Command-A?"^^ . . "0"^^ . . "<p>For starters, you're allocating an instance of <code>StartViewController</code> but you're not initializing it.</p>\n<p>Second, assuming you have code inside <code>StartViewController</code> you want to add it as a child view controller.</p>\n<p>Third, never call methods such as <code>viewDidAppear</code></p>\n<p>So, really quick example...</p>\n<hr />\n<p><strong>SomeViewController.h</strong></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n@interface SomeViewController : UIViewController\n@end\nNS_ASSUME_NONNULL_END\n</code></pre>\n<hr />\n<p><strong>SomeViewController.m</strong></p>\n<pre><code>#import &quot;SomeViewController.h&quot;\n#import &quot;StartViewController.h&quot;\n\n@interface SomeViewController ()\n@end\n\n@implementation SomeViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n \n self.view.backgroundColor = [UIColor systemBlueColor];\n \n StartViewController *vc = [StartViewController new];\n [self addChildViewController:vc];\n [self.view addSubview:vc.view];\n \n // let's give it a frame so we can see it's been added\n vc.view.frame = CGRectMake(40, 100, 240, 320);\n \n [vc didMoveToParentViewController:self];\n \n}\n\n@end\n</code></pre>\n<hr />\n<p><strong>StartViewController.h</strong></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n@interface StartViewController : UIViewController\n@end\nNS_ASSUME_NONNULL_END\n</code></pre>\n<hr />\n<p><strong>StartViewController.m</strong></p>\n<pre><code>#import &quot;StartViewController.h&quot;\n\n@interface StartViewController ()\n@end\n\n@implementation StartViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n \n self.view.backgroundColor = [UIColor systemYellowColor];\n \n UILabel *v = [UILabel new];\n v.text = @&quot;Start VC&quot;;\n v.translatesAutoresizingMaskIntoConstraints = NO;\n [self.view addSubview:v];\n [v.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor].active = YES;\n [v.centerYAnchor constraintEqualToAnchor:self.view.centerYAnchor].active = YES;\n\n}\n\n@end\n</code></pre>\n<p>Looks like this:</p>\n<p><a href="https://i.sstatic.net/ewORB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ewORB.png" alt="enter image description here" /></a></p>\n"^^ . . . . "0"^^ . "NSOpenPanel would use NSBrowser internally, I would think, to show the list of files. But something needs to call [NSApplication.sharedApplication sendEvent:@selector(selectAll:) to:nil from:<sender>] when Command-A is pressed (sending to nil should start at the first responder, and eventually find the NSBrowser implementation). Either that or a custom event listener, or set up an NSMenu and get it installed somehow. Or subclass NSOpenPanel and override sendEvent: to look for them."^^ . "0"^^ . "IMO (from experience) once you have to deal with objc, you can forget all the promises the swift concurrency gives you (including actor isolation) - it's just a class for objc. So how you handle that class very much depends on context."^^ . . "clang and clang++ will use the same layout. Your problem is that your vector_float2 does not require the right alignment, at least it's not the same as vec2."^^ . . "<p>I was trying to change the minimum deployment from iOS 13 to iOS 14 of my app, however Xcode throws these error:</p>\n<pre><code>ld: unaligned pointer(s) for architecture arm64\nclang: error: linker command failed with exit code 1 (use -v to see invocation)\n</code></pre>\n<p>Once switch back to iOS 13, my app can build and run smoothly.</p>\n<p>As far as I know, the minimum deployment of this SDK is iOS 11.0, and it's a static .a file, not xcframework I used to see, is there any approach that can embed this SDK into Swift projects that above iOS 13, without changing the code of SDK, just modify it's setting?</p>\n"^^ . . "Using RNCryptor to decrypt data throws "Decryption error: unknownHeader""^^ . "<p>I have a tvOS project contains an App target and 3 static libraries:</p>\n<p>EntryPoint – Static library that contains main , AppDelegate and SceneDelegate</p>\n<p>Experience – Static library containing my UI elements</p>\n<p>AppTarget – executable built using above two libraries</p>\n<p>I have a class &quot;SelectionTable&quot; which subclasses UITableView in Experience target :</p>\n<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>import UIKit\n\n class SelectionTable : UITableView\n{\n private var vDataSrc:[String]!\n\n func SetDataSrc (_ pDataSrc:[String])\n {\n self.vDataSrc = pDataSrc\n }\n\n func UpdateDataSrc (_ pStringList:[String])\n {\n self.vDataSrc += pStringList\n }\n\n func GetDataSrc () -&gt; [String]\n {\n return self.vDataSrc\n }\n}</code></pre>\r\n</div>\r\n</div>\r\n</p>\n<p>I am not using this class anywhere and still i am getting these errors when i build my AppTarget:</p>\n<blockquote>\n<p>Cannot find interface declaration for 'UITableView', superclass of 'SelectionTable'</p>\n</blockquote>\n<blockquote>\n<p>Expected a type</p>\n</blockquote>\n<p>These above error are coming in generated header file &quot;Experience-Swift.h&quot;. This file is auto-generated by compiler. I am not using @objc anywhere in the code, But still the Target-Swift.h file has the below lines:</p>\n<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>SWIFT_CLASS("_TtC10Experience22SelectionTable")\n@interface SelectionTable : UITableView\n- (nonnull instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style OBJC_DESIGNATED_INITIALIZER;\n- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER;\n@end</code></pre>\r\n</div>\r\n</div>\r\n</p>\n<p>When i am marking above class as Private , this error goes away .</p>\n<p>And also , if i am defining SelectionTable class in EntryPoint library , this error does not occur .</p>\n<p>I am using similar model for an iOS project also and there i am not facing this issue.</p>\n<p>I am using :- Swift version : Swift 5.9.2 XCode version : 15.2</p>\n"^^ . . "bridge"^^ . . . . . "1"^^ . . "5"^^ . . . . "0"^^ . "Receive a ObjC constant in Swift"^^ . . "Values stored in the PHP session are *not* stored in cookies. You can't access them from the client."^^ . . "<p>I’m using Objective-C and Metal to render to a window, however all of my application code is written in C++. So all of the CPU manipulation of data inside <code>MTLBuffer</code> is done in C++. This is done by passing the buffers contents (which is a <code>void*</code>) to the C++ code, where it casts the contents pointer to <code>MyVertex*</code> to write new vertex data. In my header file, i just add compiler conditions to type the vertex structs properly.</p>\n<pre><code>#ifdef __IN_OBJC__\n#define V2 vector_float2\n#define V4 vector_float4\n#endif\n\n#ifdef __IN_CPP__\n#define V2 vec2\n#define V4 vec4\n#endif\n\ntypedef struct {\n V2 position;\n V4 color;\n} MyVertex;\n\n</code></pre>\n<p>Here <code>vec2</code>, <code>vec4</code> are basically structs of 2, 4 floats implemented in my C++ code. But in this example, Objective-C and C++ think that <code>MyVertex</code> is of differing sizes. I’m compiling with clang and clang++. And the Objective-C compiler wants to pad the struct so it is of size 32, while C++ says that the struct is of size 24. I currently fixed this now with <code>#pragma pack</code>, but this feels like a weak solution. I would actually prefer my C++ implementation to be padded instead of packed to better optimize buffers in the shaders. But I cannot deliberately pad a struct like I can pack one.</p>\n<p>Should I make my own vectors (<code>vec2</code>…) compatible with Objective-C? Right now they are written as classes. That way i won’t have to do conditional declarations. I would prefer the solution to best optimize buffer performance in the shader.</p>\n"^^ . . . . . . . . . . "You may want to read up on a similar (inspirational?) issue in OpenGL land: [std140 vs std430 layout](https://www.khronos.org/opengl/wiki/Interface_Block_(GLSL))"^^ . . . . . "0"^^ . . . . "<p>I am trying to cut off my window from the screenshot on macOS. It is working perfectly fine.\nBut when I am trying to get its value, which I was setting for <code>sharingType</code> (<code>NSWindowSharingNone</code> or <code>NSWindowSharingReadOnly</code>), I am getting 0 (<code>NSWindowSharingNone</code>) all the time after the second iteration. Here is the code that I have:</p>\n<pre class="lang-objc prettyprint-override"><code>@interface ViewController () {\n BOOL sharedState;\n}\n\n@property (strong) NSWindow* childWindow;\n@property (strong) NSTimer* timer;\n@end\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n \n [self createWindowAction: nil];\n \n sharedState = YES;\n // Do any additional setup after loading the view.\n [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(triggerAction:) name: @&quot;NotificationMessageEvent&quot; object: nil];\n \n self.timer = [NSTimer scheduledTimerWithTimeInterval: 4.0f repeats: YES block:^(NSTimer * _Nonnull timer)\n {\n self-&gt;sharedState = !self-&gt;sharedState;\n \n NSLog( @&quot;Before sharing type was: %lu&quot;, (unsigned long)[self.childWindow sharingType] );\n NSWindowSharingType updatedType = self-&gt;sharedState ? NSWindowSharingNone : NSWindowSharingReadOnly;\n NSLog( @&quot;Updating sharing type to: %lu&quot;, (unsigned long)updatedType );\n [self.childWindow setSharingType: updatedType];\n NSLog( @&quot;After sharing type was: %lu&quot;, (unsigned long)[self.childWindow sharingType] );\n NSLog(@&quot;&quot;);\n }];\n}\n\n-(void) dealloc\n{\n [self.timer invalidate];\n self.timer = nil;\n}\n\n- (IBAction)createWindowAction:(NSButton *)sender {\n NSLog(@&quot;createWindowAction&quot;);\n if (!self.childWindow) {\n self.childWindow = [[NSWindow alloc] initWithContentRect: CGRectMake( 100.0f, 150.0f, 500.0f, 400.0f ) styleMask: NSWindowStyleMaskBorderless | NSWindowStyleMaskNonactivatingPanel backing: NSBackingStoreBuffered defer: NO];\n self.childWindow.collectionBehavior = NSWindowCollectionBehaviorMoveToActiveSpace | NSWindowCollectionBehaviorTransient | NSWindowCollectionBehaviorAuxiliary | NSWindowCollectionBehaviorParticipatesInCycle;\n self.childWindow.hasShadow = NO;\n self.childWindow.accessibilityElement = YES;\n [self.childWindow setCanHide: NO];\n }\n \n [self.childWindow orderFrontRegardless];\n}\n</code></pre>\n<p>The behaviour is very weird because I could not read the actual current property. I tried to modify some properties of the window but nothing helps. The property is working as expected all the time but it is not updated.</p>\n"^^ . "<p><strong>Edit:</strong> Updated code based on suggestions, fixing the ASBD and making another attempt at getting PTS right. It still doesn't play any audio, but there are no errors anymore at least.</p>\n<hr />\n<p>I'm working on an iOS project where I'm receiving packets of Opus audio data and attempting to play them using AVSampleBufferAudioRenderer. Right now I'm using Opus's own decoder, so ultimately I just need to get the decoded PCM packets to play. The whole process from top to bottom isn't suuuper well documented, but I think I'm getting close. Here's the code I'm working with so far (edited down, and with some hardcoded values for simplicity).</p>\n<pre><code>static AVSampleBufferAudioRenderer* audioRenderer;\nstatic AVSampleBufferRenderSynchronizer* renderSynchronizer;\n\nint samplesPerFrame = 240;\nint channelCount = 2;\nint sampleRate = 48000;\nint streams = 1;\nint coupledStreams = 1;\nchar mapping[8] = ['\\0','\\x01','\\0','\\0','\\0','\\0','\\0','\\0'];\n\nCMTime startPTS;\n\n// called when the stream is about to start\nvoid AudioInit()\n{\n renderSynchronizer = [[AVSampleBufferRenderSynchronizer alloc] init];\n audioRenderer = [[AVSampleBufferAudioRenderer alloc] init];\n [renderSynchronizer addRenderer:audioRenderer];\n \n int decodedPacketSize = samplesPerFrame * sizeof(short) * channelCount; // 240 samples per frame * 2 channels\n decodedPacketBuffer = SDL_malloc(decodedPacketSize);\n \n int err;\n opusDecoder = opus_multistream_decoder_create(sampleRate, // 48000\n channelCount, // 2\n streams, // 1\n coupledStreams, // 1\n mapping,\n &amp;err);\n\n [renderSynchronizer setRate:1.0 time:kCMTimeZero atHostTime:CMClockGetTime(CMClockGetHostTimeClock())];\n startPTS = CMClockGetTime(CMClockGetHostTimeClock());\n}\n\n// called every X milliseconds with a new packet of audio data to play, IF there's audio. (while testing, X = 5)\nvoid AudioDecodeAndPlaySample(char* sampleData, int sampleLength)\n{\n // decode the packet from Opus to (I think??) Linear PCM\n int numSamples;\n numSamples = opus_multistream_decode(opusDecoder,\n (unsigned char *)sampleData,\n sampleLength,\n (short*)decodedPacketBuffer,\n samplesPerFrame, // 240\n 0);\n\n int bufferSize = sizeof(short) * numSamples * channelCount; // 240 samples * 2 channels\n\n CMTime currentPTS = CMTimeSubtract(CMClockGetTime(CMClockGetHostTimeClock()), startPTS);\n\n // LPCM stream description\n AudioStreamBasicDescription asbd = {\n .mFormatID = kAudioFormatLinearPCM,\n .mFormatFlags = kLinearPCMFormatFlagIsSignedInteger,\n .mBytesPerPacket = sizeof(short) * channelCount,\n .mFramesPerPacket = 1,\n .mBytesPerFrame = sizeof(short) * channelCount,\n .mChannelsPerFrame = channelCount, // 2\n .mBitsPerChannel = 16,\n .mSampleRate = sampleRate // 48000,\n .mReserved = 0\n };\n \n // audio format description wrapper around asbd\n CMAudioFormatDescriptionRef audioFormatDesc;\n OSStatus status = CMAudioFormatDescriptionCreate(kCFAllocatorDefault,\n &amp;asbd,\n 0,\n NULL,\n 0,\n NULL,\n NULL,\n &amp;audioFormatDesc);\n \n // data block to store decoded packet into\n CMBlockBufferRef blockBuffer;\n status = CMBlockBufferCreateWithMemoryBlock(kCFAllocatorDefault,\n decodedPacketBuffer,\n bufferSize,\n kCFAllocatorNull,\n NULL,\n 0,\n bufferSize,\n 0,\n &amp;blockBuffer);\n \n // data block converted into a sample buffer\n CMSampleBufferRef sampleBuffer;\n status = CMAudioSampleBufferCreateReadyWithPacketDescriptions(kCFAllocatorDefault,\n blockBuffer,\n audioFormatDesc,\n numSamples,\n currentPTS,\n NULL,\n &amp;sampleBuffer);\n \n \n // queueing sample buffer onto audio renderer\n [audioRenderer enqueueSampleBuffer:sampleBuffer];\n}\n</code></pre>\n<p>The <code>AudioDecodeAndPlaySample</code> function comes from the library I'm working with, and as the comment says, is called with a packet of about 5 ms worth of samples at a time (and, important to note, does <em>not</em> get called if there's silence).</p>\n<p>There are plenty of places here I could be wrong - I think I'm correct that the opus decoder (<a href="https://opus-codec.org/docs/opus_api-1.3.1/group__opus__multistream.html#gaa4b89541efe01970cf52e4a336db3ad0" rel="nofollow noreferrer">docs here</a>) decodes into Linear PCM (interleaved), and I hope I'm building the <code>AudioStreamBasicDescription</code> correctly. I'm definitely not sure what to do with the PTS (presentation timestamp) in <code>CMAudioSampleBufferCreateReadyWithPacketDescriptions</code> - I'm trying to come up with a time based on <code>current host time - init host time</code>, but I have no idea if that works or not.</p>\n<p>Most code examples I've seen of <code>enqueueSampleBuffer</code> have it wrapped in <code>requestMediaDataWhenReady</code> with a dispatch queue, which I have also tried to no avail. (I suspect it's more good practice than essential to functioning, so I'm just trying to get the simplest case working first; but if it is essential I can drop it back in.)</p>\n<p>Feel free to respond using Swift if you're more comfortable with it, I can work with either. (I'm stuck with Objective-C here, like it or not. )</p>\n"^^ . . . "<p>Congratulations on finding what I consider to be one of the more obscure Apple audio playback APIs!</p>\n<p>As MeLean correctly pointed out, your sample timestamps were not progressing (you <em>do</em> need them).<br />\nIn addition to that the <code>AudioStreamBasicDescription</code> was wrong and you didn't provide a mapping to the synchronizer between your timestamps' timeline and the hosttime timeline.</p>\n<p>The fixed ASBD:</p>\n<pre><code>// In uncompressed audio, a Packet is one frame, (mFramesPerPacket == 1).\n\n// LPCM stream description\nAudioStreamBasicDescription asbd = {\n .mFormatID = kAudioFormatLinearPCM,\n .mFormatFlags = kLinearPCMFormatFlagIsSignedInteger,\n .mBytesPerPacket = sizeof(short) * channelCount,\n .mFramesPerPacket = 1,\n .mBytesPerFrame = sizeof(short) * channelCount,\n .mChannelsPerFrame = channelCount, // 2\n .mBitsPerChannel = 16,\n .mSampleRate = sampleRate, // 48000\n .mReserved = 0\n};\n</code></pre>\n<p>One possible timeline mapping (a.k.a play it ASAP, consequences be damned):</p>\n<pre><code>[renderSynchronizer setRate:1.0 time:kCMTimeZero atHostTime:CMClockGetTime(CMClockGetHostTimeClock())];\n</code></pre>\n<p>Timestamps that progress:</p>\n<pre><code>// with your other variables\nuint64_t samplesEnqueued = 0;\n\n// ...\n\n// data block converted into a sample buffer\nCMSampleBufferRef sampleBuffer;\nstatus = CMAudioSampleBufferCreateReadyWithPacketDescriptions(kCFAllocatorDefault,\n blockBuffer,\n audioFormatDesc,\n numSamples,\n CMTimeMake(samplesEnqueued, sampleRate),\n NULL,\n &amp;sampleBuffer);\n\n\nsamplesEnqueued += numSamples;\n\n// queueing sample buffer onto audio renderer\n[audioRenderer enqueueSampleBuffer:sampleBuffer];\n\n// ...\n</code></pre>\n<p>You have your own requirements for when you provide data the the renderer, but the code snippet in the API header file instead calls you. You can probably ignore this:</p>\n<pre><code>[audioRenderer requestMediaDataWhenReadyOnQueue:dispatch_get_main_queue() usingBlock:^{\n AudioDecodeAndPlaySample(sampleData, sampleLength);\n // get more sampleData\n}];\n</code></pre>\n<p>p.s. your use of <code>SDL_malloc</code> suggests you might be using this code in a game. Last time I used <code>AVSampleBufferAudioRenderer</code> IIRC its latency was unimpressive, but I may have been holding it wrong. If low latency is a requirement, you may need to rethink your design.</p>\n<p>p.p.s silence =&gt; no callback means you'll have to adjust the timestamps to account for the missing silence frames</p>\n"^^ . "ivar of Swift Actor in objc code: atomic or nonatomic?"^^ . . "-1"^^ . . "0"^^ . . . "0"^^ . "1"^^ . . "0"^^ . "2"^^ . . . . . "1"^^ . "There are twice `[self.interstitial presentFromRootViewController:self];`, why? I guess the second one causes the error message..."^^ . . . . "0"^^ . . . . . . . "I know what it requires. I'm asking you what's in your code, because you have these funny defines."^^ . "constraints"^^ . "1"^^ . . . . . . "How can I read session variables directly in Objective-C for my iOS application?"^^ . "Xcode 15.2 - Issues with mixed ObjC and Swift Codebase"^^ . . "<p>I have an iOS app that records videos. I want to place them in the user's Camera Roll, or in an album. However, to do this I must first record them to a temporary directory, <em><strong>then copy them</strong></em> to the Camera Roll. This means 2x storage space is required. Some videos may fail to copy of the storage on the device is near full.\nIs there any way to record directly into an an album? Or am I required to always make the copy?</p>\n"^^ . "<p>I want to create an Objective C class instance, input is class string, in KMM with Kotlin, is this possible?</p>\n<pre><code>fun createObject(className: String): Any? {\n if (className == &quot;MyCustomClass&quot;) {\n // create a instance of MyCustomClass and return\n }\n// return null\n}\n</code></pre>\n"^^ . . . . "5"^^ . . . . . . . . "`NSValue getValue` has been deprecated for many years. You should use `getValue:size:`. For example: `[obj getValue:&vd size:sizeof(CMVideoDimensions)];`. Even better is to use `CMVideoDimensions dim = obj.CMVideoDimensionsValue;`. Note that this requires importing AVFoundation and iOS 16+."^^ . . . "0"^^ . "0"^^ . . . "1"^^ . "<p>The <code>AVFoundation</code> framework provides a <a href="https://developer.apple.com/documentation/foundation/nsvalue/3950874-cmvideodimensionsvalue?language=objc" rel="nofollow noreferrer"><code>CMVideoDimensionsValue</code></a> property for <code>NSValue</code> as of iOS 16.</p>\n<p>Simply change your line:</p>\n<pre><code>CMVideoDimensions *vd = (__bridge CMVideoDimensions *)obj;\n</code></pre>\n<p>to:</p>\n<pre><code>CMVideoDimensions *vd = obj.CMVideoDimensionsValue;\n</code></pre>\n<p>Ensure this .m file imports AVFoundation. If not, you will get a compiler error about an unknown property.</p>\n"^^ . "0"^^ . . . . . . . . . . . . . "google-ads-api"^^ . . . . . . . "Getting Swift_header compilation error for tvOS"^^ . "0"^^ . . . . "0"^^ . . . . "<p>If I have a swift Actor...</p>\n<pre><code>@objc public actor SomeActor: NSObject, SomeProtocol { ... }\n</code></pre>\n<p>...and I want to use it as an ivar in objc code, does it need to be listed as atomic to retain it's thread safety, or is it more performant to call it nonatomic?</p>\n<p>Also, do I need to be referencing it with a getter to preserve its thread safety, or can I call it directly?</p>\n<pre><code>#import &lt;ThisProject/ThisProject-Swift.h&gt;\n\n@interface SomeClass () &lt;SomeId&gt;\n@property (strong, atomic, readwrite) SomeActor *someActor;\n@end\n\n...\n\n [SomeOtherClass someMethod:someActor];\n</code></pre>\n<p>vs</p>\n<pre><code>@interface SomeClass () &lt;SomeId&gt;\n@property (strong, nonatomic, readwrite) SomeActor *someActor;\n@end\n \n...\n\n [SomeOtherClass someMethod:_someActor];\n</code></pre>\n"^^ . . "0"^^ . "cgaffinetransform"^^ . . . . . . . . "1"^^ . . "You should use a singleton for configuration where you set that variable (or these variables needed for the framework to run completely, like "id" etc.), or even read in the Info.plist some value. Plenty of framework do that. And it's then the client (ie the one importing your lib) that should set that value."^^ . . . "Application tried to present modally a view controller <StartViewController: 0x14e90bfb0> that has a parent view controller"^^ . "0"^^ . . . . . . . . . . . . "0"^^ . . . . . "0"^^ . . . . "1"^^ . . . "0"^^ . "0"^^ . "0"^^ . . . "0"^^ . . "0"^^ . . . . . . . "Somehow it works I add the name of the class used for NSCoding. \n\nBefore encoding: NSKeyedArchiver.setClassName("Item", for: Item.self)\nBefore decoding: NSKeyedUnarchiver.setClass(Item.self, forClassName: "Item")"^^ . . . "0"^^ . . . "1"^^ . "0"^^ . "1"^^ . "c++"^^ . . "0"^^ . "1"^^ . . . . "0"^^ . "padding"^^ . "<p>I got a timer for uploading logs,here is the code:</p>\n<pre><code>- (void)setupTimer {\n if (_timerForRecording) {\n dispatch_source_cancel(_timerForRecording);\n _timerForRecording = NULL;\n }\n \n _timerForRecording = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, _safeTransactionQueue);\n if (_timerForRecording) {\n dispatch_source_set_timer(_timerForRecording, dispatch_time(DISPATCH_TIME_NOW, 4.5 * NSEC_PER_SEC), 4.5 * NSEC_PER_SEC, 0.5 * NSEC_PER_SEC);\n dispatch_source_set_event_handler(_timerForRecording, ^{\n [self sendLog];\n });\n dispatch_resume(_timerForRecording);\n }\n}\n</code></pre>\n<p>seems like using self won't cause retain cycle, should I use weakSelf instead?</p>\n"^^ . . . . . . "0"^^ . "0"^^ . . . . . . "@Larme I've removed derived data / cleaned and rebuilt the project many times already"^^ . . . "1"^^ . . . . . . . . "1"^^ . . . "@Spo1ler You also provider all necessary functions to work with it that accepts that pointer. For example many functions in corefoundation using that approach."^^ . . "Why does iOS 11 SDK written in objc unable to build on iOS14 swift project , but iOS13 does?"^^ . . . . . . . "1"^^ . "0"^^ . . . "1"^^ . "My client is working on NFI and they said Swift code is not supported at all. I don't know the reason. So I choose to provide them in both way."^^ . . . . . . . "Thanks for the insight. Unfortunately even after implementing these changes I still get no audio, and audioRenderer reports an "unknown error". I think something must be wrong with my stream description or sample buffer creation logic."^^ . "5"^^ . . . . . . . . . . . . . . . "sharingType property for NSWindow works but property value is not updated correctly"^^ . . . . "0"^^ . . . "0"^^ . "Using AVSampleBufferAudioRenderer to play packets of streamed PCM audio (decoded from Opus)"^^ . "1"^^ . . . . . . . "Thank you sir, this helped me find my way to the answer with my specific code (sorry I didn't include enough, always hard to know how much to include). Will post in a little."^^ . "Does this answer your question? [Is Php session data secure?](https://stackoverflow.com/questions/36496229/is-php-session-data-secure)"^^ . "#import "FingerprintSDKWrapper.h" same issue"^^ . "Is the real problem that every element of a `MyVertex[]` will start at multiples of 24 in C++ and multiples of 32 in Objective-C? If so, you can use `alignas(32)` modifier to make sure you match Objective-C."^^ . "@jnpdx That is actually what I was trying to do originally with something like `.onReceive(NotificationCenter.default.publisher(for: NSWorkspace.didWakeNotification), perform: { _ in` but I had the same issue with nothing being triggered."^^ . . . . . . "0"^^ . . "0"^^ . . . . "@sbooth Not at all, it's just one of a few approaches I want to try. Ultimately my goal is to get this working with airpod spatial audio, and based on other experiments it seems that if you pipe multichannel data into `AVSampleBufferAudioRenderer` it more or less automatically spatializes it for you. I did just recently stumble upon AudioQueue though, I'm curious if that'll do the same thing."^^ . "0"^^ . . . . "its my code not @Botje ‘s code. vec2 is defined as a class template in C++. Templated for type and length. So a vector of 2 floats or 4 ints etc. will be the same code. so it’s super not portable to Objective-C. the only attribute to an instance is an `std::array`. (i used this for convenient constructors with `initializer_list` but i’m not married to `std::array`."^^ . . . . . . "I also believe that the error is coming from Unarchiver."^^ . . "0"^^ . . . . "0"^^ . . . "<p>I am developing an app for ios and have integrated WebRTC to make video calls. For outgoing call it's fine, all works fine. But when I want to receive a video call, while setting a local description, didGenerate delegate doesn't return me a ICE candidate for video call (candidate.sdpMid property should be 1) it returns me only ICE candidates for audio where candidate.spdMid is 0.</p>\n<p>Here is the steps what I am doing:</p>\n<ul>\n<li>Upon receiving an incoming video call I am handling remoteSdp (a have all parameters with m=video), creating RTCSessionDescription with Offer</li>\n<li>After I am preparing media (adding video tracks to peerConnection)</li>\n<li>Setting remote description to peerConnection and in it's callback I am creating answerForConstraints where OfferToReceiveVideo and OfferToReceiveAudio are true.</li>\n<li>in answerForConstraints's callback I am setting localSdp from callback via setLocalDescription.</li>\n<li>Then Webrtc is generating ICE candidates and there is no candidates for video. usually ICE candidate should contain in property candidate.sdpMid = 1 for video, but I am getting candidate.sdpMid = 0 (only for audio).</li>\n</ul>\n<p><strong>UPDATE:</strong></p>\n<p>This is Remote SDP from server that I am receiving upon incoming video call:</p>\n<blockquote>\n<p>v=0 o=- 1707110628 1707110628 IN IP4 37.112.129.29 s=- c=IN IP4\n37.112.129.29 t=0 0 a=msid-semantic:WMS AF60F46C a=extmap-allow-mixed a=group:BUNDLE 0 1 m=audio 11260 UDP/TLS/RTP/SAVP 120 101 c=IN IP4\n37.112.129.29 a=rtpmap:120 opus/48000/2 a=fmtp:120 maxaveragebitrate=40000;stereo=1;useinbandfec=1 a=rtpmap:101\ntelephone-event/8000 a=fmtp:101 0-15 a=fingerprint:SHA-256\nD6:D2:83:38:B0:55:47:0F:D4:C8:9F:A9:5E:43:C8:2C:3F:BF:35:4F:33:F7:F4:4B:BC:61:AC:9E:F6:A1:BD:9F\na=setup:actpass a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\na=extmap:2 <a href="http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time" rel="nofollow noreferrer">http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time</a>\na=extmap:3\n<a href="http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01" rel="nofollow noreferrer">http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01</a>\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid a=mid:0\na=ice-ufrag:zjnyg58k a=ice-pwd:5hvz1eniu8kx8j8gxxefx1 a=candidate:1 1\nUDP 2130706431 37.112.129.29 11260 typ host a=msid:AF60F46C\nED29BB8139CB76CE5D3269A6CC875F7A a=rtcp-mux a=ssrc:1451091017\ncname:BD1D4D1615D5FFE3A434D305A24502B2-9 a=ssrc:1451091017\nmsid:AF60F46C ED29BB8139CB76CE5D3269A6CC875F7A a=ptime:20 a=sendrecv\na=silenceSupp:off - - - - m=video 11260 UDP/TLS/RTP/SAVPF 96 c=IN IP4\n37.112.129.29 a=rtpmap:96 VP8/90000 a=rtcp-fb:96 ccm fir a=rtcp-fb:96 goog-remb a=rtcp-fb:96 nack a=rtcp-fb:96 nack pli a=rtcp-fb:96\ntransport-cc a=fingerprint:SHA-256\nD6:D2:83:38:B0:55:47:0F:D4:C8:9F:A9:5E:43:C8:2C:3F:BF:35:4F:33:F7:F4:4B:BC:61:AC:9E:F6:A1:BD:9F\na=setup:actpass a=extmap:14 urn:ietf:params:rtp-hdrext:toffset\na=extmap:2 <a href="http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time" rel="nofollow noreferrer">http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time</a>\na=extmap:13 urn:3gpp:video-orientation a=extmap:3\n<a href="http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01" rel="nofollow noreferrer">http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01</a>\na=extmap:5 <a href="http://www.webrtc.org/experiments/rtp-hdrext/playout-delay" rel="nofollow noreferrer">http://www.webrtc.org/experiments/rtp-hdrext/playout-delay</a>\na=extmap:6\n<a href="http://www.webrtc.org/experiments/rtp-hdrext/video-content-typea=extmap:7" rel="nofollow noreferrer">http://www.webrtc.org/experiments/rtp-hdrext/video-content-typea=extmap:7</a>\n<a href="http://www.webrtc.org/experiments/rtp-hdrext/video-timing" rel="nofollow noreferrer">http://www.webrtc.org/experiments/rtp-hdrext/video-timing</a> a=extmap:8\n<a href="http://www.webrtc.org/experiments/rtp-hdrext/color-space" rel="nofollow noreferrer">http://www.webrtc.org/experiments/rtp-hdrext/color-space</a> a=extmap:4\nurn:ietf:params:rtp-hdrext:sdes:mid a=extmap:10\nurn:ietf:params:rtp-hdrext:sdes:rtp-stream-id a=extmap:11\nurn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id a=mid:1\na=ice-ufrag:zjnyg58k a=ice-pwd:5hvz1eniu8kx8j8gxxefx1 a=msid:AF60F46C\n2AF282963F6E507FA3A87716A4B25F7B a=rtcp-mux a=ssrc:984206551\ncname:BD1D4D1615D5FFE3A434D305A24502B2-9 a=ssrc:984206551\nmsid:AF60F46C 2AF282963F6E507FA3A87716A4B25F7B a=sendrecv</p>\n</blockquote>\n<p>After I am initing RTCSessionDescription with offer type using sdp above:</p>\n<pre><code>- (void) onIncomingCallInvite:(NSString*)remotePhone remoteSdp:(NSString*)remoteSdp {\n RLogInfo(@&quot;[tag = %@&quot;, self.localTag);\n self.isInviteReceived = YES;\n [self.terminateTimer invalidate];\n self.terminateTimer = nil;\n self.remoteMode = [ndSdpManager callModeFrom:remoteSdp];\n \n NSString *preparedRemoteSdp = [ndSdpManager prepareIncomingInviteSdp:remoteSdp];\n self.remoteDescription = [[RTCSessionDescription alloc] initWithType:RTCSdpTypeOffer sdp:preparedRemoteSdp];\n\n if (self.isIncomingAcceptedBeforeInvite) {\n self.isIncomingAcceptedBeforeInvite = NO;\n [self acceptCall:self.localModeIncomingAcceptedBeforeInvite];\n }\n \n [self.callViewDelegate didCallStateChanged];\n [self.libreProxy libre_progress_call:self.callId];\n}\n\n+ (NSString*) prepareRemoteSdp:(NSString*)existSdp{\nNSString *target = [[self class] replaceAcap:existSdp];\ntarget = [[self class] removeStringsContains:@&quot;sha-1&quot; existSdp:target];\ntarget = [[self class] removeStringsContains:@&quot;crypto&quot; existSdp:target];\ntarget = [[self class] addString:@&quot;a=rtcp-mux&quot; afterStringsContains:@&quot;m=audio &quot; existSdp:target];\nRLogInfo(@&quot;Prepare sdp from incoming invite = \\n%@&quot;, target);\nreturn target;\n}\n\n- (void) acceptCall:(ndCallMode)mode{\n RLogInfo(@&quot;tag = %@&quot;, self.localTag);\n if ([self isEnded]){\n return;\n }\n if (!self.isInviteReceived) {\n self.isIncomingAcceptedBeforeInvite = YES;\n self.localModeIncomingAcceptedBeforeInvite = mode;\n return;\n }\n \n self.isAnswered = YES;\n self.localMode = mode;\n self.state = ndCallStateIncomingAnswer;\n \n [self.callManager showCallInterface:self];\n [self.callViewDelegate didCallStateChanged];\n \n [self prepare];\n __weak typeof(self) weakSelf = self;\n [self.peerConnection setRemoteDescription:self.remoteDescription\n completionHandler:^(NSError *error) {\n dispatch_async(dispatch_get_main_queue(), ^{\n __strong typeof(self) strongSelf = weakSelf;\n if (error) {\n [strongSelf handleSetDescriptionError:error];\n return;\n }\n\n __weak typeof(self) weakSelf2 = strongSelf;\n [strongSelf.peerConnection answerForConstraints: \n[strongSelf defaultAnswerConstraints]\n \ncompletionHandler:^(RTCSessionDescription *sdp,\n \nNSError *error){\n dispatch_async(dispatch_get_main_queue(), ^{\n __strong typeof(self) strongSelf2 = \nweakSelf2;\n if (error) {\n [strongSelf2 \nhandleSetDescriptionError:error];\n return;\n }\n\n strongSelf2.localDescription = \n[[RTCSessionDescription alloc] initWithType:RTCSdpTypeAnswer\n \nsdp:sdp.sdp];\n __weak typeof(self) weakSelf3 = strongSelf2;\n [strongSelf2.peerConnection \nsetLocalDescription:sdp\n \ncompletionHandler:^(NSError *error) {\n dispatch_async(dispatch_get_main_queue(), \n^{\n __strong typeof(self) strongSelf3 = \nweakSelf3;\n if (error) {\n [strongSelf3 \nhandleSetDescriptionError:error];\n }\n });\n }];\n });\n }];\n });\n }];\n\n [self didConnected];\n [self doAcceptCall:mode];\n}\n\n- (void) doAcceptCall:(ndCallMode)mode{\nRLogInfo(@&quot;tag = %@&quot;, self.localTag);\nif (!self.localDescription || ![self isLocalIceCandidateExist]) {\n __weak typeof(self) weakSelf = self;\n self.acceptInviteRepeatTimer = [NSTimer \nscheduledTimerWithTimeInterval:\nND_ACCEPT_INVITE_CHECK_REPEAT_TIMEOUT\n \nrepeats:false\n \nblock:^(NSTimer * _Nonnull timer) {\n __strong typeof(self) strongSelf = weakSelf;\n [strongSelf doAcceptCall:mode];\n }];\n return;\n}\n\nNSString *preparedLocalSdp = [ndSdpManager \naddAudioIceCandidates:self.localAudioIceCandidates\n \nvideoIceCandidates:self.localVideoIceCandidates\n \ntoSdp:self.localDescription.sdp];\npreparedLocalSdp = [ndSdpManager \nprepareResponseSdpForIncomingInvite:preparedLocalSdp];\n\nself.localSdp = preparedLocalSdp;\n[self.libreProxy libre_accept_call:self.callId \nlocalSdp:self.localSdp];\n}\n</code></pre>\n<p>the thing is that in didGenerate delegate I do not receive ICE candidates after setting remoteDescription, answer constraints and setLocalDescription and in doAcceptCall I cannot exit from timer, because isLocalIceCandidateExist returning NO because in didGenerate method ICE candidates for video have not been found and didn't added to array of localVideoIceCandidates. Here is how I am preparing media for call before setting descriptions.</p>\n<pre><code>- (void) prepare{\n// Create peer connection.\nRTCMediaConstraints *constraints = [self defaultPeerConnectionConstraints];\nRTCConfiguration *config = [[RTCConfiguration alloc] init];\nconfig.iceServers = self.callManager.iceServers;\nconfig.bundlePolicy = RTCBundlePolicyMaxCompat;\nconfig.disableIPV6OnWiFi = YES;\nconfig.maxIPv6Networks = 0;\nconfig.disableLinkLocalNetworks = YES;\nconfig.sdpSemantics = RTCSdpSemanticsUnifiedPlan;\n\nconfig.tcpCandidatePolicy = RTCTcpCandidatePolicyDisabled;\nconfig.rtcpMuxPolicy = RTCRtcpMuxPolicyRequire;\nconfig.continualGatheringPolicy = RTCContinualGatheringPolicyGatherContinually;\nconfig.keyType = RTCEncryptionKeyTypeECDSA;\n\nconfig.cryptoOptions = [RTCCryptoOptions alloc];\nconfig.cryptoOptions.srtpEnableAes128Sha1_32CryptoCipher = FALSE;\n\nself.peerConnection = [self.factory peerConnectionWithConfiguration:config constraints:constraints delegate:self];\n \n// Create AV senders.\n[self createMediaSenders];\n} \n\n- (void) createMediaSenders{\nself.stream = [self.factory mediaStreamWithStreamId:kMediaStreamId];\n\nRTCMediaConstraints *constraints = [self defaultMediaAudioConstraints];\nRTCAudioSource *audioSource = [self.factory audioSourceWithConstraints:constraints];\nRTCAudioTrack *audioTrack = [self.factory audioTrackWithSource:audioSource trackId:kAudioTrackId];\nNSMutableArray *streamIds = [@[kMediaStreamId] mutableCopy];\n[self.stream addAudioTrack:audioTrack];\n\n#if !TARGET_IPHONE_SIMULATOR\nif (self.startMode == ndCallModeVideo){\n RTCVideoSource *videoSource = [self.factory videoSource];\n self.videoCapturer = [[VideoCapturer alloc] init];\n [self.videoCapturer startCaptureLocalVideoWithVideoSource:videoSource\n settings:[LocalVideoCaptureSetting createDefaultSetting]];\n self.localVideoTrack = [self.factory videoTrackWithSource:videoSource\n trackId:kVideoTrackId];\n [self.stream addVideoTrack:self.localVideoTrack];\n [self.localVideoTrack addRenderer:[self.callViewDelegate getCameraPreviewView]];\n \n \n [self.peerConnection addTrack:self.localVideoTrack streamIds:streamIds];\n}\n#endif\n\n[self.peerConnection addTrack: audioTrack streamIds:streamIds];\n}\n</code></pre>\n<p>This is constraints:</p>\n<pre><code>- (RTCMediaConstraints *)defaultPeerConnectionConstraints {\nNSDictionary *mandatoryConstraints = nil;\nif (self.startMode == ndCallModeAudio){\n mandatoryConstraints = @{\n @&quot;OfferToReceiveAudio&quot; : @&quot;true&quot;,\n @&quot;OfferToReceiveVideo&quot; : @&quot;false&quot;\n };\n}\nelse{\n mandatoryConstraints = @{\n @&quot;OfferToReceiveAudio&quot; : @&quot;true&quot;,\n @&quot;OfferToReceiveVideo&quot; : @&quot;true&quot;\n };\n}\nNSDictionary *optionalConstraints = @{ @&quot;DtlsSrtpKeyAgreement&quot; : @&quot;true&quot; };\nRTCMediaConstraints* constraints = [[RTCMediaConstraints alloc] initWithMandatoryConstraints:mandatoryConstraints\n optionalConstraints:optionalConstraints];\nreturn constraints;\n}\n</code></pre>\n"^^ . . "4"^^ . "0"^^ . "avcapturesession"^^ . "Presentation Error: Will not present ad because ad object has been used."^^ . . . "Did you try with %ld or %lld ?"^^ . "core-audio"^^ . "syncPlayers failed to loadPlayersForLegacyIdentifiers"^^ . . . . "0"^^ . . "<p>Your question, effectively, whether you could have it right aligned with the green view if it would fit, and otherwise left align it. There is no simple set of constraints that will be able to do that automatically. You could theoretically have two constraints, one for left alignment and another for right alignment, and then programmatically activate one and deactivate the other based upon where the green view was within its superview. (Or, needless to say, you could go completely old-school, and adjust frames manually.)</p>\n<p>But there is a simple alternative that keeps it entirely within the scope of the constraints system, without any manual adjustments, but it isn’t precisely what you asked for. But, it might be sufficient for your purposes: Specifically, you could right align it with the green view if there is space, and left align it with the green view’s <em>superview</em> if not.</p>\n<p>The basic idea is to have required constraints for the label with respect to the container (your dashboard view), but a lower priority constraint with respect to the green view’s trailing edge.</p>\n<p>You might also want to set the priorities of the label’s content hugging and content compression resistance. These priorities should be higher than the green view’s trailing anchor constraint. E.g.:</p>\n<pre class="lang-swift prettyprint-override"><code>let c1 = label.leadingAnchor.constraint(greaterThanOrEqualTo: dashboard.leadingAnchor)\nlet c2 = label.trailingAnchor.constraint(equalTo: greenView.trailingAnchor)\nlet c3 = label.trailingAnchor.constraint(lessThanOrEqualTo: dashboard.trailingAnchor)\n\nc2.priority = .defaultLow\n\nlabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)\nlabel.setContentHuggingPriority(.required, for: .horizontal)\n\nNSLayoutConstraint.activate([c1, c2, c3])\n</code></pre>\n<p>Yields:</p>\n<p><a href="https://i.sstatic.net/FymGj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/FymGj.png" alt="enter image description here" /></a></p>\n<hr />\n<p>Or, in Objective-C:</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSLayoutConstraint *c1 = [label.leadingAnchor constraintGreaterThanOrEqualToAnchor:dashboard.leadingAnchor];\nNSLayoutConstraint *c2 = [label.trailingAnchor constraintEqualToAnchor:greenView.trailingAnchor];\nNSLayoutConstraint *c3 = [label.trailingAnchor constraintLessThanOrEqualToAnchor:dashboard.trailingAnchor];\n\nc2.priority = UILayoutPriorityDefaultLow;\n\n[label setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];\n[label setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];\n\n[NSLayoutConstraint activateConstraints:@[c1, c2, c3]];\n</code></pre>\n<p>Or, needless to say, you can set all of these constraints and priorities in Interface Builder, not requiring any code at all. But hopefully this illustrates how to use priorities to achieve the desired effect.</p>\n"^^ . . . . . "0"^^ . . . . . "0"^^ . . "nswindow"^^ . "This makes no sense as well as the other answer. What's `_MyVertex` even? How can you work with "just pointer" to something if you don't know it's layout? What"^^ . . . . . . . . "0"^^ . . . . . . . . . . "0"^^ . "0"^^ . "Also good catch, I didn't mean to leave any SDL code in haha. Low latency is indeed a requirement, so I'll keep that in mind. This was already basically working using SDL_Audio, I'm just trying out this API to see if I can get better compatibility with Apple features like spatial audio. Definitely thought this was going to be an afternoon experiment, vs. a weeks-long head-wall-banging. "^^ . . . . "Is there an error message before like there https://stackoverflow.com/questions/70586616/cant-connect-players-in-gamekit-using-gkmatchmaker-shared-findmatch ?"^^ . "0"^^ . "0"^^ . . . . . "<p>Since Objective-C expects every field of your struct to align at a 16-byte (4 floats) boundary, you can ask C++ to do the same with <code>alignas(16)</code></p>\n<pre><code>struct MyVertex {\n alignas(16) V2 position;\n alignas(16) V4 color;\n};\n</code></pre>\n<p>This will adjust the offsets and resulting size of <code>MyVertex</code>:</p>\n<pre><code>offsetof(MyVertex, position):0\noffsetof(MyVertex, color):16\nsizeof(MyVertex): 32\n</code></pre>\n"^^ . . "integer"^^ . . "<p>I am making a Cocoapod framework that needs to declare an extern variable such that the integrator defines the constant value. This is a requirement by our client. In the past, we used a static library (without Cocoapods), and we could declare variables as extern, use them in the code, and send the library to the client who would define the variables in their project.</p>\n<p>However, when we migrated to creating a Cocoapods framework, the same code no longer works. The variables are declared as extern, but if I try to build the framework, I get linker errors saying &quot;Undefined symbols for architecture arm64&quot;. I am also using a Cocoapods example project which has the definitions for the variables, but I can't build and run the target because the framework still fails to compile. I can define the variables in the Cocoapod itself and the app will build and run, but this defeats the purpose (and, for the record, the values that are actually used are those that I define in the pod, not in the example app).</p>\n<p>How can I go about doing what I had done previously with a static library, but with a Cocoapods framework?</p>\n"^^ . "What's the alignment of `vector_float2` and `vec2`?"^^ . . "You can also use `alignas(16)` on individual field members. This is reminiscent of the OpenGL struct layout problem..."^^ . "Thank you so much for these details, I feel like I'm getting close. The renderer does seem to accept the ASBD now; I think I was getting confused by the definitions of "frames" and "packets", as they have different definitions at different steps of my pipeline.\n\nIt still isn't playing audio, and I suspect it's still the PTS. I'm trying to adjust based on the silence => no callback...should it work to do something like `PTS = currentHostTime - initHostTime`? I'm not sure the best way to count missing silence samples with the API I'm using."^^ . . . . . . . "metal"^^ . . "1"^^ . "1"^^ . "0"^^ . . "0"^^ . . "0"^^ . . "0"^^ . "0"^^ . . . "<p>I'm writing an application which needs to be able to log into the Internet. The iOS part of the app is written in Objective-C and the server side is written in PHP. Those PHP functions are called by both the iOS app and the website.</p>\n<p>The code to retrieve data from the database works fine. I can populate my tables in iOS and I can also add data to the database by calling PHP functions (using NSURLSession and NSURLRequest). But now I want to add functionality to update secure pages (account management), and for this I intended to set cookies for the session. In PHP this doesn't present a problem. I can check that the login was successful and then set (and unset) using the following code:</p>\n<pre class="lang-php prettyprint-override"><code>if(session_status() !== PHP_SESSION_ACTIVE) session_start();\nif ($_POST['username'] == $username &amp;&amp; password_verify($_POST['passhash'], $passwordhash)) {\n $_SESSION['loggedin'] = true;\n $_SESSION['username'] = $username;\n} else {\n $_SESSION['loggedin'] = false;\n $_SESSION['username'] = '';\n}\n</code></pre>\n<p>I can then check to see if I'm logged in as follows:</p>\n<pre class="lang-php prettyprint-override"><code>if(session_status() !== PHP_SESSION_ACTIVE) session_start();\nif (isset($_SESSION['username']) &amp;&amp; ($_SESSION['username'] != '') &amp;&amp; isset($_SESSION['loggedin']) &amp;&amp; $_SESSION['loggedin']) {\n return true;\n} else {\n return false;\n}\n</code></pre>\n<p>I could always call these functions from Objective-C (the same way that I populate and retrieve data from my tables), but this seems inefficient. I have an NSURLSession so (I would have thought) it should be possible to see these values directly without calling PHP code on my website.</p>\n<p>The problem is that I can't quite workout how. NSURLSession doesn't seem be quite right and NSHTTPCookieStorage seems to persist between sessions, which is definitely wrong. My understanding of how this all hooks together is clearly wrong. Can anyone set me straight?</p>\n<p>If possible, I do want to be able to continue sharing as much code between website and app as possible (so setting the cookies for login for example), but not when it doesn't make sense to do so - like calling out to the server for information which should be available to me locally.</p>\n"^^ . "Just always use `nonatomic` and properties. Ivars directly should be used only in initializers. For synchronisation use other tools. It's Apple's style: swift is example."^^ . . . . . "0"^^ . . "2"^^ . . . . "3"^^ . "2"^^ . . . "<p>I have used RNCryptor in my objective-c project to encrypt and decrypt a plist data file. Now I am recreating the project in Swift. When I try to decrypt the plist data in swift project which was created in objective-c project, it always throw &quot;Decryption error: unknownHeader&quot;. I am using the same app identifier so that I can access the same plist file which was stored in App's Document's directory. Could someone advise what I am doing wrong? Here is my code:</p>\n<p>Objective C - Encrypting and Saving to directory:</p>\n<pre><code>- (void)savePasswordlistItems {\n NSMutableData *data = [[NSMutableData alloc] init];\n NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];\n [archiver encodeObject:items forKey:@&quot;MyKey&quot;];\n [archiver finishEncoding];\n \n NSError *error;\n NSData *encryptedData = [RNEncryptor encryptData:data\n withSettings:kRNCryptorAES256Settings\n password:MY_SECRET_KEY\n error:&amp;error];\n [encryptedData writeToFile:[self dataFilePath] atomically:YES];\n }\n</code></pre>\n<p>Objective C - Decrypting, decoding, adding to NSmutableArray:</p>\n<pre><code>- (void)loadPasswordlistItems {\n if ([[NSFileManager defaultManager] fileExistsAtPath:path])\n {\n NSData *data = [[NSData alloc] initWithContentsOfFile:path];\n \n NSError *error;\n NSData *decryptedData = [RNDecryptor decryptData:data\n withPassword:MY_SECRET_KEY\n error:&amp;error];\n\n NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData: decryptedData];\n items = [unarchiver decodeObjectForKey:@&quot;MyKey&quot;];\n [unarchiver finishDecoding];\n }\n else\n {\n items = [[NSMutableArray alloc] initWithCapacity:20];\n }\n \n \n}\n</code></pre>\n<p>Swift - Decrypting, decoding and adding to NSMutableArray:</p>\n<pre><code>func loadPasswordlistItems() {\n let path = dataFilePath()\n if FileManager.default.fileExists(atPath: path) {\n do {\n let data = try Data(contentsOf: URL(fileURLWithPath: path))\n \n do {\n let decryptedData = try RNCryptor.decrypt(data: data, withPassword: Constants.MY_SECRET_KEY)\n let unarchiver = try NSKeyedUnarchiver(forReadingFrom: decryptedData)\n items = (unarchiver.decodeObject(forKey: &quot;MyKey&quot;) as! NSMutableArray)\n unarchiver.finishDecoding() \n } catch {\n // Handle decryption error\n print(&quot;Decryption error: \\(error)&quot;)\n }\n } catch {\n // Handle reading data from file error\n print(&quot;Error reading data from file: \\(error)&quot;)\n }\n } else {\n items = []\n }\n }\n</code></pre>\n<p>Swift - Encoding, Encrypting and writing to Directory (I haven't test this as I could not decrypt the existing plist file):</p>\n<pre><code>func savePasswordlistItems() {\n let data = NSMutableData()\n let archiver = NSKeyedArchiver(forWritingWith: data)\n archiver.encode(items, forKey: &quot;MyKey&quot;)\n archiver.finishEncoding()\n \n let encryptedFile = RNCryptor.encrypt(data: data as Data, withPassword: Constants.MY_SECRET_KEY)\n do {\n try encryptedFile.write(to: URL(fileURLWithPath: dataFilePath()), options: .atomic)\n } catch {\n print(error)\n }\n }\n</code></pre>\n"^^ . . "2"^^ . . . "0"^^ . . "Please provide enough code so others can better understand or reproduce the problem."^^ . . . . . "0"^^ . "You need to [edit] your question to include all relevant code in the form of a [mcve] in order to make the question on-topic."^^ . . . . "0"^^ . . . "0"^^ . . . "0"^^ . . . "0"^^ . "autolayout"^^ . . . . "encode"^^ . "Thank you for help. I should submit a ticket to DTS."^^ . . . . . . "0"^^ . . "0"^^ . . "<p>I'm coding Objective C in Xcode 15 and found this NSLog %d problem.\nThe code I used to test:</p>\n<pre><code> int someInt = -1;\n NSLog(@&quot;AppDelegate status: %d (%d) ((%.0f)) %@ -&gt; %d)&quot; ,\n someInt,\n -1,\n someInt * 1.0,\n [NSString stringWithFormat:@&quot;%d&quot;, someInt],\n [NSString stringWithFormat:@&quot;%d&quot;, someInt].intValue);\n</code></pre>\n<p>The result in Log:</p>\n<pre><code>AppDelegate status: 18,446,744,073,709,551,615 (18,446,744,073,709,551,615) ((-1.0000)) -1 -&gt; 18,446,744,073,709,551,615)\n</code></pre>\n<p>So for -1,</p>\n<ol>\n<li>it's printed as 8,446,744,073,709,551,615 with %d</li>\n<li>Converted to float using %f shows correct -1.0000</li>\n<li>Converted to NSString shows correct -1</li>\n</ol>\n<p>But</p>\n<ol>\n<li>%d with -1 doesn't work</li>\n<li>%d with someInt doesn't work</li>\n<li>%d with NSString converted back to intValue doesn't work.</li>\n</ol>\n<p>Seems like NSLog is printing %d as a unsigned int.\nIn addition, using printf is fine with -1 and %d.</p>\n<p>Is there some setting problem of my Xcode? Any ideas how to fix this?</p>\n"^^ . . . . "1"^^ . . "I was under the impression that the alignment of struct members was similar to std140 in OpenGL, where *every* member must be aligned to the largest alignment in the struct, frequently that of vec4. This means a single int gets padded up to 32 bytes. How would you achieve this without explicit alignment hints for c++?"^^ . "0"^^ . . . . "0"^^ . "@Botje No The Objective-C compiler pads the internals of each `MyVertex` struct, so that `position` is size 8, then pad 8, and then `color` is 16. I mean I could manually hack it so I the structs align, but that doesn't feel like best practice."^^ . "<p>If all manipulations is done in C++ then you don't need to know anything about <code>MyVertex</code> content in ObjectiveC. In ObjectiveC you can work just with pointer on it.</p>\n<p>Yours declaration file should be:</p>\n<pre><code>#ifdef __IN_CPP__\nstruct MyVertex {\n vec2 position;\n vec4 color;\n};\n#else\ntypedef struct _MyVertex MyVertex;\n#endif\n</code></pre>\n"^^ . "0"^^ . . "1"^^ . . "This might be a good question for DTS"^^ . . . . "1"^^ . . . . "0"^^ . . "0"^^ . . . "0"^^ . . . . . . "So I align within the struct. And Both Objective-C and C++ will compile the same format if it is specified that way. That seems like a good solution"^^ . "nsurlsession"^^ . . "<p>CocoaPods enforces pods being pure libraries. They need to be buildable without any knowledge of their clients.</p>\n<p>You could declare the variable without <code>extern</code> in the CocoaPod and set its value in the client.</p>\n"^^ . "game-center"^^ . . "0"^^ . . . "1"^^ . . . . "camera"^^ . . . . "1"^^ . "0"^^ . "0"^^ . "What OS is this question about? iOS? macOS? Other? Show what you have tried so far. Clearly explain what issues you are having. The link by Willeke gives you a good starting point at a minimum."^^ . "here is the BUNDLE\na=group:BUNDLE 0 1\nso 0 for audio and 1 for video"^^ . . "0"^^ . . . . . "<p>I want the text label adjust its position based on the green view.\nIt should left alignment to the view if possible, but if the text content extent out of the dashboard, I'd like the text to right alignment to the view. Example:</p>\n<p><img src="https://i.sstatic.net/52omq.png" alt="example" /></p>\n<p>The green view's position and changed randomly, I don't want to calculate the text frame every time and manually enable or disable different constraints, or set frame directly. I really want to explore some easy way to achieve that</p>\n<p>Currently I uses:</p>\n<pre><code>C1 = [text.leadingAnchor constraintEqualToAnchor:view.leadingAnchor]\nC2 = [text.trailingAnchor constraintLessThanOrEqualToAnchor:view.trailingAnchor]\nC3 = [text.trailingAnchor constraintLessThanOrEqualToAnchor:dashboard.trailingAnchor]\n</code></pre>\n<p>priority:\nC3&gt;C2&gt;C1</p>\n<p>But in that case, the text position for the middle green view is wrong.</p>\n"^^ . . "4"^^ . "0"^^ . "@CarlLindberg Seems reasonable that NSOpenPanel should have its own listener that does that and wholly unreasonable for every app that every developer writes be responsible for it."^^ . . . . "-1"^^ . . "If I use`alignas(32)` with `MyVertex` in C++, then C++ will think `color` has an offset of 4 still, and Objective-C will think that `color` has an offset of 8."^^ . . . . . . "<p>It seems like you're on the right track with your iOS audio project. Your approach to decoding Opus audio data and attempting to play it using AVSampleBufferAudioRenderer is fundamentally sound, but there are a few potential issues and improvements to consider in your code.</p>\n<pre><code>// Global variable to keep track of the current PTS\nCMTime currentPTS = kCMTimeZero;\n\nvoid AudioDecodeAndPlaySample(char* sampleData, int sampleLength)\n{\n // [Existing decoding logic]\n\n // Update PTS\n CMTime frameDuration = CMTimeMake(numSamples, sampleRate);\n currentPTS = CMTimeAdd(currentPTS, frameDuration);\n\n // [Existing LPCM stream description logic]\n\n // [Existing sample buffer creation logic]\n\n // Queueing sample buffer onto audio renderer within requestMediaDataWhenReady block\n [audioRenderer requestMediaDataWhenReadyOnQueue:dispatch_get_main_queue() usingBlock:^{\n if ([audioRenderer isReadyForMoreMediaData]) {\n CMSampleBufferSetOutputPresentationTimeStamp(sampleBuffer, currentPTS);\n [audioRenderer enqueueSampleBuffer:sampleBuffer];\n CFRelease(sampleBuffer); // Don't forget to release the sample buffer\n }\n }];\n}\n</code></pre>\n"^^ . "0"^^ . . . . "0"^^ . . "You cannot accomplish this with constraints only. *"I don't want to ... I really want to explore some easy way..."* -- a fairly simple subclass would be "the easy way.""^^ . "@dalton_c Thanks for your support. I forgot to set class public in target membership"^^ . "0"^^ . . . . . . . "0"^^ . . . "<p>While Alexander answered your question (and you should feel free to accept <a href="https://stackoverflow.com/a/77810175/1271826">his answer</a>; +1), I offer a few clarifying observations:</p>\n<ol>\n<li><p><strong>What is the purpose of <code>atomic</code>?</strong></p>\n<p>The <code>atomic</code> qualifier on the property just dictates how Objective-C synthesized accessors handle the <em>pointer</em> to the actor and has nothing to with the actor’s internal behaviors. As the <a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html#//apple_ref/doc/uid/TP40011210-CH5-SW37" rel="nofollow noreferrer">documentation</a> says, <code>atomic</code> “means that the synthesized accessors ensure that a value [the pointer in this case] is always fully retrieved by the getter method or fully set via the setter method, even if the accessors are called simultaneously from different threads.”</p>\n<p>The <code>atomic</code> keyword simply ensures that the synthesized accessor methods atomically fetch and store the pointer address, itself. It has no bearing on the internal thread-safety (or lack thereof) of the object to which it points.</p>\n</li>\n<li><p><strong>Should one use <code>atomic</code> or <code>nonatomic</code>?</strong></p>\n<p>In practice, <code>atomic</code> often introduces (admittedly negligible) overhead with limited benefit. Like Alexander, I almost always use <code>nonatomic</code>. If the Objective-C code has thread-safety issues, one often needs a higher-level of synchronization, rendering the <code>atomic</code> nature to the pointer largely moot. It depends the Objective-C code (which is not really relevant to the immediate question).</p>\n<p>But, as Alexander pointed out, whether you mark the property as <code>atomic</code> or <code>nonatomic</code> is irrelevant to the fact that you are pointing to an <code>actor</code> or some other <code>class</code>.</p>\n</li>\n<li><p><strong>Should you use the property getter, <code>self.someActor</code>, or access the backing ivar, <code>_someActor</code>?</strong></p>\n<p>You did not explicitly ask this question, but one of your examples, you refer to <code>someActor</code> (which I presume means you intended to use the getter, though given the absence of either <code>self.</code> or the leading underscore, it is not entirely clear) and in the other, <code>_someActor</code> (the property’s backing ivar).</p>\n<p>As <a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html#//apple_ref/doc/uid/TP40011210-CH5-SW5" rel="nofollow noreferrer">Programming with Objective-C</a> says, “… it’s best practice for an object to access its own properties using accessor methods or dot syntax.” The two common exceptions to this rule are (a) in <code>init</code>; and (b) in manually implemented getters/setters, if any.</p>\n<p>So, in short, I would generally use <code>self.someActor</code> and not <code>_someActor</code>.</p>\n<p>Please note, I belabor this accessor vs. ivar distinction because the <code>atomic</code>/<code>nonatomic</code> only dictates the nature of the synthesized accessor methods. It has no effect on direct interaction via the ivar. Thus, an <code>atomic</code> ivar is a bit of a non-sequitur, as directly interacting with the ivar bypasses the accessors and their synthesized behaviors (including <code>atomic</code>), too.</p>\n</li>\n</ol>\n<p>Bottom line, feel free to use <code>nonatomic</code>. And if you are trying to ensure that the Objective-C code, itself, is thread-safe, we would need to see any relevant code, but, generally, merely making the property <code>atomic</code> would be insufficient. The fact that you are dealing with an <code>actor</code> has no meaningful impact on the choice of <code>atomic</code> or <code>nonatomic</code>.</p>\n<hr />\n<p>For folks looking for a description of <code>actor</code> interoperability with Objective-C, see <a href="https://github.com/apple/swift-evolution/blob/main/proposals/0297-concurrency-objc.md#actor-classes" rel="nofollow noreferrer">SE-0297 – Concurrency Interoperability with Objective-C</a>.</p>\n"^^ . "1"^^ . . "0"^^ . . "0"^^ . "NSLog cannot print negative int with %d in Xcode 15"^^ . . . . . . . . "0"^^ . . "@JeremyP hm good point, but that code was actually just to illustrate the issue. All those lines above 187 in my screencapture were just attempts to break it down into several smaller steps to help out the compiler and see where it goes wrong. Initially I've attempted to directly access a property of `mapViewModel` inside a closure."^^ . "Is it a requirement to use `AVSampleBufferAudioRenderer`?"^^ . "0"^^ . . "<p>I want to call a function if the volume down button is pressed twice in the same second, is that possible or is it impossible?!</p>\n"^^ . . . "0"^^ . "0"^^ . "2"^^ . . . "0"^^ . "<p>I am getting this error and my code is below</p>\n<pre><code> - (void)viewWillAppear:(BOOL)animated {\n NSLog(@&quot;self.inter eve reload cl %@&quot;, self.interstitial);\n DebugAssert(index != NSNotFound);\n double delayInSeconds = 5.0;\n dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));\n if (!didPurchaseAds) {\n dispatch_after(popTime, dispatch_get_main_queue(), ^(void){\n NSLog(@&quot;Interstitial ad loaded %ld&quot;, (long)index);\n if ((index % 2 == 0)) {\n NSLog(@&quot;Interstitial ad loaded for even num %ld&quot;, (long)index);\n if (self.interstitial) {\n NSLog(@&quot;Show InterstitialAd %@&quot;, self.interstitial);\n [self.interstitial presentFromRootViewController:self];\n [self.interstitial presentFromRootViewController:self];\n } else {\n NSLog(@&quot;Ad wasn't ready event&quot;);\n }\n }\n });\n }\n }\n \n - (void)viewDidLoad{\n [super viewDidLoad];\n [self loadInterstitial];\n }\n \n - (void)loadInterstitial {\n GADRequest *request = [GADRequest request];\n [GADInterstitialAd loadWithAdUnitID:@&quot;ca-app-pub-3940256099942544/4411468910&quot;\n request:request\n completionHandler:^(GADInterstitialAd *ad, NSError *error) {\n if (error) {\n NSLog(@&quot;Failed to load interstitial ad with error: %@&quot;, [error localizedDescription]);\n return;\n }\n self.interstitial = ad;\n self.interstitial.fullScreenContentDelegate = self;\n }];\n }\n \n \n - (void)ad:(nonnull id&lt;GADFullScreenPresentingAd&gt;)ad\n didFailToPresentFullScreenContentWithError:(nonnull NSError *)error {\n NSLog(@&quot;Ad did fail to present full screen content.&quot;);\n }\n \n /// Tells the delegate that the ad will present full screen content.\n - (void)adWillPresentFullScreenContent:(nonnull id&lt;GADFullScreenPresentingAd&gt;)ad {\n NSLog(@&quot;Ad will present full screen content.&quot;);\n }\n \n /// Tells the delegate that the ad dismissed full screen content.\n - (void)adDidDismissFullScreenContent:(nonnull id&lt;GADFullScreenPresentingAd&gt;)ad {\n NSLog(@&quot;Ad did dismiss full screen content.&quot;);\n }\n \n \n\n \n</code></pre>\n"^^ . "0"^^ . . "That make it sound like the `unknownHeader` is coming from the `NSKeyedUnarchiver(forReadingFrom:)` rather than from `RNCryptor.decrypt`. Is that possible?"^^ . "1"^^ . . "0"^^ . "Difficulty Accessing Objective-C Class within Swift Framework in XCFramework"^^ . "@Spo1ler `_MyVertex` is struct forward declaration and code sugar to not write `struct MyVertex`"^^ . . . . "webrtc"^^ . "0"^^ . . . "cocoapods"^^ . . . . . "<p>For the following lightning bolt graphic:</p>\n<p><a href="https://i.sstatic.net/u7aLF.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/u7aLF.png" alt="enter image description here" /></a></p>\n<p>I'm trying to flip it while scaling like such:</p>\n<pre><code>CGAffineTransform transform = CGAffineTransformMakeScale(newSize.width / initialSize.width, -1 * (newSize.height / initialSize.height));\nCGMutablePathRef mutablePath = CGPathCreateMutableCopyByTransformingPath(shapeLayer.path, &amp;transform);\nshapeLayer.path = mutablePath;\nCGPathRelease(mutablePath);\n</code></pre>\n<p>This is what happens:</p>\n<p><a href="https://i.sstatic.net/aId6L.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/aId6L.png" alt="enter image description here" /></a></p>\n<p>I've tried a bunch of different ways to translate it but to no success:</p>\n<pre><code>CGAffineTransform transform = CGAffineTransformMakeTranslation(newSize.width / 2, newSize.height / 2);\ntransform = CGAffineTransformScale(transform, newSize.width / initialSize.width, -1 * (newSize.height / initialSize.height));\ntransform = CGAffineTransformTranslate(transform, -newSize.width / 2, -newSize.height / 2);\n</code></pre>\n<p>Does anyone know the correct way to get my graphic back into the bounding box of the view?</p>\n"^^ . . . . "audiotoolbox"^^ . . . "<p>A blunder wasted my time. Simple solution that works</p>\n<ol>\n<li><p>Add Objective C class in Swift Framework</p>\n</li>\n<li><p>Set .h file as public in Target Membership\n<a href="https://i.sstatic.net/4unyM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4unyM.png" alt="enter image description here" /></a></p>\n</li>\n<li><p>import Objective C class in Umbrella header</p>\n<p>#import &lt;yourSDK/ObjectiveC-class.h&gt;</p>\n</li>\n</ol>\n<p>That's all you need.</p>\n"^^ . . . "0"^^ . . "0"^^ . . "1"^^ . "2"^^ . . . "0"^^ . . "Thanks, I'll give that a try in a bit. I don't know of a way to track the missing frames via the library I'm using, hence why I'm trying to track myself how much time elapses between callback calls. We'll see what I can come up with."^^ . . "0"^^ . "objective-c"^^ . "There is also the case where the text could be long enough to not fit the dashboard even if it is right-aligned. What do you want to happen in that case? Right-align the text anyway? Or not aligning the text and prioritise making the text visible?"^^ . "0"^^ . "MacVim has a Select All menu item with key equivalent Command-A and action `selectAll:`. It is possible to make Command-A work without a menu item but I don't know if it will work (in the future) outside the usual runloop of `NSApplication`. I'm surprised the open panel works at all."^^ . . . . . "0"^^ . . . "3"^^ . . "1"^^ . "0"^^ . . . . "@sbooth May I ask what DTS stands for and how it is related to the issue? Thank you!"^^ . . . "There is an error parameter in that delegate method, print the error (not only the error.localizedDescription btw)."^^ . . "Does it work if you add `@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate` too your `App` struct?"^^ . . . . . . . "0"^^ . "How can I create an instance of Objective C instance by name in KMM?"^^ . . . . . . . . . "In fact I'm sure I can go deeper with `alignas` and optimize a lot more to focus on shader buffer and cache hits.. Somehow. Will have to read a bit more how that works."^^ . . . . . . . "Why are my NSWorkspace notification and listeners not being recieved or firing?"^^ . . "AVCaptureVideoDataOutputSampleBufferDelegate is not triggering captureOutput"^^ . "0"^^ . . . . . . . "Try just adding `#import "FingerprintSDKWrapper.h"`"^^ . "Look's like you don't need mention `#import "FingerprintSDK/FingerprintSDK.h"` in `FingerprintSDKWrapper`'s header."^^ . . . . . . . . "0"^^ . "OK, I have edit the example code to explain my goal"^^ . "1"^^ . . . . "Why not use the header? EDIT: store some secret in the header and use that to authenticate is what I mean."^^ . "@Cy-4AH The setup of supported architectures is standard(arm64), and Build Active Architecture Only is No when releasing, Yes when Debugging, also feels same about cocapods."^^ . . . . . "How can I tell NSOpenPanel to respect the ⌘A (select all items) key binding?"^^ . "⌘A doesn't work for me either, just like OP."^^ . "<p>The link by Willeke gives you a good starting point at a minimum.<br />\nif your device is iPhone with OC, use AVFoundation and MediaPlayer can monitored the volume change.<br />\n1、</p>\n<pre><code>#import &lt;AVFoundation/AVFoundation.h&gt;\n#import &lt;MediaPlayer/MediaPlayer.h&gt;\n</code></pre>\n<p>2、</p>\n<pre><code>@property (nonatomic, strong) MPVolumeView* volumeView;\n@property (nonatomic, strong) UISlider* volumeSlider;\n</code></pre>\n<p>3、</p>\n<pre><code>NSError* error = nil;\n [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:&amp;error];\n if (error) {\n NSLog(@&quot;error setting category:%@&quot;, error.localizedDescription);\n }\n \n _volumeView = [[MPVolumeView alloc] initWithFrame:CGRectZero];\n [self.view addSubview:self.volumeView];\n\n // 找到MPVolumeView上的UISlider\n for (UIView *view in [self.volumeView subviews]){\n if ([view isKindOfClass:[UISlider class]]) {\n self.volumeSlider = (UISlider *)view;\n break;\n }\n }\n \n [self.volumeSlider addTarget:self action:@selector(volumeChanged:) forControlEvents:UIControlEventValueChanged];\n</code></pre>\n<p>4、</p>\n<pre><code>- (void)dealloc {\n [self.volumeSlider removeTarget:self action:@selector(volumeChanged:) forControlEvents:UIControlEventValueChanged];\n}\n\n- (void)volumeChanged:(UISlider *)sender {\n NSLog(@&quot;%.2f&quot;, sender.value);\n}\n</code></pre>\n<p>You can listen to the volume change in the method, and if you want to make consecutive clicks for 1 second, you need to set a timestamp as an anchor.\nBut there are some problems with this method:</p>\n<ol>\n<li>Removed the default volume adjustment UI of the system, and the new iOS system can not use MPVolumeView;</li>\n<li>When the screen is locked, the APP cannot take effect when it is inactive;</li>\n<li>Different iOS versions may have different effects.</li>\n</ol>\n"^^ . "0"^^ . "0"^^ . . . "0"^^ . . . "I imagine NSOpenPanel implements the selectAll: responder method. But something else has to translate a Command-A keystroke into sending the selectAll: method to the first responder."^^ . "<p>It's unclear what you're trying to do, and you have not supplied sufficient code even to generate the interface you've pictured, let alone to discover what the issue may be. However, the simplest thing is probably to transform the shape layer, not the path. The following code draws a non-symmetric shape in the center of the screen, and then flips it horizontally and enlarges it, operating round its center, so that it still in the center of the screen:</p>\n<pre><code>let shape = CAShapeLayer()\nshape.frame = CGRect(x: 0, y: 0, width: 100, height: 100)\nlet path = UIBezierPath()\npath.move(to: .zero)\npath.addLine(to: .init(x: 0, y: 100))\npath.addLine(to: .init(x: 100, y: 100))\nshape.path = path.cgPath\nself.view.layer.addSublayer(shape)\nshape.frame.origin = CGPoint(\n x: view.bounds.width / 2 - 50, \n y: view.bounds.height / 2 - 50\n)\n\nlet newsize = 1.5\nDispatchQueue.main.asyncAfter(deadline: .now() + 3) {\n shape.transform = CATransform3DMakeScale(-newsize, newsize, 0)\n}\n</code></pre>\n<p>If you insist upon transforming the path, then the transform takes place around the origin (the top left), so you would need to move the center of the path to the origin, perform the scale transform, then move the center of the path back to the center.</p>\n<pre><code>let shape = CAShapeLayer()\nshape.frame = CGRect(x: 0, y: 0, width: 100, height: 100)\nlet path = UIBezierPath()\npath.move(to: .zero)\npath.addLine(to: .init(x: 0, y: 100))\npath.addLine(to: .init(x: 100, y: 100))\nshape.path = path.cgPath\nself.view.layer.addSublayer(shape)\nshape.frame.origin = CGPoint(\n x: view.bounds.width / 2 - 50, \n y: view.bounds.height / 2 - 50\n)\n\nlet newsize = 1.5\nDispatchQueue.main.asyncAfter(deadline: .now() + 3) {\n path.apply(CGAffineTransform(translationX: -50, y: -50))\n path.apply(CGAffineTransform(scaleX: -newsize, y: newsize))\n path.apply(CGAffineTransform(translationX: 50, y: 50))\n shape.path = path.cgPath\n}\n</code></pre>\n"^^ . . . . . . . "2"^^ . "2"^^ . "<p>This is <a href="https://stackoverflow.com/a/1174127/3585796">how</a> you can do it in ObjC:</p>\n<pre class="lang-objectivec prettyprint-override"><code>[[NSClassFromString(className) alloc] init];\n</code></pre>\n<p>I'm not sure if you can do it from Swift, but Kotlin doesn't have such an option according to <a href="https://github.com/JetBrains/kotlin-native/issues/3247" rel="nofollow noreferrer">this discussion</a>.</p>\n<p>So the only option I can think of that might work is to create ObjC files that implement this functionality, and then add them to your project using <a href="https://kotlinlang.org/docs/multiplatform-dsl-reference.html#cinterops" rel="nofollow noreferrer"><code>cinterops</code></a>.</p>\n"^^ . . "Ah -- sorry about the `NS` vs `UI` mixup. I suggest you use a more modern Combine or async/await approach and avoid the old `objc` code and `Selector`s -- then, the compiler can help you out of those issues"^^ . "0"^^ . "func NSClassFromString(_ aClassName: String) -> AnyClass? also available in swift"^^ . "<p>I like to use an ObjC constant in Swift.</p>\n<p>IronSource ad network recommends to initialize a banner ad like so:</p>\n<pre><code>[IronSource loadBannerWithViewController:self size:ISBannerSize_SMART];\n</code></pre>\n<p>I use Swift and translate is like so:</p>\n<pre><code>IronSource.loadBanner(with: self, size: dont_know)\n</code></pre>\n<p>But for parameter ISBannerSize_SMART I don't know what to fill in as nothing works for me. ISBannerSize.ISBannerSize_SMART not working, ISBannerSize_SMART not working...</p>\n<p>This is how the ObjC source looks like.</p>\n<pre><code>//\n// ISBannerSize.h\n// IronSource\n\n#import &lt;Foundation/Foundation.h&gt;\n\nstatic NSString* const kSizeSmart = @&quot;SMART&quot;;\n\n#define ISBannerSize_SMART [[ISBannerSize alloc] initWithDescription:kSizeSmart width:0 height:0]\n\n@interface ISBannerSize : NSObject\n</code></pre>\n"^^ . . "1"^^ . "0"^^ . . "I'm sorry, I tried the first piece of code and I assumed the open panel was used in an app, like MacVim."^^ . . "1"^^ . . "If you know that N frames were skipped due to silence, then you need to do `samplesEnqueued += N`. In retrospect that variable should probably be called `nextPresentationTimeStamp`. If you suspect timing, try adding some, uh, latency to the start hosttime, e.g. 1 second `CMTimeAdd(CMClockGetTime(CMClockGetHostTimeClock()), CMTimeMake(1, 1))` \n\nFor SpatialAudio I think you need to look at the PHASE framework."^^ . . "0"^^ . . . . . "<p>tl;dr</p>\n<p>Yes, you have introduced a strong reference cycle. You should use <code>weakSelf</code> pattern.</p>\n<hr />\n<p>Needless to say, in the case of a timer, you could just add some logging in the timer code, so you will see that the timer is still firing after its owner has been dismissed.</p>\n<p>But more generally, to identify whether objects remain in memory longer than intended, one can empirically verify this with the <a href="https://developer.apple.com/documentation/xcode/gathering-information-about-memory-use/#Inspect-the-debug-memory-graph" rel="nofollow noreferrer">“Debug Memory Graph”</a> feature.</p>\n<p>E.g., here I started the timer in a view controller, presented and dismissed this view controller three times, and the panel to the left of my memory graph shows that I have three instances of that view controller still in memory!</p>\n<p><a href="https://i.sstatic.net/14khp.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/14khp.png" alt="enter image description here" /></a></p>\n<p>Sometimes, we will be lucky enough that the “memory graph” will successfully identify this as a strong reference cycle (and you may see ⚠️ warning icons or circular graphs in the main panel). But, sometimes, such as in this case, you will just see the lingering instances, at which point you can start your hunt for the strong reference cycle (which you have successfully already identified here).</p>\n<p>In this case, I:</p>\n<ul>\n<li>turned on the “Malloc Stack” diagnostic option under my scheme settings;</li>\n<li>ran the app in the debugger;</li>\n<li>manifested the strong reference cycle;</li>\n<li>clicked on the “Debug Memory Graph” button (circled at the bottom of the above screen snapshot);</li>\n<li>selected one of the lingering view controllers;</li>\n<li>clicked on the object that was keeping the strong reference;</li>\n<li>I could then see the call stack trace on the right and I clicked on the arrow next to the call in my code (circled on the right edge of the above screen snapshot); and</li>\n<li>that took me to where the strong reference was established:</li>\n</ul>\n<p><a href="https://i.sstatic.net/v6AWF.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/v6AWF.png" alt="enter image description here" /></a></p>\n<p>Once I defined <code>weakSelf</code> and modified the block to call <code>[weakSelf sendLog]</code>, I repeated the above steps. There were no more lingering objects. I then removed the “Malloc stack” diagnostics once I confirmed there were no more strong reference cycles.</p>\n"^^ . . . "0"^^ . . . . . . . "@Willeke When the MCV example runs, there is no Apple menu for which to control. There are many questions to ask regarding your inability to repro the problem."^^ . . "@Willeke MacVim uses NSOpenPanel. When it raises the open panel, you can select all items in the view. I see nothing in its source that coaxes NSOpenPanel to be fully featured."^^ . "0"^^ . . . . . . . "actor"^^ . . "strong-reference-cycle"^^ . . "Menu creation code: [Create Cocoa Document App without xib files](https://stackoverflow.com/questions/76464494/create-cocoa-document-app-without-xib-files/76466859#76466859)"^^ . . . . . . "sdk"^^ . "0"^^ . "<p>You need to hold the output object to prevent it from being released.<br />\n1、@property (nonatomic, strong) AVCaptureVideoDataOutput* cameraOutput;<br />\n2、_cameraOutput = videoDataOutput;<br />\nIt is recommended that you also create an <code>AVCaptureConnection</code> object to distinguish the connection in the <code>AVCaptureVideoDataOutputSampleBufferDelegate</code>.<br />\n3、AVCaptureConnection* _videoConnection;<br />\n4、_videoConnection = [_cameraOutput connectionWithMediaType:AVMediaTypeVideo];<br />\n5、this <code>didOutputSampleBuffer</code>, if (_videoConnection == connection), you can use sampleBuffer.</p>\n"^^ . "<p>After submitting an issue to Apple Developer Technical Support (DTS), I believe the problem has been resolved. I just tested with AirPods and it is now correctly returning 0, 1 for microphone usage.</p>\n"^^ . . . "Have you added `FingerprintSDKWrapper.h` to your framework's umbrella header?"^^ . "<p>From <a href="https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Console" rel="nofollow noreferrer">Xcode 15 Release Notes</a>:</p>\n<blockquote>\n<p><strong>Console</strong></p>\n<p><strong>New Features</strong></p>\n<p>By default, Xcode streams os_logs through the unified logging and activity tracing infrastructure. The output may be formatted differently compared to previous versions of Xcode, and its order relative to standard IO may also change. To customize the behavior of logging, edit the Run scheme action to set the environment variable IDELogRedirectionPolicy. The value “oslogToStdio” redirects os_log messages to standard IO and formats them in a style identical to previous versions of Xcode. The value stdioToOSLog redirects standard IO to the os_log messages, and presents them in the debug console with additional metadata. (109380695)</p>\n</blockquote>\n<p>Apparently there's a bug in the new logging system. Workaround: Edit Scheme and add environment variable <code>IDELogRedirectionPolicy</code> with value <code>oslogToStdio</code>.</p>\n"^^ . . . . . "0"^^ . . "0"^^ . . . "0"^^ . . . . "0"^^ . "0"^^ . . . . . "0"^^ . "Cannot read CMVideoDimensions structure with Objective C code"^^ . "0"^^ . "0"^^ . . . "[*The float2 type in the Metal structure requires an alignment of 8 bytes.*](https://computergraphics.stackexchange.com/a/6258/11366) See also p26 of the [Metal spec](https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf)"^^ . "@Dewerro it's available, but how are you going to create an object instance from `AnyClass`?"^^ . . "Check parameters of supported architectures. I suggest to remove any if specified. Also if you are using cocopods, you need manually rise deployment target in all pods. Doesn't know why cocoapods not doing it automatically."^^ . . "0"^^ . "0"^^ . . . . "0"^^ . . "0"^^ . "2"^^ . "0"^^ . "Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/256799/discussion-between-ian-and-jnpdx)."^^ . . . . . . "No, not `NotificationCenter.shared` -- `NSWorksapce.shared`"^^ . . . "0"^^ . "0"^^ . . . "@CarlLindberg Sounds like there's a design conflict in my head. In my head, I would want NSOpenPanel to always respect ⌘A while others think it should be allowed to behave differently depending upon the application. I think that's crazy."^^ . . . . . . "1"^^ . "<p><code>ISBannerSize_SMART</code> is not a constant. It is a macro that expands to</p>\n<pre class="lang-objectivec prettyprint-override"><code>[[ISBannerSize alloc] initWithDescription:kSizeSmart width:0 height:0]\n</code></pre>\n<p><a href="https://developer.apple.com/documentation/swift/using-imported-c-macros-in-swift" rel="nofollow noreferrer">Such macros are not imported into Swift.</a> Only simple macros that expand to a constant value like the following, are imported into Swift:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#define SOME_CONSTANT 3.14\n</code></pre>\n<p>So you would need to translate <code>[[ISBannerSize alloc] initWithDescription:kSizeSmart width:0 height:0]</code> into Swift, i.e. something like</p>\n<pre class="lang-swift prettyprint-override"><code>ISBannerSize(description: kSizeSmart, width: 0, height: 0)\n</code></pre>\n<p>You can use this directly as the <code>size</code> parameter of <code>loadBanner</code>, or you can write an extension of <code>ISBannerSize</code>:</p>\n<pre class="lang-swift prettyprint-override"><code>extension ISBannerSize {\n static var smart: ISBannerSize {\n ISBannerSize(description: kSizeSmart, width: 0, height: 0)\n }\n}\n</code></pre>\n<p>Usage:</p>\n<pre class="lang-swift prettyprint-override"><code>IronSource.loadBanner(with: self, size: .smart)\n</code></pre>\n"^^ . . . . . "1"^^ . . . . . "rncryptor"^^ . . . . . "macos"^^ . "Incorrect Value Returned by kAudioDevicePropertyDeviceIsRunningSomewhere for External Devices like AirPods"^^ . "0"^^ . "if self in dispatch_source_set_event_handler need to be weak"^^ . . . . . "0"^^ . . . . . . . . . "-1"^^ . "<p>I am trying to build an card scanner app using vision framework of IOS. I am successfully able to open the camera but the problem is that AVCaptureVideoDataOutputSampleBufferDelegate is not triggering captureOutput function where I will do the analysis for identifying the card.</p>\n<p>Here is my .h file</p>\n<pre><code>#import &lt;AVFoundation/AVFoundation.h&gt;\n#import &lt;UIKit/UIKit.h&gt;\n\n@interface Trying : NSObject &lt;AVCaptureVideoDataOutputSampleBufferDelegate&gt;\n@property (nonatomic, strong) AVCaptureSession *captureSession;\n@property (nonatomic, strong) AVCaptureVideoPreviewLayer *previewLayer;\n@property (nonatomic, strong) dispatch_queue_t videoDataOutputQueue;\n@property (nonatomic, strong) UIView *view;\n- (void)setupCamera;\n@end\n\n</code></pre>\n<p>And .m file</p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n#import &lt;AVFoundation/AVFoundation.h&gt;\n#import &quot;Trying.h&quot;\n\n@interface Trying ()\n\n@end\n\n@implementation Trying\n\n- (void)setupCamera {\n self.captureSession = [[AVCaptureSession alloc] init];\n \n AVCaptureDevice *captureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];\n \n NSError *error;\n AVCaptureDeviceInput *deviceInput = [AVCaptureDeviceInput deviceInputWithDevice:captureDevice error:&amp;error];\n \n if (deviceInput) {\n [self.captureSession addInput:deviceInput];\n \n AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:self.captureSession];\n previewLayer.frame = self.view.bounds;\n previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;\n [self.view.layer addSublayer:previewLayer];\n \n self.previewLayer = previewLayer;\n \n // Create a video data output and set the delegate\n self.videoDataOutputQueue = dispatch_queue_create(&quot;VideoDataOutputQueue&quot;, DISPATCH_QUEUE_SERIAL);\n AVCaptureVideoDataOutput *videoDataOutput = [[AVCaptureVideoDataOutput alloc] init];\n [videoDataOutput setSampleBufferDelegate:self queue:self.videoDataOutputQueue];\n [self.captureSession addOutput:videoDataOutput];\n \n // Start the session\n [self.captureSession startRunning];\n } else {\n NSLog(@&quot;Error setting up camera: %@&quot;, error.localizedDescription);\n }\n}\n\n- (void)captureOutput:(AVCaptureOutput *)output didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {\n // Process the live sample buffer here\n NSLog(@&quot;Got a live sample buffer&quot;);\n \n // You can use the sampleBuffer for further processing, such as image recognition or analysis\n}\n\n- (void)captureOutput:(AVCaptureOutput *)output didDropSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {\n NSLog(@&quot;Dropped a sample buffer&quot;);\n // Handle dropped frames if needed\n}\n@end\n\n</code></pre>\n<p>Can anyone please help with why <code>captureOutput</code> is not being triggered by <code>AVCaptureVideoDataOutputSampleBufferDelegate</code>. I am able to see the live camera feed in the view but <code>captureOutput</code> is not being called</p>\n"^^ . . . . "DTS is Apple Developer Technical Support. https://developer.apple.com/support/technical/"^^ . . "0"^^ . . . . . "1"^^ . . . . . . "<p>As mentioned, this cannot be accomplished with constraints only, but the logic is fairly straightforward and we can take advantage of constraints for <em>most</em> of the work.</p>\n<p>So, the goal:</p>\n<ul>\n<li>align the label leading to the &quot;green view&quot; leading</li>\n<li>IF the label extends past the trailing edge of the superview,\n<ul>\n<li>align the label trailing to the &quot;green view&quot; trailing</li>\n</ul>\n</li>\n</ul>\n<p>Obviously, if the string is shorter than the view width, we don't have to do anything.</p>\n<p><a href="https://i.sstatic.net/vachL.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vachL.gif" alt="enter image description here" /></a></p>\n<p>When the label is wider than the view:</p>\n<ul>\n<li>create both Leading and Trailing constraints</li>\n<li>toggle the <code>.active</code> property of the constraints as needed</li>\n</ul>\n<p><a href="https://i.sstatic.net/s8cLs.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/s8cLs.gif" alt="enter image description here" /></a></p>\n<p>But -- what should happen if the label is too wide to fit when it is <strong>right-aligned</strong>?</p>\n<p><a href="https://i.sstatic.net/gD3rJ.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gD3rJ.gif" alt="enter image description here" /></a></p>\n<p>We can lower the priority of the leading/trailing constraints from the label to the &quot;green view&quot; and add <strong>required</strong> constraints between the label and the superview:</p>\n<p><a href="https://i.sstatic.net/zGrcu.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zGrcu.gif" alt="enter image description here" /></a></p>\n<p>This may end up looking a little &quot;un-balanced&quot; -- so we can add in one more piece of logic... we'll use the wider &quot;gap&quot; on the left/right of the &quot;green view&quot; and the superview to give priority to the layout:</p>\n<p><a href="https://i.sstatic.net/MJ4Ox.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/MJ4Ox.gif" alt="enter image description here" /></a></p>\n<p>Here is some sample code...</p>\n<hr />\n<p><strong>AttachedLabelView.h</strong></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n@interface AttachedLabelView : UIView\n@property (strong, nonatomic) UILabel *attachedLabel;\n@end\nNS_ASSUME_NONNULL_END\n</code></pre>\n<hr />\n<p><strong>AttachedLabelView.m</strong></p>\n<pre><code>#import &quot;AttachedLabelView.h&quot;\n\n@interface AttachedLabelView ()\n{\n UILabel *myLabel;\n NSLayoutConstraint *labelLeading;\n NSLayoutConstraint *labelTrailing;\n NSLayoutConstraint *limitLabelLeading;\n NSLayoutConstraint *limitLabelTrailing;\n}\n\n@end\n\n@implementation AttachedLabelView\n\n- (void)setAttachedLabel:(UILabel *)attachedLabel {\n\n // make sure this is set\n attachedLabel.translatesAutoresizingMaskIntoConstraints = NO;\n \n // initialize leading and trailing constraints\n // these will be toggled so the label is either\n // aligned with the leading edge, or\n // aligned with the trailing edge\n labelLeading = [attachedLabel.leadingAnchor constraintEqualToAnchor:self.leadingAnchor];\n labelTrailing = [attachedLabel.trailingAnchor constraintEqualToAnchor:self.trailingAnchor];\n labelLeading.priority = UILayoutPriorityDefaultHigh;\n labelTrailing.priority = UILayoutPriorityDefaultHigh;\n\n // label will always be &quot;pinned&quot; to the bottom of self\n [attachedLabel.topAnchor constraintEqualToAnchor:self.bottomAnchor].active = YES;\n \n myLabel = attachedLabel;\n \n [self setNeedsLayout];\n}\n- (UILabel *)attachedLabel {\n return myLabel;\n}\n- (void)layoutSubviews {\n [super layoutSubviews];\n \n UIView *sv = self.superview;\n UILabel *myLabel = self.attachedLabel;\n \n // don't try to do anything if we don't have\n // a superview AND an &quot;attached&quot; label\n if (!sv || !myLabel) {\n return;\n }\n \n // if not yet set, do so now\n // these constraints prevent the label from extending outside the superview frame\n if (!limitLabelLeading) {\n limitLabelLeading = [myLabel.leadingAnchor constraintGreaterThanOrEqualToAnchor:sv.leadingAnchor];\n limitLabelLeading.active = YES;\n limitLabelTrailing = [myLabel.trailingAnchor constraintLessThanOrEqualToAnchor:sv.trailingAnchor];\n limitLabelTrailing.active = YES;\n }\n \n // disable both constraints\n labelLeading.active = NO;\n labelTrailing.active = NO;\n \n // get self's &quot;left&quot; and &quot;right&quot;\n CGFloat myMinX = CGRectGetMinX(self.frame);\n CGFloat myMaxX = CGRectGetMaxX(self.frame);\n \n // get the widths of the\n // leading &quot;empty space&quot; and\n // trailing &quot;empty space&quot;\n CGFloat leadingGap = myMinX;\n CGFloat trailingGap = sv.frame.size.width - myMaxX;\n \n // the logic:\n // IF the label is too long to fit in the superview when &quot;left-aligned&quot;\n // AND\n // IF there is more space on &quot;my left&quot; than on &quot;my right&quot;\n // then we use the Trailing constraint\n \n if (myMinX + myLabel.intrinsicContentSize.width &gt; sv.frame.size.width) {\n if (leadingGap &gt; trailingGap) {\n labelTrailing.active = YES;\n }\n }\n \n labelLeading.active = !labelTrailing.active;\n}\n\n@end\n</code></pre>\n<hr />\n<p><strong>SimpleExampleViewController.h</strong> - <em>simple example showing usage...</em></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n@interface SimpleExampleViewController : UIViewController\n@end\nNS_ASSUME_NONNULL_END\n</code></pre>\n<hr />\n<p><strong>SimpleExampleViewController.m</strong></p>\n<pre><code>#import &quot;SimpleExampleViewController.h&quot;\n#import &quot;AttachedLabelView.h&quot;\n\n@interface SimpleExampleViewController ()\n{\n UIView *dashboardView;\n AttachedLabelView *exampleView;\n UILabel *someLabel;\n}\n@end\n\n@implementation SimpleExampleViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n\n // change the string and the x-position to see the differences\n NSString *sample = @&quot;This string is a little longer.&quot;;\n CGFloat xPos = 40.0;\n \n self.view.backgroundColor = UIColor.systemBackgroundColor;\n \n dashboardView = [UIView new];\n dashboardView.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0];\n \n exampleView = [AttachedLabelView new];\n exampleView.backgroundColor = UIColor.systemGreenColor;\n \n someLabel = [UILabel new];\n someLabel.backgroundColor = UIColor.cyanColor;\n \n dashboardView.translatesAutoresizingMaskIntoConstraints = NO;\n exampleView.translatesAutoresizingMaskIntoConstraints = NO;\n someLabel.translatesAutoresizingMaskIntoConstraints = NO;\n \n // add the custom view and label to the dashboardView\n [dashboardView addSubview:exampleView];\n [dashboardView addSubview:someLabel];\n \n // add dashboardView\n [self.view addSubview:dashboardView];\n \n UILayoutGuide *g = self.view.safeAreaLayoutGuide;\n \n [NSLayoutConstraint activateConstraints:@[\n\n [dashboardView.topAnchor constraintEqualToAnchor:g.topAnchor constant:20.0],\n [dashboardView.heightAnchor constraintEqualToConstant:140.0],\n [dashboardView.widthAnchor constraintEqualToConstant:340.0],\n [dashboardView.centerXAnchor constraintEqualToAnchor:g.centerXAnchor],\n\n [exampleView.widthAnchor constraintEqualToConstant:120.0],\n [exampleView.heightAnchor constraintEqualToConstant:80.0],\n [exampleView.topAnchor constraintEqualToAnchor:dashboardView.topAnchor constant:20.0],\n [exampleView.leadingAnchor constraintEqualToAnchor:dashboardView.leadingAnchor constant:xPos],\n\n ]];\n\n someLabel.text = sample;\n\n // &quot;attach&quot; the label to exampleView\n [exampleView setAttachedLabel:someLabel];\n\n}\n\n@end\n</code></pre>\n<hr />\n<p><strong>AttachExampleViewController.h</strong> - <em>a more complex example, showing usage with &quot;draggable&quot; green view and &quot;tap to cycle&quot; through sample labels...</em></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n@interface AttachExampleViewController : UIViewController\n@end\nNS_ASSUME_NONNULL_END\n</code></pre>\n<hr />\n<p><strong>AttachExampleViewController.m</strong></p>\n<pre><code>#import &quot;AttachExampleViewController.h&quot;\n#import &quot;AttachedLabelView.h&quot;\n\n@interface AttachExampleViewController ()\n{\n UIView *dashboardView;\n AttachedLabelView *exampleView;\n UILabel *someLabel;\n NSMutableArray &lt;NSString *&gt;*samples;\n NSLayoutConstraint *evTopConstraint;\n NSLayoutConstraint *evLeadingConstraint;\n}\n@end\n\n@implementation AttachExampleViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n \n // some sample strings to cycle through\n samples = [NSMutableArray arrayWithObjects:\n @&quot;Sample string.&quot;,\n @&quot;This string is a little longer.&quot;,\n @&quot;Might extend outside the superview.&quot;,\n nil\n ];\n \n self.view.backgroundColor = UIColor.systemBackgroundColor;\n \n dashboardView = [UIView new];\n dashboardView.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0];\n \n exampleView = [AttachedLabelView new];\n exampleView.backgroundColor = UIColor.systemGreenColor;\n \n someLabel = [UILabel new];\n someLabel.backgroundColor = UIColor.cyanColor;\n \n dashboardView.translatesAutoresizingMaskIntoConstraints = NO;\n exampleView.translatesAutoresizingMaskIntoConstraints = NO;\n someLabel.translatesAutoresizingMaskIntoConstraints = NO;\n\n // add the custom view and label to the dashboardView\n [dashboardView addSubview:exampleView];\n [dashboardView addSubview:someLabel];\n \n // add dashboardView\n [self.view addSubview:dashboardView];\n\n UILayoutGuide *g = self.view.safeAreaLayoutGuide;\n \n [NSLayoutConstraint activateConstraints:@[\n [dashboardView.topAnchor constraintEqualToAnchor:g.topAnchor constant:20.0],\n [dashboardView.heightAnchor constraintEqualToConstant:140.0],\n [dashboardView.widthAnchor constraintEqualToConstant:340.0],\n [dashboardView.centerXAnchor constraintEqualToAnchor:g.centerXAnchor],\n ]];\n \n // add a &quot;prompt&quot; label\n UILabel *pLabel = [UILabel new];\n pLabel.numberOfLines = 0;\n pLabel.textAlignment = NSTextAlignmentCenter;\n pLabel.text = @&quot;Tap outside the gray \\&quot;dashboard\\&quot; view\\nto cycle through the sample strings.&quot;;\n pLabel.translatesAutoresizingMaskIntoConstraints = NO;\n [self.view addSubview:pLabel];\n\n [NSLayoutConstraint activateConstraints:@[\n [pLabel.topAnchor constraintEqualToAnchor:dashboardView.bottomAnchor constant:20.0],\n [pLabel.leadingAnchor constraintEqualToAnchor:dashboardView.leadingAnchor],\n [pLabel.trailingAnchor constraintEqualToAnchor:dashboardView.trailingAnchor],\n ]];\n\n // start with exampleView at 20,40\n evTopConstraint = [exampleView.topAnchor constraintEqualToAnchor:dashboardView.topAnchor constant:20.0];\n evLeadingConstraint = [exampleView.leadingAnchor constraintEqualToAnchor:dashboardView.leadingAnchor constant:40.0];\n \n // this avoids auto-layout console warnings\n evTopConstraint.priority = UILayoutPriorityRequired - 1;\n evLeadingConstraint.priority = UILayoutPriorityRequired - 1;\n\n [NSLayoutConstraint activateConstraints:@[\n evTopConstraint, evLeadingConstraint,\n [exampleView.widthAnchor constraintEqualToConstant:120.0],\n [exampleView.heightAnchor constraintEqualToConstant:80.0],\n ]];\n \n // we're making exampleView draggable\n UIPanGestureRecognizer *p = [UIPanGestureRecognizer new];\n [p addTarget:self action:@selector(handlePan:)];\n [exampleView addGestureRecognizer:p];\n \n // &quot;attach&quot; the label to exampleView\n [exampleView setAttachedLabel:someLabel];\n \n // update the label text\n [self nextString];\n}\n\n- (void)handlePan:(UIPanGestureRecognizer *)p {\n\n UIView *v = p.view;\n UIView *sv = v.superview;\n CGPoint pt = [p translationInView:v];\n [p setTranslation:CGPointZero inView:v];\n \n // let's prevent dragging the exampleView outside of the dashboardView frame\n CGFloat xMax = sv.frame.size.width - v.frame.size.width;\n CGFloat yMax = sv.frame.size.height - (v.frame.size.height + someLabel.frame.size.height);\n\n CGFloat x = evLeadingConstraint.constant + pt.x;\n CGFloat y = evTopConstraint.constant + pt.y;\n\n evLeadingConstraint.constant = MIN(xMax, MAX(x, 0.0));\n evTopConstraint.constant = MIN(yMax, MAX(y, 0.0));\n\n // tell exampleView to update the label position (if necessary)\n [exampleView setNeedsLayout];\n}\n\n- (void)touchesBegan:(NSSet&lt;UITouch *&gt; *)touches withEvent:(UIEvent *)event {\n UITouch *t = [touches anyObject];\n CGPoint p = [t locationInView:self.view];\n if (CGRectContainsPoint(dashboardView.frame, p)) {\n return;\n }\n // if we tap outside of dashboardView, cycle to the next sample string\n [self nextString];\n}\n- (void)nextString {\n NSString *s = [samples firstObject];\n [samples removeObject:s];\n [samples addObject:s];\n someLabel.text = s;\n\n // tell exampleView to update the label position (if necessary)\n [exampleView setNeedsLayout];\n}\n\n@end\n</code></pre>\n"^^ . "0"^^ . . "<p>I'm experiencing an issue where <code>kAudioDevicePropertyDeviceIsRunningSomewhere</code> is not returning the expected values for wireless audio devices such as AirPods. The expected behavior is to return 1 when the device is in use and 0 when it is not. However, even when the device is actively being used, it consistently returns 0.</p>\n<p>This problem seems to be a common one, as evidenced by discussions on platforms like the Apple Developer Forums and Stack Overflow.</p>\n<p><a href="https://developer.apple.com/forums/thread/741026" rel="nofollow noreferrer">https://developer.apple.com/forums/thread/741026</a></p>\n<p><a href="https://stackoverflow.com/questions/39574616/how-to-detect-microphone-usage-on-os-x">How to detect microphone usage on OS X?</a></p>\n<p>I have attempted various methods to retrieve the correct value of <code>kAudioDevicePropertyDeviceIsRunningSomewhere</code> for wireless devices but have not been successful. One peculiar observation is that when I use <code>ListenerBlock</code> on <code>kAudioDevicePropertyDeviceIsRunningSomewhere</code>, the <code>ListenerBlock</code> is triggered, which is strange given that the property always reports the device as inactive, meaning &quot;0&quot;.</p>\n<p>Can anyone provide insights or solutions on how to accurately obtain the <code>kAudioDevicePropertyDeviceIsRunningSomewhere</code> value for wireless audio devices?</p>\n"^^ . "<p>I have an <code>AVCaptureDevice</code> object at hand and would like to print the maximum supported photo dimensions as provided by <code>activeFormat.supportedMaxPhotoDimensions</code> (*), using Objective C. I tried the following:</p>\n<pre><code>for (NSValue *obj in device.activeFormat.supportedMaxPhotoDimensions) {\n CMVideoDimensions *vd = (__bridge CMVideoDimensions *)obj;\n NSString *s = [NSString stringWithFormat:@&quot;res=%d:%d&quot;, vd-&gt;width, vd-&gt;height];\n //print that string\n}\n</code></pre>\n<p>If I run this code, I get:</p>\n<pre><code>res=314830880:24994\n</code></pre>\n<p>This is way too high, and there is obviously something I am doing wrong, but I don't know what it could be? According to the information I see on the web, I should get something closer to <code>4000:3000</code>.</p>\n<p>I can successfully read <code>device.activeFormat.videoFieldOfView</code> and other fields, so I believe my code is sound overall.</p>\n<p>(*) <a href="https://developer.apple.com/documentation/avfoundation/avcapturedevice/format/3967581-supportedmaxphotodimensions" rel="nofollow noreferrer">https://developer.apple.com/documentation/avfoundation/avcapturedevice/format/3967581-supportedmaxphotodimensions</a></p>\n"^^ . "Both answers were great, but this was especially clarifying. I was actually trying to ask question 3 on here too, but was probably not clear enough. Thanks!"^^ . . "WebRTC doesn't generate ICE candidates for video in incoming video call for iOS"^^ . . . "0"^^ . . "When I try that I get: `Type 'NotificationCenter' has no member 'shared'`"^^ . . . . . "Also... > "This is the requirement for some reason" < If I were you, I would try to figure out what this reason is, because it shouldn't be necessary to do what you're doing."^^ . . "core-graphics"^^ . . . . . . . . "2"^^ . . . "-1"^^ . . . "@dalton_c I have tried adding \n#import <FingerprintScanSDK/FingerprintSDKWrapper.h> but I am getting an error "'FingerprintScanSDK/FingerprintSDKWrapper.h' file not found""^^ . . "Great answer! Finally my opus player works!"^^ . "Does this answer your question? [Detect volume button press](https://stackoverflow.com/questions/28471481/detect-volume-button-press)"^^ . . . . "Hmm. This has not been my experience. The actor isolation has always worked fine for me when called from Objective-C. If you have a chance, I’d love to see MRE where actor-isolation is not honored. IMHO, the only major annoyance that you cannot expose non-`async` isolated methods via `@objc` (as discussed in the [SE-0297](https://github.com/apple/swift-evolution/blob/main/proposals/0297-concurrency-objc.md#actor-classes))."^^ . . . "0"^^ . "0"^^ . "nslog"^^ . . . . "<p>I recieve no errors, my app runs with no errors. None of the events are triggered at sleep / wake or when the listened are registered.</p>\n<p>What am I doing wrong here? Thanks!</p>\n<pre><code>import SwiftUI\n\n@main\nstruct NotificationsApp: App {\n var body: some Scene {\n WindowGroup {\n ContentView()\n }\n }\n \n class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {\n \n func applicationDidFinishLaunching(_ aNotification: Notification) {\n NSWorkspace.shared.notificationCenter.addObserver(self, selector: Selector((&quot;sleepListener&quot;)), name: NSWorkspace.willSleepNotification, object: nil)\n NSWorkspace.shared.notificationCenter.addObserver(self, selector: Selector((&quot;wakeUpListener&quot;)), name: NSWorkspace.didWakeNotification, object: nil)\n }\n\n @objc private func sleepListener(_ aNotification: Notification) {\n print(&quot;listening to sleep&quot;)\n \n if aNotification.name == NSWorkspace.willSleepNotification {\n print(&quot;Going to sleep&quot;)\n } else if aNotification.name == NSWorkspace.didWakeNotification {\n print(&quot;Woke up&quot;)\n } else {\n print(&quot;Some other event other than the first two&quot;)\n }\n }\n }\n}\n\nfunc sleepListener() {\n print(&quot;Sleep Listening&quot;);\n}\n\nfunc wakeUpListener() {\n print(&quot;Wake Up Listening&quot;);\n}\n</code></pre>\n"^^ . . . "2"^^ . . . . "<p><a href="https://macvim.org/" rel="nofollow noreferrer">MacVim</a> is a macOS application with a file open dialog that calls <a href="https://developer.apple.com/documentation/appkit/nsopenpanel" rel="nofollow noreferrer">NSOpenPanel</a> with a simple view to show hidden files (see <a href="https://github.com/macvim-dev/macvim/blob/master/src/MacVim/MMAppController.m" rel="nofollow noreferrer">MMAppController.m's fileOpen method</a> and <a href="https://github.com/macvim-dev/macvim/blob/master/src/MacVim/Miscellaneous.m" rel="nofollow noreferrer">Miscellaneous.m's showHiddenFilesView method</a>).</p>\n<p>When I open files with MacVim, I can use ⌘A to select all files. But I don't see what it's doing that's any different than what I do below, which does <em>not</em> allow me to use ⌘A to select all files.</p>\n<pre><code>NSOpenPanel *panel = [NSOpenPanel openPanel];\n[panel setCanChooseFiles:YES];\n[panel setCanChooseDirectories:YES];\n[panel setAllowsMultipleSelection:YES];\nif ([panel runModal] == NSModalResponseOK) {\n for ( NSURL* URL in [panel URLs] ) {\n NSLog( @&quot;%@&quot;, [URL path] );\n }\n} else {\n NSLog( @&quot;ok button not pressed&quot;);\n}\n</code></pre>\n<p>The docs for <code>NSOpenPanel</code> and <a href="https://developer.apple.com/documentation/appkit/nssavepanel" rel="nofollow noreferrer">NSSavePanel</a>, which <code>NSOpenPanel</code> inherits don't make any mention of key bindings or other booleans that I might set. The only thing that I saw that might be useful is a custom view but MacVim doesn't appear to be doing anything with <code>NSView</code> that relates.</p>\n<p>Below is the entire MCV example and how it's compiled. I suspect there's something wrong with the example since I have to click the graphics rectangle first before I can get the open panel to behave. But I don't think that's having an effect on the key bindings.</p>\n<pre><code>#import &lt;Cocoa/Cocoa.h&gt;\n\nvoid openDialog () {\n @try {\n NSOpenPanel *panel = [NSOpenPanel openPanel];\n [panel setCanChooseFiles:YES];\n [panel setCanChooseDirectories:YES];\n [panel setAllowsMultipleSelection:YES];\n if ([panel runModal] == NSModalResponseOK) {\n for ( NSURL* URL in [panel URLs] ) {\n NSLog( @&quot;%@&quot;, [URL path] );\n }\n } else {\n NSLog( @&quot;ok button not pressed&quot;);\n }\n } @catch (NSException *exception) {\n NSLog(@&quot;%@&quot;, [exception callStackSymbols]);\n }\n}\n\nvoid setup () {\n NSWindow *myWindow;\n NSRect graphicsRect = NSMakeRect(100.0, 350.0, 400.0, 400.0);\n\n myWindow = [ [NSWindow alloc]\n initWithContentRect: graphicsRect\n styleMask:NSWindowStyleMaskTitled\n |NSWindowStyleMaskClosable\n |NSWindowStyleMaskMiniaturizable\n backing:NSBackingStoreBuffered\n defer:NO ];\n\n [myWindow setTitle:@&quot;Open File App&quot;];\n [myWindow makeKeyAndOrderFront: nil];\n openDialog();\n}\n\nint main ( ) {\n NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];\n NSApp = [NSApplication sharedApplication];\n setup();\n [NSApp run];\n [NSApp release];\n [pool release];\n return(EXIT_SUCCESS);\n}\n\ngcc -o $@ -framework Cocoa -isysroot $(SDK) -fobjc-exceptions -std=c99 ofdtest.m\n</code></pre>\n<p>EDIT 1</p>\n<p>My macOS version is Sonoma 14.2.1.\nMy Xcode version is 15.2 (15C500b).\nI'm using SDK /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk</p>\n<p>I'm running the built MCV in iTerm2 but I don't think that matters.</p>\n"^^ . . . . "0"^^ . . . . "Unknown header indicates the first bytes of the cipher text are incorrect. Looking at your ObjC encryptor and Swift decryptor, they look fine. My suspicion is that the output of the ObjC encryptor is not actually what you're reading. I would dig into that ; making sure the output of one is exactly the input of the other, and that you're using the same version of RNCryptor in both cases (which it seems like you are; I suspect a reading or writing problem)."^^ . . "-1"^^ . . "System components simply implement the standard selectAll: responder method. In a normal app, the default Edit NSMenu would exist, which is the class which turns an actual Command-A keystroke into a sendAction: call to NSApplication to invoke selectAll: on the first responder in the responder chain which implements it. It's not the job of every system component to know about key bindings, and keep them consistent. There is even a system preference where users can override default key bindings for themselves across apps. NSMenu handles all that."^^ . "apple-tv"^^ . . "1"^^ . . "1"^^ . . "0"^^ . . "0"^^ . . . "So NSURLSession is something distinct then? I have no choice but to use php for this, it’s not directly readable in my app code?"^^ . . . "format-specifiers"^^ . . . . . "0"^^ . . "0"^^ . . . "`NSOpenPanel` is designed to be used in an app and doesn't support Select All. `selectAll:` is implemented by `NSBrowser`, `NSOutlineView` and `NSCollectionView`. Try Command-Z, X, C and V in the search field."^^ . . . . "cocoa"^^ . "1"^^ . . . "<p>In this instance, you'll want to convert the <code>NSValue</code> to <code>CMVideoDimensions</code> using its <code>getValue</code> method.</p>\n<pre><code>for (NSValue *obj in device.activeFormat.supportedMaxPhotoDimensions)\n{\n CMVideoDimensions vd;\n [obj getValue:&amp;vd];\n \n NSString *s = [NSString stringWithFormat:@&quot;res=%d:%d&quot;, vd.width, vd.height];\n //print that string\n}\n</code></pre>\n"^^ . . . "5"^^ . "@matt I need to do both simultaneously, the scale code I have is working on its own and as shown, it flips it, just repositions it out of the view and I don't know how to get it back in."^^ . "<p>I have a Swift Framework and I want to add an Objective C wrapper to access from Objective C project (This is the requirement for some reason).</p>\n<p>I have wrapped up the Swift class to support in Objective as well.\nI have created XCFramework and import it in the project.\nNow I am encountering challenges in accessing an Objective-C class in Objective C, however I can access the Swift Classes.</p>\n<p>Any insights or solutions would be greatly appreciated.</p>\n<p>Here is my code of Objective C class in Framework</p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n#import &quot;FingerprintSDK/FingerprintSDK.h&quot;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface FingerprintSDKWrapper : NSObject\n+ (instancetype)sharedInstance;\n- (void)scanFingerprintWithKeywindow:(UIWindow *)window compeltion:(void (^)(NSArray&lt;Images *&gt; *resultArray))completion;\n\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n"^^ . . . . "0"^^ . . . . . . "How to correctly position graphic after flipping it"^^ . "Thanks @RobNapier for providing such an awesome library. Appreciate your assistance. It decrypts and decodes perfectly in obj-c version. So I am not sure what’s happening in swift version. Anything to do with “kRNCryptorAES256Settings” which used during encrypting in obj-c?"^^ . "autocomplete"^^ . . "decode"^^ . "1"^^ . . . "The answer down here fixed the problem"^^ . . . . "<p>I'm trying to establish a connection between two devices using mobile network. The config in both devices are ok allowing use mobile data for the app.\nI'm able to connect and start the game with WIFI networ</p>\n<pre><code>`// Initiate matchmaking\n- (void)initiateMatchmakingWithViewController:(UIViewController*)rustViewController {\n dispatch_async(dispatch_get_main_queue(), ^{\n if (![GKLocalPlayer localPlayer].isAuthenticated) {\n NSLog(@&quot;Player is not authenticated.&quot;);\n return;\n }\n\n NSLog(@&quot;Preparing MatchMaker&quot;);\n GKMatchRequest *request = [[GKMatchRequest alloc] init];\n request.minPlayers = 2;\n request.maxPlayers = 2;\n\n GKMatchmakerViewController *mmvc = [[GKMatchmakerViewController alloc] initWithMatchRequest:request];\n mmvc.matchmakerDelegate = self;\n\n // Use the passed view controller to present the matchmaking UI\n [rustViewController presentViewController:mmvc animated:YES completion:nil];\n NSLog(@&quot;MatchMaker running....&quot;);\n\n // Store the rustViewController for later, to revert back to it\n originalViewController = rustViewController;\n });\n}\n\n\n// GKMatchmakerViewControllerDelegate methods\n- (void)matchmakerViewControllerWasCancelled:(GKMatchmakerViewController *)viewController {\n [originalViewController dismissViewControllerAnimated:YES completion:nil];\n NSLog(@&quot;Matchmaking was cancelled.&quot;);\n}\n\n- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFailWithError:(NSError *)error {\n [originalViewController dismissViewControllerAnimated:YES completion:nil];\n NSLog(@&quot;Matchmaking failed with error: %@&quot;, error.localizedDescription);\n}\n\n- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFindMatch:(GKMatch *)match {\n [originalViewController dismissViewControllerAnimated:YES completion:nil];\n self.currentMatch = match;\n match.delegate = self;\n NSLog(@&quot;Match found.&quot;);\n\n // Fetch details for each player in the match\n NSMutableArray&lt;NSString *&gt; *playerIDs = [NSMutableArray array];\n for (GKPlayer *player in match.players) {\n [playerIDs addObject:player.playerID];\n }\n\n [GKPlayer loadPlayersForIdentifiers:playerIDs withCompletionHandler:^(NSArray&lt;GKPlayer *&gt; *players, NSError *error) {\n if (error) {\n NSLog(@&quot;Error retrieving player details: %@&quot;, error.localizedDescription);\n return;\n }\n\n for (GKPlayer *player in players) {\n if (![player.playerID isEqualToString:GKLocalPlayer.localPlayer.playerID]) {\n [self loadAndStoreAvatarForRemotePlayer:player];\n }\n }\n }];\n}`\n</code></pre>\n<p>I can see how both clients are in state &quot;connecting&quot; but the log &quot;Match found.&quot; it's never set.\nI also can see this log &quot;[Match] syncPlayers failed to loadPlayersForLegacyIdentifiers&quot;\nGameKit</p>\n"^^ . . . . . . . "0"^^ . "0"^^ . . "php"^^ . . "ios"^^ . "2"^^ . . "This is not even the right answer. The real answer is to make sure that alignment on different vectors structs that you defined is the same across the places that it gets included."^^ . . "0"^^ . . "0"^^ . "0"^^ . . "0"^^ . "0"^^ . "0"^^ . . . . "0"^^ . . "0"^^ . . . "1"^^ . . . . . . "1"^^ . . "0"^^ . "0"^^ . . "0"^^ . . . . . . . . "same issue with me"^^ . . "Thanks, it's all good after setting the variables in the Schemem"^^ . . . "0"^^ . . "1"^^ . "2"^^ . . . "Matchmaker connecting issues on Mobile network"^^ . . "0"^^ . "0"^^ . . . "<p>The <code>atomic</code> keyword is about the <em>storage</em> about the property itself, e.g. in this case, the <code>SomeActor *</code> pointer. All it guarantees is that changes to the pointer are done atomically.</p>\n<p>It has nothing to do with the semantics of the pointed-to thing, such as your actor.</p>\n<p>It's not often that I find that my synchronization issues are about settings specific fields. It's usually about synchronizing entire objects or collections, so I find the whole <code>atomic</code> feature pretty dubious. I just always go <code>nonatomic</code>.</p>\n"^^ . "0"^^ . "0"^^ . "You could try creating a NSMenu with that item (or more) and assign it to the NSApp.mainMenu property, to see if that works in your situation. Probably a good idea to have cut/copy/paste too."^^ . "1"^^ . . "Ad did fail to present full screen content while showing Interstitial Google ads shows the error for me in iOS objective -C"^^ . . . "But the std::array I don't think is a problem, because it will pack the floats together, WITHIN a single vector which is what `vector_floatx` also does."^^ . . . "-1"^^ . "Flipping is one thing, resizing is another. Which do you want to do?"^^ . "1"^^ . "Yes, if you create both in the XIB. The missing connector is because you didn't make `delegate` and IBOutlet, which is typically how you do that. (If you're not wiring it in the XIB, where are you setting `delegate`? If you never set it, it's going to be nil, right?)"^^ . "0"^^ . . . "0"^^ . "0"^^ . . . . "0"^^ . . . "Where do you ever assign a non-nil value to the `delegate` property of a `SquareView` instance?"^^ . "That looks promising. Could you share the full project?"^^ . . . "0"^^ . "@Konrad I will try to contact Apple's code level support and see if they can help me with that, then I post here whatever they tell me."^^ . . "2"^^ . "0"^^ . . . . "Thanks for your suggestion, I tried to remove `.sign()` , but the error was still the same @Robert"^^ . . . "How to access the storyboard of an SDK?"^^ . "If I understand it correctly `cfunc` is an ObjC method that returns a point of a C-function? Why do you execute `sign()` on the pointer? That doesn't make sense to me. It would make more sense to me without `.sign()`. Then you define the native method and call it with the three zero arguments."^^ . "<p>I am trying to build a program where the MainController uses a delegate to pass data into a table inside TableViewController. I think I've initialized it correctly but LoadSN() does not trigger the delegate function (I do see it run). Does the initialization of the MainController and the TableViewController not playing well together? (maybe I am not understanding the order of initialization?)</p>\n<p>MainController.h</p>\n<pre><code>#import &lt;Cocoa/Cocoa.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n@class MainController;\n@protocol MainDelegate &lt;NSObject&gt;\n\n- (void)addMainEntry:(NSString *)patchName :(NSString *)filename;\n\n@end\n@interface MainController : NSWindowController\n{\n@private\n IBOutlet NSTextField *status;\n IBOutlet NSTextField *serialNumber;\n}\n@property (nonatomic, weak) id&lt;MainDelegate&gt; delegate;\n-(IBAction)LoadSNBtn:(id)sender;\n-(IBAction)saveBtn:(id)sender;\n\n@end\nNS_ASSUME_NONNULL_END\n</code></pre>\n<p>MainController.m</p>\n<pre><code>#import &quot;MainController.h&quot;\n\n@implementation MainController\n\n@synthesize delegate;\n\n- (void)awakeFromNib\n{\n //NSLog(@&quot;%@&quot;,[status stringValue]);\n NSLog(@&quot;awakeFromNib MainController&quot;);\n NSString* msg = @&quot;Main Station: Scan or Enter Serial Number above.&quot;;\n msg = [NSString stringWithFormat:@&quot;%@\\n%@&quot;,[status stringValue], msg];\n [status setStringValue:msg];\n [status setDrawsBackground:YES];\n [status setSelectable:YES];\n}\n- (void)windowDidLoad {\n [super windowDidLoad];\n \n // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.\n}\n- (IBAction)LoadSNBtn:(id)sender\n{\n NSLog(@&quot;LoadSNBtn&quot;);\n [delegate addMainEntry:@&quot;LoadName&quot; :@&quot;LoadFilename&quot;];\n}\n- (IBAction)saveBtn:(id)sender\n{\n \n}\n@end\n</code></pre>\n<p>TableViewController.h</p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n#import &lt;Cocoa/Cocoa.h&gt;\n#import &quot;MainController.h&quot;\n#import &quot;mainImage.h&quot;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface TableViewController : NSObject &lt;NSTableViewDataSource, MainDelegate&gt;\n{\n @public\n IBOutlet NSTableView *tableView;\n NSMutableArray *imageList;\n}\n@property (copy) NSMutableArray *imageList;\n@property (weak) MainController *mainController;\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<p>TableViewController.m\n#import &quot;TableViewController.h&quot;</p>\n<pre><code>@implementation TableViewController\n@synthesize imageList = _imageList;\n@synthesize mainController = _mainController;\n\n-(id)init\n{\n self = [super init];\n if (self)\n {\n NSLog(@&quot;tableViewController init&quot;);\n [_mainController setDelegate:self];\n _imageList = [[NSMutableArray alloc] init];\n mainImage *mainEntry = [[mainImage alloc] init];\n [mainEntry setValue:@&quot;noFilename&quot; forKey:@&quot;filename&quot;];\n \n [_imageList addObject:mainEntry];\n\n }\n return self;\n}\n- (void)awakeFromNib\n{\n NSLog(@&quot;awakeFromNib TableViewController&quot;);\n\n}\n-(NSInteger)numberOfRowsInTableView:(NSTableView *)tableView\n{ // this needs to return the number of rows that the array has so tableView can display all of them\n //NSLog(@&quot;size: %i&quot;, [list count]);\n return [_imageList count];\n \n}\n-(id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row\n{ // need to pass in table column and row and return the right data to display\n mainImage *entry = [_imageList objectAtIndex:row];\n NSString *identifier = [tableColumn identifier]; // need to find the column, either name/age\n //NSLog(@&quot;identifier: %@&quot;, identifier);\n return [entry valueForKey:identifier];\n}\n-(void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(nullable NSTableColumn *)tableColumn row:(NSInteger)row\n{\n mainImage *entry = [_imageList objectAtIndex:row];\n NSString *identifier = [tableColumn identifier];\n \n [entry setValue:object forKey:identifier];\n}\n-(void)addMainEntry:(NSString *)patchName :(NSString *)filename\n{\n NSLog(@&quot;inside adding main entry&quot;);\n [_imageList addObject:[[mainImage alloc] init]];\n mainImage *entry = [_imageList objectAtIndex:0];\n [entry setValue:patchName forKey:@&quot;patchName&quot;];\n [entry setValue:filename forKey:@&quot;filename&quot;];\n //NSLog(@&quot;name: %@ filename: %@&quot;, [entry valueForKey:@&quot;patchName&quot;], [entry valueForKey:@&quot;filename&quot;]);\n \n [tableView reloadData];\n}\n@end\n</code></pre>\n"^^ . . "0"^^ . "Is there a way to be notified any time a drag-and-drop operation begins in the current application?"^^ . "1"^^ . . "localization"^^ . . . . . . . . . "2"^^ . "<p>I try to implement a custom Cocoa main loop for my app using <a href="https://developer.apple.com/metal/cpp/" rel="nofollow noreferrer">metal-cpp</a> (the source code is also available <a href="https://github.com/LeeTeng2001/metal-cpp-cmake" rel="nofollow noreferrer">here</a>) wrapper.</p>\n<p>The first step is to write a something like:</p>\n<pre><code>[NSThread detachNewThreadSelector:@selector(doNothing:)\n toTarget:stubTarget\n withObject:nil];\n</code></pre>\n<p>To run a stub selector (the solution is based on GLFW source code).</p>\n<p>The <strong>metal-cpp</strong> doesn't contain <code>NSThread</code> class, so I've implemented it:</p>\n<p><strong>metal-cpp/Foundation/NSThread.hpp:</strong></p>\n<pre><code>#pragma once\n\n#include &lt;functional&gt;\n\n#include &quot;NSObject.hpp&quot;\n\nnamespace NS\n{\n\nclass Runnable\n{\npublic:\n virtual ~Runnable() {}\n virtual void run() {}\n};\n\nclass Thread: public NS::Referencing&lt; Thread &gt;\n{\npublic:\n static void detachNewThread( const Runnable* pRunnable );\n};\n\n_NS_INLINE void NS::Thread::detachNewThread( const Runnable* pRunnable )\n{\n NS::Value* pWrapper = NS::Value::value( pRunnable );\n\n typedef void (*DispatchFunction)( NS::Value*, SEL, void* );\n \n DispatchFunction run = []( Value* pSelf, SEL, void* unused )\n {\n auto pDel = reinterpret_cast&lt; NS::Runnable* &gt;( pSelf-&gt;pointerValue() );\n pDel-&gt;run();\n };\n\n return Object::sendMessage&lt;void&gt;(_NS_PRIVATE_CLS(NSThread), _NS_PRIVATE_SEL(detachNewThreadSelector_toTarget_withObject_), run, pWrapper, nullptr );\n}\n\n}\n</code></pre>\n<p>Also I've registered new <code>_NS_PRIVATE_SEL</code> variants in <strong>metal-cpp/Foundation/NSPrivate.hpp</strong>:</p>\n<pre><code>_NS_PRIVATE_DEF_SEL(detachNewThreadSelector_toTarget_withObject_,\n &quot;detachNewThreadSelector:toTarget:withObject:&quot;);\n</code></pre>\n<p>Finally, I've included <code>NSThread</code> into the main header <code>metal-cpp/Foundation/Foundation.hpp</code>.</p>\n<p>The source code of <code>NSThread</code> was written researching a source code of <code>NSApplication</code> and <a href="https://developer.apple.com/documentation/foundation/nsthread/1415633-detachnewthreadselector" rel="nofollow noreferrer">Apple references</a>. I don't know Objective-C and its code is a little magic for me.</p>\n<p>Later, I call <code>NSThread::detachNewThread()</code> in my app:</p>\n<pre><code>class MainLoopTarget: public NS::Runnable\n{\n public:\n void run() override\n {\n std::cout &lt;&lt; &quot;run()&quot; &lt;&lt; std::endl;\n }\n};\n\nauto target = new MainLoopTarget();\nNS::AutoreleasePool* autorelease_pool = NS::AutoreleasePool::alloc()-&gt;init();\n\nNS::Thread::detachNewThread(target);\n\nautorelease_pool-&gt;release();\ndelete target;\n</code></pre>\n<p>And it crashes with errors:</p>\n<pre><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSThread initWithTarget:selector:object:]: target does not implement selector ((null))'\n*** First throw call stack:\n(\n 0 CoreFoundation 0x00000001856aeccc __exceptionPreprocess + 176\n 1 libobjc.A.dylib 0x0000000185196788 objc_exception_throw + 60\n 2 Foundation 0x00000001867641d0 -[NSThread setQualityOfService:] + 0\n 3 Foundation 0x00000001867c1118 +[NSThread detachNewThreadSelector:toTarget:withObject:] + 60\n 4 libb3engine.dylib 0x000000010506bb88 _ZN2b38platform6darwin9DarwinApp5startEv + 336\n 5 B3 0x0000000104b7dd4c main + 252\n 6 dyld 0x00000001851d20e0 start + 2360\n)\nlibc++abi: terminating due to uncaught exception of type NSException\n</code></pre>\n<p>I understand there is a problem with the class method's parameters but my skills in Objective-C are not enough to get where and what.</p>\n"^^ . . . . . . . "@MarekH I stated the reason in my question, 2nd paragraph. This happened in all macOS versions, not just Sonoma."^^ . "Your question is unclear. But `@"Ratings":[NSString stringWithFormat:@"[%@]",[self.ratings componentsJoinedByString:@","]]` seems a lot wrong to me..."^^ . . . . . . . "0"^^ . . "0"^^ . . . "session2 is the client with the userName, password and transport and connectsWithConnectHandler. I have put didEnterBackground in my code and tried it with the added code but nothing happens. There is a didEnterBackground in the AppDelegate that works but since the Session2 is created in the main ViewController I can't put it into the AppDelegate. I have tried to create session2 in the AppDelegate and use it in the ViewController but no go. Thanks"^^ . . "cgpath"^^ . . "1"^^ . . . . . . . "1"^^ . . "initialization order with delegates and multiple view controllers is not working"^^ . "5"^^ . . "0"^^ . . "0"^^ . . "1"^^ . . . . . "Have you tried `[[NSWindowController alloc] initWithWindowNibName:@"GoWindow" owner:self]`? The File's Owner class is `AppDelegate`."^^ . "-1"^^ . "0"^^ . "In Xcode, select your project file, choose your target and select the 'Info' tab. This list 'Custom macOS Application Target properties' first, and then below, 'URL Types'. Click +, and set an identifier (reverse domain is recommended) [com.example.myApp], and set [myApp] as URL Schemes.\nIn the AppDelegate, implement -(BOOL) application:(NSApplication*)app continueUserActivity..... Run the app. In Safari, type [myApp://Open] and it asks to open the app."^^ . "<p>This looks like TableViewController is loaded from a Storyboard or XIB (given the IBOutlet annotation). <code>init</code> isn't going to be called in that case. You'll need to put your logic in <code>awakeFromNib</code>, as you do for MainController.</p>\n<p>You'll also need to make sure that you've actually wired the <code>delegate</code> property to TableViewController in the XIB. This is a very common thing to forget to do. Make sure that <code>delegate</code> isn't nil. If &quot;nothing happens&quot; then something is almost certainly nil.</p>\n"^^ . . . "0"^^ . "1"^^ . . . . "0"^^ . "5"^^ . "0"^^ . . . . . . "memory-management"^^ . . . . "<p>If you want to prepare a JSON request, you would use <a href="https://developer.apple.com/documentation/foundation/nsjsonserialization/" rel="nofollow noreferrer"><code>NSJSONSerialization</code></a>.</p>\n<p>But, first, I would advise not using <code>stringValue</code> when building your array of ratings. You want numbers as <code>NSNumber</code>:</p>\n<pre class="lang-objectivec prettyprint-override"><code>self.ratings = [[NSMutableArray alloc] init];\nfor (RatingQuestion *question in reviewQuestions) {\n [self.ratings addObject:@{\n @&quot;QuestionId&quot;: question.ID,\n @&quot;Rating&quot;: question.rating,\n }];\n}\n</code></pre>\n<p>Then, you want to build JSON, just put your <code>ratings</code> (an <code>NSArray</code> of <code>NSDictionary</code>) in the <code>params</code> dictionary (and, again, avoiding <code>stringValue</code> for <code>ustaID</code> and <code>jobID</code>):</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSDictionary *params = @{\n @&quot;Ratings&quot;: self.ratings,\n @&quot;Comment&quot;: self.comment,\n @&quot;UstaId&quot;: self.ustaID,\n @&quot;JobId&quot;: self.jobID\n};\n</code></pre>\n<p>Then, to build the JSON, use <code>NSJSONSerialization</code>:</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSError *error = nil;\nNSData *json = [NSJSONSerialization dataWithJSONObject:params options:NSJSONWritingPrettyPrinted error:&amp;error];\nif (!json) {\n NSLog(@&quot;error: %@&quot;, error);\n return;\n}\n</code></pre>\n<p>Now, you can use that <code>json</code> however you want. For example, you likely want to set the <code>HTTPBody</code> of an <code>NSMutableURLRequest</code>:</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];\n[request setValue:@&quot;application/json&quot; forHTTPHeaderField:@&quot;Content-Type&quot;];\nrequest.HTTPMethod = @&quot;POST&quot;;\nrequest.HTTPBody = json;\n</code></pre>\n<p>If you want to confirm that the JSON is what you expected (for debugging purposes), you can also create an <code>NSString</code> of that <code>NSData</code>:</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSString *string = [[NSString alloc] initWithData:json encoding:NSUTF8StringEncoding];\nNSLog(@&quot;%@&quot;, string);\n</code></pre>\n<p>Which will output:</p>\n<pre class="lang-json prettyprint-override"><code>{\n &quot;JobId&quot; : 564876565946,\n &quot;UstaId&quot; : 242816809697,\n &quot;Comment&quot; : &quot;test postman&quot;,\n &quot;Ratings&quot; : [\n {\n &quot;QuestionId&quot; : 3533,\n &quot;Rating&quot; : 4\n },\n {\n &quot;QuestionId&quot; : 9767,\n &quot;Rating&quot; : 4\n }\n ]\n}\n</code></pre>\n<p>Note, above I used the <a href="https://developer.apple.com/documentation/foundation/nsjsonwritingoptions/nsjsonwritingprettyprinted?language=objc" rel="nofollow noreferrer"><code>NSJSONWritingPrettyPrinted</code></a> option. Once you have confirmed that the JSON is what you want, you can use <code>0</code> or <code>kNilOptions</code> instead. But pretty-printed format is useful when visually inspecting the JSON for correctness.</p>\n<hr />\n<p>Note, the reason we make sure our <code>NSDictionary</code> has numeric values as <code>NSNumber</code> rather than <code>NSString</code>, is that <code>NSJSONSerialization</code> will put quotation marks around strings, but not around numeric values. Your Postman sample did not have quotation marks around the numeric values, so I assume you did not want your Objective-C code to introduce quotation marks, either.</p>\n"^^ . . . . . . . . . . "xcode"^^ . . "0"^^ . "0"^^ . . . . . . . "Sorry, I'm unclear as to what kind of answer you are looking for here (bearing in mind that requests for books etc are [off topic](https://stackoverflow.com/help/on-topic) here). Take a look at the [`mosquitto_sub` docs](https://mosquitto.org/man/mosquitto_sub-1.html); these will show you how to specify the server, username, password etc."^^ . . . . "0"^^ . . . "<p>I have two rather old app that use Objectiv-C-code, integrated with an Interface-Bridging-Header file.\nOne runs well on Sonoma, but the other has an NSViewViewController class using IBOutlets and IBActions in the Objective-C-Part. That run well in macos Monterey with Xcode 14. But now with Sonoma and Xcode15, the IBOutlets and the corresponding IBActions are not connected any more:\nFor the IBOutlets, the error is:</p>\n<pre><code>Failed to connect (CNC_BlockKonfigurierenTaste) outlet from (NSViewController) to (NSButton): missing setter or instance variable\n</code></pre>\n<p>and the error for the IBAction is</p>\n<pre><code>Could not connect action. Target class 'NSViewController' does not respond to '-reportBlockkonfigurieren:'\n</code></pre>\n<p>The IBOutlet CNC_BlockKonfigurierenTaste and the IBAction function reportBlockkonfigurieren are declared in the Objective-C header file and implemented in the corresponding c file.</p>\n<p>The IBOutlets defined in the Objectiv-C file also do not respond to mouseclicks.</p>\n<p>The viewcontroller is</p>\n<pre><code>class rViewController: NSViewController, NSWindowDelegate\n</code></pre>\n<p>It has a member AVR which is instantiated inas</p>\n<pre><code>var AVR = rAVRview()\n</code></pre>\n<p>The project is a CNC-Hotwire-cutting app, started in 2014 in pure Objectiv-C and revised for every new version of Xcode. It run well until macos Monterey. The objective-C files are about 25'000 lines, making translating to swift a big job.</p>\n<p>My question:\nIs connecting IBOutlets and IBActions from Objective-C no more supported in Xcode15?</p>\n"^^ . . . "0"^^ . . "2"^^ . . "clang-static-analyzer"^^ . . . "java"^^ . . . . . . . . . "@Rob Thanks for the info, I'll definitely be using UIBezierPath for my next project."^^ . "0"^^ . . . "with #if, how we can check for Mac OS version availability ?"^^ . "0"^^ . "0"^^ . . "the issue is that the speechsdk.audio.AudioConfig package requires a device ID, not an index"^^ . . . "1"^^ . . . "1"^^ . "<p>If I create a command line tool project and run something like:</p>\n<pre class="lang-objc prettyprint-override"><code>NSError *error = nil;\nNSFileManager *fileManager = [NSFileManager defaultManager];\nif(![fileManager createDirectoryAtPath:@&quot;/vault/ahh/eee&quot; withIntermediateDirectories:YES attributes:nil error:&amp;error])\n{\n NSLog(@&quot;couldn't make dir: %@&quot;, error);\n}\n</code></pre>\n<p>I am actually able to make the 'eee' directory. But if I do the same thing with an app (Cocoa):</p>\n<blockquote>\n<p>couldn't make dir: Error Domain=NSCocoaErrorDomain Code=513 &quot;You don’t have permission to save the file “eee” in the folder “ahh”.&quot; UserInfo={NSFilePath=/vault/ahh/eee, NSUnderlyingError=0x600000a5d800 {Error Domain=NSPOSIXErrorDomain Code=1 &quot;Operation not permitted&quot;}}</p>\n</blockquote>\n<p>Why is this and what should I do for the app so that it can handle file accesses?</p>\n"^^ . . . "<p>After doing some research I have figured out that there is actually no way to apply landscape orientation only to some pages while leaving other pages as portrait in default printing preview. One either can apply landscape orientation or portrait orientation to ALL pages.</p>\n<hr />\n<p>So I have solved my problem by rotating content inside of pages instead. That it is the way Preview.app works, for example.</p>\n<p>You can distinguish between printing to preview and printing to file using <code>printInfo.jobDisposition</code> which is <code>NSPrintSpoolJob</code> when printing to a screen or an actual printer and <code>NSPrintSaveJob</code> when saving to PDF. That way you can save your actual page orientations while printing to PDF.</p>\n<p>Here is modified <code>rectForPage:</code> function:</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (NSRect)rectForPage:(NSInteger)page\n{\n currentPage = (int)page - 1;\n\n if (printInfo.jobDisposition == NSPrintSaveJob)\n {\n // apply my page orientation only when saving to file\n [printInfo setOrientation:[self getCurrentPageOrientation]];\n }\n\n NSRect r = NSMakeRect(0, 0, printInfo.paperSize.width, printInfo.paperSize.height);\n [self setFrame:r];\n return r;\n}\n</code></pre>\n<p>Function <code>getCurrentPageOrientation</code> simply return 0 for odd pages and 1 for even pages as before.</p>\n<p>And here is overriden <code>drawRect:</code> function:</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (void)drawRect:(NSRect)dirtyRect\n{\n CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] CGContext];\n\n if (printInfo.jobDisposition == NSPrintSpoolJob &amp;&amp; (int)printInfo.orientation != [self getCurrentPageOrientation])\n {\n // rotate content only when drawing on preview AND current page is in wrong orientation\n CGAffineTransform transform = CGAffineTransformMake(0, -1, 1, 0, 0, dirtyRect.size.height);\n CGContextConcatCTM(context, transform);\n }\n\n // rect sizes\n int rectW = 200;\n int rectH = 100;\n // bottom left rectangle\n CGRect rect1 = NSMakeRect(0, 0, rectW, rectH);\n CGContextSetRGBFillColor(context, 1.0, 0.0, 0.0, 1.0);\n CGContextFillRect(context, rect1);\n}\n</code></pre>\n<p>I draw a red rectangle 100 x 200 at the left bottom corner of every page. For every page that is in wrong orientation I apply transform matrix to rotate it by 90 degrees clockwise (like in Preview.app) and move it so it fits in view rect.</p>\n<hr />\n<p>Here the screenshot of how print preview looks now:\n<a href="https://i.sstatic.net/YdHPO.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/YdHPO.png" alt="print preview in portrait orientation" /></a></p>\n<p>And since I've added <code>NSPrintPanelShowsOrientation</code> to <code>NSPrintPanelOptions</code> you can even see how it looks in landscape orientation:\n<a href="https://i.sstatic.net/S1n9h.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/S1n9h.png" alt="enter image description here" /></a></p>\n<p>And if I print it to PDF I get all pages in specified orientation:\n<a href="https://i.sstatic.net/68eya.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/68eya.png" alt="enter image description here" /></a></p>\n<hr />\n<p>It's really weird and unintuitive that Apple didn't add functionality of rotating some pages in default print preview. Hope they'll add it sometime. And I also hope this answer help those who are facing similar problem.</p>\n"^^ . . . "swift"^^ . "frida"^^ . "1"^^ . . "<p>This issue is caused by <a href="https://github.com/wix/react-native-navigation" rel="nofollow noreferrer">ReactNative navigation</a> lib. This lib contains a <a href="https://github.com/wix/react-native-navigation/blob/7.38.1/lib/ios/Dictionary.h" rel="nofollow noreferrer"><code>Dictionary</code> interface</a> that creates a name collision with the Swift <code>Dictionary</code>. Renaming this interface resolves the issue.</p>\n"^^ . . "Using `copy` in the `NSString` passed to `init` is a good idea. But this means you should declare the `title` and `identifier` properties as `copy` instead of `strong`. And way back before ARC, there was no `strong`. Instead, you used `retain`. With ARC they are now synonyms. But back to your question - please update your question with your attempt JSON code."^^ . . . . . "0"^^ . "0"^^ . "0"^^ . . "0"^^ . . . "1"^^ . . . . . "I'm not clicking a link. If you have a solution, post it here as an Answer. Answering your own question is legal and encouraged."^^ . "0"^^ . . . . . "you should have to remove un-necessary packages from your package.json."^^ . . . "<p>I was able to solve the issue after putting the code in viewDidLayoutSubviews</p>\n<pre><code>-(void)viewDidLayoutSubviews{\n [self.navigationController setValue:navBar forKeyPath:@&quot;navigationBar&quot;];\n}\n</code></pre>\n<p>After this code is working and not crashing anymore</p>\n"^^ . . . . . . "NSInvalidArgumentException: expected Dictionary but actual _SwiftDeferredNSDictionary"^^ . . . . . "0"^^ . "1"^^ . . . . "0"^^ . . . "I have an app group properly setup, and when my app tries to load the persistent storage, it shows that prompt, every time the app opens. I'm using App Groups already, I'm bringing to the Mac a setup that already works fine in iOS, but for some reason, every time my app tries to access the stores from its own app group, it's treated like it's trying to access data from other app."^^ . . "0"^^ . "0"^^ . . "Releasing object when you get it from another function"^^ . . . "<p>I am able to save the array as folowing:</p>\n<pre><code> -(void) saveToDoList:(NSMutableArray&lt;TreeNode *&gt; *)todoList {\n NSMutableArray *array = [self convertArrayToJson:todoList];\n NSError *error;\n NSData *jsonData = [NSJSONSerialization dataWithJSONObject:array options:NSJSONWritingPrettyPrinted error:&amp;error];\n NSString *jsonString = [[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding] autorelease];\n [self writeStringToFile:jsonString];\n}\n//Following function will convert a nested array of array to JSON Object\n-(NSMutableArray *) convertArrayToJson: (NSMutableArray *) array {\n NSMutableArray *mainArray = [NSMutableArray new];\n \n for (TreeNode *element in array) {\n NSMutableDictionary *node = [NSMutableDictionary new];\n [node setValue:element.title forKey:keyTitle];\n [node setValue:element.identifier forKey:keyIdentifier];\n \n if (element.children != nil &amp;&amp; [[element children] count] &gt; 0) {\n NSMutableArray *array1 = [self convertArrayToJson:element.children];\n [node setValue:array1 forKey:keyChildren];\n } else {\n [node setValue:nil forKey:keyChildren];\n }\n [mainArray addObject:node];\n }\n return mainArray;\n}\n\n- (void)writeStringToFile:(NSString*)aString {\n NSString *fileAtPath = [self jsonFilePath];\n if (![[NSFileManager defaultManager] fileExistsAtPath:fileAtPath]) {\n [[NSFileManager defaultManager] createFileAtPath:fileAtPath contents:nil attributes:nil];\n }\n [[aString dataUsingEncoding:NSUTF8StringEncoding] writeToFile:fileAtPath atomically:NO];\n}\n</code></pre>\n"^^ . "2"^^ . . . "Are the previous windows document windows? Post a [mre] please."^^ . . . . "You can create obj-c function that returns NSString from that array by index and use that function from swift. That would probably be cleaner than messing with unsafe pointers in swift."^^ . . "Access NSString *const *Array in Swift"^^ . "0"^^ . . . . . "how to call pointer function in Frida script"^^ . . "0"^^ . "0"^^ . "0"^^ . . . . . "<p>I found Xcode [Target]-Swift.h gen tool does not care about &quot;Target Membership&quot;. It only see swift files under MyTarget directory.</p>\n<p>Failed case files location</p>\n<ul>\n<li>MyTarget1/MyOBJC1Class.m</li>\n<li>MyTarget1/MySwiftClass.swift</li>\n<li>MyTarget2/MyOBJC2Class.m</li>\n<li>Xcode Target Membership of MySwiftClass.swift ON for MyTargert2</li>\n</ul>\n<p>Success case files location</p>\n<ul>\n<li>MyTarget1/MyOBJC1Class.m</li>\n<li>MyTarget1/MySwiftClass.swift</li>\n<li>MyTarget2/MyOBJC2Class.m</li>\n<li>MyTarget2/MySwiftClass.swift (exact copy)</li>\n</ul>\n"^^ . . . . "See the other answer"^^ . "No file access permission for Cocoa app but works with command line app"^^ . . . . . "1"^^ . "1"^^ . "0"^^ . . . . . "<p>The results are pretty easy to replicate.</p>\n<ol>\n<li>Create a new Xcode project called TestWindow.</li>\n<li>XIB not storyboard.</li>\n<li>Objective-C</li>\n<li>Set the project’s scheme to turn off Metal API validation.</li>\n<li>Set Build Options to NO ARC under Objective-C options.</li>\n<li>Delete the Main Menu window.</li>\n<li>Create a new window object called GoWindow. And add a window to it.</li>\n<li>Set File’s Owner of the AppDelegate object in Placeholders to AppDelegate.</li>\n<li>Drag a Scrollable Text View from the Library to the Window</li>\n<li>Connect an IBOutlet NSWindow in AppDelegate to the window.</li>\n<li>Connect an IBOutlet NSScrollview in AppDelegate to the scrollview in the window.</li>\n<li>Connect an IBOutlet NSTextView in AppDelegate to the textView in the ScrollView in the window.</li>\n<li>In AppDelegate, create an IBAction method to makeWindow.</li>\n<li>Add a menu item called makeWindow to the AppDelegate.</li>\n<li>Wire the menu item to the IBAction in AppDelegate.</li>\n<li>Create a method in AppDelegate called <code>makeWindowContinued</code>.</li>\n<li>Add a breakpoint to an <code>NSBeep();</code> inside the <code>makeWindowContinued</code> method.</li>\n<li>Add <code>[self performSelector:@selector(makeGoWindowContinued) withObject:nil afterDelay:1];</code> to the AppDelegate method.</li>\n<li>Run the app.</li>\n<li>The breakpoint will trigger allowing you to see that the three outlets and not being set.</li>\n<li>Here is the resultant AppDelegate.h code:</li>\n</ol>\n<pre><code>#import &lt;Cocoa/Cocoa.h&gt;\n\n@interface AppDelegate : NSObject &lt;NSApplicationDelegate&gt;\n{\n IBOutlet NSWindow *theDocumentWindow;\n IBOutlet NSScrollView *theDocumentWindowScrollView;\n IBOutlet NSTextView *theDocumentWindowTextView;\n\n NSWindowController *myDocumentWindowController;\n \n}\n\n- (NSWindowController *)myDocumentWindowController ;\n- (void)set_myDocumentWindowController:(NSWindowController *)t;\n- (IBAction)makeWindow:(id)sender;\n- (void)makeGoWindowContinued;\n\n@end\n</code></pre>\n<p>And the resultant AppDelegate.m code:</p>\n<pre><code>#import &quot;AppDelegate.h&quot;\n\n@interface AppDelegate ()\n\n@property (strong) IBOutlet NSWindow *window;\n\n@end\n\n@implementation AppDelegate\n\n- (NSWindowController *)myDocumentWindowController {return myDocumentWindowController;}\n- (void)set_myDocumentWindowController:(NSWindowController *)t {[t retain]; [myDocumentWindowController release]; myDocumentWindowController = t;}\n\n- (IBAction)makeWindow:(id)sender\n{\n if (![self myDocumentWindowController]) {\n [self set_myDocumentWindowController:[[NSWindowController alloc] initWithWindowNibName:@&quot;GoWindow&quot;]];\n }\n [[[self myDocumentWindowController] window] setTitleWithRepresentedFilename:@&quot;Untitled&quot;];\n [[[self myDocumentWindowController] window] center];\n [[[self myDocumentWindowController] window] makeKeyAndOrderFront:self];\n [self performSelector:@selector(makeGoWindowContinued) withObject:nil afterDelay:1]; // wait for window to appear\n}\n\n- (void)makeGoWindowContinued\n{\n NSBeep();\n}\n\n- (void)applicationWillTerminate:(NSNotification *)aNotification\n{\n // Insert code here to tear down your application\n}\n\n- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app\n{\n return YES;\n}\n</code></pre>\n<p>I'm not sure File's Owner is correct, maybe I need to set a delegate? Don't know.</p>\n"^^ . . "1"^^ . "0"^^ . "<p>This message pops up if you try to read data frm any other app(s container) that is not in the same app group.</p>\n<p>In my case i send a script to InDesign that includes a path to a screenshot inside my apps Container (where I stored the image).</p>\n<p>Once InDesign processes the script it tries to access this image and voila.</p>\n<p>The onliest workaround I found so far is to create a subfolder in documents folder (requires users acceptance) and store the images there.\nThen InDesign asks (once only) to access that folder.</p>\n"^^ . . "FYI - you don't need to explicitly import AvailabilityMacros.h. You usually get it automatically through other main imports you would use in an AppKit app (or other frameworks). It's also best to avoid using numbers such as `140000`. There are much more human readable macros (as seen in my answer)."^^ . "0"^^ . . . . . . "1"^^ . "`-reportBlockkonfigurieren:` is an action, not an outlet. What is the class of the view controller in IB? How is the view controller instantiated? How old is the Xcode project?"^^ . "security"^^ . "<p>Your app size increases through the packages installed in your application. I have React-Is, Formik and Moment also installed, and yes these 3 packages increase the size of my application too.</p>\n<hr />\n"^^ . . "<p>When you need to support both Xcode 14 and Xcode 15 while also wanting to take advantage of new APIs added in macOS 14.0, you need to make use of the <code>__MAC_OS_X_VERSION_MAX_ALLOWED</code> macro.</p>\n<p>In your specific case you would want:</p>\n<pre class="lang-objc prettyprint-override"><code>#if __MAC_OS_X_VERSION_MAX_ALLOWED &gt;= 140000 // Only true in Xcode 15.0+\n myNSView.clipsToBounds = YES;\n#endif\n</code></pre>\n<p><code>clipsToBounds</code> is a weird case since it became public in Xcode 15 but it can now be used with a deployment target back to macOS 10.9.</p>\n<p>The more general approach, when needing to support an API added in macOS 14.0 and not available at all prior to that, and your app has a deployment target older than macOS 14.0, all while supporting Xcode 14 and 15, then you need something like the following:</p>\n<pre class="lang-objc prettyprint-override"><code>#if __MAC_OS_X_VERSION_MAX_ALLOWED &gt;= 140000\n // Built with Xcode 15.0+\n if (@available(macOS 14.0, *)) {\n someObject.someNewProperty = someValue;\n } else {\n // optional code for pre-macOS 14.0\n someObject.someOldProperty = someValue;\n }\n#else\n // Built with Xcode before 15.0\n // optional code for pre-macOS 14.0\n someObject.someOldProperty = someValue;\n#endif\n</code></pre>\n<p>Once you stop trying to support Xcode 14 you can remove everything between <code>#else</code> and <code>#endif, and remove the </code>#if<code>, </code>#else<code>, and </code>#endif` lines.</p>\n<p>The downside to this is that if you do have alternate code for older versions of macOS while supporting multiple versions of Xcode, that code gets repeated in two places.</p>\n<p>The following resolves the duplicate code issue:</p>\n<pre class="lang-objc prettyprint-override"><code> if (@available(macOS 14.0, *)) {\n#if __MAC_OS_X_VERSION_MAX_ALLOWED &gt;= 140000\n // Built with Xcode 15.0+\n someObject.someNewProperty = someValue;\n#endif\n } else {\n // optional code for pre-macOS 14.0\n someObject.someOldProperty = someValue;\n }\n</code></pre>\n<p>Once you stop trying to support Xcode 14 you can remove the <code>#if</code> and <code>#endif</code> lines.</p>\n<hr />\n<p>Note: There is a macro named <code>__MAC_14_0</code> that is defined as <code>140000</code> and using it would make the code easier to read. But that macro would only be defined when using Xcode 15 and not when using Xcode 14.</p>\n"^^ . "0"^^ . . . "FYI - I created a project and added your two sets of code, first one, then the other. After adding enough other code to make it compile, I ran the analyzer. I get the message about the potential leak in both sets of code. I'm using Xcode 15.2 under macOS 14.3.1. Perhaps you need to post a minimal, complete example that replicates the issue. But in either case, the solution is as I stated earlier - the code that should call `CGPathRelease` is the code that calls `newSquarePath`. It makes the analyzer happy and it avoids the risk of over releasing."^^ . "1"^^ . . . . . . "0"^^ . . . . . . . . . "<p>I sent my data as url-encoded form:</p>\n<pre><code>JobId=564876565946&amp;UstaId=242816809697&amp;Comment=&amp;Ratings=%5B%7B%0A%20%20%20%20QuestionId%20%3D%203533%3B%0A%20%20%20%20Rating%20%3D%204%3B%0A%7D%2C%7B%0A%20%20%20%20QuestionId%20%3D%209767%3B%0A%20%20%20%20Rating%20%3D%205%3B%0A%7D%5D\n</code></pre>\n<p>When I decode this data:</p>\n<pre><code>JobId=564876565946&amp;UstaId=242816809697&amp;Comment=&amp;Ratings=[{\n QuestionId = 3533;\n Rating = 4;\n},{\n QuestionId = 9767;\n Rating = 5;\n}]\n</code></pre>\n<p>It is shown as above,\nbut in postman it was successful when I sent in this form:</p>\n<pre class="lang-json prettyprint-override"><code>{\n &quot;JobId&quot;: 564876565946,\n &quot;UstaId&quot;: 242816809697,\n &quot;Ratings&quot;: [\n {\n &quot;QuestionId&quot;: 3533,\n &quot;Rating&quot;: 4\n },\n {\n &quot;QuestionId&quot;: 9767,\n &quot;Rating&quot;: 4\n }\n ],\n &quot;Comment&quot;: &quot;test postman&quot;\n}\n</code></pre>\n<p>In the JSON format.</p>\n<p>The parameters that I created are created like this:</p>\n<pre><code>NSDictionary *params = @{\n @&quot;Ratings&quot;:[NSString stringWithFormat:@&quot;[%@]&quot;,[self.ratings componentsJoinedByString:@&quot;,&quot;]],\n @&quot;Comment&quot;:comment,\n @&quot;UstaId&quot;:[self.ustaID stringValue],\n @&quot;JobId&quot;:[self.jobID stringValue]\n};\n</code></pre>\n<p>And I add my answers to the <code>self.ratings(which is a NSMutableArray)</code> as like this:</p>\n<pre><code>for(RatingQuestion * question in AppDlg.reviewQustions){\n self.answer=[[NSMutableDictionary alloc]init];\n [self.answer setObject:[question.ID stringValue]forKey:@&quot;QuestionId&quot;];\n [self.answer setObject:@5 forKey:@&quot;Rating&quot;];\n [self.ratings addObject:self.answer];\n}\n</code></pre>\n<p>The code is written in Objective-C for iOS and I can provide more information when requested.</p>\n<p>I want my URL encoded data sent correctly.</p>\n"^^ . . . . "I don't know why, but suddenly it seems to work I closed and reload the Xcode project several times etc."^^ . . "If you want the app delegate to be the file's owner then use `[[NSWindowController alloc] initWithWindowNibName:@"GoWindow" owner:self]`. Be aware of dangling pointers when you close the window."^^ . . "I add a view inside that view that you put , but when I try to put in landscape or portrait I got the same space in the leading, and I erase a lot of constraints"^^ . . . . . . . "<p>I want to print a document which is consists of multiple pages with different orientations. Let's say every odd page is in portrait orientation and every even page is in landscape orientation. Below is the code for my <code>PrintView</code> class:</p>\n<pre class="lang-objectivec prettyprint-override"><code>// PrintView.h\n@interface PrintView : NSView\n{\n NSPrintInfo* printInfo;\n int nPages;\n}\n- (id)initWithParams:(CGRect)frame pages:(int)pagesCount;\n- (void)setPrintInfo:(NSPrintInfo *)pi;\n@end\n</code></pre>\n<pre class="lang-objectivec prettyprint-override"><code>// PrintView.m\n#import &quot;PrintView.h&quot;\n\n@implementation PrintView\n- (id)initWithParams:(CGRect)frame pages:(int)pagesCount\n{\n self = [super initWithFrame:frame];\n if (self)\n {\n nPages = pagesCount;\n }\n return self;\n}\n\n- (void)setPrintInfo:(NSPrintInfo *)pi\n{\n if (printInfo != pi)\n {\n printInfo = pi;\n }\n}\n\n// print support\n\n- (BOOL)knowsPageRange:(NSRangePointer)range\n{\n range-&gt;location = 1;\n range-&gt;length = nPages;\n\n return YES;\n}\n\n- (NSRect)rectForPage:(NSInteger)page\n{\n if (page % 2)\n [printInfo setOrientation:NSPaperOrientationPortrait];\n else\n [printInfo setOrientation:NSPaperOrientationLandscape];\n\n NSRect r = NSMakeRect(0, 0, printInfo.paperSize.width, printInfo.paperSize.height);\n [self setFrame:r];\n return r;\n}\n@end\n</code></pre>\n<p>This code simply produces blank pages without any drawings. Page orientations are applied in <code>rectForPage:</code>.</p>\n<p>When I run print operation (more details in function <code>onBtnClick</code> in MRE below) in built-in preview I see that all pages are shown in portrait orientation:</p>\n<p><a href="https://i.sstatic.net/vmz16.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vmz16.png" alt="Print window" /></a></p>\n<p>though actually the second page should be in landscape orientation. Moreover, if I print this to PDF I can see that in PDF all page orientations are correct:</p>\n<p><a href="https://i.sstatic.net/bqhQd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bqhQd.png" alt="enter image description here" /></a></p>\n<p>So the problem is in built-in Cocoa preview as I think. If the last page is in landscape orientation then all pages in preview will be shown in landscape orientation too. Seems that only last page orientation is applied to preview.</p>\n<p>Is there any workarounds for showing pages with different orientations in default Cocoa printing preview? Or am I doing something wrong?</p>\n<hr />\n<h2>Minimal Reproducible Example</h2>\n<p>Below is the code for simple application with just one button labeled &quot;Print&quot;. Pressing on that button starts printing process. You can run and compile it in Xcode (I use Xcode version 15.2). Files <code>PrintView.m</code> and <code>PrintView.h</code> are listed above so here are the rest:</p>\n<pre class="lang-objectivec prettyprint-override"><code>// main.m\n#import &lt;Cocoa/Cocoa.h&gt;\n#import &quot;AppDelegate.h&quot;\n\nint main(int argc, const char *argv[])\n{\n @autoreleasepool\n {\n AppDelegate *delegate = [[AppDelegate alloc] init];\n NSApplication *app = [NSApplication sharedApplication];\n app.delegate = delegate;\n\n [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];\n [NSApp activateIgnoringOtherApps:YES];\n\n NSApplicationMain(argc, argv);\n }\n return 0;\n}\n</code></pre>\n<pre class="lang-objectivec prettyprint-override"><code>// AppDelegate.h\n#import &lt;Cocoa/Cocoa.h&gt;\n#import &quot;ViewController.h&quot;\n\n@interface AppDelegate : NSObject &lt;NSApplicationDelegate&gt;\n@property (nonatomic, strong) NSWindow* window;\n@property (nonatomic, strong) NSViewController* controller;\n@end\n</code></pre>\n<pre class="lang-objectivec prettyprint-override"><code>// AppDelegate.m\n#import &quot;AppDelegate.h&quot;\n\n@implementation AppDelegate\n\n- (void)applicationDidFinishLaunching:(NSNotification *)aNotification\n{\n int mask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable;\n _window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:mask backing:2 defer:NO];\n _controller = [[ViewController alloc] init];\n\n [_window.contentView addSubview:_controller.view];\n\n [_window makeKeyAndOrderFront:nil];\n}\n\n- (BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender\n{\n return YES;\n}\n@end\n</code></pre>\n<pre class="lang-objectivec prettyprint-override"><code>// ViewController.h\n#import &lt;Cocoa/Cocoa.h&gt;\n\n@interface ViewController : NSViewController\n@property (nonatomic, strong) NSButton* button;\n-(void) onBtnClick;\n@end\n</code></pre>\n<pre class="lang-objectivec prettyprint-override"><code>// ViewController.m\n#import &quot;ViewController.h&quot;\n#import &quot;PrintView.h&quot;\n\n@implementation ViewController\n\n- (void)loadView\n{\n self.view = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 200, 200)];\n}\n\n- (void)viewDidLoad\n{\n [super viewDidLoad];\n\n _button = [NSButton buttonWithTitle:@&quot;Print&quot; target:self action:@selector(onBtnClick)];\n [_button setFrame:NSMakeRect(50, 50, 100, 100)];\n\n [self.view addSubview:_button];\n}\n\n- (void)onBtnClick\n{\n int nPages = 3; // here you can change the number of page being printed\n\n NSLog(@&quot;printint %d pages...&quot;, nPages);\n\n PrintView* pView = [[PrintView alloc] initWithParams:NSMakeRect(0, 0, 100, 100) pages:nPages];\n\n NSPrintInfo* printInfo = [NSPrintInfo sharedPrintInfo];\n\n NSPrintPanelOptions options = NSPrintPanelShowsCopies;\n options |= NSPrintPanelShowsPageRange;\n options |= NSPrintPanelShowsPaperSize;\n options |= NSPrintPanelShowsPrintSelection;\n options |= NSPrintPanelShowsPreview;\n\n NSPrintOperation* pro;\n if (printInfo)\n pro = [NSPrintOperation printOperationWithView:pView printInfo:printInfo];\n else\n pro = [NSPrintOperation printOperationWithView:pView];\n\n [pView setPrintInfo:[pro printInfo]];\n\n [pro setShowsPrintPanel:YES];\n [[pro printPanel] setOptions:options];\n [pro runOperation];\n}\n\n@end\n</code></pre>\n"^^ . . "1"^^ . "<p>I'm debugging a macOS app by Frida.\nhere is pseudocode</p>\n<pre><code> rax = [Herlper cfunc];\n rax = *rax;\n rax = (rax)(0x0, 0x0, 0x0);\n rax = [rax retain];\n r13 = rax;\n r12 = [[r13 dataUsingEncoding:0x4] retain];\n</code></pre>\n<p>How do I get r12 results in a script?</p>\n<p>Hope you can help, thank you!</p>\n<p>i tried using this script</p>\n<pre><code>var f = new NativeFunction(ptr(ObjC.classes.Herlper.cfunc()).sign(),'pointer',['uint8','uint8','uint8'])\nf(0x0,0x0,0x0)\n</code></pre>\n<p>but it error:</p>\n<pre><code>Error: access violation accessing 0x600001931050\n at &lt;eval&gt; (&lt;input&gt;:1)\n</code></pre>\n"^^ . . . "0"^^ . "The reason why this works is explained by this Apple engineer here: https://developer.apple.com/forums/thread/721701\nYou would not see the alert if your app is deployed via App Store or TestFlight. And here is one of their recommendation:\n"If you use an iOS-style app group ID in a macOS app, you might run into the authorisation prompt during day-to-day development. One way around this is to use a macOS-style app group ID during development and switch to the iOS-style app group ID for production.""^^ . . . "Since `loadGraphicView` takes a GraphicView as a parameter, why isn't it an _instance_ property of GraphicView (that _doesn't_ take a GraphicView as a parameter)? Just call it `-(void) loadWithPath:`."^^ . . "1"^^ . . . . "1"^^ . . "0"^^ . . . . . . . "0"^^ . "It you want to subscribe to multiple topics then you need to specify this on the command like (e.g. `mosquitto_sub -t topic/state -t topic/temp -t feed/#`). If you subscribe to a topic and no messages are published on that topic then nothing will appear to happen (the program is just waiting for a message that never comes). You may benefit from reading an MQTT introduction (e.g. [steves](http://www.steves-internet-guide.com/mqtt/), [Hives](https://www.hivemq.com/article/how-to-get-started-with-mqtt/))."^^ . . "<p>I have created an SDK which includes a storyboard. In the storyboard there are 4-5 view controllers. How to access the storyboard of the SDK?</p>\n<p>Here is my code:</p>\n<pre class="lang-objc prettyprint-override"><code>- (void)openAppleInAppProvisionMain {\n // NSBundle *bundle = [NSBundle bundleForClass:[self class]];\n NSBundle *bundle = [NSBundle bundleWithIdentifier:@&quot;com.digiTech.apple.applewalletNFI&quot;];\n\n NSLog(@&quot;Received from Main Kony Callback : %@&quot;, shManager.callBack);\n NSLog(@&quot;Received from Main Kony Data : %@&quot;, shManager.dictResponse);\n NSLog(@&quot;method is accessible in this way&quot;);\n\n UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@&quot;WalletMain&quot; bundle:bundle];\n UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@&quot;CardsViewsController&quot;];\n\n [AppleWallet performSelectorOnMainThread:@selector(presentTheViewController:) withObject:vc waitUntilDone:YES];\n\n [[NSNotificationCenter defaultCenter] postNotificationName:@&quot;getCardsList&quot; object:nil userInfo:shManager.dictResponse];\n}\n\n+ (void)presentTheViewController:(UIViewController *)vc {\n if(vc) {\n vc.modalPresentationStyle = UIModalPresentationFullScreen;\n // [KonyUIContext onCurrentFormControllerPresentModalViewController:vc animated:YES];\n }\n}\n</code></pre>\n<p>In this way I am able to access this method and also all other methods in my sample app, but I'm not able to load the storyboard of the SDK to my sample app.</p>\n<p>My storyboard settings are like this.</p>\n<p>I have tried with the bundle changes but not working.</p>\n"^^ . . "<p>I have create a MQTT system using MQTTClient library on my Arduino IDE for ESP8266 to publish and subscribe to io.Adafruit. Everything is working great except there is some functionality that I can't get on an app I developed for my iPhone/iPad using MQTT. So I have installed a Mosquitto broker on an old MacBook pro using Homebrew. When I look at the Publish and Subscribe code for the broker on the MacBook it looks different than that I use on the Arduino and iPhone app.</p>\n<pre><code>//this is on the arduino using MQTTClient library\n//connect\nAdafruit_MQTT_Client mqtt(&amp;client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);\n//publish\nAdafruit_MQTT_Publish temperature = Adafruit_MQTT_Publish(&amp;mqtt, AIO_USERNAME &quot;/feeds/temperature&quot;);\n//subscribe\nAdafruit_MQTT_Subscribe trip2 = Adafruit_MQTT_Subscribe(&amp;mqtt, AIO_USERNAME &quot;/feeds/temperature&quot;);\n</code></pre>\n<p>On the local Mosquitto on MacBook I use this it subscribe</p>\n<pre><code>mosquitto_sub -t topic/state\n\n//and this to publish\n\nmosquitto_pub -t topic/state -m &quot;hello World&quot;\n</code></pre>\n<p>Is there a way to reconcile these so they work together? Can someone recommend a book or website or tutorial that will help me do this?</p>\n"^^ . . . "0"^^ . . "0"^^ . "1"^^ . . . . . "Thanks matt. I solved it refer below link.\n\nhttps://huisoo.tistory.com/17"^^ . . "0"^^ . . . . "0"^^ . . . . . . . "0"^^ . . . . . . "0"^^ . . "0"^^ . . . . . "Thanks, I edited the post corresponding to your questions."^^ . "@HangarRash Good idea, I will change CGMutablePathRef to CGPathRef. I agree about ownership, it was making my head explode a little when I started nesting method calls, passing the newSquarePath down the chain as opposed to working with it / releasing it in the initial method that gets it."^^ . . . . . . "<p>I'm working on a framework that's intended to be added to a native macOS application so that it can post events into the application's event queue in response to touch-screen events. In order to function properly, it needs to know when a drag-and-drop operation has started within the current application. (It doesn't need to know about drag-and-drop operations started anywhere else within the system.)</p>\n<p>Is there any way to do that?</p>\n<p>So far I've checked to see if any relevant notifications are posted to the application's shared notification center, but that didn't bear any fruit. I'm willing to use Objective-C method swizzling, but I'd prefer to avoid that if possible.</p>\n"^^ . "0"^^ . . "<p>Your storyboard is not located within main app bundle.<br />\nYou may try it in next way, where the <code>CardsViewsController</code> class is expected to be part of your SDK:</p>\n<pre><code>NSBundle *sdkBundle = [NSBundle bundleForClass:[CardsViewsController class]];\nUIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@&quot;WalletMain&quot; bundle:sdkBundle];\n</code></pre>\n"^^ . . . . "0"^^ . "mqtt"^^ . . "0"^^ . . . "Sorry, but I don't understand the answer. Cookbook only helps if one knows the ingredients by name. What are "App Groups" and why should my app/binary have an App Group? Where in the app's code should the provided code be added, and when should it be executed? This is very frustrating."^^ . . . . "3"^^ . . "[MyTarget]-Swift.h does not have MySwiftClass declaration"^^ . "How do I stop MQTTClient from getting new data"^^ . . "0"^^ . . "0"^^ . "Different page orientations in default print preview in NSPrintPanel"^^ . . "5"^^ . . . . "0"^^ . . "0"^^ . . . . . "0"^^ . . ""How can I achieve this?" In a UILabel you can't. You would have to draw the text yourself and lay it out yourself with TextKit."^^ . . "<p>I'm using (Product -&gt; Perform Action -&gt; Assemble &quot;file&quot;) in Xcode to investigate assembler instructions. But for some unknown to me reasons it sometimes shows llvm instructions instead. It happens for both .c and .m files. Sometimes it suddenly just starts to produce llvm for the same file which produced assembler many times before. Has anyone else encountered this? Is that a bug or am I doing something wrong?</p>\n<p>I'm using Xcode 15.0.1</p>\n"^^ . . . . "Does this answer your question? [Any way to iterate a tuple in swift?](https://stackoverflow.com/questions/24299045/any-way-to-iterate-a-tuple-in-swift)"^^ . . . "1"^^ . . "How did you implement "State Restoration"?"^^ . . . . . . . "Thank to answer Sam. But it doesn't work."^^ . . . "3"^^ . . . . "Your answer is in my Edit 1."^^ . . . . . . . "<p>The problem is that you end up calling <code>roundSpecificCorners</code> when auto-layout has not yet set the final frame / bounds.</p>\n<p>You will find it <em><strong>much easier</strong></em> to use a <code>UIView</code> subclass that updates the corners on its own.</p>\n<p>Quick example:</p>\n<pre><code>@interface RoundedCornersView : UIView\n@end\n\n@implementation RoundedCornersView\n- (void)layoutSubviews {\n [super layoutSubviews];\n CAShapeLayer *maskLayer = [CAShapeLayer layer];\n maskLayer.path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(10.0, 10.0)].CGPath;\n self.layer.mask = maskLayer;\n}\n@end\n</code></pre>\n<p>In Storyboard, select that view and assign its <strong>Custom Class</strong> to <code>RoundedCornersView</code>, and your view controller becomes:</p>\n<pre><code>@interface LoginAccountViewController ()\n@end\n\n@implementation LoginAccountViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n // Initial setup of the view\n //enterEmailView.inputTextField.placeholder = @&quot;Enter Email&quot;;\n //enterPasswordView.inputTextField.placeholder = @&quot;Enter Password&quot;;\n}\n\n@end\n</code></pre>\n<p>You can remove the <code>@implementation UIView (CustomLoader)</code> completely, as well as everything in <code>viewWillLayoutSubviews</code> and <code>viewWillTransitionToSize</code>.</p>\n<hr />\n<p>In fact, by using a few <code>IBInspectable</code> properties and making that custom view <code>IB_DESIGNABLE</code>, you can modify the corners and radii and see it in Storyboard:</p>\n<pre><code>IB_DESIGNABLE\n@interface RoundedCornersView : UIView\n@property (assign, readwrite) IBInspectable CGFloat radius;\n@property (assign, readwrite) IBInspectable BOOL topLeft;\n@property (assign, readwrite) IBInspectable BOOL topRight;\n@property (assign, readwrite) IBInspectable BOOL bottomLeft;\n@property (assign, readwrite) IBInspectable BOOL bottomRight;\n@end\n\n@implementation RoundedCornersView\n\n- (instancetype)initWithFrame:(CGRect)frame {\n self = [super initWithFrame:frame];\n if (self) {\n [self commonInit];\n }\n return self;\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n self = [super initWithCoder:aDecoder];\n if (self) {\n [self commonInit];\n }\n return self;\n}\n\n- (void)commonInit {\n // dfault values for corners-to-round and radii\n _radius = 10.0;\n _topLeft = YES;\n _topRight = YES;\n}\n\n- (void)layoutSubviews {\n [super layoutSubviews];\n UIRectCorner corners = 0;\n if (_topLeft) { corners |= UIRectCornerTopLeft; }\n if (_topRight) { corners |= UIRectCornerTopRight; }\n if (_bottomLeft) { corners |= UIRectCornerBottomLeft; }\n if (_bottomRight) { corners |= UIRectCornerBottomRight; }\n CAShapeLayer *maskLayer = [CAShapeLayer layer];\n maskLayer.path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(_radius, _radius)].CGPath;\n self.layer.mask = maskLayer;\n}\n\n@end\n</code></pre>\n<hr />\n<p><a href="https://i.sstatic.net/jEeg5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jEeg5.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/d5chH.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/d5chH.png" alt="enter image description here" /></a></p>\n"^^ . . "1"^^ . "AppDelegate owns the window. Because WindowControllers make new windows from nibs. Because this is a demo program that illustrates that my outlets are not being connected. In reality, I have a huge program that is having the same problem but can't be replicated here because it's too large. MainMenu is used for other things. I think I instantiate only once, follow the steps in my original question. ai want to use the outlets right after the NSBeep() but they are always nil."^^ . . . . "Willeke, I have restructured my program to eliminate using WindowControllers and instead use windows defined in MainMenu. Seems to work as expected now. I'm very grateful for your suggestion, I had so presumed that WindowControllers were the right way to go that I hadn't considered another entirely different approach. I guess that sometimes you get too close to the problem and don't see an alternative. I very much appreciate your involvement and suggestions, they forced me into a different solution."^^ . . "permissions"^^ . . . . . . . . "3"^^ . . . "arrays"^^ . "0"^^ . "Background task is not reliable enough for my needs so I will be deleting this post."^^ . . . . "0"^^ . . "0"^^ . "<p>The reason is that <code>clipsToBounds</code> ships with macOS 14 SDK, which includes Xcode 15. In Xcode below 15, this property is not available, so the compiler cannot find it and throws an error. It's just a kind of syntax detection.</p>\n<p>The release note is <a href="https://developer.apple.com/documentation/macos-release-notes/appkit-release-notes-for-macos-14#NSView" rel="nofollow noreferrer">here</a>.</p>\n<blockquote>\n<p>In macOS 14, AppKit is exposing the clipsToBounds property of NSView.</p>\n</blockquote>\n<p><strong>Updated:</strong> You can use preprocessors which define in <code>&lt;AvailabilityMacros.h&gt;</code> to cover this case</p>\n<pre class="lang-objectivec prettyprint-override"><code>//You don't really need to import this\n//#import &lt;AvailabilityMacros.h&gt;\n...\n\n//You can also check all available versions in the AvailabilityVersions.h file.\n//140000 means MacOS 14.0\n#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 140000\n view.clipsToBounds = YES;\n#endif\n</code></pre>\n"^^ . "1"^^ . . "1"^^ . "<pre><code>+ (void)addEllipsisAtLabel:(nonnull UILabel *)label ellipsis:(nonnull NSString *)ellipsis {\n if (label == nil || label.text == nil || label.text.length == 0 || ellipsis == nil) return;\n if (label.numberOfLines &lt;= 1) return;\n if (!(label.lineBreakMode == NSLineBreakByCharWrapping)) return;\n \n// int lines = [THISUTILCLASS numberOfLine:label content:label.text];\n CGSize maxSize = CGSizeMake(label.frame.size.width, CGFLOAT_MAX);\n NSInteger lines = [THISUTILCLASS numberOfLinesForString: label.text size:maxSize font:label.font];\n NSUInteger index = label.text.length;\n\n while (lines &gt; label.numberOfLines) {\n NSString *subStr = [label.text substringToIndex: index];\n if (!subStr) {\n return;\n }\n \n NSString *combineStr = [NSString stringWithFormat:@&quot;%@%@&quot;, subStr, ellipsis];\n \n// int newLines = [THISUTILCLASS numberOfLine:label content:combineStr];\n NSInteger newLines = [THISUTILCLASS numberOfLinesForString: combineStr size:maxSize font:label.font];\n \n if (newLines &gt; label.numberOfLines) {\n if (--index &lt;= 0) return;\n } else {\n label.text = combineStr;\n return;\n }\n }\n}\n\n\n+ (int)numberOfLine:(nonnull UILabel *)label content:(nonnull NSString *)content {\n if (label == nil || content == nil || content.length == 0) return 0;\n \n CGSize maxSize = CGSizeMake(label.frame.size.width, CGFLOAT_MAX);\n \n CGRect rect = [content boundingRectWithSize:maxSize\n options:NSStringDrawingUsesLineFragmentOrigin | label.lineBreakMode\n attributes:@{NSFontAttributeName:label.font}\n context:nil];\n \n return (int)(ceil((rect.size.height / label.font.lineHeight)));\n}\n\n\n+ (NSInteger)numberOfLinesForString:(nonnull NSString *)string size:(CGSize)size font:(nonnull UIFont *)font {\n if (string == nil || font == nil) return 0;\n \n NSTextStorage *textStorage = [[NSTextStorage alloc] initWithString:string attributes:@{NSFontAttributeName: font}];\n \n NSTextContainer *textContainer = [[NSTextContainer alloc] initWithSize:size];\n textContainer.lineBreakMode = NSLineBreakByWordWrapping;\n textContainer.maximumNumberOfLines = 0;\n textContainer.lineFragmentPadding = 0;\n \n NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init];\n [layoutManager setTextStorage:textStorage];\n [layoutManager addTextContainer:textContainer];\n \n NSInteger numberOfLines = 0;\n NSUInteger index = 0;\n NSRange lineRange = NSMakeRange(0, 0);\n while (index &lt; [layoutManager numberOfGlyphs]) {\n [layoutManager lineFragmentRectForGlyphAtIndex:index effectiveRange:&amp;lineRange];\n index = NSMaxRange(lineRange);\n numberOfLines++;\n }\n \n return numberOfLines;\n}\n</code></pre>\n"^^ . . . . "0"^^ . "gameplay-kit"^^ . "2"^^ . "0"^^ . . . . "It depends on what you're trying to accomplish. Which object owns the window? Why do you use a `NSWindowController`? Why is the window in a new xib instead of MainMenu.xib? Do you instantiate the window once? When do you want to use the outlets?"^^ . "1"^^ . . . . . "1"^^ . . "assembly"^^ . . . "macos-sonoma"^^ . . "I added a check to see if delegate == nil and it is. I moved the init code in TableViewController to awakeFromNib. still delegate == nil. What do you mean wire delegate property to TableViewController? The delegate property is in MainController, I created a MainController object in the XIB but there is no delegate pull out that I can set to TableViewController. (Can I even set a delegate property in one controller object to another controller?)"^^ . . . "1"^^ . "1"^^ . "0"^^ . . . . . "python"^^ . "0"^^ . . . "2"^^ . "0"^^ . . "c"^^ . . . "2"^^ . . . . "0"^^ . "It continues not to cover all the space, it still looks strange, and in Lanscape the view completely disappears @DonMag"^^ . . "Just `fooStrings[0]`. `NSArray` is toll-free bridged to Swift `Array` and `NSString` is toll-free bridged to Swift `String`"^^ . "c++"^^ . . "please can someone help me in this"^^ . . . . "0"^^ . . . . "0"^^ . . . . . . . "@Dan check the **Updated Solution** in my updated answer now with the new code that uses audioConfig and the Mic selected from the Listed option"^^ . . . . . . . "<p>On macOS CoreAudio plugin development, I try to call Swift func from Objective-C code. But I get error:</p>\n<blockquote>\n<p>Use of undeclared identifier 'MySwiftClass'</p>\n</blockquote>\n<p>I checked these.</p>\n<ul>\n<li>Add &quot;@objc&quot; on Swift class and public func.</li>\n<li>#import &quot;[MyTarget]-Swift.h&quot; on Objective-C code</li>\n<li>On Xcode &quot;Target Membership&quot; of MySwiftClass.swift, MyTarget is checked.</li>\n<li>Set Swift version to Swift5.</li>\n<li>Set macOS min support to 12.3.</li>\n<li>Run xcodebuild on command line and fixed all error</li>\n</ul>\n<p>But &quot;[MyTarget]-Swift.h&quot; under ~/Library/Developer/Xcode/DerivedData/[MyProject]-[hash] has no declaration of MySwiftClass</p>\n<p>I like to know command to generate [MyTarget]-Swift.h, and find out why MySwiftClass is ignored.</p>\n<p>If target is macOS app, I can call Swift func from Objective-C code.</p>\n"^^ . . . . . "1"^^ . . . . . "8"^^ . . . "qt"^^ . . "<p>My current solution is to intercept the <code>odoc</code> AppleEvent, and if that's invoked, set a flag that causes <code>[NSApp restoreWindowWithIdentifier:]</code> to return NO.</p>\n<p>Here's the code inside <code>AppDelegate.m</code>:</p>\n<pre><code>static AEEventHandlerUPP openDocHandler = NULL;\nstatic SRefCon openDocRefcon;\n\nstatic pascal short HandleOpenDocMessage (const AEDesc *theAppleEvent, AEDesc *reply, void* handlerRefcon)\n{\n // intercepts the &quot;odoc&quot; Event to check if we're about to open any files, and then continues with the original handler \n NSAppleEventDescriptor *event = [NSAppleEventDescriptor.alloc initWithAEDescNoCopy:theAppleEvent];\n NSURL *url = [NSURL URLWithString:[[event paramDescriptorForKeyword:keyDirectObject] stringValue]];\n if (url) {\n NSString *docType = [NSDocumentController.sharedDocumentController typeForContentsOfURL:url error:nil];\n if ([docType isEqualToString:@&quot;...&quot;]) { // I can check for particular types here in case I can open several\n [(Application*)NSApplication.sharedApplication setSuppressRestorationOfSearchWindows:YES];\n }\n }\n return openDocHandler (theAppleEvent, reply, openDocRefcon);\n}\n\n- (void)applicationWillFinishLaunching:(NSNotification *)notification\n{\n AEGetEventHandler(kCoreEventClass, kAEOpen, &amp;openDocHandler, &amp;openDocRefcon, false);\n AEInstallEventHandler(kCoreEventClass, kAEOpen, HandleOpenDocMessage, (__bridge SRefCon)(self), false);\n ...\n</code></pre>\n<p>Inside <code>Application.h</code>:</p>\n<pre><code>@property (assign) BOOL suppressRestorationOfSearchWindows;\n</code></pre>\n<p>Inside <code>Application.m</code>:</p>\n<pre><code>- (BOOL)restoreWindowWithIdentifier:(NSString *)identifier state:(NSCoder *)state completionHandler:(void (^)(NSWindow *, NSError *))completionHandler // override\n{\n if ([identifier isEqualToString:@&quot;MyWindowType&quot;] &amp;&amp; self.suppressRestorationOfSearchWindows) {\n // prevent window restoration on startup if the user launched this app by opening a file of my particular type\n return NO;\n } else {\n // continue with regular state restoration\n return [super restoreWindowWithIdentifier:identifier state:state completionHandler:completionHandler];\n }\n}\n</code></pre>\n<p>Feels like a hack, though.</p>\n"^^ . "drag-and-drop"^^ . "@RafaelBitencourt I'm experiencing the same issue, app and plugin are expected to share the same group within AppGroup to manage settings access and storage."^^ . "1"^^ . . . . "0"^^ . . . . . "0"^^ . . "Performing assembly in Xcode sometimes produces llvm instead"^^ . . "1"^^ . "0"^^ . . . . . . . "0"^^ . . . . . "thanks that did it I finally figured it out with the help. Not sure where I can put answered"^^ . . "0"^^ . . . "0"^^ . "1"^^ . . . . "0"^^ . . "2"^^ . . . . . . . . "0"^^ . . . . "1"^^ . . . "Absolutely yes on Xcode below 15, what do you expect? Are you confused `@available` and `#if`? It isn't relevant to the @available macro here."^^ . . . "0"^^ . . . . "I also question why you call `CGPathRelease` inside either `loadGraphicView` method. Neither version should assume that the passed in path needs to be released. You are likely to overrelease `path` in some cases. Also, why does `loadGraphicView` take a `CGMutablePathRef` instead of just `CGPathRef`?"^^ . . "1"^^ . . . . "So the window I put in the XIB is redundant? How do I get IBOutlets into a window created by a window controller?"^^ . . . . "Thank you very much. you save me a lot of time. I did not notice my miss type."^^ . . . . "I would like to know why I’m not getting IBOutlets connected in an App’s window"^^ . "1"^^ . "0"^^ . . "0"^^ . "0"^^ . . . . . "0"^^ . . "2"^^ . "1"^^ . . . "0"^^ . . . . "1"^^ . . . . . "-1"^^ . . . . "Sure i posted it"^^ . . . "1"^^ . . . . . "0"^^ . . . . . . "1"^^ . . . . . "0"^^ . . "Saving nested array of objects to JSON"^^ . . "Sending Data in dictionary in form of x-www-form-urlencoded but it expects JSON"^^ . . . . "header-files"^^ . . . "<p><code>onActiveSpace</code> can change under the following circumstances:</p>\n<ul>\n<li><p>When the user changes the stage they are currently viewing. For example, assume that in Mission Control there are Stage 1 and Stage 2, and the window is on Stage 1 while the user is viewing Stage 1. In this case, onActiveSpace is YES; however, if the user switches to Stage 2, onActiveSpace will change to NO. This stage change can be detected via the <a href="https://developer.apple.com/documentation/appkit/nsworkspace/activespacedidchangenotification" rel="nofollow noreferrer"><code>NSWorkspaceActiveSpaceDidChangeNotification</code></a>.</p>\n</li>\n<li><p>When the window moves to another stage. This cannot be achieved using public APIs. Instead, you can use the SkyLight API as shown below:</p>\n</li>\n</ul>\n<pre class="lang-objectivec prettyprint-override"><code>#import &lt;Cocoa/Cocoa.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n\nAPPKIT_EXTERN NSNotificationName const MA_NSWindowActiveSpaceDidChangeNotification;\nAPPKIT_EXTERN void startWindowActiveSpaceObservation(void);\n\nNS_ASSUME_NONNULL_END\n\n/* ——————————— */\n\n#import &lt;objc/message.h&gt;\n#import &lt;objc/runtime.h&gt;\n#include &lt;dlfcn.h&gt;\n\nNSNotificationName const MA_NSWindowActiveSpaceDidChangeNotification = @&quot;MA_NSWindowActiveSpaceDidChangeNotification&quot;;\n\nvoid _ma_NSWindow_Category_didReceiveEvent(unsigned int type, const void *data, size_t length, const void *context, unsigned int cid) {\n long windowNumber = *(long *)data;\n NSWindow *window = reinterpret_cast&lt;id (*)(id, SEL, long)&gt;(objc_msgSend)(NSApp, sel_registerName(&quot;windowWithWindowNumber:&quot;), windowNumber);\n if (window == nil) return;\n \n [NSNotificationCenter.defaultCenter postNotificationName:MA_NSWindowActiveSpaceDidChangeNotification object:window];\n}\n\nvoid startWindowActiveSpaceObservation(void) {\n static dispatch_once_t onceToken;\n dispatch_once(&amp;onceToken, ^{\n void *handle = dlopen(&quot;/System/Library/PrivateFrameworks/SkyLight.framework/Versions/A/SkyLight&quot;, RTLD_NOW);\n void *symbol = dlsym(handle, &quot;SLSRegisterConnectionNotifyProc&quot;);\n assert(symbol != NULL);\n \n __kindof NSNotificationCenter *notificationCenter = NSWorkspace.sharedWorkspace.notificationCenter;\n unsigned int connectionID = reinterpret_cast&lt;unsigned int (*)(id, SEL)&gt;(objc_msgSend)(notificationCenter, sel_registerName(&quot;connectionID&quot;));\n\n // ____NSDoOneTimeWindowNotificationRegistration_block_invoke\n reinterpret_cast&lt;SInt16 (*)(unsigned int, void *, unsigned int, void *)&gt;(symbol)(connectionID, (void *)_ma_NSWindow_Category_didReceiveEvent, 0x33b, NULL);\n });\n}\n</code></pre>\n<p>Then, you can use it like this:</p>\n<pre class="lang-objectivec prettyprint-override"><code>// invoke from `-applicationDidFinishLaunching:`\nstartWindowActiveSpaceObservation();\n\n[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(_didChangeWindowActiveSpace:) name:MA_NSWindowActiveSpaceDidChangeNotification object:nil];\n</code></pre>\n<p>Thus, when notifications for <a href="https://developer.apple.com/documentation/appkit/nsworkspace/activespacedidchangenotification" rel="nofollow noreferrer"><code>NSWorkspaceActiveSpaceDidChangeNotification</code></a> and <code>MA_NSWindowActiveSpaceDidChangeNotification</code> are received, the onActiveSpace value will change.</p>\n"^^ . "0"^^ . . . . "core-audio"^^ . . "json"^^ . "0"^^ . "@Paulw11 The OP has a C-style array, not an `NSArray`."^^ . . . . . . "0"^^ . "1"^^ . . "Umbrella-Header uses wrong import syntax after `pod install`"^^ . . . . . "nswindow"^^ . . "1"^^ . . "0"^^ . . "0"^^ . . . . . . . "1"^^ . "You will see different behaviour depending on whether you are running under Xcode or not. Under Xcode your app has infinite background time. When not running under Xcode iOS will terminate your app after 30 seconds. The correct thing to do is disconnect the client in `didEnterBackground`. If that isn't working then you probably aren't disconnecting the right client . Show that code"^^ . "1"^^ . . . . . . "0"^^ . "<p>We want to be able to call our application from a browser link (as i.e. MS teams does when you open a link to a teams meeting).</p>\n<p>The principle is quite simple and exists since quite a while. Under Windows this consists just of a few registry entries (<a href="https://stackoverflow.com/questions/80650/how-do-i-register-a-custom-url-protocol-in-windows">How do I register a custom URL protocol in Windows?</a>).</p>\n<p>But anything i tried on the Mac does not work at all.\nSee i.e. <a href="https://stackoverflow.com/questions/15721047/mac-custom-protocol-fails-on-some-machines">Mac custom protocol fails on some machines</a> or <a href="https://web.archive.org/web/20091215155410/http://www.xmldatabases.org/WK/blog/1154_Handling_URL_schemes_in_Cocoa.item" rel="nofollow noreferrer">https://web.archive.org/web/20091215155410/http://www.xmldatabases.org/WK/blog/1154_Handling_URL_schemes_in_Cocoa.item</a> (very old...)</p>\n<p>I learned that we need:</p>\n<ol>\n<li>Add CFBundleURLTypes to pInfo.list</li>\n<li>Add a handler that shall be called by MacOs.</li>\n</ol>\n<p>But i dont get it to work at all.\nNeither my application gets started after adding the required entries to CFBundleURLTypes, nor is such a Handler in our application ever called.</p>\n<p>The Application in Question uses QtWidgets so the code in the application is C++ / Objective-C.</p>\n<p>Does anyone have a working sample project or a link to such that does this using Objective-C or even Qt?</p>\n"^^ . "Step 7 creates a window object with a window in it. That window will have a scrollView in it. Step 8 sets the File's Owner to App Delegate, I also tried setting File's Owner to NSApplication, No luck. The AppDelegate files (.h and .m) were created by Xcode when the project was created. The object of the question is to find out why the IBOutles are still nil when the breakpoint occurs. The window has had plenty of time to load."^^ . . . "1"^^ . "See [Memory Management Policy](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html)"^^ . . "nsprintoperation"^^ . . . . "1"^^ . "When you do `NSLog(@"squares to draw: %@", [delegate numberOfSquaresInSquareView:self]);`, what's the value of `delegate`. I guess it's `nil` since I only see this line setting it: `[_squareView setDelegate:nil];`. If it's nil, then there is no delegate object, so no-one to execute the delegate method, right? To illustrate, imagine having a manager (delegate) position, that's the delegate declaration (only a position, no hired people), employees that need that delegate. So the delegations won't work."^^ . . . . "0"^^ . . . "This custom navigation bar is being used in more than 15 view controllers. So, I didn't want to go in each one of them and create separate buttons and navigations items, that why I created a separate custom class."^^ . . "Thanks for your help, I have solved the question. The function of `cfunc` is to return the function stack address"^^ . . . "pointers"^^ . "1"^^ . . . . . "0"^^ . . . . . . "0"^^ . "all of the packages are required for the app functionality, I have cross-checked"^^ . . "0"^^ . . . "2"^^ . . . . . . . . . "still not working , tried your solution. also tried some way to debug , while debugging inside the Xcode I can see the view controller but it is not showing on the device"^^ . . . . "I think that is what I did in the MakeWindow method."^^ . . . . . . "appkit"^^ . "0"^^ . . "<p>Undocumented (= unsupported) feature: Restoring all documents when the app is launched by opening a document can be disabled. In <code>applicationWillFinishLaunching</code> do</p>\n<pre><code>[NSUserDefaults.standardUserDefaults setBool:YES forKey:@&quot;NSDiscardWindowsOnDocumentOpen&quot;];\n</code></pre>\n"^^ . . "2"^^ . "<p>I have made a custom class for UINavigationBar which has all the custom features I need for an application.\nAfter initialising the class I am adding it to the navigation controller like this</p>\n<pre><code>if (!navBar) {\n navBar=[[NavigationBar alloc]initWithFrame:self.navigationController.navigationBar.frame];\n [self.navigationController setValue:navBar forKeyPath:@&quot;navigationBar&quot;];\n }\n</code></pre>\n<p>My app is crashing on the line</p>\n<pre><code>[self.navigationController setValue:navBar forKeyPath:@&quot;navigationBar&quot;];\n</code></pre>\n<p>Till Xcode 14 its working fine but on Xcode 15 it's crashing. Any help is highly appreciated.</p>\n<p>below is the crash that I am getting</p>\n<pre><code>*** Assertion failure in -[UINavigationBar layoutSubviews], UINavigationBar.m:3856\n</code></pre>\n"^^ . . "azure-cognitive-services"^^ . . . . . . . . . "0"^^ . "0"^^ . . . . "What compiler error was there with -validateVisibleColumns ? Any inherited method should exist."^^ . "<p>The <code>delegate</code> has to 'retain' somewhere to make it work. As I can see here, the <code>SquareView</code> is a sub-view of <code>AppController</code>, and the <code>delegate</code> works like <code>SquareView &lt;-&gt; AppController</code>. It's a kind of callback in this case. However, you're assigning it to <code>nil</code> by <code>[_squareView setDelegate:nil]</code> It should be:</p>\n<pre class="lang-objectivec prettyprint-override"><code>_squareView.delegate = self;\n</code></pre>\n<p>By doing that, every time <code>drawRect</code> in SquareView gets called, it will trigger <code>numberOfSquaresInSquareView</code> in AppController, and in this case, it will print out</p>\n<blockquote>\n<p>squares to draw: 10</p>\n</blockquote>\n"^^ . "I was curious how this was going to turn out. Congrats on sleuthing the problem."^^ . . "1"^^ . "0"^^ . . "0"^^ . "1"^^ . "<p>I've looked at other delegate questions but there weren't any good existing answers. Everything should be set up properly, I can see my slider will change value in logs. For some reason, the delegate function numberOfSquaresInSquareView() never fires when I call it from squareView, and the squareView delegate call just returns nil. I know I am fairly close since this closely matches some lessons I've found, but I think I am missing something. The changeSquareCount() works and I can see in logs that it saves the value.</p>\n<p>squareView.h</p>\n<pre><code>#import &lt;Cocoa/Cocoa.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n@class SquareView;\n@protocol SquareViewDelegate &lt;NSObject&gt;\n\n- (NSNumber *)numberOfSquaresInSquareView:(SquareView *)squareView;\n\n@end\n\n@interface SquareView : NSView\n@property (nonatomic, weak) id&lt;SquareViewDelegate&gt; delegate;\n\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<p>squareView.m</p>\n<pre><code>#import &quot;SquareView.h&quot;\n\n@implementation SquareView\n@synthesize delegate;\n\n- (id)initWithFrame:(NSRect)frame\n{\n self = [super initWithFrame:frame];\n if (self)\n {\n }\n return self;\n}\n\n- (void)drawRect:(NSRect)dirtyRect {\n [super drawRect:dirtyRect];\n NSLog(@&quot;drawing rect&quot;);\n [[NSColor redColor]set];\n\n //NSNumber *num = ; //cound pass in nil, dont matter\n NSLog(@&quot;squares to draw: %@&quot;, [delegate numberOfSquaresInSquareView:self]);\n // Drawing code here.\n}\n\n@end\n</code></pre>\n<p>AppController.h</p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n#import &quot;SquareView.h&quot;\n//@class SquareView;\nNS_ASSUME_NONNULL_BEGIN\n\n@interface AppController : NSObject &lt;SquareViewDelegate&gt;\n\n@property (retain) IBOutlet SquareView *squareView;\n\n- (IBAction)changeSquareCount:(id)sender;\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<p>AppController.m</p>\n<pre><code>#import &quot;AppController.h&quot;\n\n@implementation AppController\n{\n NSNumber *_squareCount;\n}\n@synthesize squareView = _squareView;\n- (void)awakeFromNib\n{\n [_squareView setDelegate:nil];\n _squareCount = @(10);\n [_squareView setNeedsDisplay:YES];\n}\n\n- (void)changeSquareCount:(id)sender\n{\n _squareCount = @([sender intValue]);\n NSLog(@&quot;square count stored: %@&quot;,_squareCount);\n [_squareView setNeedsDisplay:YES];\n}\n-(NSNumber *)numberOfSquaresInSquareView:(SquareView *) squareView\n{\n NSLog(@&quot;triggering numberOfSquaresInSquareView&quot;);\n return _squareCount;\n}\n\n@end\n</code></pre>\n"^^ . . "flexbox"^^ . . "1"^^ . . . . . . "Sorry, I copied the question's text from Notes. Didn't know how to format but it seems to be right now, above."^^ . . "Tip: draw something on the page, the third page doesn't look right in the preview."^^ . . "Delegate does not trigger method"^^ . . . . . "0"^^ . . . . . "This should be marked as best answer. I haven't prefixed the group identifier with Team ID, but with "group." instead. Now that I'm revisiting docs it's clear, and it seems that the way I had it is under section "Create App Groups for all other platforms", which is not my case."^^ . "I updated the answer, you may want to take a look."^^ . "0"^^ . "0"^^ . "0"^^ . . . "0"^^ . . "1"^^ . . "<p>I would like find a way to track changes to the onActiveSpace property of an NSWindow.</p>\n<p>I used the KVO method to monitor this property, but did not receive the property change notification. Does this property not support KVO? If so, is there any way to confirm whether a certain attribute supports KVO? Here is my code:</p>\n<ul>\n<li>first: addobserver</li>\n</ul>\n<pre><code>- (instancetype)initWithWidgetSpaceTracker:(WidgetSpaceTracker*)owner {\n if ((self = [super init])) {\n DCHECK(owner);\n _owner = owner;\n NSWindow* window = _owner-&gt;GetNSWindow();\n\n if (window) {\n [window addObserver:self\n forKeyPath:@&quot;onActiveSpace&quot;\n options:NSKeyValueObservingOptionNew\n context:nil];\n }\n }\n\n return self;\n}\n</code></pre>\n<ul>\n<li>second:receive the change notification</li>\n</ul>\n<pre><code>- (void)observeValueForKeyPath:(NSString*)keyPath\n ofObject:(id)object\n change:(NSDictionary&lt;NSKeyValueChangeKey, id&gt;*)change\n context:(void*)context {\n DCHECK(_owner);\n if ([keyPath isEqual:@&quot;onActiveSpace&quot;]) {\n _owner-&gt;OnSpaceActiveChanged([change[NSKeyValueChangeNewKey] boolValue]);\n } else {\n [super observeValueForKeyPath:keyPath\n ofObject:object\n change:change\n context:context];\n }\n}\n</code></pre>\n"^^ . . "I created a sample app using Xcode 13 doing just the same, but it just won't work. I uploaded the here: https://www.file2send.eu/de/download/kFf6xo1p8Hl5jsprLKOwkeRgJ8P47ZtOVvx8L2Btt28RjuympAB2lmGi71sCCQSA Can you tell what I m missing?"^^ . . . . "`didEnterBackground` is an AppDelegate method. You can't just add it to any class and expect it to run. You need provide the `session2` object to the App Delegate or you can observe the did enter background `NSNotification` in your other class. Really your view controller should not own the MQTT session. That should be in some other object that both the view controller and the app delegate can reference."^^ . . . . "0"^^ . "1"^^ . . . "5"^^ . . . . "<p>I have a class <code>GraphicView</code> that basically creates a <code>UIView</code> that uses a <code>CAShapeLayer</code> as its default <code>layer</code> object:</p>\n<p><strong>GraphicView.h</strong></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\n@interface GraphicView : UIView\n{\n CAShapeLayer *_shapeLayer;\n}\n@property(nonatomic, strong) CAShapeLayer *shapeLayer;\n\n- (void) loadPath:(CGPathRef)path;\n\n@end\n</code></pre>\n<p><strong>GraphicView.m</strong></p>\n<pre><code>#import &quot;GraphicView.h&quot;\n\n@implementation GraphicView\n\n- (id) initWithFrame:(CGRect)frame\n{\n self = [super initWithFrame:frame];\n if (self)\n {\n self.shapeLayer = (CAShapeLayer *) self.layer;\n }\n return self;\n}\n\n+ (Class)layerClass\n{\n return [CAShapeLayer class];\n}\n\n- (void) loadPath:(CGPathRef)path\n{\n CGMutablePathRef tempPath = path;\n self.shapeLayer.path = tempPath;\n CGPathRelease(tempPath);\n}\n\n@end\n</code></pre>\n<p>When I call <code>loadPath</code>:</p>\n<p><strong>GraphicViewController.m</strong></p>\n<pre><code>- (void) loadSquarePath\n{\n [self.graphicView loadPath:[SquarePath newSquarePath]];\n}\n</code></pre>\n<p><strong>SquareBalloonPath.m</strong></p>\n<pre><code>- (CGMutablePathRef) newSquareBalloonPath\n{\n CGSize mutablePathInitialSize = [self squareBalloonPathInitialSize];\n CGMutablePathRef mutablePath = CGPathCreateMutable();\n CGPathMoveToPoint(mutablePath, NULL, 0, 0);\n CGPathAddRect(mutablePath, NULL, CGRectMake(0, 0, mutablePathInitialSize.width, mutablePathInitialSize.height));\n CGPathCloseSubpath(mutablePath);\n return mutablePath;\n}\n</code></pre>\n<p>I get an analyzer error saying &quot;Potential leak of an object of type 'CGMutablePathRef'&quot;. However, when I move <code>loadPath</code> from <code>GraphicView</code> to <code>GraphicViewController</code> (and change the method header to <code>loadGraphicView:WithPath:</code></p>\n<p><strong>GraphicViewController.m</strong></p>\n<pre><code>- (void) loadGraphicView:(GraphicView *)graphicView withPath:(CGPathRef)path\n{\n CGPathRef tempPath = path;\n graphicView.shapeLayer.path = tempPath;\n CGPathRelease(tempPath);\n}\n\n- (void) loadSquarePath\n{\n [self.graphicView loadPath:[SquarePath newSquarePath]];\n}\n</code></pre>\n<p>The analyzer error goes away! Is there something I have to tell the compiler so I can get <code>loadPath</code> to work when it's included as an instance method within <code>GraphicView</code>?</p>\n"^^ . . . "0"^^ . . . "0"^^ . "Xcode 15: App is crashing when setting custom Navigation bar for navigation controller"^^ . . . . . . . "0"^^ . . . . "7"^^ . "@Dan Check my ***Updated Solution2 with Device Id:-*** in my updated answer, it meets your current requirement"^^ . . "1"^^ . . "bridging"^^ . "0"^^ . "0"^^ . . . "0"^^ . "xcode15"^^ . . . . "0"^^ . . . "<p>Every time I instantiate a UIView and add a UIBezierPath as a mask using the roundSpecificCorners:withRadius: function, the view seems to have a smaller margin on the right side and bottom, causing it not to cover the entire view as expected.</p>\n<pre><code>@implementation LoginAccountViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n // Initial setup of the view\n enterEmailView.inputTextField.placeholder = @&quot;Enter Email&quot;;\n enterPasswordView.inputTextField.placeholder = @&quot;Enter Password&quot;;\n}\n\n- (void)viewWillLayoutSubviews{\n // Apply corner rounding on the main view\n [mainViewContainer roundSpecificCorners:UIRectCornerTopLeft | UIRectCornerTopRight withRadius:10.0];\n [super viewWillLayoutSubviews];\n}\n\n- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id&lt;UIViewControllerTransitionCoordinator&gt;)coordinator {\n __weak typeof(self) weakSelf = self;\n [coordinator animateAlongsideTransition:^(id&lt;UIViewControllerTransitionCoordinatorContext&gt; context) {\n // Apply corner rounding when changing orientation\n UIWindowScene *windowScene = (UIWindowScene *)self.view.window.windowScene;\n UIInterfaceOrientation orientation = windowScene.interfaceOrientation;\n if (UIInterfaceOrientationIsLandscape(orientation)) {\n [weakSelf.mainViewContainer roundSpecificCorners:UIRectCornerTopLeft | UIRectCornerTopRight withRadius:10.0];\n } else {\n [weakSelf.mainViewContainer roundSpecificCorners:UIRectCornerTopLeft | UIRectCornerTopRight withRadius:10.0];\n }\n } completion:nil];\n [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];\n}\n\n@end\n\n@implementation UIView (CustomLoader)\n\n// Other functions here...\n\n- (void)roundSpecificCorners:(UIRectCorner)corners withRadius:(CGFloat)radius {\n // Apply a layer mask with corner rounding\n CAShapeLayer *maskLayer = [CAShapeLayer layer];\n maskLayer.path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(radius, radius)].CGPath;\n self.layer.mask = maskLayer;\n // Adjust the autoresizingMask to allow for size changes\n self.autoresizingMask = UIViewAutoresizingFlexibleRightMargin |\n UIViewAutoresizingFlexibleLeftMargin |\n UIViewAutoresizingFlexibleBottomMargin |\n UIViewAutoresizingFlexibleTopMargin;\n}\n</code></pre>\n<p>Why does this behavior occur and how can I fix it so that the view covers the entire screen without any additional margins?</p>\n<p>here is an image <a href="https://i.sstatic.net/8p78K.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8p78K.png" alt="image" /></a></p>\n<p>my view is made by GUI this is the image of my stack of views , the last view is mainViewContainer</p>\n<p><a href="https://i.sstatic.net/e2Hi5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/e2Hi5.png" alt="Stack view container" /></a></p>\n<hr />\n<p>Revised results:</p>\n<p><a href="https://i.sstatic.net/aVU96.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/aVU96.png" width="400"></a></p>\n<p><a href="https://i.sstatic.net/K3z4G.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/K3z4G.png" alt="Stack view container" /></a></p>\n"^^ . . . "2"^^ . "2"^^ . . . . "@Willeke 1. Yes, I have tried printing pdf with different page orientations from Preview app. In the printing preview all pages have the same orientation, but the content inside landsape pages is rotated, which is, in fact, suitable for an actual printer. 2. The third page is clipped on my screenshot - it is actually correctly drawn in the preview. I'm sorry for bad screenshot."^^ . . . . "0"^^ . "nslocalizedstring"^^ . . "0"^^ . . "0"^^ . . . . . . . . . . . "As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . . . "0"^^ . . "0"^^ . . . . . . . "0"^^ . "@HangarRash If it works, don't touch it. You'll never know what kind of retain/release hocus pocus an old app contains. Converting to modern Objective-C and ARC is not trivial."^^ . . . . . . . "0"^^ . . "<p>I'm working on a ReactNative application with native dependencies. Particularly I'm trying to link iOS xcframework of a proprietary library. I can build an application and init SDK but in a couple of moments after it, the app crashes because the SDK is trying to send an analytics but fails.</p>\n<p>The error message:</p>\n<pre><code>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unacceptable type of value for attribute: property = &quot;data&quot;; desired type = Dictionary; given type = _TtGCs26_SwiftDeferredNSDictionarySSSS_$; value = {\n &quot;app_type&quot; = MEP;\n &quot;application_bundle_id&quot; = &quot;xxx&quot;;\n &quot;application_installer_id&quot; = &quot;com.apple.dt.Xcode&quot;;\n &quot;application_name&quot; = xxx;\n &quot;application_version&quot; = &quot;999.999.999&quot;;\n &quot;client_id&quot; = &quot;xxx&quot;;\n country = xxx;\n &quot;device_platform&quot; = &quot;iPhone16,1|iOS|17.2&quot;;\n &quot;external_app_id&quot; = &quot;xxx&quot;;\n &quot;mep_analytics_sdk_version&quot; = &quot;1.1.1&quot;;\n}.'\n</code></pre>\n<p>Top of the backtrace:</p>\n<pre><code>Last Exception Backtrace:\n0 CoreFoundation 0x110ee6751 __exceptionPreprocess + 226\n1 libobjc.A.dylib 0x116290904 objc_exception_throw + 48\n2 CoreData 0x10f367a7c _PFManagedObject_coerceValueForKeyWithDescription + 2175\n3 CoreData 0x10f36f51b _sharedIMPL_setvfk_core + 177\n4 CoreData 0x10f3737e3 _sharedIMPL_copying_setvfk_core + 54\n5 XxxAnalytics 0x1137d94f5 specialized Client.__allocating_init(entity:insertInto:id:data:) + 229\n6 XxxAnalytics 0x1137e5a13 closure #1 in AnalyticsStorageManager.add(_:) + 355\n7 XxxAnalytics 0x1137daedc thunk for @callee_guaranteed () -&gt; () + 12\n8 XxxAnalytics 0x1137daefe thunk for @escaping @callee_guaranteed () -&gt; () + 14\n9 CoreData \n</code></pre>\n<p>Where XxxAnalytics is a proprietary lib that I'm linking.</p>\n<p><strong>Investigation:</strong>\nWhen I link the lib to a new ReactNative application (created with <code>npx react-native@0.71.2 init TestProj</code>) everything works OK. But when I link it with the production application it crashes. Looks like the issue is in build settings but I don't know where exactly.</p>\n<p>The production application doesn't use ReactNative autolinking.</p>\n<p>In <a href="https://github.com/apple/swift/blob/main/stdlib/public/core/Dictionary.swift#L195" rel="nofollow noreferrer">Swift sources</a> I've found that <code>SwiftDeferredNSDictionary</code> is a Swift-ObjC bridging implementation. So I can assume that in some cases the dictionary is formed in Swift and everything ok but in other cases it is formed in ObjC and it breaks it.</p>\n<p><strong>The question:</strong> what build settings might lead to such an error?</p>\n"^^ . . "0"^^ . . . "Thanks you so much for the info. I have looked at the mosquitto_sub docs and think I am getting the hang of it. However I can't seem to be able to change the topic -t. Originally it says to use ```mosquitto_sub -t topic/state```. That works ok but when I try to change to say topic/temp or feed/temp nothing happens. Can someone show me how to change to topics and have more than one to subscribe to. If you want me to start another thread I can."^^ . . "Why does a smaller margin appear on the right side and bottom when adding a UIBezierPath as a mask to a UIView for the first time?"^^ . "0"^^ . . . . "Yes, after calling `newSquarePath`, you do need to eventually call `CGReleasePath`. I'm just questioning the ownership and responsibility of that release. `loadPath` is not the owner of the created path so it shouldn't be the one that releases it. Ideally, the caller of `newSquarePath` should call `CGPathRelease`. And you should change `loadPath` to take `CGPathRef`, not `CGMutablePathRef`. `loadPath` does not need a mutable path."^^ . . . . . "0"^^ . . "0"^^ . "0"^^ . "Xcode is throwing compile error even if use #available for older version Xcode"^^ . . . . . "0"^^ . "1"^^ . "0"^^ . . "<p>i have solved the question.\nscript:</p>\n<pre><code>var stackAddress = ObjC.classes.Herlper.cfunc()\nvar memoryAddress = Memory.readPointer(stackAddress)\nvar func = new NativeFunction(memoryAddress,'pointer',['int','int'])\nvar result = func(0x0,0x0)\nMemory.readByteArray(result,100)\n</code></pre>\n"^^ . "@matt Fixed it and updated the question, still having same issue but code is nicer."^^ . "android"^^ . . "0"^^ . "1"^^ . "0"^^ . . "0"^^ . . . . "1"^^ . . . . . . . . . . . "1"^^ . . . . . . . "0"^^ . . "delegates"^^ . . . "0"^^ . . "2"^^ . "Also, what if my (security tool) binary, which isn't an app at all - needs to send AppleEvents to other 3rd party apps NOT in the same app-group? Why would this dialog pop again and again and again even if user presses "Allow" every time?"^^ . "0"^^ . "state-restoration"^^ . "foundation"^^ . . . . "Maybe you can do something with `printInfo.jobDisposition`?"^^ . . . . . . . "Thank you! I was hoping to find an alternate to manually evaluating each string. That is the last resort!"^^ . . . "cocoapods"^^ . . . "0"^^ . . . . "Keep in mind that only sandboxed apps can be submitted to the App Store."^^ . . . . . . . . . . "bridging-header"^^ . "0"^^ . "1"^^ . . "uibackgroundtask"^^ . "NSOpenPanel allows a file's selection on the first invocation but not the second possibly due to an inode change"^^ . . . "0"^^ . . "<p>I am using <code>AsyncDisplayKit/Texture</code> in my iOS app to display a simple list. On each row, I want to display some text and an image horizontally and at the very bottom right corner of the row, I want to display a triangle. I have the following simple code which can demonstrate the entire issue:</p>\n<pre><code>import UIKit\nimport SnapKit\nimport AsyncDisplayKit\n\nclass ViewController: UIViewController, ASTableDataSource {\n\n let tableNode = ASTableNode()\n \n override func viewDidLoad() {\n super.viewDidLoad()\n \n view.addSubnode(tableNode)\n tableNode.view.snp.makeConstraints { make in\n make.edges.equalToSuperview()\n }\n tableNode.dataSource = self\n }\n\n func tableNode(_ tableNode: ASTableNode, numberOfRowsInSection section: Int) -&gt; Int {\n return 100\n }\n \n func tableNode(_ tableNode: ASTableNode, nodeBlockForRowAt indexPath: IndexPath) -&gt; ASCellNodeBlock {\n let row = indexPath.row\n return {\n return MyCellNode(str: &quot;Row \\(row)&quot;)\n }\n }\n\n}\n\nlet sizeToUse = 15.0\n\nclass MyCellNode: ASCellNode {\n private var title = ASTextNode()\n private let savedIcon = SaveIconNode()\n private var thumbnailNode = ASNetworkImageNode()\n \n init(str : String) {\n super.init()\n automaticallyManagesSubnodes = true\n automaticallyRelayoutOnSafeAreaChanges = true\n automaticallyRelayoutOnLayoutMarginsChanges = true\n \n title.attributedText = NSAttributedString(string: str, attributes: [.foregroundColor:UIColor.white,.font:UIFont.systemFont(ofSize: 30, weight: .medium)])\n title.backgroundColor = .darkGray\n \n thumbnailNode = ASNetworkImageNode()\n thumbnailNode.isLayerBacked = true\n thumbnailNode.cornerRoundingType = .precomposited\n thumbnailNode.cornerRadius = sizeToUse\n thumbnailNode.style.preferredSize = CGSize(width: 60, height: 60)\n thumbnailNode.url = URL(string: &quot;https://favicon.mars51.com/instagram.com&quot;)\n }\n \n override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -&gt; ASLayoutSpec {\n \n \n \n let content = ASStackLayoutSpec(direction: .horizontal, spacing: sizeToUse, justifyContent: .spaceBetween, alignItems: .start, children: [title,thumbnailNode])\n \n \n let inseted = ASInsetLayoutSpec(insets: UIEdgeInsets(top: sizeToUse, left: sizeToUse, bottom: sizeToUse, right: sizeToUse), child: content)\n \n \n savedIcon.style.preferredSize = CGSize(width: sizeToUse, height: sizeToUse)\n savedIcon.style.layoutPosition = CGPoint(x: constrainedSize.max.width - sizeToUse, y: 0)\n \n let finalLayout = ASAbsoluteLayoutSpec(sizing: .default, children: [inseted,savedIcon])\n \n \n return finalLayout\n }\n \n override func layout() {\n super.layout()\n var f = savedIcon.frame\n f.origin.y = calculatedSize.height - f.height\n savedIcon.frame = f\n }\n}\n\nclass SaveIconNode: ASDisplayNode {\n \n override init() {\n super.init()\n isLayerBacked = true\n backgroundColor = .clear\n isOpaque = false\n }\n \n override class func draw(_ bounds: CGRect, withParameters parameters: Any?, isCancelled isCancelledBlock: () -&gt; Bool, isRasterizing: Bool) {\n \n guard let context = UIGraphicsGetCurrentContext() else { return }\n\n context.beginPath()\n context.move(to: CGPoint(x: bounds.maxX, y: bounds.minY))\n context.addLine(to: CGPoint(x: bounds.maxX, y: bounds.maxY))\n context.addLine(to: CGPoint(x: bounds.minX, y: bounds.maxY))\n context.closePath()\n\n UIColor.green.setFill()\n context.fillPath()\n }\n}\n</code></pre>\n<p>This renders as such:</p>\n<p><a href="https://i.sstatic.net/zOqgl.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zOqgl.png" alt="enter image description here" /></a></p>\n<p>As you can see, the content in the rows aren't stretching the entire width of the row. This seems to be caused by <code>ASAbsoluteLayoutSpec</code>. I am not sure why it's happening and how to fix it. Note that I have specified <code>sizing: .default</code> on the <code>ASAbsoluteLayoutSpec</code> and documents state that:</p>\n<p><a href="https://texturegroup.org/docs/layout2-layoutspec-types.html" rel="nofollow noreferrer">https://texturegroup.org/docs/layout2-layoutspec-types.html</a></p>\n<blockquote>\n<p>sizing: Determines how much space the absolute spec will take up. Options include: Default, and Size to Fit.</p>\n</blockquote>\n<p>And in the source code, it says <code>default</code> will <code>The spec will take up the maximum size possible.</code>:</p>\n<pre><code>/** How much space the spec will take up. */\ntypedef NS_ENUM(NSInteger, ASAbsoluteLayoutSpecSizing) {\n /** The spec will take up the maximum size possible. */\n ASAbsoluteLayoutSpecSizingDefault,\n /** Computes a size for the spec that is the union of all children's frames. */\n ASAbsoluteLayoutSpecSizingSizeToFit,\n};\n</code></pre>\n<p>So I think my code is correct.</p>\n<p>If I don't include the <code>ASAbsoluteLayoutSpec</code> and simply <code>return inseted</code>, then it looks okay:</p>\n<p><a href="https://i.sstatic.net/0CWGS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0CWGS.png" alt="enter image description here" /></a></p>\n<p>But then I am not able to include my <code>savedIcon</code> triangle.</p>\n<p>I have tried setting <code>.style.flexGrow = 1</code> and <code>.style.alignSelf = .stretch</code> on all the nodes but that didn't make any difference whatsoever.</p>\n"^^ . "You're using private API via the key path, it's not safe at all. You could think about another way like a custom `navigationItem` for titleView, leftItem, right item, etc."^^ . . . . "0"^^ . . . "How to implement custom traits in Objective-C?"^^ . . "objective-c"^^ . . "0"^^ . "1"^^ . . . . . "Xcode analyzer is showing leak for CGPathRef when it's in a class instance method?"^^ . . . "<p><em><strong>Updated Solution2 with Device Id:-</strong></em></p>\n<p>After multiple trial and error, I have used subprocess module to directly run powershell command in Python and retrieve Device_Id of Microphone then use the same device Id in the <strong><code>audio_config = speechsdk.audio.AudioConfig(device_name=mic_device_id)</code></strong></p>\n<p>My code:-</p>\n<pre class="lang-py prettyprint-override"><code>import subprocess\nimport azure.cognitiveservices.speech as speechsdk\n\ndef get_audio_devices():\n try:\n # Execute PowerShell command to get audio devices\n command = ['powershell', 'Get-WmiObject Win32_SoundDevice | Select-Object DeviceID, Name']\n process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n output, error = process.communicate()\n\n # Print out any error message\n if error:\n print(f&quot;Error: {error.decode()}&quot;)\n\n # Decode and split the output to extract device ID and name\n output_lines = output.decode().strip().split('\\n')[2:] # Skip first two lines (column headers)\n if output_lines:\n devices = []\n for line in output_lines:\n device_id, name = line.strip().split(None, 1) # Split on first whitespace\n devices.append((device_id.strip(), name.strip()))\n return devices\n else:\n print(&quot;No audio devices found.&quot;)\n return []\n except Exception as e:\n print(f&quot;Error: {e}&quot;)\n return []\n\ndef text_to_speech(text, mic_device_id):\n speech_config = speechsdk.SpeechConfig(subscription=&quot;de63f99217074bd88429dbc7ccb45a10&quot;, region=&quot;eastus&quot;)\n audio_config = speechsdk.audio.AudioConfig(device_name=mic_device_id)\n speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)\n\n # Synthesize text to speech\n result = speech_synthesizer.speak_text_async(text).get()\n if result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted:\n print(&quot;Speech synthesized successfully&quot;)\n elif result.reason == speechsdk.ResultReason.Canceled:\n cancellation_details = result.cancellation_details\n print(&quot;Speech synthesis canceled:&quot;, cancellation_details.reason)\n if cancellation_details.reason == speechsdk.CancellationReason.Error:\n print(&quot;Error details:&quot;, cancellation_details.error_details)\n\nif __name__ == &quot;__main__&quot;:\n # Get the list of audio devices\n devices = get_audio_devices()\n \n # Print the list of devices\n for index, device in enumerate(devices, start=1):\n print(f&quot;{index}. DeviceID: {device[0]}, Name: {device[1]}&quot;)\n \n # Prompt the user to enter the microphone device ID directly\n mic_device_id = input(&quot;Enter the DeviceID of the microphone you want to use: &quot;)\n text = input(&quot;Enter the text you want to synthesize and speak: &quot;)\n text_to_speech(text, mic_device_id)\nimport subprocess\nimport azure.cognitiveservices.speech as speechsdk\n\ndef get_audio_devices():\n try:\n # Execute PowerShell command to get audio devices\n command = ['powershell', 'Get-WmiObject Win32_SoundDevice | Select-Object DeviceID, Name']\n process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n output, error = process.communicate()\n\n # Print out any error message\n if error:\n print(f&quot;Error: {error.decode()}&quot;)\n\n # Decode and split the output to extract device ID and name\n output_lines = output.decode().strip().split('\\n')[2:] # Skip first two lines (column headers)\n if output_lines:\n devices = []\n for line in output_lines:\n device_id, name = line.strip().split(None, 1) # Split on first whitespace\n devices.append((device_id.strip(), name.strip()))\n return devices\n else:\n print(&quot;No audio devices found.&quot;)\n return []\n except Exception as e:\n print(f&quot;Error: {e}&quot;)\n return []\n\ndef text_to_speech(text, mic_device_id):\n speech_config = speechsdk.SpeechConfig(subscription=&quot;de63f99217074bd88429dbc7ccb45a10&quot;, region=&quot;eastus&quot;)\n audio_config = speechsdk.audio.AudioConfig(device_name=mic_device_id)\n speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)\n\n # Synthesize text to speech\n result = speech_synthesizer.speak_text_async(text).get()\n if result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted:\n print(&quot;Speech synthesized successfully&quot;)\n elif result.reason == speechsdk.ResultReason.Canceled:\n cancellation_details = result.cancellation_details\n print(&quot;Speech synthesis canceled:&quot;, cancellation_details.reason)\n if cancellation_details.reason == speechsdk.CancellationReason.Error:\n print(&quot;Error details:&quot;, cancellation_details.error_details)\n\nif __name__ == &quot;__main__&quot;:\n # Get the list of audio devices\n devices = get_audio_devices()\n \n # Print the list of devices\n for index, device in enumerate(devices, start=1):\n print(f&quot;{index}. DeviceID: {device[0]}, Name: {device[1]}&quot;)\n \n # Prompt the user to enter the microphone device ID directly\n mic_device_id = input(&quot;Enter the DeviceID of the microphone you want to use: &quot;)\n text = input(&quot;Enter the text you want to synthesize and speak: &quot;)\n text_to_speech(text, mic_device_id)\n\n</code></pre>\n<p><strong>Output:-</strong></p>\n<p><img src="https://i.imgur.com/nTbJERD.png" alt="enter image description here" /></p>\n<p><em><strong>Just retreive Mic ID:-</strong></em></p>\n<p><strong>For Windows:-</strong></p>\n<pre class="lang-py prettyprint-override"><code>import subprocess\n\ndef get_audio_devices():\n try:\n # Execute PowerShell command to get audio devices\n command = ['powershell', 'Get-WmiObject Win32_SoundDevice | Select-Object DeviceID, Name']\n process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n output, error = process.communicate()\n\n # Print the raw output from PowerShell\n print(&quot;Raw Output from PowerShell:&quot;)\n print(output.decode())\n\n # Print out any error message\n if error:\n print(f&quot;Error: {error.decode()}&quot;)\n\n # Decode and split the output to extract device ID and name\n output_lines = output.decode().strip().split('\\n')[2:] # Skip first two lines (column headers)\n if output_lines:\n for line in output_lines:\n device_id, name = line.strip().split(None, 1) # Split on first whitespace\n print(f&quot;DeviceID: {device_id.strip()}, Name: {name.strip()}&quot;)\n else:\n print(&quot;No audio devices found.&quot;)\n except Exception as e:\n print(f&quot;Error: {e}&quot;)\n\nif __name__ == &quot;__main__&quot;:\n get_audio_devices()\n</code></pre>\n<p><strong>Output:-</strong></p>\n<p><img src="https://i.imgur.com/tyB3Wkq.png" alt="enter image description here" /></p>\n<p><strong>For MAC:-</strong></p>\n<pre class="lang-py prettyprint-override"><code>import subprocess\n\ndef get_audio_devices():\n try:\n # Execute system_profiler command to get audio devices\n command = ['system_profiler', 'SPAudioDataType']\n process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n output, error = process.communicate()\n\n # Print the raw output from system_profiler\n print(&quot;Raw Output from system_profiler:&quot;)\n print(output.decode())\n\n # Print out any error message\n if error:\n print(f&quot;Error: {error.decode()}&quot;)\n\n # Decode and split the output to extract device ID and name\n devices = []\n output_lines = output.decode().strip().split('\\n\\n')\n for device_info in output_lines:\n if 'Devices' in device_info:\n lines = device_info.split('\\n')\n for line in lines:\n if 'Device Name:' in line:\n device_name = line.split(': ')[1]\n elif 'Device ID:' in line:\n device_id = line.split(': ')[1]\n devices.append((device_id.strip(), device_name.strip()))\n break # Move to the next device\n if devices:\n return devices\n else:\n print(&quot;No audio devices found.&quot;)\n return []\n except Exception as e:\n print(f&quot;Error: {e}&quot;)\n return []\n\nif __name__ == &quot;__main__&quot;:\n get_audio_devices()\n</code></pre>\n<p><strong>Updated Solution:-</strong></p>\n<p>Try the code below where I have retrieved the list of Microphone in the output, And allowed user to Pass the Microphone Index, then passed the Mic_Id in the audio.config:-</p>\n<pre class="lang-py prettyprint-override"><code>import azure.cognitiveservices.speech as speechsdk\nimport sounddevice as sd\nimport soundfile as sf\n\ndef get_microphone_devices():\n devices = sd.query_devices()\n return devices\n\ndef select_microphone():\n print(&quot;Available microphones:&quot;)\n devices = get_microphone_devices()\n for i, device in enumerate(devices):\n print(f&quot;{i}: {device['name']}&quot;)\n \n device_index = int(input(&quot;Select microphone index: &quot;))\n return devices[device_index]['name']\n\ndef text_to_speech(text, output_file, mic_device_id):\n # Set up the speech config\n speech_config = speechsdk.SpeechConfig(subscription=&quot;de63f99217074bd88429dbc7ccb45a10&quot;, region=&quot;eastus&quot;)\n\n # Create an audio configuration specifying the selected microphone device\n audio_config = speechsdk.audio.AudioConfig(device_name=mic_device_id)\n\n # Create a speech synthesizer object\n speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)\n\n # Synthesize the text to speech\n result = speech_synthesizer.speak_text_async(text).get()\n\n # Save the speech output to a file\n if result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted:\n audio_data = result.audio_data\n sf.write(output_file, audio_data, 16000)\n\ndef main():\n mic_device_id = select_microphone()\n text = input(&quot;Enter the text to convert to speech: &quot;)\n output_file = &quot;output.wav&quot;\n text_to_speech(text, output_file, mic_device_id)\n \nif __name__ == &quot;__main__&quot;:\n main()\n</code></pre>\n<p><img src="https://i.imgur.com/j5oK8rD.png" alt="enter image description here" /></p>\n<p><em><strong>Approach 1:-</strong></em></p>\n<p>Use the code below to select the available Microphone or Audio devices and then get the speech output:-</p>\n<pre class="lang-py prettyprint-override"><code>import azure.cognitiveservices.speech as speechsdk\nimport sounddevice as sd\nimport soundfile as sf\n\ndef text_to_speech(text, output_file):\n # Set up the speech config\n speech_config = speechsdk.SpeechConfig(subscription=&quot;xxxxxxx5a10&quot;, region=&quot;eastus&quot;)\n\n # Create a speech synthesizer object\n speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config)\n\n # Synthesize the text to speech\n result = speech_synthesizer.speak_text_async(text).get()\n\n # Save the speech output to a file\n if result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted:\n audio_data = result.audio_data\n sf.write(output_file, audio_data, 16000)\n\ndef select_microphone():\n print(&quot;Available microphones:&quot;)\n for i, device in enumerate(sd.query_devices()):\n print(f&quot;{i}: {device['name']}&quot;)\n \n device_index = int(input(&quot;Select microphone index: &quot;))\n return device_index\n\ndef main():\n device_index = select_microphone()\n text = input(&quot;Enter the text to convert to speech: &quot;)\n output_file = &quot;output.wav&quot;\n text_to_speech(text, output_file)\n \n play_audio_file(output_file, device_index)\n\nif __name__ == &quot;__main__&quot;:\n main()\n\n</code></pre>\n<p><strong>Output:-</strong></p>\n<p><img src="https://i.imgur.com/VBjv0tP.png" alt="enter image description here" /></p>\n<p><em><strong>Approach 2:-</strong></em></p>\n<p>Alternatively, You can directly add the Microphone Device ID in your code and get the speech output in that specific Mic:-\nIn order to get <strong><code>Microphone Device ID</code></strong> in your <strong>MAC device</strong> use the command in your terminal:-</p>\n<pre><code>system_profiler SPAudioDataType\n</code></pre>\n<p>This will list the audio devices along with their <strong><code>ID's</code></strong>, Now use the <strong><code>Microphone Id</code></strong> in the code below:-</p>\n<pre class="lang-py prettyprint-override"><code>import os\nimport azure.cognitiveservices.speech as speechsdk\n\n\nmic_device_id = &quot;INTELAUDIO\\FUNC_xxxxxxxx_xxxxxEV_10xx\\5&amp;1xxxx001&quot;\n\n\nspeech_config = speechsdk.SpeechConfig(subscription='de63f99217074bd88429dbc7ccb45a10', region=&quot;eastus&quot;)\n\n\naudio_config = speechsdk.audio.AudioConfig(device_name=mic_device_id)\n\n\nspeech_config.speech_synthesis_voice_name='en-US-JennyNeural'\n\nspeech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)\n\n\nprint(&quot;Enter some text that you want to speak &gt;&quot;)\ntext = input()\n\nspeech_synthesis_result = speech_synthesizer.speak_text_async(text).get()\n\nif speech_synthesis_result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted:\n print(&quot;Speech synthesized for text [{}]&quot;.format(text))\nelif speech_synthesis_result.reason == speechsdk.ResultReason.Canceled:\n cancellation_details = speech_synthesis_result.cancellation_details\n print(&quot;Speech synthesis canceled: {}&quot;.format(cancellation_details.reason))\n if cancellation_details.reason == speechsdk.CancellationReason.Error:\n if cancellation_details.error_details:\n print(&quot;Error details: {}&quot;.format(cancellation_details.error_details))\n print(&quot;set the resource key and region values?&quot;)\n</code></pre>\n<p><em><strong>Output:-</strong></em></p>\n<p><img src="https://i.imgur.com/3gApDWV.png" alt="enter image description here" /></p>\n"^^ . . . . . "<app> would like to access data from other apps - macOS Sonoma"^^ . "It is actually some task I am doing to learn manual memory management as I have possibility to work on a project which is using manual memory management. I have not seen the code yet so I don't know how easy or difficult it will be to convert it to ARC. The app was crashing a lot with title variable but once I did a copy on this, it has fixed the crashes."^^ . . "Nope, as I explained in the question, I found no way to delay the state restoration without also stopping the process that would open the documents, as it all happens in the same subroutine into which I cannot find a way to hook into."^^ . . "Determine which microphone source to use for Azure Cognitive Services with Python"^^ . . "0"^^ . . "<p>Well, I've got my mistake. Right implementation is below:</p>\n<p>In <strong>metal-cpp/Foundation/NSPrivate.hpp</strong>:</p>\n<pre><code>_NS_PRIVATE_DEF_SEL(detachNewThreadSelector_toTarget_withObject_,\n &quot;detachNewThreadSelector:toTarget:withObject:&quot;);\n// Register our selector\n_NS_PRIVATE_DEF_SEL(run_,\n &quot;run:&quot;);\n</code></pre>\n<p>In <strong>metal-cpp/Foundation/NSThread.hpp</strong>:</p>\n<pre><code>_NS_INLINE void NS::Thread::detachNewThread( const Runnable* pRunnable )\n{\n NS::Value* pWrapper = NS::Value::value( pRunnable );\n\n typedef void (*DispatchFunction)( NS::Value*, SEL, void* );\n \n DispatchFunction run = []( Value* pSelf, SEL, void* unused )\n {\n auto pDel = reinterpret_cast&lt; NS::Runnable* &gt;( pSelf-&gt;pointerValue() );\n pDel-&gt;run();\n };\n\n // Register the class method on Objective-C side\n class_addMethod( (Class)_NS_PRIVATE_CLS( NSValue ), _NS_PRIVATE_SEL( run_ ), (IMP)run, &quot;v@:@&quot; );\n // Here we call an Objective-C side's selector\n return Object::sendMessage&lt;void&gt;(_NS_PRIVATE_CLS(NSThread), _NS_PRIVATE_SEL(detachNewThreadSelector_toTarget_withObject_), _NS_PRIVATE_SEL(run_), pWrapper, nullptr );\n}\n</code></pre>\n"^^ . . "0"^^ . "0"^^ . "0"^^ . . . . "<p>I have an app which uses MQTTClient to connect to io.adafruit and then subscribes to various feeds. I then publish a &quot;GET&quot; message to start receiving data from the various feeds. Then I check the various feeds to see what they are and do whatever.\nThis is fine when the app is in the foreground but when it is put into the background I would like to stop the process. I have tried setting the session to nil, disconnect the session, and set the MQTTCRSocketTransport to nil all to no avail. It just keeps checking for updates.\nThis is my code.</p>\n<pre><code>NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];\n self.myUserName = [defaults objectForKey:@&quot;myUserNameFile&quot;];\n NSLog(@&quot;myUserName:%@&quot;,self.myUserName);\n self.myUserKey = [defaults objectForKey:@&quot;myUserKeyFile&quot;];\n NSLog(@&quot;myUserKey:%@&quot;,self.myUserKey);\n \n transport = [[MQTTCFSocketTransport alloc] init];\n transport.host = @&quot;io.adafruit.com&quot;;\n transport.port = 1883;\n \n NSLog(@&quot;transport:%@&quot;,transport);\n session2 = [[MQTTSession alloc] init];\n session2.userName =self.myUserName;\n session2.password = self.myUserKey;\n session2.transport = transport;\n \n session2.delegate = self;\n session2.keepAliveInterval = 30;\n NSString *feeds = [self.myUserName stringByAppendingString:@&quot;/feeds/&quot;];\n \n self.battery = [feeds stringByAppendingString:@&quot;battery&quot;];\n \n self.getbat = [self.battery stringByAppendingString:@&quot;/get&quot;];\n \n [session2 connectWithConnectHandler:^(NSError *error) {\n if(!error){\n \n [session2 subscribeToTopic:self.battery atLevel:1 subscribeHandler:^(NSError *error, NSArray *gQoss){\n \n if (error) {\n NSLog(@&quot;Subscription failed %@&quot;, error.localizedDescription);\n } else {\n NSLog(@&quot;Subscription sucessfull! Granted Qos: %@&quot;, gQoss);\n \n \n NSData* data = [ @&quot;0&quot; dataUsingEncoding:NSUTF8StringEncoding];\n [session2 publishData:data onTopic:self.getbat retain:NO qos:0 publishHandler:nil];\n }\n }]; }\n else {NSLog(@&quot;[connectWithConnectHandler]Error Connect %@&quot;, error.localizedDescription);}\n }];\n }\n\n- (void)newMessage:(MQTTSession *)session\n data:(NSData *)data\n onTopic:(NSString *)topic\n qos:(MQTTQosLevel)qos\n retained:(BOOL)retained\n mid:(unsigned int)mid {\n NSString *dataString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];\n\n if ([topic isEqualToString:self.battery]){\n B = [dataString intValue];\n }\n\n- (void)applicationDidEnterBackground:(UIApplication *)application\n{ [session2 disconnect];\n [session2 unsubscribeTopic:self.battery];\n NSLog(@&quot;this enters background&quot;);}\n</code></pre>\n<p>Can someone help me stop the process when the app enters the background. The biggest problem is that one of the feeds updates it data every 6seconds so when the app enters the background these updates keeps the app alive in the background.</p>\n"^^ . "<p>I have an older objective-C iOS project with thousands of strings, both user facing and internal, that is not localized.</p>\n<p>My main challenge is to identify user facing text that are string literals in code without NSLocalizedString wrapper.</p>\n<p>I cannot just find and replace all string literals in code, as some (hundreds) of them are not user facing text.</p>\n<p>Is there a way to find all the user facing strings, and wrap them with NSLocalizedString so that I can localize my app?</p>\n"^^ . . "<p>I have an array of nested objects that I want to save as JSON. Object is defined as following:</p>\n<pre><code>@interface TreeNode : NSObject\n\n@property(nonatomic, strong) NSString *title;\n@property(nonatomic, strong) NSMutableArray&lt;TreeNode *&gt; *children;\n@property(nonatomic, strong) NSString *identifier;\n@property(nonatomic, assign) bool isCompleted;\n\n- (instancetype)initWithValue:(NSString *)title :(NSString *)number;\n- (void)addChild:(TreeNode *)child;\n\n@end\n\n@implementation TreeNode\n\n- (instancetype)initWithValue:(NSString *)title :(NSString *)number {\n self = [super init];\n if (self) {\n _isCompleted = false;\n _title = [title copy];\n _identifier = [number copy];\n _children = [[NSMutableArray alloc] init];\n }\n return self;\n}\n\n- (void)addChild:(TreeNode *)child {\n [_children addObject:child];\n}\n\n- (void)dealloc\n{\n [_title release];\n [_identifier release];\n [_children release];\n \n [super dealloc];\n}\n\n@end\n</code></pre>\n<p>The above object is added to array as unlimited nested objects as following:\n[[String,[[String,[]], [String,[]]]],[String,[]],[String,[]]]\n[String,[]] above represents my class object(TreeNode).\nI want to save it locally in document directory. I am trying to save it as JSON but not able to convert it to JSON object.</p>\n"^^ . "<p>Found the answer. you can turn off sandbox by going to signing and capabilities tab and just remove the sandbox settings on the right.</p>\n"^^ . "azure"^^ . "3"^^ . "0"^^ . "2"^^ . . . . . "iOS AsyncDisplayKit / Texture's ASAbsoluteLayoutSpec not stretching content to fill width"^^ . . . . . . "0"^^ . . . . . . "0"^^ . "0"^^ . "0"^^ . "0"^^ . . . . "I am getting value for title at init so wouldn't copy will make more sense here than strong?"^^ . . . "@son Good point about the `__MAC_14_0` macro. That probably isn't defined in Xcode 14. I don't actually have Xcode 14 so I didn't catch that oversight in my answer. I need to update for that."^^ . . "uitraitcollection"^^ . . "That or convert it to a literal `NSArray`. `static NSArray<NSString> *fooStrings = @[@"foo"]`"^^ . . "How to prevent automatic State Restoration if the app was launched to open specific documents?"^^ . . . . . "<p>I figured out the solution in a different way.</p>\n<ol>\n<li><p>I got rid of the <code>func layout()</code> function.</p>\n</li>\n<li><p>I put the <code>savedIcon</code> inside an <code>ASInsetLayoutSpec</code> whose <code>top</code> and <code>left</code> are set to <code>CGFloat.infinity</code>.</p>\n</li>\n<li><p>I returned a <code>ASOverlayLayoutSpec</code> whose child is the <code>inseted</code> content and overlay is the above created <code>savedIconSpec</code>.</p>\n</li>\n</ol>\n<p>I learnt about this trick from the <code>Photo with Inset Text Overlay</code> example below:</p>\n<p><a href="https://texturegroup.org/docs/automatic-layout-examples-2.html" rel="nofollow noreferrer">https://texturegroup.org/docs/automatic-layout-examples-2.html</a></p>\n<p>Now my <code>layoutSpecThatFits</code> looks like this:</p>\n<pre><code>override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -&gt; ASLayoutSpec {\n \n let content = ASStackLayoutSpec(direction: .horizontal, spacing: sizeToUse, justifyContent: .spaceBetween, alignItems: .start, children: [title,thumbnailNode])\n \n let inseted = ASInsetLayoutSpec(insets: UIEdgeInsets(top: sizeToUse, left: sizeToUse, bottom: sizeToUse, right: sizeToUse), child: content)\n \n savedIcon.style.preferredSize = CGSize(width: sizeToUse, height: sizeToUse)\n savedIcon.style.layoutPosition = CGPoint(x: constrainedSize.max.width - sizeToUse, y: 0)\n \n let savedIconSpec = ASInsetLayoutSpec(insets: UIEdgeInsets(top: CGFloat.infinity, left: CGFloat.infinity, bottom: 0, right: 0), child: savedIcon)\n \n return ASOverlayLayoutSpec(child: inseted, overlay: savedIconSpec)\n}\n</code></pre>\n<p>It looks like this now:</p>\n<p><a href="https://i.sstatic.net/wRKvn.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wRKvn.jpg" alt="enter image description here" /></a></p>\n"^^ . "Looks like the array passed to you is autoreleased: `NSMutableArray *_flatTodoList = [[[NSMutableArray alloc] init] autorelease];`."^^ . "FYI - there is no unavoidable reason for using MRC. Even in an MRC project, individual files can be converted to ARC. The trivial amount of time doing the conversion far outweighs all of the issues from staying with MRC."^^ . "0"^^ . "<p>Xcode14 is throwing compile error -</p>\n<p><a href="https://i.sstatic.net/Y0J13.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Y0J13.png" alt="enter image description here" /></a></p>\n<p>When I use clipsToBounds property in Mac OS 14 with Xcode 15 it works.<br />\nI need to run code on both Xcode 15 and Xcode 14.</p>\n<p>I added availability check, but its failing at compile time.</p>\n<p>any suggestion?</p>\n"^^ . "-1"^^ . . "As a side note, 1. Why are you using MRC instead of ARC? 2. You declare the `title` and `identifier` properties as `strong` but your `init` method is using copy semantics on both."^^ . "Also this seems to be Objective-C code, so please don't tag [swift], and post your code as *text*, not an image."^^ . "@HangarRash Thanks for doing that. Dunno why I'm getting the analyzer error for one set of code and not the other, but regardless what you're saying about CGPathRelease and newSquarePath is correct. Have to find a new solution."^^ . . . . . "Please update your question showing how you create and setup `mainViewContainer`."^^ . . . . "How do I use MQTTClient library on Arduino to publish and subscribe to the MQTT broker installed on a Mac using Homebrew?"^^ . . . . . . . . "0"^^ . "This thread too: https://developer.apple.com/forums/thread/758375"^^ . . . . . . "iboutlet"^^ . . "There is no "best way". You have to manually look at every string in the code and decide yourself whether to wrap it in `NSLocalizedString`. It's a terribly tedious process to go back and add localization to an old project. I went through that years ago on a very large code base. No fun. I now add the comment `// NO_I18N` to end of every line that contains a string that doesn't need to be localized. I wrote a script that scans source files for string literals and it filters out references to `NSLocalizedString` and the `NO_I18N` comment. What's left are strings that need to be localized."^^ . "0"^^ . . . . . "@red_menace Entitlemenets are set accordingly."^^ . . . "<p>Can you maybe delay state restoration? Queue up all the data you get for restoring state, return an &quot;everything fine&quot; value, and then wait for 'oapp' Apple Event to restore it (or just clear the queue if an 'odoc' arrives).</p>\n"^^ . "0"^^ . "1"^^ . . . "asyncdisplaykit"^^ . . . "0"^^ . . . . . . "0"^^ . . "2"^^ . "react-native"^^ . . "@grazer1998 did you ever find a solution to this? i'm running into the same issue."^^ . . . . "0"^^ . . . "if I add below code still it throws error -\n\n if (@available(macOS 14.0, *)) {\n myNSView.clipsToBounds = YES;\n }"^^ . . "<p>macOS Sequoia has started to fully control security.</p>\n<p>The issue is with <strong>App Groups</strong> in xCode.</p>\n<p>The app developer in xCode should go to the section (<strong>repeat for each target</strong>):</p>\n<pre><code>Signing &amp; Capabilities → Targets → TARGET_NAME → App Groups → App Group\n</code></pre>\n<p>where he should specify the following:</p>\n<pre><code>$(TeamIdentifierPrefix)myFirm.myName\n</code></pre>\n<p>A fictitious ID like this does not work:</p>\n<pre><code>myGroupID.myFirm.myName\n</code></pre>\n<p>And in the program code he should specify the real group ID (<strong>in numbers</strong>):</p>\n<pre><code>let storeDirectory = FileManager.default.containerURL(\n forSecurityApplicationGroupIdentifier: “0123456789.myFirm.myName”\n)\n</code></pre>\n<p>After recompiling the app, the problem disappears.</p>\n"^^ . "0"^^ . "0"^^ . . . "<p>I have implemented State Restoration in my AppKit (Cocoa) app. That works.</p>\n<p>However: If the user opens the app by double clicking a document file saved by the app, then I want the app not to restore the previous windows but <em>only</em> open the document that was opened in Finder.</p>\n<p>The problem is that the state restoration appears to happen <em>before</em> the handlers for opening document files are invoked, so even if I had a way to suppress the state restoration, I have no knowledge of the pending openURL calls at that point, yet.</p>\n<p>I understand that I could check the launch arguments, but that seems to be a rather dirty way. I'd think that I should be able to query the stored file paths/URLs from the app object somehow, but I can't find anything.</p>\n<p>Or can I change the order of restoring documents vs. opening documents? I've so far found out that both happens deep inside <code>[NSDocument restoreDocumentWindowWithIdentifier:state:completionHandler:]</code>, inside the completionHandler function. I could not find an overridable function below that where I'd have more control over this, though.</p>\n<p>I implement State Restauration by overriding <code>restoreStateWithCoder:</code> and <code>encodeRestorableStateWithCoder:</code> in my NSDocument subclass.</p>\n"^^ . . . "uikit"^^ . "1"^^ . "I agree with @son, but please at least add the crash's stack trace to the question—without it it's not possible to figure out the reason of the crash."^^ . "thanks @lazarevzubov for the suggestion. My bad that I haven't added the crash that I am getting.\nI have added now. Also I was using valueForKeyPath:@"navigationbar" and it was working fine till Xcode 14 and its even working on iOS 16 when build with Xcode 15. Its only crashing when I am running with combination of Xcode 15 and iOS 17"^^ . "What are you trying to accomplish? I'm sorry but I don't understand steps 7 and 8. Add a window to a window? What is "File’s Owner of the AppDelegate object in Placeholders"?"^^ . . . . "It's a sandbox issue."^^ . . . . . "1"^^ . . . "0"^^ . "0"^^ . . . . "0"^^ . . . "0"^^ . . . "Have you tried printing the pdf in the Preview app? what does the preview look like?"^^ . "0"^^ . "1"^^ . . . . "0"^^ . "0"^^ . "1"^^ . . . . "0"^^ . . "nsprintpanel"^^ . . . . . "<p>I am developing a <a href="https://docs.expo.dev/modules/get-started/#adding-a-new-module-to-an-existing-application" rel="nofollow noreferrer">local Expo module</a> in which I am using a 3rd party Framework.</p>\n<p>My <code>.podspec</code> looks something like this:</p>\n<pre><code>Pod::Spec.new do |s|\n # root specification\n\n s.dependency 'ExpoModulesCore'\n s.vendored_frameworks = 'Frameworks/MyLocalFramework.framework'\n s.public_header_files = &quot;Frameworks/MyLocalFramework.framework/Headers/*&quot;\n\n # Swift/Objective-C compatibility\n s.pod_target_xcconfig = {\n 'DEFINES_MODULE' =&gt; 'YES',\n 'SWIFT_COMPILATION_MODE' =&gt; 'wholemodule'\n }\n\n s.source_files = &quot;**/*.{h,m,mm,swift,hpp,cpp}&quot;\nend\n</code></pre>\n<p>After running <code>pod install</code> in my prebuilded iOS app, which implements my module, I am able to import and use <code>MyLocalFramework</code> in my Objective-C and Swift files without issues.</p>\n<p>However, once I try to run my app with <code>npx expo run:ios</code> I get a build error saying an import in my <code>ModuleName-umbrella.h</code> failed. There it tries to import the Frameworks headers via the <code>&quot;Header.h&quot;</code> syntax (this was generated after <code>pod install</code>).</p>\n<p>Now, when I manually change the imports using the <code>&lt;MyLocalFramework/Header.h&gt;</code> syntax I can build and run the app without issues.</p>\n<p>My question is: Why does <code>pod install</code> use the &quot;&quot; import syntax here instead of &lt;&gt;? I don't want to manually change the imports every time I run <code>pod install</code>.</p>\n<p>Additional information:\nUnder my modules <code>Build Phases &gt; Headers &gt; Project</code> I specified the <code>ModuleName-umbrella.h</code> as well as the <code>MyLocalFramework</code> headers.</p>\n"^^ . "0"^^ . . . "0"^^ . "Is there a way to do this conversion in Swift? It's an older library's code that someone else has written and not something I can directly modify.\n\nIf I was to use an ObjC function to return it, it might be a better idea to just have everything done in ObjC (would prefer not to since I'm learning Swift)."^^ . . "1"^^ . . "0"^^ . . . . "0"^^ . . "0"^^ . . . . "1"^^ . . . "0"^^ . "I am not the one who created this framework, thus I have no control over it @Cy-4AH"^^ . . . . . "There are no problems to create frameworks written in Objective-C with SPM"^^ . "0"^^ . . . . "0"^^ . "0"^^ . . . . . "0"^^ . "0"^^ . "<p>The method I've found so far is to use Objective-C method swizzling and replace these three methods with a function that calls my callback function and then calls the original method:</p>\n<ul>\n<li><code>dragImage:at:offset:event:pasteboard:source:slideBack:</code> on <code>NSWindow</code></li>\n<li><code>dragImage:at:offset:event:pasteboard:source:slideBack:</code> on <code>NSView</code></li>\n<li><code>beginDraggingSessionWithItems:event:source:</code> on <code>NSView</code></li>\n</ul>\n<p>I'm not 100% sure that will catch every drag-and-drop operation, but it's caught all the ones I've tested out so far.</p>\n"^^ . . . "0"^^ . . "0"^^ . . . . "xib"^^ . . . . . . "Are the outlet and action connected in a xib or storyboard? How is the `rViewController` instantiated?"^^ . "1"^^ . "2"^^ . "As we are talking about ObjC: Is it possible that the returned value is not a pointer but an `ObjC.Block`? AFAIR callbacks are usually stored as such a block instead of plain pointer in ObjC 8see e.g. https://codeshare.frida.re/@ivan-sincek/ios-touch-id-bypass/) . Is the pointer value still as high as `0x600001931050`? because such a value doesn't look like a pointer (too high) instead it could be handle is used to identify something."^^ . . . "@HangarRash I have all my shape paths stored in one class and are returned as above using the new keyword i.e. newSquareBalloonPath, so it needs to be released in that case right because new will add one to the reference count. As for why mutable, I'm building the paths using CGPathAddCurveToPoint."^^ . "Thanks @HangarRash, I updated it, and my purpose is to point out to OP that there are preprocessors in AvailabilityMacros.h that can support in this scenario. Beside that, it seems like __MAC_14_0 doesn't really work on the lower Xcode version (I tried on 14.3.1), so I decided to use its value directly."^^ . . "Ill have to do more investigations on this. It seems to me that xCode does more than advertised - i.e. does more than set CFBundleURLTypes"^^ . "0"^^ . "0"^^ . "NSThread initWithTarget:selector:object:]: target does not implement selector ((null))'"^^ . "<p>I have a java swing app that calls <a href="https://developer.apple.com/documentation/appkit/nsopenpanel?language=objc" rel="nofollow noreferrer">NSOpenPanel</a> two times. The first time, it allows a file to be selected. When NSOpenPanel's [Open] button is clicked, the app changes the file that was selected such that the file's inode changes.</p>\n<p>When the app calls NSOpenPanel again, that file is not selectable. But if I navigate away from that folder and come back to it, then the changed file is now selectable.</p>\n<p>Is this NSOpenPanel behavior defined or undefined?</p>\n<p>Is there any way I can coax NSOpenPanel to refresh it's view of the former folder instead of indicating staleness?</p>\n<p>It inherits <a href="https://developer.apple.com/documentation/appkit/nssavepanel?language=objc" rel="nofollow noreferrer">NSSavePanel</a> and the only attribute there that looked interesting was <code>validateVisibleColumns</code> but it isn't accessible to NSOpenPanel, according to my compiler.</p>\n<p>Below is the MCV example that reliably repros what I consider a problem on Sonoma 14.2.1 and Xcode 15.2.</p>\n<p>Open.java</p>\n<pre><code>import java.awt.event.*;\nimport javax.swing.*;\nimport java.io.*;\nimport java.nio.file.*;\npublic class Open extends JFrame {\n public Open () {\n setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n getContentPane().add(new JButton(new AbstractAction() {\n public void actionPerformed (ActionEvent e) {\n SwingWorker&lt;Void,Void&gt; worker = new SwingWorker&lt;Void,Void&gt;() {\n String[] files = null;\n public Void doInBackground () throws Exception {\n files = NativeOpenFileDialog.run();\n return null;\n }\n protected void done () {\n if (files != null) {\n for (String s : files) {\n File old = new File(s);\n File tmp = new File(&quot;tempfile&quot;);\n try {\n Files.copy(old.toPath(), tmp.toPath(), StandardCopyOption.REPLACE_EXISTING);\n if (tmp.renameTo(old))\n System.out.println(s + &quot;: ok&quot;);\n else\n System.err.println(s + &quot;: rename fail&quot;);\n } catch (Throwable ex) {\n System.err.println(s + &quot;: copy fail&quot;);\n }\n }\n }\n }\n };\n worker.execute();\n }\n }));\n pack();\n setVisible(true);\n }\n public static void main(String[] args) {\n SwingUtilities.invokeLater(new Runnable() {\n public void run() { new Open(); }\n });\n }\n}\n</code></pre>\n<p>NativeOpenFileDialog.java</p>\n<pre><code>import javax.swing.*;\n\npublic class NativeOpenFileDialog {\n static {\n System.loadLibrary(&quot;natopndlg&quot;);\n };\n public static native String[] run ();\n}\n</code></pre>\n<p>NativeOpenFileDialog.m</p>\n<pre><code>#import &lt;Cocoa/Cocoa.h&gt;\n\n#include &lt;jni.h&gt;\n#include &quot;NativeOpenFileDialog.h&quot;\n\nJNIEXPORT jobjectArray JNICALL Java_NativeOpenFileDialog_run (JNIEnv *env, jclass jcls) {\n @autoreleasepool {\n __block jobjectArray arr;\n dispatch_sync(dispatch_get_main_queue(), ^{\n jclass strcls = (*env)-&gt;FindClass(env, &quot;java/lang/String&quot;);\n NSOpenPanel *panel = [NSOpenPanel openPanel];\n [panel setCanChooseFiles:YES];\n [panel setCanChooseDirectories:YES];\n [panel setAllowsMultipleSelection:YES];\n [panel setAllowsOtherFileTypes:YES];\n if ([panel runModal] != NSModalResponseOK) {\n arr = (*env)-&gt;NewObjectArray(env, 0, strcls, NULL);\n return;\n }\n NSArray *urls = [panel URLs];\n int count = urls == NULL ? 0 : [urls count];\n arr = (*env)-&gt;NewObjectArray(env, count, strcls, NULL);\n if (urls != NULL) {\n int i = 0;\n for (NSURL* url in urls) {\n NSString *path = [url path];\n jstring str = (*env)-&gt;NewStringUTF(env, [path UTF8String]);\n (*env)-&gt;SetObjectArrayElement(env, arr, i++, str);\n }\n }\n });\n return arr;\n }\n}\n</code></pre>\n<p>makefile</p>\n<pre><code>SDK = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk\n\nOpen.class: Open.java NativeOpenFileDialog.java NativeOpenFileDialog.m\n javac -h . NativeOpenFileDialog.java\n javac Open.java\n gcc -dynamiclib -o libnatopndlg.dylib -framework Cocoa -isysroot $(SDK) -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/darwin -fobjc-exceptions -std=c99 NativeOpenFileDialog.m\n\nclean:\n rm -f *.class *.dylib *.h\n</code></pre>\n<p>Compile, link, and go...</p>\n<pre><code>$ make\n$ open Java\n</code></pre>\n<p>Click the app's button to open the open file dialog. Select any file and click [Open] to give that file a new inode. Click the app's button again and you'll see that the file previously selected is not selectable unless you navigate away from the folder and come back again.</p>\n"^^ . . "1"^^ . "This is more of a comment than an answer."^^ . . "mosquitto"^^ . "Any news on this ? Same problem here...still not solved in 2024-11-10"^^ . "Does the app you are controlling have access to user data?"^^ . "0"^^ . . . . . "Solved! , I see that self.bounds = container View.bounds causes the problems, I needed to make the entire view with constraints, the space that was left over in white or whatever color was because when the view was rendered that space was part of the safe area . @DonMag"^^ . . . . . . "5"^^ . . . . . . "0"^^ . "1"^^ . . "0"^^ . . "arduino-esp8266"^^ . . "-1"^^ . . . . . "macos"^^ . . "1"^^ . "@matt yeah you're right, got so wound up in redesigning some of my code and moving stuff around that I lost sight of it. going to change it and see if it fixes it, though if it does not sure I understand why."^^ . . "-1"^^ . . "setNeedsDisplay belongs to NSView subclass, not to a controller. What you are trying to achieve is data source. Instead of calling setneedsdisplay you need method called reload. Look at how NSTableView is being implemented"^^ . . . . . . . . "Does this answer your question? [New React Native iOS app size over 500 MB - in release mode](https://stackoverflow.com/questions/75740568/new-react-native-ios-app-size-over-500-mb-in-release-mode)"^^ . . . . . . "0"^^ . . . . "0"^^ . . "Your updated solution uses the mic name, not the ID - I've tried passing it the name (see my initial question), but it doesn't pick up the microphone based on the name. As such, I want to find the device ID to pass through. I appreciate your help, but I think you're maybe not understanding the issue?"^^ . . . . "line-breaks"^^ . "<p>The problem is with ownership. You have one place that creates and takes ownership of the <code>CGMutablePathRef</code>. You then pass that reference to another method that then releases it. But that method should not take responsibility for releasing the reference. It has no idea if the reference it is getting should be released or not.</p>\n<p>The simple fix is to put the responsibility in the correct place. Change <code>loadSquarePath</code> in <code>GraphicViewController</code> to something like this:</p>\n<pre class="lang-objc prettyprint-override"><code>- (void) loadSquarePath\n{\n CGMutablePathRef path = [SquarePath newSquareBalloonPath];\n [self.graphicView loadPath:path];\n CGPathRelease(path);\n}\n</code></pre>\n<p>and remove the call to <code>CGPathRelease</code> from <code>loadPath:</code> in <code>GraphicView</code>.</p>\n<p>Or in the second set of code, remove <code>CGPathRelease</code> from <code>loadGraphicView:withPath:</code> in <code>GraphicViewController</code>.</p>\n<p>These changes quiet the analyzer because it moves the responsibility of releasing to the same place that took the responsibility of ownership at creation.</p>\n<p>This also eliminates possible crashes due to the <code>CGReleasePath</code> in <code>loadPath:</code> over-releasing paths that should not be released. While your current code is only passing a path reference that does need to be released, that may not always be the case.</p>\n"^^ . . . "Thank you for your suggestion, I will follow it. I am now able to save it to JSON file, adding my code as answer to this question."^^ . "How track a NSWindow's onActiveSpace property"^^ . . "0"^^ . . "<p>I've set up an instance of Azure Cognitive Services to listen on a microphone for a key phrase. This works fine, however I'm unable to tell it to listen to a specific microphone on my Apple Mac.</p>\n<p>The code I have is:</p>\n<pre class="lang-py prettyprint-override"><code>mic_name = self.preferences.get('mic_name', None)\nself.audio_config = speechsdk.audio.AudioConfig(device_name=mic_name) if mic_name else None\n...\nself.keyword_recognizer = speechsdk.KeywordRecognizer(audio_config=self.audio_config)\n</code></pre>\n<p>Where I'm providing the microphone name as the device name to the <code>speechsdk.audio.AudioConfig</code> library. However from what I can read via <a href="https://aka.ms/csspeech/microphone-selection" rel="nofollow noreferrer">https://aka.ms/csspeech/microphone-selection</a> it seems I need to provide the device ID, not the name or index which is what pyaudio gives me.</p>\n<p>I've been searching online in an attempt to find a solution to getting the device ID, and the only thing I've been able to determine is that the pyobjc package might be needed in order to interact with the hardware via objective-c. Yet my attempts at that have also failed.</p>\n<p>Does anyone know of an existing library, or example I could reference, where a Python script is able to return the ID of a microphone device so I can provide it to the Speech Services SDK? (I also want this to work for windows, but that is a seperate matter)</p>\n<p>===</p>\n<p>Update - to be clear, I need the user to be able to select the microphone they want to use from a dropdown, and then pass said Microphone ID through to the <code>speechsdk.audio.AudioConfig</code> library.</p>\n"^^ . . . . . "0"^^ . . . . . "<p>i have a properly sandboxed and codesigned app for macOS in objective-c. On Sonoma (macOS 14) i keep getting the dialog &quot; would like to access data from other apps&quot;. According to Apple Developer this is a new security related message on macOS 14.2.</p>\n<p>See here: <a href="https://developer.apple.com/forums/thread/742147" rel="noreferrer">https://developer.apple.com/forums/thread/742147</a></p>\n<p>My App is developed according to Apples guidelines. E.g. using Open or SavePanels, Security scoped Bookmarks and so on. It does NOT try to access anothers app AppContainer (so this is whats confusing me).</p>\n<p>My app controls another one by the usage of Apple Events but i do not try to access the apps AppContainer to read/write data.</p>\n<p>CodeSigning uses a valid DeveloperIDApplication signature, Notarization also succeeds every time.</p>\n<p>I searched through Developer Docs, Forums and so on and I am quite lost, just seeing that others got this issue too.</p>\n<p>Any hint towards the right direction is very much appreciated.</p>\n"^^ . "uinavigationbar"^^ . . "0"^^ . . . "Is a window object a xib file? If a window has a window controller then usually the window controller owns the window, is the file's owner, is the window's delegate and has the outlets to the controls in the window. The app delegate talks to the window controller, not to the window or the controls. The window controller controls the window."^^ . . . . "0"^^ . . . . . . "How to use Interface-Bridging-Header.h in macos Sonoma"^^ . . "0"^^ . . . . "core-graphics"^^ . . . "1"^^ . . . "I am talking about 'NSView' only. if it's available from macOS 10.9, then why it is throwing error on Xcode 14.3.1 and working on Xcode 15. if I put macOS 10.9 availability in code its throwing same error."^^ . . . . . . . "<p>I gues there is a typo here. It was <code>retractingFact</code> in Objective-C and <code>assertingFact</code> in Swift.</p>\n<pre><code>//Objc-C\n[ruleSystem addRule:[GKRule ruleWithPredicate:playerNear retractingFact:@&quot;hunt&quot; grade:1.0]];\n\n///Swift\nruleSystem.add(GKRule(predicate: playerNear, assertingFact: assertingFactKey, grade: 1.0))\n</code></pre>\n<p>And you might consider changing to this rather than hard code in the format.</p>\n<pre class="lang-swift prettyprint-override"><code>let num = 10.0\nlet playerFar = NSPredicate(format: &quot;$distanceToPlayer.floatValue &gt;= %f&quot;, num)\n</code></pre>\n"^^ . "0"^^ . . . "<p>It turns out that you don't need the computed property on <code>UIMutableTraits</code> for this to work. That added property in the example Swift code is just a convenience for later use. In Objective-C, you can still make it work, it's just that the final code is slightly more cumbersome.</p>\n<p>For example, in the Swift code you can create a <code>UITraitCollection</code> with the sample custom trait using code such as:</p>\n<pre class="lang-swift prettyprint-override"><code>let myTraits = UITraitCollection { mutableTraits in\n mutableTraits.myAppTheme = .pastel // &lt;-- custom trait here\n mutableTraits.horizontalSizeClass = .regular\n}\n</code></pre>\n<p>In Objective-C, the code looks as follows:</p>\n<pre class="lang-objc prettyprint-override"><code>UITraitCollection *myTraits = [UITraitCollection traitCollectionWithTraits:^(id&lt;UIMutableTraits&gt; _Nonnull mutableTraits) {\n [mutableTraits setNSIntegerValue:MyAppThemePastel forTrait:MyAppThemeTrait.class];\n mutableTraits.horizontalSizeClass = UIUserInterfaceSizeClassRegular;\n}];\n</code></pre>\n<p>Since there is no convenience property named <code>myAppTheme</code> on <code>UIMutableTraits</code>, we need to use the more verbose syntax of calling <code>setNSIntegerValue:forTrait:</code> (or <code>setObjectValue:forTrait:</code> or <code>setCGFloatValue:forTrait:</code> as needed for the given trait).</p>\n<p>However, there is the added property <code>myAppTheme</code> on <code>UITraitCollection</code> so we can now read the value as follows:</p>\n<pre class="lang-objc prettyprint-override"><code>MyAppTheme theme = myTraits.myAppTheme;\n</code></pre>\n<p>To see a fully working example in Objective-C, create a new iOS app project. Select Storyboard for the user interface and Objective-C for the language.</p>\n<p>Add MyTraits.h and MyTraits.m as shown in the question above.</p>\n<p>To work with the theme, we need to add a custom dynamic color. Add the following to <em>MyTraits.h</em>:</p>\n<pre class="lang-objc prettyprint-override"><code>@interface UIColor (MyTraits)\n\n@property (nonatomic, readonly, class) UIColor *customBackgroundColor;\n\n@end\n</code></pre>\n<p>Add the following to <em>MyTraits.m</em>:</p>\n<pre class="lang-objc prettyprint-override"><code>@implementation UIColor (MyTraits)\n\n+ (UIColor *)customBackgroundColor {\n return [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) {\n // This example uses some randomly chosen colors. Pick your own to suit your needs\n switch (traitCollection.myAppTheme) {\n case MyAppThemeStandard:\n return [UIColor colorWithRed:0 green:1 blue:0 alpha:1];\n case MyAppThemePastel:\n return [UIColor colorWithRed:0.39 green:0.58 blue:0.93 alpha:1];\n case MyAppThemeBold:\n return [UIColor colorWithRed:1 green:0 blue:1 alpha:1];\n case MyAppThemeMonochrome:\n return [UIColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:1];\n default: // make the compiler happy\n return UIColor.systemBackgroundColor; // This shouldn't happen\n }\n }];\n}\n\n@end\n</code></pre>\n<p>In <em>ViewController.m</em>, add the following code to <code>viewDidLoad</code>. This creates a button that overrides the <code>myAppTheme</code> trait with a random theme.</p>\n<pre class="lang-objc prettyprint-override"><code>// Let's see when the theme changes\n[self registerForTraitChanges:@[ MyAppThemeTrait.class ] withHandler:^(__kindof id&lt;UITraitEnvironment&gt; _Nonnull traitEnvironment, UITraitCollection * _Nonnull previousCollection) {\n NSLog(@&quot;VC change myAppTheme: %ld&quot;, traitEnvironment.traitCollection.myAppTheme);\n}];\n\n// Set the background to the custom theme color\nself.view.backgroundColor = UIColor.customBackgroundColor;\n\n// Setup a button to randomly change the theme\n__weak typeof(self) weakSelf = self;\nUIButtonConfiguration *cfg = [UIButtonConfiguration grayButtonConfiguration];\ncfg.title = @&quot;Change&quot;;\nUIButton *btn = [UIButton buttonWithConfiguration:cfg primaryAction:[UIAction actionWithHandler:^(__kindof UIAction * _Nonnull action) {\n NSInteger theme = arc4random() % 4; // Pick a random theme\n // Set the new theme\n [weakSelf.traitOverrides setNSIntegerValue:theme forTrait:MyAppThemeTrait.class];\n // If we could add the convenience property to UIMutableTrait then this line would simply be:\n // weakSelf.traitOverrides.myAppTheme = theme;\n}]];\nbtn.translatesAutoresizingMaskIntoConstraints = NO;\n[self.view addSubview:btn];\n\n// Put the button in the center of the screen\n[NSLayoutConstraint activateConstraints:@[\n [btn.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor],\n [btn.centerYAnchor constraintEqualToAnchor:self.view.centerYAnchor],\n]];\n</code></pre>\n<p>Build and run the app. Each time you tap the button the view controller's background color will change depending on the random theme that gets selected. You will also see a log message in the console showing what theme has been selected.</p>\n"^^ . . . . . . "1"^^ . "1"^^ . "1"^^ . "How to UILabel Linebreak set character wrap + truncate tail?"^^ . . . . "0"^^ . . "0"^^ . "-1"^^ . "0"^^ . . . . . "1"^^ . "<p>I have a react-native app that I build a week ago, when I checked the app size in android it was initialiy 17MB, and that i supposed is okay, but now when i check my apk size its 638MB and the bundle size is 283.3MB. and the ios app size is 180MB</p>\n<p>the asset size for the app is 3.6MB and overall src where the assets is also located size is 4.7MB which means my code size is 1.1MB</p>\n<p>I haven't added any other libraries, all of the libraries are required for functionality.</p>\n<p>my <strong>package.json</strong> file is here</p>\n<pre><code> {\n &quot;name&quot;: &quot;salushealth&quot;,\n &quot;version&quot;: &quot;1.0.2&quot;,\n &quot;private&quot;: true,\n &quot;scripts&quot;: {\n &quot;android&quot;: &quot;react-native run-android&quot;,\n &quot;ios&quot;: &quot;react-native run-ios&quot;,\n &quot;lint&quot;: &quot;eslint .&quot;,\n &quot;start&quot;: &quot;react-native start&quot;,\n &quot;test&quot;: &quot;jest&quot;,\n &quot;pregit&quot;: &quot;git status&quot;,\n &quot;git&quot;: &quot;git add . &amp;&amp; git commit -m&quot;,\n &quot;postgit&quot;: &quot;git push&quot;,\n &quot;i-15&quot;: &quot;react-native run-ios --simulator='iPhone 15 Pro Max'&quot;,\n &quot;iPad&quot;: &quot;react-native run-ios --simulator='iPad Pro (12.9-inch) (6th generation)'&quot;,\n &quot;run-all&quot;: &quot;yarn iPad &amp;&amp; yarn i-15 &amp;&amp; yarn android&quot;\n },\n &quot;dependencies&quot;: {\n &quot;@apollo/client&quot;: &quot;^3.8.8&quot;,\n &quot;@preact/signals-react&quot;: &quot;^2.0.0&quot;,\n &quot;@react-native-async-storage/async-storage&quot;: &quot;^1.19.6&quot;,\n &quot;@react-native-community/netinfo&quot;: &quot;^11.2.1&quot;,\n &quot;@react-native-community/slider&quot;: &quot;^4.5.0&quot;,\n &quot;@react-native-masked-view/masked-view&quot;: &quot;^0.3.0&quot;,\n &quot;@react-navigation/bottom-tabs&quot;: &quot;^6.5.11&quot;,\n &quot;@react-navigation/native&quot;: &quot;^6.1.9&quot;,\n &quot;@react-navigation/native-stack&quot;: &quot;^6.9.17&quot;,\n &quot;@reduxjs/toolkit&quot;: &quot;^2.0.1&quot;,\n &quot;@stripe/stripe-react-native&quot;: &quot;0.19.0&quot;,\n &quot;add&quot;: &quot;^2.0.6&quot;,\n &quot;axios&quot;: &quot;^1.6.2&quot;,\n &quot;camelize&quot;: &quot;^1.0.1&quot;,\n &quot;eslint-plugin-react-hooks&quot;: &quot;^4.6.0&quot;,\n &quot;formik&quot;: &quot;^2.4.5&quot;,\n &quot;graphql&quot;: &quot;^16.8.1&quot;,\n &quot;jsrsasign&quot;: &quot;^11.1.0&quot;,\n &quot;lottie-react-native&quot;: &quot;^6.5.0&quot;,\n &quot;moment&quot;: &quot;^2.29.4&quot;,\n &quot;prop-types&quot;: &quot;^15.8.1&quot;,\n &quot;react&quot;: &quot;18.2.0&quot;,\n &quot;react-native&quot;: &quot;0.72.7&quot;,\n &quot;react-native-calendars&quot;: &quot;^1.1303.0&quot;,\n &quot;react-native-circular-progress&quot;: &quot;^1.3.9&quot;,\n &quot;react-native-device-info&quot;: &quot;^10.11.0&quot;,\n &quot;react-native-dropdown-picker&quot;: &quot;^5.4.6&quot;,\n &quot;react-native-gifted-charts&quot;: &quot;^1.3.18&quot;,\n &quot;react-native-gifted-chat&quot;: &quot;^2.4.0&quot;,\n &quot;react-native-image-crop-picker&quot;: &quot;^0.40.2&quot;,\n &quot;react-native-linear-gradient&quot;: &quot;^2.8.3&quot;,\n &quot;react-native-otp-entry&quot;: &quot;^1.4.0&quot;,\n &quot;react-native-paper&quot;: &quot;^5.11.1&quot;,\n &quot;react-native-pie-chart&quot;: &quot;^3.0.1&quot;,\n &quot;react-native-pure-jwt&quot;: &quot;^3.0.2&quot;,\n &quot;react-native-raw-bottom-sheet&quot;: &quot;^2.2.0&quot;,\n &quot;react-native-responsive-fontsize&quot;: &quot;^0.5.1&quot;,\n &quot;react-native-safe-area-context&quot;: &quot;^4.7.4&quot;,\n &quot;react-native-screens&quot;: &quot;^3.27.0&quot;,\n &quot;react-native-select-dropdown&quot;: &quot;^3.4.0&quot;,\n &quot;react-native-skeleton-placeholder&quot;: &quot;^5.2.4&quot;,\n &quot;react-native-splash-screen&quot;: &quot;^3.3.0&quot;,\n &quot;react-native-storage&quot;: &quot;^1.0.1&quot;,\n &quot;react-native-store-version&quot;: &quot;^1.4.1&quot;,\n &quot;react-native-svg&quot;: &quot;^14.1.0&quot;,\n &quot;react-native-toast-message&quot;: &quot;^2.1.7&quot;,\n &quot;react-native-track-player&quot;: &quot;^4.0.1&quot;,\n &quot;react-native-url-polyfill&quot;: &quot;^2.0.0&quot;,\n &quot;react-native-vector-icons&quot;: &quot;^10.0.2&quot;,\n &quot;react-native-zoom-us&quot;: &quot;6.19.6&quot;,\n &quot;react-redux&quot;: &quot;^9.0.4&quot;,\n &quot;redux-persist&quot;: &quot;^6.0.0&quot;,\n &quot;styled-components&quot;: &quot;^6.1.1&quot;,\n &quot;validator&quot;: &quot;^13.11.0&quot;,\n &quot;yarn&quot;: &quot;^1.22.21&quot;,\n &quot;yup&quot;: &quot;^1.3.2&quot;,\n &quot;yup-password&quot;: &quot;^0.2.2&quot;\n },\n &quot;devDependencies&quot;: {\n &quot;@babel/core&quot;: &quot;^7.20.0&quot;,\n &quot;@babel/preset-env&quot;: &quot;^7.20.0&quot;,\n &quot;@babel/runtime&quot;: &quot;^7.20.0&quot;,\n &quot;@react-native/eslint-config&quot;: &quot;^0.72.2&quot;,\n &quot;@react-native/metro-config&quot;: &quot;^0.72.11&quot;,\n &quot;@tsconfig/react-native&quot;: &quot;^3.0.0&quot;,\n &quot;@types/react&quot;: &quot;^18.0.24&quot;,\n &quot;@types/react-test-renderer&quot;: &quot;^18.0.0&quot;,\n &quot;babel-jest&quot;: &quot;^29.2.1&quot;,\n &quot;babel-plugin-inline-import&quot;: &quot;^3.0.0&quot;,\n &quot;eslint&quot;: &quot;^8.19.0&quot;,\n &quot;jest&quot;: &quot;^29.2.1&quot;,\n &quot;metro-react-native-babel-preset&quot;: &quot;0.76.8&quot;,\n &quot;prettier&quot;: &quot;^2.4.1&quot;,\n &quot;react-native-svg-transformer&quot;: &quot;^1.3.0&quot;,\n &quot;react-test-renderer&quot;: &quot;18.2.0&quot;,\n &quot;typescript&quot;: &quot;4.8.4&quot;\n },\n &quot;engines&quot;: {\n &quot;node&quot;: &quot;&gt;=16&quot;\n }\n}\n</code></pre>\n<p>here is my <strong>app.build.gradle</strong> file</p>\n<pre><code>apply plugin: &quot;com.android.application&quot;\napply plugin: &quot;com.facebook.react&quot;\n\n/**\n * This is the configuration block to customize your React Native Android app.\n * By default you don't need to apply any configuration, just uncomment the lines you need.\n */\nreact {\n /* Folders */\n // The root of your project, i.e. where &quot;package.json&quot; lives. Default is '..'\n // root = file(&quot;../&quot;)\n // The folder where the react-native NPM package is. Default is ../node_modules/react-native\n // reactNativeDir = file(&quot;../node_modules/react-native&quot;)\n // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen\n // codegenDir = file(&quot;../node_modules/@react-native/codegen&quot;)\n // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js\n // cliFile = file(&quot;../node_modules/react-native/cli.js&quot;)\n\n /* Variants */\n // The list of variants to that are debuggable. For those we're going to\n // skip the bundling of the JS bundle and the assets. By default is just 'debug'.\n // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.\n // debuggableVariants = [&quot;liteDebug&quot;, &quot;prodDebug&quot;]\n\n /* Bundling */\n // A list containing the node command and its flags. Default is just 'node'.\n // nodeExecutableAndArgs = [&quot;node&quot;]\n //\n // The command to run when bundling. By default is 'bundle'\n // bundleCommand = &quot;ram-bundle&quot;\n //\n // The path to the CLI configuration file. Default is empty.\n // bundleConfig = file(../rn-cli.config.js)\n //\n // The name of the generated asset file containing your JS bundle\n // bundleAssetName = &quot;MyApplication.android.bundle&quot;\n //\n // The entry file for bundle generation. Default is 'index.android.js' or 'SessionCard.js'\n // entryFile = file(&quot;../js/MyApplication.android.js&quot;)\n //\n // A list of extra flags to pass to the 'bundle' commands.\n // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle\n // extraPackagerArgs = []\n\n /* Hermes Commands */\n // The hermes compiler command to run. By default it is 'hermesc'\n // hermesCommand = &quot;$rootDir/my-custom-hermesc/bin/hermesc&quot;\n //\n // The list of flags to pass to the Hermes compiler. By default is &quot;-O&quot;, &quot;-output-source-map&quot;\n // hermesFlags = [&quot;-O&quot;, &quot;-output-source-map&quot;]\n}\n\n/**\n * Set this to true to Run Proguard on Release builds to minify the Java bytecode.\n */\ndef enableProguardInReleaseBuilds = false\n\n/**\n * The preferred build flavor of JavaScriptCore (JSC)\n *\n * For example, to use the international variant, you can use:\n * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`\n *\n * The international variant includes ICU i18n library and necessary data\n * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that\n * give correct results when using with locales other than en-US. Note that\n * this variant is about 6MiB larger per architecture than default.\n */\ndef jscFlavor = 'org.webkit:android-jsc:+'\n\nandroid {\n ndkVersion rootProject.ext.ndkVersion\n\n compileSdkVersion rootProject.ext.compileSdkVersion\n\n namespace &quot;com.salus.health&quot;\n defaultConfig {\n applicationId &quot;com.salus.health&quot;\n minSdkVersion rootProject.ext.minSdkVersion\n targetSdkVersion rootProject.ext.targetSdkVersion\n versionCode 4\n versionName &quot;1.0.2&quot;\n }\n signingConfigs {\n release {\n if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {\n storeFile file(MYAPP_UPLOAD_STORE_FILE)\n storePassword MYAPP_UPLOAD_STORE_PASSWORD\n keyAlias MYAPP_UPLOAD_KEY_ALIAS\n keyPassword MYAPP_UPLOAD_KEY_PASSWORD\n }\n }\n debug {\n storeFile file('debug.keystore')\n storePassword 'android'\n keyAlias 'androiddebugkey'\n keyPassword 'android'\n }\n }\n buildTypes {\n debug {\n signingConfig signingConfigs.debug\n }\n release {\n // Caution! In production, you need to generate your own keystore file.\n // see https://reactnative.dev/docs/signed-apk-android.\n signingConfig signingConfigs.release\n minifyEnabled enableProguardInReleaseBuilds\n proguardFiles getDefaultProguardFile(&quot;proguard-android.txt&quot;), &quot;proguard-rules.pro&quot;\n }\n }\n}\n\ndependencies {\n // The version of react-native is set by the React Native Gradle Plugin\n implementation(&quot;com.facebook.react:react-android&quot;)\n\n debugImplementation(&quot;com.facebook.flipper:flipper:${FLIPPER_VERSION}&quot;)\n debugImplementation(&quot;com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}&quot;) {\n exclude group:'com.squareup.okhttp3', module:'okhttp'\n }\n\n debugImplementation(&quot;com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}&quot;)\n if (hermesEnabled.toBoolean()) {\n implementation(&quot;com.facebook.react:hermes-android&quot;)\n } else {\n implementation jscFlavor\n }\n}\n\napply from: file(&quot;../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle&quot;); applyNativeModulesAppBuildGradle(project)\napply from: file(&quot;../../node_modules/react-native-vector-icons/fonts.gradle&quot;)\n</code></pre>\n<p>here is my Podfile</p>\n<pre><code># Resolve react_native_pods.rb with node to allow for hoisting\nrequire Pod::Executable.execute_command('node', ['-p',\n 'require.resolve(\n &quot;react-native/scripts/react_native_pods.rb&quot;,\n {paths: [process.argv[1]]},\n )', __dir__]).strip\n\nplatform :ios, min_ios_version_supported\nprepare_react_native_project!\n\n# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.\n# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded\n#\n# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`\n# ```js\n# module.exports = {\n# dependencies: {\n# ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),\n# ```\nflipper_config = ENV['NO_FLIPPER'] == &quot;1&quot; ? FlipperConfiguration.disabled : FlipperConfiguration.enabled\n\nlinkage = ENV['USE_FRAMEWORKS']\nif linkage != nil\n Pod::UI.puts &quot;Configuring Pod with #{linkage}ally linked Frameworks&quot;.green\n use_frameworks! :linkage =&gt; linkage.to_sym\nend\n\ntarget 'SalusHealth' do\n config = use_native_modules!\n\n # Flags change depending on the env values.\n flags = get_default_flags()\n\n use_react_native!(\n :path =&gt; config[:reactNativePath],\n # Hermes is now enabled by default. Disable by setting this flag to false.\n :hermes_enabled =&gt; flags[:hermes_enabled],\n :fabric_enabled =&gt; flags[:fabric_enabled],\n # Enables Flipper.\n #\n # Note that if you have use_frameworks! enabled, Flipper will not work and\n # you should disable the next line.\n :flipper_configuration =&gt; flipper_config,\n # An absolute path to your application root.\n :app_path =&gt; &quot;#{Pod::Config.instance.installation_root}/..&quot;\n )\n\n target 'SalusHealthTests' do\n inherit! :complete\n # Pods for testing\n end\n\n post_install do |installer|\n # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202\n react_native_post_install(\n installer,\n config[:reactNativePath],\n :mac_catalyst_enabled =&gt; false\n )\n __apply_Xcode_12_5_M1_post_install_workaround(installer)\n end\nend\n</code></pre>\n"^^ . . . . . . "0"^^ . . "1"^^ . "0"^^ . . . "1"^^ . . "<p>Still trying my best to learn swift and hit this problem with some old library code -</p>\n<p>I have something like this -</p>\n<pre><code>static NSString *const fooStrings[] = {\n @&quot;Foo&quot;\n}\n</code></pre>\n<p>Getting a value through this is rather easy in Objective C:</p>\n<pre><code>NSString *foo = fooStrings[0];\n</code></pre>\n<p>How do I get these in Swift though? I've tried casting <code>UnsafePointer&lt;NSString&gt;</code> and getting the string back with code similar to that above. I also tried <code>fooStrings.elements[0]</code> or trying dereferencing with <code>&amp;fooStrings.elements[0]</code> or <code>(fooStrings as UnsafePointer).pointee[0]</code>, but every time, it complains about not being able to do this with an <code>NSString * strong</code>.</p>\n<p>I'm obviously out of my depth here and am asking for help as I wasn't able to find an answer to what looks like a straightforward thing to do.</p>\n"^^ . "1"^^ . . . "0"^^ . . "1"^^ . "@Cy-4AH I would love to but I have no choice. I have to implement this framework which is only available locally and written in Objective-C."^^ . . "0"^^ . "Thanks for your answer - i know theses Docs, but i dont find a working sample, and i am unable to build one."^^ . . "Does this answer your question? ["if (@available(iOS 13.0, \\*))" doesn't compile in Xcode 10.3](https://stackoverflow.com/questions/58083310/if-availableios-13-0-doesnt-compile-in-xcode-10-3)"^^ . . . . . . "Instructive and entertaining."^^ . . "0"^^ . "<p>I wrote a piece of code with swift, but can not get the result expected.\nIf you know the bug in the code, please help me, thank you very much in advance.\nThis the code I wrote:</p>\n<pre><code>let assertingFactKey = &quot;hunt&quot; as NSString\n//\nlet ruleSystem = GKRuleSystem()\nlet playerFar : NSPredicate = NSPredicate(format:&quot;$distanceToPlayer.floatValue &gt;= 10.0&quot;)\nruleSystem.add(GKRule(predicate: playerFar, assertingFact: assertingFactKey, grade: 1.0))\nlet playerNear = NSPredicate(format:&quot;$distanceToPlayer.floatValue &lt; 10.0&quot;)\nruleSystem.add(GKRule(predicate: playerNear, assertingFact: assertingFactKey, grade: 1.0))\n //\n for i in 1...30 {\n ruleSystem.state[&quot;distanceToPlayer&quot;] = i\n ruleSystem.reset()\n ruleSystem.evaluate()\n let result = ruleSystem.grade(forFact:assertingFactKey) &gt; 0.0\n if result {\n print (&quot;**True : \\(i)&quot;)\n } else {\n print (&quot;**False&quot;)\n }\n }\n</code></pre>\n<p>The result is always to True.</p>\n<p>I want to know the correct way to use GKRuleSystem in swift</p>\n<p>The code with Objective-C:</p>\n<pre><code> GKRuleSystem *ruleSystem = [[GKRuleSystem alloc] init];\n NSPredicate *playerFar = [NSPredicate predicateWithFormat:@&quot;$distanceToPlayer.floatValue &gt;= 10.0&quot;];\n [ruleSystem addRule:[GKRule ruleWithPredicate:playerFar assertingFact:@&quot;hunt&quot; grade:1.0]];\n NSPredicate *playerNear = [NSPredicate predicateWithFormat:@&quot;$distanceToPlayer.floatValue &lt; 10.0&quot;];\n [ruleSystem addRule:[GKRule ruleWithPredicate:playerNear retractingFact:@&quot;hunt&quot; grade:1.0]];\n \n for (NSUInteger i = 0; i&lt;=30; i++) {\n ruleSystem.state[@&quot;distanceToPlayer&quot;] = @(i);\n [ruleSystem reset];\n [ruleSystem evaluate];\n BOOL result = ([ruleSystem gradeForFact:@&quot;hunt&quot;] &gt; 0.0);\n if (result) {\n NSLog(@&quot;true: %ld&quot;, i);\n } else {\n NSLog(@&quot;false&quot;);\n }\n }\n</code></pre>\n"^^ . . . . . . "0"^^ . . "Please do not post code-only answers. A good answer explains how it solved the issue."^^ . . . . "React-Native app size is too large in both ios and android (android bundleRelease size is 283.3MB)"^^ . . . "<p><strong>For some unavoidable reasons I have to work on a program with Objective-C and manual memory management environment (no ARC)</strong>.</p>\n<p>I am filtering an array that I receive from another function like following:</p>\n<pre><code>- (void) setNodeAndChildrenCompletion: (TreeNode *) node :(bool) isComplete {\n node.isCompleted = isComplete;\n NSMutableArray *childNodes = [self getFlattenedChildren:node];\n for (TreeNode *node in childNodes) {\n node.isCompleted = isComplete;\n }\n}\n</code></pre>\n<p>Do I need to release or autorelease the childNodes variable when I am done? I feel I don't need to do anything here but I am not sure. Can someone please help me?</p>\n<p>The getFlattenedChildren is further defined as following:</p>\n<pre><code>- (NSMutableArray *) getFlattenedChildren:(TreeNode *) node {\n return [self flattenedNodeArray: node.children];\n}\n\n- (NSMutableArray *) flattenedNodeArray:(NSMutableArray*) array {\n NSMutableArray *_flatTodoList = [[[NSMutableArray alloc] init] autorelease];\n for (TreeNode *element in array) {\n [_flatTodoList addObject:element];\n \n if ([element children] != nil) {\n NSMutableArray *array1 = [self flattenedNodeArray:[element children]];\n for (TreeNode *element in array1) {\n [_flatTodoList addObject:element];\n }\n }\n }\n return _flatTodoList;\n}\n</code></pre>\n<p>Following is init and dealloc:</p>\n<pre><code>- (instancetype)init {\n self = [super init];\n if (self) {\n _todoList = [[NSMutableArray alloc] init];\n _flatTodoList = [[NSMutableArray alloc] init];\n }\n return self;\n}\n\n (void)dealloc {\n [_todoList release];\n [_flatTodoList release];\n [super dealloc];\n}\n</code></pre>\n"^^ . . . . . . . . . "<p>I want to set UILabel to character wrap + truncate tail. If I only set it to truncate tail, it breaks lines for word wrapping. How can I achieve this?&quot;</p>\n<p>NSLineBreakByCharWrapping | NSLineBreakByTruncatingTail</p>\n<p>I try it but failed</p>\n"^^ . . "Implement a Custom Protocol on Mac for a Cocoa / Qt Application"^^ . . . "0"^^ . "1"^^ . . "cocoa"^^ . . . . "Are you doing this hack because of bug in Sonoma? I found that the windows are only open if content of saved state is "dirty". (_NSPersistentUIDeleteItemAtFileURL(NSURL *const __strong) Failed to stat item: file:///Users/<user_name>/Library/Containers/<container_name>/Data/Library/Saved%20Application%20State/<container_name>.savedState/restorecount.plist)"^^ . . . . . "2"^^ . . . . . "Show your attempts to convert to/from JSON."^^ . . "So `mainViewContainer` is a view inside a view inside a stack view which is in another stack view? Are there any constraints on `mainViewContainer` to size and position it within its parent view? When using constraints, do not also set the `autoresizingMask`."^^ . . "1"^^ . "0"^^ . . . "1"^^ . "1"^^ . "1"^^ . "I suggest to use SPM and it's commands"^^ . "<p>I would consider looking into the <code>numberOfLines</code> property on <code>UILabel</code>. I am not sure the exact behavior without testing this, but if you set the <code>numberOfLines = 2</code> and then the <code>lineBreakMode = .byTruncatingTail</code> you might be able to get this functionality by sacrificing a dynamic number of lines.</p>\n"^^ . "0"^^ . . "@JaelRuvalcaba - I added your "second try" images to your original post. Looking at those images, the "rounded corners view" ***does*** size correctly. The UI elements you're adding as subviews are the problem. We can't help you without seeing how you're setting up constraints. Create a new project with **only that view controller** and post it somewhere like GitHub ... then we can see what you're doing, and hopefully correct it for you."^^ . . . . "3"^^ . . . "1"^^ . "1"^^ . . . "nsthread"^^ . "0"^^ . . "0"^^ . . . . . . "1"^^ . "What is the best way to find all user facing text in an iOS app for localization?"^^ . "Can you please format your code blocks. Right now it’s a mulch of bullet points and code."^^ . . . "It's imported in swift as tuple, so it will be `fooString.0`. Do you need iterate over that array or `fooString.0` will be enough?"^^ . . . . . "nspredicate"^^ . . . . "<p>The WWDC 2023 video <a href="https://developer.apple.com/videos/play/wwdc2023/10057" rel="nofollow noreferrer">Unleash the UIKit trait system</a> discusses new UIKit APIs added in iOS 17 related to custom traits in trait collections. The video and its associated code is all in Swift but I wish to use these APIs in an older Objective-C app. I've run into some questions while converting the sample code from Swift to Objective-C.</p>\n<p>To start, here is some sample Swift code provided on the Code tab (at timestamp 11:00) of the video:</p>\n<pre class="lang-swift prettyprint-override"><code>enum MyAppTheme: Int {\n case standard, pastel, bold, monochrome\n}\n\nstruct MyAppThemeTrait: UITraitDefinition {\n static let defaultValue = MyAppTheme.standard\n static let affectsColorAppearance = true\n static let name = &quot;Theme&quot;\n static let identifier = &quot;com.myapp.theme&quot;\n}\n\nextension UITraitCollection {\n var myAppTheme: MyAppTheme { self[MyAppThemeTrait.self] }\n}\n\nextension UIMutableTraits {\n var myAppTheme: MyAppTheme {\n get { self[MyAppThemeTrait.self] }\n set { self[MyAppThemeTrait.self] = newValue }\n }\n}\n</code></pre>\n<p>So far, this is what I have for the Objective-C conversion:</p>\n<p><em>MyTraits.h</em>:</p>\n<pre class="lang-objc prettyprint-override"><code>@import UIKit;\n\nNS_ASSUME_NONNULL_BEGIN\n\ntypedef enum : NSUInteger {\n MyAppThemeStandard,\n MyAppThemePastel,\n MyAppThemeBold,\n MyAppThemeMonochrome\n} MyAppTheme;\n\n@interface MyAppThemeTrait : NSObject&lt;UINSIntegerTraitDefinition&gt;\n\n@end\n\n@interface UITraitCollection (MyTraits)\n\n@property (nonatomic, readonly) MyAppTheme myAppTheme;\n\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<p><em>MyTraits.m</em>:</p>\n<pre class="lang-objc prettyprint-override"><code>#import &quot;Traits.h&quot;\n\n@implementation MyAppThemeTrait\n\n+ (NSInteger)defaultValue { return MyAppThemeStandard; }\n\n+ (BOOL)affectsColorAppearance { return YES; }\n\n+ (NSString *)name { return @&quot;Theme&quot;; }\n\n+ (NSString *)identifier { return @&quot;com.myapp.theme&quot;; }\n\n@end\n\n@implementation UITraitCollection (MyTraits)\n\n- (MyAppTheme)myAppTheme {\n return [self valueForNSIntegerTrait:MyAppThemeTrait.class];\n}\n\n@end\n</code></pre>\n<p>The sticky point here is how to implement the extension on the <code>UIMutableTraits</code> protocol. Objective-C doesn't support adding a computed property to a protocol through an extension/category. How do you finish implementing custom traits in Objective-C when the language doesn't support what is needed?</p>\n"^^ . "ios"^^ . "Use NSPredicate with swift, but can not get the same result with code written by Objective-C"^^ . . . . . "@JaelRuvalcaba - then the problem is with your constraints / layout. Here are two screenshots (corner radius set to 30 to make it easier to see): https://i.sstatic.net/xZQPj.png ... https://i.sstatic.net/lMiP9.png"^^ . . . . . "0"^^ . . "Okay I don't think this exactly answers my question...\n\nSo the issue I have is that I want the user to be able to select their microphone source - which means that I need to show a list of the microphones and then let retrieve the ID. This microphone is then what I need for the speechsdk.KeywordRecognizer \n\nI cant manually specify the ID as I won't know it - and I need the ID to pass through to speechsdk.audio.AudioConfig"^^ . . "1"^^ . . . "FWIW, I agree with HangarRash that whomever calls `newSquareBalloonPath` (or `newSquarePath`) should `CGPathRelease` it after calling `loadPath` (and that `loadPath` should not be releasing objects it did not create). For the sake of completeness, the other alternative is to use `UIBezierPath` instead of `CGPathRef`, which cuts the Gordian knot, because assuming you are using ARC, it completely eliminates the need to manually release the path."^^ . . . . . . . . "1"^^ . . . . "0"^^ . . . . . "0"^^ . . . . "0"^^ . . . "You can use numberOfLine method instead of numberOfLinesForString but if then will be some bugs in iOS15."^^ . . . "0"^^ . "0"^^ . "<p>You need to add a URL to your target (Project &gt; Target &gt; Info &gt; URL Types) <a href="https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app" rel="nofollow noreferrer">[Example here]</a></p>\n<p>Then, follow <a href="https://developer.apple.com/documentation/xcode/supporting-universal-links-in-your-app" rel="nofollow noreferrer">this guide</a> and run your application. From a browser, type in your urlscheme (yourAppName://open) and Safari asks if you want to open the app. This works for a Objective-c application, I don't know what QT is (hopefully not QuickTime)..</p>\n<p>Also, I would personally avoid using 10+ year old SO questions as a reference, a lot have happend since :)</p>\n<p>Edit: Added a few screenshots to help explain:\n<a href="https://i.sstatic.net/nkubd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/nkubd.png" alt="Xcode setup" /></a>\nRun the app to register the URL schema</p>\n<p>In Safari, type schema://whatever\n<a href="https://i.sstatic.net/RYqYP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RYqYP.png" alt="In Safari" /></a></p>\n<p>User is promted to open the app or not\n<a href="https://i.sstatic.net/JDa9n.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JDa9n.png" alt="Dialog in Safari" /></a></p>\n"^^ . . . . "Unfortunately you can't because there is no answer (just some comments). Please feel free to answer your own question if you feel it may help others (but the question does not really provide enough detail for someone else to answer it)."^^ . . . . "0"^^ . . "uilabel"^^ . . . . "3"^^ . "-2"^^ . . . . . "@Dan The Approach 1 code shows the list of Microphone and you can use one of the microphone in your speech recognizer."^^ . . "storyboard"^^ . "5"^^ . . "1"^^ . "1"^^ . . . . . . . . "ios17"^^ . . "1"^^ . . . "0"^^ . "1"^^ . . . . . . "1"^^ . "2"^^ . . . . "1"^^ . . . "<p>You can call the <code>apply</code> method on the kernel instead:</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (CIImage *)outputImage\n{\n CISampler *src = [CISampler samplerWithImage: inputImage]; \n CIKernelROICallback roiCallback = ^(int index, CGRect rect) {\n return rect;\n };\n return [Self.alphaRemoveKernel applyWithExtent: [inputImage extent], roiCallback: roiCallback, arguments: @[src]];\n}\n</code></pre>\n<p>And it's actually simpler if you use <code>CIColorKernel</code> instead, because you don't need the <code>roiCallback</code> then. This works for your filter since you have a 1:1 mapping of input to output pixels:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &quot;AlphaFilter.h&quot;\n\n@implementation CIAlphaFilter\n@synthesize inputImage;\nstatic CIColorKernel *alphaRemoveKernel = nil;\n\n- (id)init {\n if(alphaRemoveKernel == nil)\n {\n NSString *code = @&quot;kernel vec4 darkToTransparent(__sample src){vec4 color = src;color.a = 0.5;return color;}&quot;;\n alphaRemoveKernel = [CIColorKernel kernelWithString:code];\n }\n return [super init];\n}\n\n- (CIImage *)outputImage\n{\n CISampler *src = [CISampler samplerWithImage: inputImage];\n return [Self.alphaRemoveKernel applyWithExtent: [inputImage extent], arguments: @[src]];\n}\n\n@end\n</code></pre>\n<p>And, even simpler, for this use case you can use the built-in <code>CIColorMatrix</code> filter. You don't need to write your own kernel:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &quot;AlphaFilter.h&quot;\n\n@implementation CIAlphaFilter\n@synthesize inputImage;\n\n\n- (CIImage *)outputImage\n{\n CIColorMatrix *colorMatrixFilter = [CIFilter colorMatrixFilter];\n colorMatrixFilter.inputImage = inputImage;\n colorMatrixFilter.AVector = [CIVector vectorWithX:0 Y:0 Z:0 W:0.5]\n return colorMatrixFilter.outputImage;\n}\n\n@end\n</code></pre>\n"^^ . "0"^^ . . . . . . . . . . . . "Why these code can make a continuous child thread?"^^ . . . "0"^^ . . "0"^^ . "0"^^ . . . "objective-c-category"^^ . . . . "0"^^ . . . . . "How are Swift and Obective-C interoperable despite having different runtimes?"^^ . . . . "0"^^ . . "You question is unclear. According to provided link you need to change Image of left and right swipe cell in cellForRowAt function. But you are changing it in tappedButtonAtIndex that's why you image is not getting change. \n\nDo you want to change the image when cell get's swipe or what?"^^ . "0"^^ . . "2"^^ . . . . "2"^^ . "@Paulw11 I also tested `name` on the server and it's null as well."^^ . . . . . . . . . "what do you suggest I do then? Can you give me an example of how to retain and release an NSString? I tried [playerName retain]; in the init before posting but it didn't solve the problem"^^ . . . . . "Using UICollectionViewCell with IBOutlet"^^ . "1"^^ . . "How are you presenting the drawable in the application? The easiest way to pace the app would be to use `presentDrawable:afterMinimumDuration:` method https://developer.apple.com/documentation/metal/mtlcommandbuffer/2806849-presentdrawable"^^ . . . . "1"^^ . . . . . . . "0"^^ . . "1"^^ . . "XPC Service always falling into invalidationHandler despite proper configuration"^^ . "0"^^ . . "ionic-framework"^^ . . . . . . . . . . "@Rob the `[NSObject doesNorRecognizeSelector]` in the stack trace is the method in the NSobject class that gets invoked to throw the exception when the dynamic method dispatch fails. The OP needs the exception message which will give the details of the object class and the method that was attempted to be invoked."^^ . . "0"^^ . . . "The content type of the response is set by your server."^^ . "POSTMAN code needs to be corrected/adapted, as it's not "beautiful" code (but usually working code). It's a good thing to help compare and see what's different, and what was wrong. What was the error then?"^^ . . "xcode"^^ . "Well this probably needs a sample then where it reproduces, it’s impossible to say why it does it like that"^^ . . "0"^^ . . "<p>I want/need to place a dock-alike window in the &quot;empty&quot; areas left or right of the macOS 14+ system dock, when located at the bottom.</p>\n<p>Getting the height of the dock is easy, e.g. as shown here: <a href="https://stackoverflow.com/questions/35826550/how-to-get-position-width-and-height-of-mac-os-x-dock-cocoa-carbon-c-qt">How to get Position, Width and Height of Mac OS X Dock? Cocoa/Carbon/C++/Qt</a></p>\n<p>But getting the actual width or dimensions of the dock, and thereby the uncovered space left and right of the dock, seems to be impossible.</p>\n<p>Does anyone have any ideas or hints where to look, other than brute force, taking a screenshot and analyzing it?</p>\n<p>I followed any hint I can find, tried everything I can find. But it seems there is no API that supports (directly or indirectly) to retrieve the size, both height AND width, of the Dock.</p>\n"^^ . . . . . . "<p>The Swift compiler generates one header for each module. Your different targets are creating different modules and so the header ends up with different names.</p>\n<p>The name of the header generated by a target is in the build settings for that target. It's in the section <code>Swift Compiler - General</code> and the setting name is <code>Generated Header Name</code>.</p>\n<p>If you set that generated header to the same name for each of your targets that may resolve your issue.</p>\n<p>If both targets are building the same &quot;thing&quot; - the same Module, you might also look in the <code>Packaging</code> Section of your target build settings and change the targets so that they use the same <code>Product Module Name</code>.</p>\n<p>Generally, however, if you want to build the same &quot;thing&quot; for debug and for release, what you would do is set up one single Target and then you can build it for debug, or for release using the <code>product</code> menu. If you need to make more complex changes then you can make different Schemes of the same target to switch between debug and release. The current scheme is at the left side of the small information area in the tile bar of an Xcode project (see the image at <a href="https://developer.apple.com/documentation/xcode/build-system" rel="nofollow noreferrer">https://developer.apple.com/documentation/xcode/build-system</a> where the scheme and target settings are called out).</p>\n"^^ . . . . "0"^^ . "2"^^ . . . . "I would implore you to think critically about the UX requirements to which you're alluding here - it's highly likely that bolting on a Dock-like thing to the Dock itself would cause significant user confusion when said bolt-on doesn't look and/or behave the same way the Dock itself does."^^ . . . . . . . . "2"^^ . . . . . . . . . "swift"^^ . "<p>I am developing a Swift library that supports both Objective-C and Swift. In order to utilize the <code>+load</code> method for initialization tasks, I have implemented it in an Objective-C file. This approach works perfectly when using CocoaPods. However, when I migrated to Swift Package Manager (SPM) and organized my Objective-C files in a separate target (folder ObjC), I encountered an issue where the <code>+load</code> method is not being called during runtime.</p>\n"^^ . . . . . "<p>We are implementing our custom subclassed QLPreviewController.\nIndeed we subclassed and customized it since we do not want its 'Save to Files', 'Print', 'Share' options to be shown to the user. For this purpose, we used Lukas' solution suggestion in <a href="https://stackoverflow.com/a/18658481/13529386">this</a> page and hid both navigation bar at the top and toolbar at the bottom. After all just placed a 'back' button over its hidden toolbar and it is seen as such <a href="https://i.sstatic.net/EqL9e.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EqL9e.jpg" alt="as such" /></a></p>\n<p>Everything upto now was nice so far, but we do not want to lose 'search' feature of QLPreviewController because it is good enough. Normally this functionality can be accessed inside bottom toolbar of QLPreviewController by the user and another popup appears if clicked. <a href="https://i.sstatic.net/ceG8j.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ceG8j.png" alt="popup" /></a></p>\n<p>Just to test it, when we made our blocking bottom view's height lesser and let this 'search' button be visible and clicked, this search popup is laying out over our blocking view, so this is enough for us to use it. The search item button is normally existing inside bottom toolbar (before we hide it with a blocking view) as shown in the picture\n<a href="https://i.sstatic.net/YvK8g.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/YvK8g.png" alt="search button location" /></a></p>\n<p>Hence all we need to do is, making that search button (which is staying under our blocking bottom view) action be called programmatically.</p>\n<p>We have already searched it in stackoverflow and over internet, but almost all questions are about customizing it, hiding buttons or any other appearance things etc. Any help and assistance will be kindly appreciated by us.</p>\n"^^ . . "audio-streaming"^^ . . "Note that this is true of any binary distribution, not just bare `.a` files. Even xcframeworks, which are quite nice ways to bundle multi-platform binaries, cannot be used on new platforms they weren't built for. Accepting a binary-only package will always make you dependent on the other party to provide you new versions when platforms change significantly. It's usually years between this happening, so folks don't realize the trouble it's going to cause when it finally does happen. Best of luck. It's always a hard spot to be in."^^ . . . "Well... yes and no. Layers *belong to* a view. You *can* manage the layer appearance (not the hierarchy) by manipulating the `.zPosition`. I'm adding an answer for one approach...."^^ . . "<p>I'm creating a simple custom <code>CIFilter</code> that implements <code>CIKernel</code> to decrease alpha value.</p>\n<p>My &quot;AlphaFilter.h&quot;:</p>\n<pre class="lang-objc prettyprint-override"><code>@interface CIAlphaFilter: CIFilter {\n CIImage *inputImage;\n}\n@property (retain, nonatomic) CIImage *inputImage;\n@end\n</code></pre>\n<p>My &quot;AlphaFilter.m&quot;:</p>\n<pre class="lang-objc prettyprint-override"><code>#import &quot;AlphaFilter.h&quot;\n\n@implementation CIAlphaFilter\n@synthesize inputImage;\nstatic CIKernel *alphaRemoveKernel = nil;\n\n- (id)init {\n if(alphaRemoveKernel == nil)\n {\n NSString *code = @&quot;kernel vec4 darkToTransparent(sampler image){vec4 color = sample(image, samplerCoord(image));color.a =0.5;return color;}&quot;;\n alphaRemoveKernel = [CIKernel kernelWithString:code];\n }\n return [super init];\n}\n\n- (CIImage *)outputImage\n{\n CISampler *src = [CISampler samplerWithImage: inputImage];\n \n return [self apply: alphaRemoveKernel, src, nil]; // Error here\n}\n\n@end\n</code></pre>\n<p>At the return for <code>(CIImage *)outputImage</code>, Xcode give me an error:</p>\n<blockquote>\n<p>'apply:' is unavailable: not available on iOS</p>\n</blockquote>\n<p>Can anyone tell me what mistake I made? I'm using Xcode 15.2.</p>\n"^^ . "2"^^ . "0"^^ . . . "0"^^ . "2"^^ . "4"^^ . . . . "0"^^ . "It's a Command Line? Okay, then do you ensure that your app hasn't reached yet the end of the "file"? I think you have this issue: https://stackoverflow.com/questions/31944011/how-to-prevent-a-command-line-tool-from-exiting-before-asynchronous-operation-co https://stackoverflow.com/questions/9449123/keep-command-line-tool-alive etc"^^ . . . . "When importing a header into swift file, how do I define conditional macros for different targets?"^^ . "0"^^ . . . . . . "0"^^ . . "0"^^ . "0"^^ . "3"^^ . . . . . "1"^^ . "0"^^ . . . . . "removing WKWebView leaving keyboard stuck open"^^ . . . . . . . . "0"^^ . . "0"^^ . "mac-catalyst"^^ . . "How to client SSL certificate for iOS app for React native project?"^^ . . . "<p>Starting with the macOS version 14.x.x and TextKit1, selecting multiple lines of text triggers a text replacement bug: some of the text on one of the selected lines inadvertently replaces a portion of the selected text.</p>\n<p>For example, the bug is exhibited when selecting the following lines:</p>\n<pre><code>Carnaroli, Maratelli, or Vialone Nano are best\nVialone Nano cooks quickly – watch it! It also absorbs condiments nicely.\nAvoid Baldo, Originario, Ribe and Roma\n</code></pre>\n<p>To trigger the bug, select the three line paragraph using either the cursor or shift with arrow keys. Notice that a portion of the selected text was replaced. Command-Z to undo will allow you to repeat the undesired behavior.</p>\n<p>In this case, &quot;<em>e Nano cooks quickly -</em> &quot; is replaced by &quot;<em>Baldo, Originario, Ribe</em>.&quot;</p>\n<p>This does not occur with all strings or selected strings, but in cases where it does occur, it is perfectly reproducible. It does not occur on iOS. Pasteboard contents are irrelevant. After triggering the bug repeatedly, at some point it stops occurring.</p>\n<p>Why does this bug occur? How can it be fixed?</p>\n<p><strong>Screen grabs showcasing the behavior</strong></p>\n<p>Before selection:\n<a href="https://i.sstatic.net/Rbey3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Rbey3.png" alt="before selection" /></a></p>\n<p>After selection:\n<a href="https://i.sstatic.net/nuoHH.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/nuoHH.png" alt="after selection" /></a></p>\n<p><strong>Sample code to recreate the issue</strong></p>\n<pre><code>@interface TestNoteViewController ()\n\n@end\n\n\n@implementation TestNoteViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n \n [self createTextView];\n}\n\n- (void)createTextView {\n \n NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:self.note.text\n attributes:nil];\n \n NSTextStorage *textStorage = [NSTextStorage new];\n [textStorage appendAttributedString:attrString];\n \n CGRect newTextViewRect = self.view.bounds;\n \n // Create the layout manager\n NSLayoutManager *layoutManager = [NSLayoutManager new];\n [textStorage addLayoutManager:layoutManager];\n \n // Create a text container\n NSTextContainer *container = [[NSTextContainer alloc] initWithSize:CGSizeMake(newTextViewRect.size.width, CGFLOAT_MAX)];\n [layoutManager addTextContainer:container];\n \n \n // Create and place a text view\n UITextView *textView = [[UITextView alloc] initWithFrame:newTextViewRect\n textContainer:container];\n [self.view addSubview:textView];\n textView.translatesAutoresizingMaskIntoConstraints = NO;\n UILayoutGuide *safeArea = textView.superview.safeAreaLayoutGuide;\n [textView.leadingAnchor constraintEqualToAnchor:safeArea.leadingAnchor].active = YES;\n [textView.trailingAnchor constraintEqualToAnchor:safeArea.trailingAnchor].active = YES;\n [textView.topAnchor constraintEqualToAnchor:safeArea.topAnchor].active = YES;\n [textView.bottomAnchor constraintEqualToAnchor:textView.superview.bottomAnchor].active = YES;\n}\n\n@end\n</code></pre>\n<p><strong>Sample code to recreate the issue WITHOUT the text container and layout manager, which also exhibits the bug</strong></p>\n<pre><code>@interface TestNoteViewController ()\n\n@end\n\n\n@implementation TestNoteViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n \n [self createTextView];\n}\n\n- (void)createTextView {\n \n UITextView *textView = [UITextView new];\n textView.text = self.note.text;\n [self.view addSubview:textView];\n textView.translatesAutoresizingMaskIntoConstraints = NO;\n UILayoutGuide *safeArea = textView.superview.safeAreaLayoutGuide;\n [textView.leadingAnchor constraintEqualToAnchor:safeArea.leadingAnchor].active = YES;\n [textView.trailingAnchor constraintEqualToAnchor:safeArea.trailingAnchor].active = YES;\n [textView.topAnchor constraintEqualToAnchor:safeArea.topAnchor].active = YES;\n [textView.bottomAnchor constraintEqualToAnchor:textView.superview.bottomAnchor].active = YES;\n}\n\n@end\n</code></pre>\n"^^ . . . . "Use Web localStorage in Objective-C but not working"^^ . . . . . . "pow"^^ . . . . "Call QLPreviewController toolbar action programmatically"^^ . . "In what context can we use an unqualified #selector() expression in Swift?"^^ . . . "0"^^ . . "firebase"^^ . "ibaction"^^ . "0"^^ . "1"^^ . "nsxpcconnection"^^ . "runloop"^^ . . . . . "0"^^ . . . . . "Known changes to NSURLSessionDataTask from iOS 16 to iOS 17?"^^ . . . "1"^^ . . . . "<p>I have a weather app that refreshes asynchronously. While I've never seen it crash myself, I do see about a crash per day in Apple's reports, and not from a specific device. The app does have a good amount of users and it refreshes every few minutes, but I have no idea what kind of percentage send reports to Apple, so don't really know how rare the crash really is. I've tried a few things, like making sure I the Async Downloader class that creates the datatask does not get destroyed etc. There are 2 kinds of reported crashes, the most common is at this code:</p>\n<pre class="lang-objectivec prettyprint-override"><code>-(void)startDownload\n{\n NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:fileURL] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:12];\n NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];\n\n if (!session || !request || ![session respondsToSelector:@selector(dataTaskWithRequest:completionHandler:)])\n return;\n // Stack trace points to line below crashing\n self.dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {...}\n // ...\n}\n</code></pre>\n<p>The &quot;defensive&quot; <code>if</code> is a sanity check as the crash stack trace looks like this:</p>\n<p><a href="https://i.sstatic.net/xdIew.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/xdIew.png" alt="Stack trace" /></a></p>\n<p>That <code>self.dataTask</code> is just <code>@property NSURLSessionDataTask *dataTask;</code>.</p>\n<p>Any ideas on what to look into or try in order to avoid this?</p>\n<p>I seems quite rare overall so I am wondering if it's a case of the app is getting killed by the system or something like that which causes an unclean termination. Would welcome any suggestion though.</p>\n<p>Edit: Couldn't find how to get Xcode to show me more info from the crash dump, but of course I could just open it with a text editor and here is all the info:</p>\n<pre><code>Exception Type: EXC_CRASH (SIGABRT)\nException Codes: 0x0000000000000000, 0x0000000000000000\nTriggered by Thread: 9\n\nLast Exception Backtrace:\n0 CoreFoundation 0x1ca108cb4 __exceptionPreprocess + 164 (NSException.m:202)\n1 libobjc.A.dylib 0x1c32243d0 objc_exception_throw + 60 (objc-exception.mm:356)\n2 CoreFoundation 0x1ca27dab8 -[NSObject(NSObject) doesNotRecognizeSelector:] + 136 (NSObject.m:140)\n3 CoreFoundation 0x1ca11f0e8 ___forwarding___ + 1592 (NSForwarding.m:3578)\n4 CoreFoundation 0x1ca185900 _CF_forwarding_prep_0 + 96 (:-1)\n5 App 0x1009667cc -[AsyncDownloader startDownload] + 396 (AsyncDownloader.m:79)\n</code></pre>\n<p>Now, going to the thread that triggered this:</p>\n<pre><code>Thread 9 name:\nThread 9 Crashed:\n0 libsystem_kernel.dylib 0x0000000208743558 __pthread_kill + 8 (:-1)\n1 libsystem_pthread.dylib 0x0000000229411118 pthread_kill + 268 (pthread.c:1670)\n2 libsystem_c.dylib 0x00000001d162b178 abort + 180 (abort.c:118)\n3 libc++abi.dylib 0x000000022934fbf8 abort_message + 132 (:-1)\n4 libc++abi.dylib 0x000000022933f444 demangling_terminate_handler() + 348 (:-1)\n5 libobjc.A.dylib 0x00000001c3229ea4 _objc_terminate() + 144 (objc-exception.mm:498)\n6 libc++abi.dylib 0x000000022934efbc std::__terminate(void (*)()) + 16 (:-1)\n7 libc++abi.dylib 0x000000022934ef60 std::terminate() + 56 (:-1)\n8 libdispatch.dylib 0x00000001d15caec0 _dispatch_client_callout + 40 (object.m:563)\n9 libdispatch.dylib 0x00000001d15ce330 _dispatch_continuation_pop + 504 (queue.c:306)\n10 libdispatch.dylib 0x00000001d15e1908 _dispatch_source_invoke + 1588 (source.c:961)\n11 libdispatch.dylib 0x00000001d15cde6c _dispatch_queue_override_invoke + 500 (queue.c:0)\n12 libdispatch.dylib 0x00000001d15dc944 _dispatch_root_queue_drain + 396 (queue.c:7051)\n13 libdispatch.dylib 0x00000001d15dd158 _dispatch_worker_thread2 + 164 (queue.c:7119)\n14 libsystem_pthread.dylib 0x000000022940ada0 _pthread_wqthread + 228 (pthread.c:2631)\n15 libsystem_pthread.dylib 0x000000022940ab7c start_wqthread + 8 (:-1)\n\n\nThread 9 crashed with ARM Thread State (64-bit):\n x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000\n x4: 0x0000000229353647 x5: 0x000000016fa2acb0 x6: 0x000000000000006e x7: 0x0000000000002700\n x8: 0xc5115eb4a9cc1e34 x9: 0xc5115eb5c66eae34 x10: 0x0000000000000200 x11: 0x000000000000000b\n x12: 0x000000000000000b x13: 0x00000000001ff800 x14: 0x00000000000007fb x15: 0x000000009002802e\n x16: 0x0000000000000148 x17: 0x000000016fa2b000 x18: 0x0000000000000000 x19: 0x0000000000000006\n x20: 0x000000000001e10f x21: 0x000000016fa2b0e0 x22: 0x0000000000000110 x23: 0x0000000000000000\n x24: 0x0000000000000000 x25: 0x000000016fa2b0e0 x26: 0x0000000000030008 x27: 0x0000000282e3d180\n x28: 0x0000000220904c80 fp: 0x000000016fa2ac20 lr: 0x0000000229411118\n sp: 0x000000016fa2ac00 pc: 0x0000000208743558 cpsr: 0x40001000\n esr: 0x56000080 Address size fault\n</code></pre>\n"^^ . . . . . "0"^^ . . "1"^^ . "httprequest"^^ . . "1"^^ . "0"^^ . "Occasional crash at NSURLSessionDataTask dataTaskWithRequest:completionHandler:"^^ . "2"^^ . "0"^^ . . "Usually this is due to the order of libraries or objects during the link. The one who call the other must be first."^^ . "avplayer"^^ . . . "0"^^ . "0"^^ . . "0"^^ . "<p>I am trying to learn about making http requests using Swift but for some reason i cannot get the <code>getPosts()</code> method to print anything. It keeps skipping over the dataTask and prints after it. I understand that the dataTask is happening asynchronously on a different thread but how would i go about printing this data onto the console?</p>\n<p>Note: I am creating an instance and calling this method from a Obj-C main file but I do not see how that would affect this.</p>\n<pre><code>class EndpointInterface: NSObject {\n @objc var baseUrl:URL = URL(string:&quot;https://api.publicapis.org&quot;)!\n \n @objc func getPosts() -&gt; Void{\n let getPostsEndpoint:URL = URL(string: &quot;/entries&quot;, relativeTo: baseUrl)!\n print(getPostsEndpoint.absoluteString)\n let getPostsRequest:URLRequest = URLRequest(url: getPostsEndpoint)\n let session = URLSession.shared\n let task = session.dataTask(with: getPostsRequest) {(data, response, error) in\n if let error = error {\n print(error)\n } else if let data = data, let response = response as? HTTPURLResponse {\n if response.statusCode == 200 {\n print(data)\n } else {\n print(response.statusCode)\n }\n }\n }\n task.resume()\n }\n}\n</code></pre>\n<p>Thank You.</p>\n<p>I have tried passing a completion handler</p>\n<pre><code>@objc func getPosts(completion: @escaping (NSData?) -&gt; Void) -&gt; Void{\n let getPostsEndpoint:URL = URL(string: &quot;/entries&quot;, relativeTo: baseUrl)!\n print(getPostsEndpoint.absoluteString)\n let getPostsRequest:URLRequest = URLRequest(url: getPostsEndpoint)\n let session = URLSession.shared\n let task = session.dataTask(with: getPostsRequest) {(data, response, error) in\n if let error = error {\n print(error)\n } else if let data = data, let response = response as? HTTPURLResponse {\n if response.statusCode == 200 {\n print(data)\n completion(data as NSData)\n } else {\n print(response.statusCode)\n completion(nil)\n }\n }\n }\n task.resume()\n }\n</code></pre>\n<p>like so and</p>\n<pre><code>[e getPostsWithCompletion:^(NSData *data) {\n NSLog(@&quot;%@&quot;, [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);\n return;\n }];\n</code></pre>\n<p>in main.m</p>\n"^^ . . "2"^^ . . "0"^^ . "<p>Confirm that your Mach-O file has been successfully decrypted.\nYou can check it by using the following command</p>\n<pre><code> $ otool -l &lt;Mach-O file&gt; | grep cryptid\n\n cryptid 0\n</code></pre>\n<p>If the value of cryptid is not 0, please decrypt your Mach-O file first.</p>\n<p>If the value of cryptid is 0, then please try using AloneMonkey's <a href="https://github.com/AloneMonkey/MonkeyDev/blob/master/bin/class-dump" rel="nofollow noreferrer">class-dump</a> tool. AloneMonkey has made some fixes to class-dump.</p>\n"^^ . . "0"^^ . . . . . . . "0"^^ . . . . . "Where you are loading the `WKWebView`"^^ . . "Thank you @Larme for your reply . I corrected the spell mistake and I was using code from postman only and it worked."^^ . . "SSL certificate pinning in iOS app using objective C for React Native Project"^^ . . . . . . . "Correct I get this certificate form client so both have same keys."^^ . . "0"^^ . . . . . "0"^^ . "Did you tried to manually make a second request while the first one is still running ? As you create a new data task each time, the previous dataTask is possibly released from your object but called when the session task finished. So in this case it calls a method on the wrong type if object."^^ . "0"^^ . "1"^^ . . "Managed to solve it. Your answer gave me the hint that I needed. I changed the code from [playerName retain] to playerName = [playerName retain] and now it works. many thanks, now I can sleep properly tonight."^^ . . . "<pre class="lang-objc prettyprint-override"><code>#import &quot;AppDelegate.h&quot;\n#import &quot;MainViewController.h&quot;\n#import &lt;OneSignalFramework/OneSignalFramework.h&gt; // Import OneSignalFramework\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n self.viewController = [[MainViewController alloc] init];\n \n // Remove this method to stop OneSignal Debugging\n [OneSignal.Debug setLogLevel:ONE_S_LL_VERBOSE];\n \n // OneSignal initialization\n [OneSignal initialize:@&quot;OneSignal App ID&quot; withLaunchOptions:launchOptions];\n \n // requestPermission will show the native iOS notification permission prompt.\n // We recommend removing the following code and instead using an In-App Message to prompt for notification permission\n [OneSignal.Notifications requestPermission:^(BOOL accepted) {\n NSLog(@&quot;User accepted notifications: %d&quot;, accepted);\n } fallbackToSettings:true];\n \n// NSString *userId = OneSignal.User.onesignalId;\n // Store OneSignal player ID in local storage\n NSString *oneSignalPlayerID = OneSignal.User.onesignalId;\n if (oneSignalPlayerID != nil) {\n NSLog(@&quot;OneSignal Player ID: %@&quot;, oneSignalPlayerID);\n // Store the player ID in local storage (NSUserDefaults)\n [[NSUserDefaults standardUserDefaults] setObject:oneSignalPlayerID forKey:@&quot;oneSignalPlayerID&quot;];\n [[NSUserDefaults standardUserDefaults] synchronize];\n \n } else {\n NSLog(@&quot;OneSignal Player ID is nil or not available.&quot;);\n }\n \n // Retrieve the value from NSUserDefaults\n NSString *playerID = [[NSUserDefaults standardUserDefaults] objectForKey:@&quot;oneSignalPlayerID&quot;];\n\n // Log the value\n NSLog(@&quot;oneSignalPlayerID: %@&quot;, playerID);\n\n // Login your customer with externalId\n // [OneSignal login:@&quot;EXTERNAL_ID&quot;];\n \n return [super application:application didFinishLaunchingWithOptions:launchOptions];\n}\n\n@end\n\n\n</code></pre>\n<p>used this method but having error in webView &quot;Use of undeclared identifier 'webView'&quot;</p>\n<pre class="lang-objc prettyprint-override"><code>NSString \\*oneSignalPlayerID = OneSignal.User.onesignalId;\nif (oneSignalPlayerID != nil) {\nNSLog(@&quot;OneSignal Player ID: %@&quot;, oneSignalPlayerID);\n\n // Inject JavaScript to store the player ID in localStorage\n NSString *jsCode = [NSString stringWithFormat:@&quot;localStorage.setItem('OneSignalPlayerID', '%@');&quot;, oneSignalPlayerID];\n [self.webView evaluateJavaScript:jsCode completionHandler:nil];\n \n } else {\n NSLog(@&quot;OneSignal Player ID is nil or not available.&quot;);\n }\n</code></pre>\n<p>However, when I try to compile/run this code, I'm getting the error message: &quot;Use of undeclared identifier 'webView'&quot;. It seems like <strong><code>webView</code></strong> is not recognized or declared anywhere in my codebase.</p>\n<p>Can someone please guide me on how to properly declare or access <strong><code>webView</code></strong> in my code? I want to store <strong><code>onesignalPlayerID</code></strong> to web localStorage using <strong><code>webView</code></strong>.</p>\n"^^ . "1"^^ . "-1"^^ . . . "Thank you sir, really appreciate this incredibly well thought out and detailed response. Think I'm just going to go with the all view approach to keep things clean and simple as recommended above, though it's a useful resource to have the layers / zPosition approach as well."^^ . . . "0"^^ . "Thank you @PtitXav for your reply . It has to be converted .ut8 encoding"^^ . . . . "Thanks for help. Just added the property and problem resolved.."^^ . . "In iPad/iPhone (iOS 17.4) App crashed on Launching"^^ . . . "0"^^ . . . . "@PtitXav – FWIW, the replacing of self’s reference to the prior task would not cancel the prior one. The session, itself, keeps a strong reference to the data task, even if you don’t keep your own. The only way that a task will stop is if you explicitly cancel it, or you explicitly `invalidateAndCancel()` the session (or the app is terminated). And even then, none of those would generate this sort of stack trace, but merely call the completion handler with `URLError(.cancelled)`."^^ . . "0"^^ . "0"^^ . "I can't reproduce your issue. I created a new project, put your second set of code in the supplied view controller, and built it for Mac Catalyst. In the code I set the text view's text property to the three lines of text mentioned in your question. Running the app on an M3 MacBook Pro with macOS 14.4.1 resulted in no issues when highlighting the text."^^ . "0"^^ . "0"^^ . "0"^^ . . . "0"^^ . . . . . "0"^^ . "<p>Objective-C++ is superset of C++ language and all rules of C++ apply here. I.e. when declaring a function you have to deal with so-called <a href="https://stackoverflow.com/questions/1314743/what-is-name-mangling-and-how-does-it-work">name mangling</a>, which alters the function signature in a way that the compiler won't be able to locate it in a Objective-C/C compilation unit. For such scenarios you are supposed to tell the linker to apply C rules when including this header in a C++ compilation unit by employing <code>extern &quot;C&quot;</code> section:</p>\n<pre class="lang-cpp prettyprint-override"><code>#ifdef __cplusplus\nextern &quot;C&quot; {\n#endif\nvoid GetInputSizeFromUsage(PPVEUsage usage, size_t *width, size_t *height);\n#ifdef __cplusplus\n}\n#endif\n</code></pre>\n"^^ . . "0"^^ . . "1"^^ . "<p>You've defined an <code>@interface</code> for <code>bleconfigLibrary</code>, but you haven't defined an <code>@implementation</code> for it in the code you've shown here. The fact that it works on physical devices but not the simulator suggests you're linking a library that defines an implementation, but that library isn't built for simulator. Possibly it's an old-style &quot;fat&quot; library that wasn't built for Apple Silicon. The library would need to be <a href="https://developer.apple.com/documentation/xcode/creating-a-multi-platform-binary-framework-bundle" rel="nofollow noreferrer">rebuilt as an xcframework</a>. (While the linked page discusses Swift, xcframeworks are applicable to ObjC as well.)</p>\n<p>But note that <a href="https://stackoverflow.com/questions/10024608/does-the-iphone-simulator-in-xcode-support-bluetooth-low-energy">BLE functionality generally does not work in the simulator anyway</a>, so you may prefer to simply not build this code for simulator.</p>\n<p>This line is incorrect:</p>\n<pre><code>handleRequest = [bleconfigLibrary alloc];\n</code></pre>\n<p>That allocates memory, but does not initialize the object. While it might &quot;work&quot; (if, for example, the object happens not to need initialization), the correct line here is, assuming ARC is enabled:</p>\n<pre><code>handleRequest = [bleconfigLibrary new];\n</code></pre>\n<p>or equivalently, whether ARC is or isn't enabled:</p>\n<pre><code>handleRequest = [[bleconfigLibrary alloc] init];\n</code></pre>\n<p>As a side note, ObjC classes should begin with an uppercase letter (though it's not mandatory). The normal capitalization convention here would be <code>BLEConfigLibrary</code>.</p>\n<p>(I'm assuming the <code>.</code> at the end of your <code>@interface</code> definition is a typo in your question, since it wouldn't compile in ObjC.)</p>\n"^^ . . "0"^^ . . . "I tried with a timer, and the keyboard properly dismisses, and while the issue is reproducible with the code from the question, is this the real code from you app? Are you removing the webview based on some gestures?"^^ . . . . . . . "0"^^ . . . "0"^^ . . "0"^^ . . "0"^^ . "uiview"^^ . "<p>I've tried to find out if there were any significant behavioral changes for <code>NSURLSessionDataTask</code> between iOS versions 16 and 17, but have not found any answers.</p>\n<p>I'm having an issue where I'm performing a 'POST' request to an endpoint. On iOS 16, I'm getting a 400 status code, on iOS 17, a 200. There are no changes in the source code or the endpoint being accessed.</p>\n<p><code>NSURLSessionDataTask</code> is being configured with <code>[NSURLSessionConfiguration defaultSessionConfiguration]</code> and the request <code>Content-Type</code> is set to <code>application/json</code></p>\n<p>Are there any known changes in iOS versions that can explain this behavior?</p>\n"^^ . . "I tried your suggestion but it didn't work. However. if I replace ```AVPlayerViewController``` with ```AVPlayerLayer```, everything works as expected! I updated the question."^^ . . . . . . . . . "<p>Having the same runtime isn't a necessary condition for interoperability, but it certainly makes interoperating two languages a lot easier.</p>\n<p>Arguably, Kotlin and Java don't have the <em>same</em> runtime either. Kotlin has its own runtime built on top of the JDK/JVM. This is what makes <code>suspend</code> functions, Kotlin reflection, and other Kotlin-specific features work.</p>\n<p>All that matters is that Kotlin's compiler can output binaries that Java's compiler can understand, and Java's compiler can output binaries that Kotlin's compiler can understand. That is, the compilers follow each other's <a href="https://en.wikipedia.org/wiki/Application_binary_interface" rel="nofollow noreferrer">ABI</a>.</p>\n<p>With both of them running on the JVM, lots of this is given &quot;for free&quot;. Kotlin's compiler can just output a Kotlin method as a JVM method, a Kotlin class as a JVM class, calling a Java method from Kotlin generates basically the same bytecode as calling a Java method from Java, etc.</p>\n<p>Similarly, when you call a Objective-C method in Swift, <code>swiftc</code> just outputs the same instructions <code>clang</code> would output for that method call, as if some Objective-C code had called it. If a class is marked <code>@objc</code> in Swift, <code>swiftc</code> generates Objective-C headers for that class, as if it were an Objective-C class, and so on.</p>\n<p>In theory, Swift could be made to interoperate with Java. One can write a Swift compiler that outputs Java bytecode.</p>\n<hr>\n<p>Having the same runtime isn't a sufficient condition for interoperability either. Kotlin's compiler generates synthetic members to implement some of Kotlin's language features, which are ignored by Java's compiler. Similarly, not every Swift declaration can be made visible to Objective-C (e.g. protocols with associated types), and Objective-C macros that are not just simple constants, are not visible to Swift either.</p>\n"^^ . . "<p>HangarRash pointed me in the right direction by suggesting that I use <code>v4</code>'s <code>center</code> property instead of manually calculating the origin. After that, I just had to adjust for the fact that <code>v4</code>'s <code>center</code> property is in terms of <code>v3</code>'s coordinate space when using <code>convertPoint:fromView</code>, and then it worked!</p>\n<pre><code>CGSize targetImageViewSize = CGSizeMake(v4.frame.size.width / 2, v4.frame.size.height / 2);\nCGPoint targetImageViewCenter = v4.center;\nCGPoint convertedTargetImageViewCenter = [v1 convertPoint:targetImageViewCenter fromView:v3];\n\nUIImageView *targetImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, targetImageViewSize.width, targetImageViewSize.height)];\ntargetImageView.image = [UIImage imageNamed:@&quot;TargetIcon&quot;];\ntargetImageView.center = convertedTargetImageViewCenter;\n[self.targetImageViews addObject:targetImageView];\ntargetImageView.transform = CGAffineTransformMakeRotation(v3.angle);\n[v1 addSubview: targetImageView];\n</code></pre>\n"^^ . "Does this issue appear if you create a normal `UITextView` without setting up your own text container for it?"^^ . "@Ecuador Could this issue be related to the specific URL (or specific URL scheme) being requested? Perhaps internal to the implementation of `NSURLSession`, it tries to call some method that doesn't actually exist if the wrong kind of URL request is provided. You have an `NSString` named `fileURL`. Where does that come from? What limits are put on its value?"^^ . . "0"^^ . . "0"^^ . "0"^^ . "0"^^ . . . . . "1"^^ . "0"^^ . . . "Have you added the relevant header to AppTarget-Bridging-Header.h (and configured a bridging header in your project)."^^ . . . . "0"^^ . . . "<p>There's nothing wrong with accessing NSString from an IBAction.</p>\n<p>The problem is with the memory management. This error message (BAD_EXEC_ACCESS) means you are trying to access a deallocated object.</p>\n<p>Since ARC (Automatic Reference Counting is not available for Tiger, and only properly supported from 10.7 Lion the memory is not managed automatically.</p>\n<p><a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/MemoryMgmt.html" rel="nofollow noreferrer">https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/MemoryMgmt.html</a></p>\n<p><a href="https://developer.apple.com/library/archive/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011226" rel="nofollow noreferrer">https://developer.apple.com/library/archive/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011226</a></p>\n<p>If the program relies on ARC, it won't work in older systems (crashes due to access to deallocated objects).</p>\n<p>You could write manual retains and releases like in pre-ARC times, but that would mean you would have to manage memory manually everywhere. Possible, but not fun.</p>\n"^^ . . . . . . . "nstimer"^^ . "0"^^ . "0"^^ . . . . . . "2"^^ . . . . . . . "I have the same issue. It is happening randomly."^^ . . "1"^^ . "0"^^ . "0"^^ . "Passing encrypted string as nsdata in http body gives 400 bad request error"^^ . . . . "<p>I have the following view set up:</p>\n<p><a href="https://i.sstatic.net/R5fH5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/R5fH5.png" alt="enter image description here" /></a></p>\n<p>Where the anchor point for V3 is (0, .5) and it can be rotated by a UIPanGestureRecognizer that's attached to V4. I'm trying to translate a point on V4 to V1s coordinate space (so I can attach a subview to V1 that appears over the center of V4) and I can't get it to place correctly. I have the following code:</p>\n<pre><code>CGSize targetImageViewSize = CGSizeMake(v4.frame.size.width / 2, v4.frame.size.height / 2);\n//find the point that will place the target in the center of v4 when attached as a subview to v1 (i.e. in its center)\nCGPoint convertedTargetImageViewOrigin = [v1 convertPoint:CGPointMake((v4.frame.size.width - targetImageViewSize.width) / 2, (v4.frame.size.height - targetImageViewSize.height) / 2) fromView:v4];\nUIImageView *targetImageView = [[UIImageView alloc] initWithFrame:CGRectMake(convertedTargetImageViewOrigin.x, convertedTargetImageViewOrigin.y, targetImageViewSize.width, targetImageViewSize.height)];\ntargetImageView.image = [UIImage imageNamed:@&quot;TargetIcon&quot;];\ntargetImageView.transform = CGAffineTransformMakeRotation(v3.degreesRotated);\n[v1 addSubview:targetImageView];\n</code></pre>\n<p>I've also tried rotating the point to no avail:</p>\n<pre><code>convertedTargetImageViewOrigin = CGPointApplyAffineTransform(convertedTargetImageViewOrigin, CGAffineTransformMakeRotation(v3.degreesRotated));\n</code></pre>\n<p>To be clear, I don't this target to appear over v4 while the user is rotating, just briefly when the user taps v1. Any help as to why I can't get the correct point would be appreciated, thanks.</p>\n"^^ . "0"^^ . "1"^^ . . "c"^^ . . . . . "0"^^ . . . . . . . . . . . . "0"^^ . . "<pre><code>- (void)testCreateContinuousChildThread {\n testThread *thread = [[testThread alloc] initWithBlock:^{\n NSTimer *timer = [NSTimer timerWithTimeInterval:1.0 repeats:NO block:^(NSTimer * _Nonnull timer) {\n NSLog(@&quot;current thread:%@&quot;, [NSThread currentThread]);\n }];\n NSRunLoop *loop = [NSRunLoop currentRunLoop];\n [loop addTimer:timer forMode:NSRunLoopCommonModes];\n [loop run];\n }];\n \n \n [thread start];\n \n [self performSelector:@selector(testSelector) onThread:thread withObject:nil waitUntilDone:YES];\n}\n\n- (void)testSelector {\n NSLog(@&quot;testSelector&quot;);\n}\n</code></pre>\n<p>The class of 'testThread' only contains dealloc method to log message of dealloc. And after running these code, the testThread won't be destroyed automatically.</p>\n<p>When I delete this line, the testThread will be destroyed automatically as expected.</p>\n<pre><code>[self performSelector:@selector(testSelector) onThread:thread withObject:nil waitUntilDone:YES];\n</code></pre>\n"^^ . "I always keep a strong reference to the session - just saying. You only need one, not one per task. Also as @PtitXav said - instead of a per task ivar use a mutable set or dictionary to hold the tasks - on completion they can remove themselves. Note completion is on a background queue!"^^ . . "How to share a global function between .m file and .mm file (obj c and obj c++) with common header file?"^^ . . . . "Rapid memory growth caused by Go calling Objective-C"^^ . . . . . . . "@Rob it is a standard session. I will add the rest of the code above for illustration, but session is just an `NSURLSession *`."^^ . . . . . . . "How to get the width of the macOS dock?"^^ . . . . . . . . . . "0"^^ . . "0"^^ . . "0"^^ . . . "0"^^ . . . . . . . . . . "launchctl"^^ . "@HangarRash Thanks I changed to the center, and it seems to be more consistent in how it's missing, so maybe it was correct to do that but something else is at play. And yeah changed from frame to bounds as well, good call."^^ . . "Xcode Firebase "library not loaded" -- Problem running Simulator"^^ . . . . . "0"^^ . . . . "swift-extensions"^^ . . "0"^^ . . "@Cristik The app does use a double tap to exit. Not my UI design, and this is not the only part of the UI that suffers. I tried with a timer and it failed for me, so if it did not fail for you that gives me something to dig into. Seems like a timer would be just as forceful as somehow digesting the touch events it was looking for?"^^ . "<p>I have clients cloudflare SSL certificate(.pem). I want to embed this SSL certificate for my react native project for <strong>iOS</strong> so that we can access our API's. I am new to this I have tried so many ways but didn't get exact solution for it.</p>\n<p>The language we are using is Objective C where we have to write code for SSL cert embedding.\nCan anyone help me with this any tutorial link will work for me to get reference.</p>\n<p>I have tried to convert cert into .p12 but when I decode response and call our API I am getting 403 error code. I want try same cert which client gave me .pem I dont want to convert it to somethingelse</p>\n"^^ . . . . . "Actually, I don't think it matters how what glfw does. If you have an `MTLCommandBuffer`, you can just present after minimum duration and it should pace the app. Unless glfw internally does some additional pacing, then you will get a weird double pacing that might or might not work."^^ . "Don't forget the following in the documentation for `UIView frame`: *"Warning\nIf the transform property is not the identity transform, the value of this property is undefined and therefore should be ignored."*."^^ . . "0"^^ . "No, I haven't thought about the permission. I will do some search on how to grant root permission for my app. Thanks for the comment!"^^ . . . . . . . . "@Larme : My public key used for encryption was wrong"^^ . . . "1"^^ . "mobile"^^ . . . . . "What do you mean by “makes it hard to actually actually use”?"^^ . "<p>I have this solution, in nineteen languages. I needs a pow() function (or operator) to calc from increase to interest rate and from interest rate to increase. The only language I can't calc it is in Objective-C. How to use it?</p>\n<p>This works:</p>\n<pre><code>NSLog(@&quot;Pow = %f&quot;, pow(1.03, 0.5));\n</code></pre>\n<p>This don't works:</p>\n<pre><code>- (double) pot: (double) value exponent: (double) e {\n return pow(value, e);\n}\n</code></pre>\n<p>It gives this error:</p>\n<pre><code>/usr/sbin/ld: /tmp/ccYQw9Wv.ltrans0.ltrans.o: undefined reference to symbol 'pow@@GLIBC_2.29'\n/usr/sbin/ld: /usr/lib/libm.so.6: error adding symbols: DSO missing from command line\ncollect2: error: ld returned 1 exit status\n</code></pre>\n"^^ . . "<p>I have an iOS SwiftUI project with the following hierarchy:</p>\n<pre><code>Module hierarchy:\n\nAppTarget -&gt; depends on Experience\nExperience -&gt; depends on Lifecycle\nLifecycle\n\nContent of each module:\nLifecycle \n -- struct conforming App protocol (entry point)\n -- AppDelegate, SceneDelegate etc.\nExperience\n -- URLHandler (and other supporting classes to handle launch parameters (if app is launched by tapping an associated file, quick action etc..) and update the UI.\n</code></pre>\n<p>I have a struct conforming to App protocol in the <code>Lifecycle</code> library. It defines the <a href="https://developer.apple.com/documentation/swiftui/view/onopenurl(perform:)" rel="nofollow noreferrer">onOpenURL(perform:)</a> method to handle all URL based launches (widgets, files, deep links, universal links etc.).</p>\n<pre><code>// In Lifecycle library\n\nWindowGroup {\n ContentView()\n .onOpenURL(perform: { (url: URL) in\n // Handle URL with which the app is launched.\n })\n}\n</code></pre>\n<p>In the above method, I need to invoke the URL handler method in <code>Experience</code> library. Note that the <code>Experience</code> library is above <code>Lifecycle</code> in the hierarchy (as mentioned above), so I cannot simply directly invoke it.</p>\n<p>I'm thinking of using <a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html" rel="nofollow noreferrer">ObjC categories</a> to achieve this. ObjC category is a way to add methods to an existing class. At runtime, all methods in the category would be under one single class, though they are defined in two files in different modules.</p>\n<p>In <code>Lifecycle</code> library, I define the class as below:</p>\n<pre><code>// In header file,\n@interface URLHandler : NSObject\n\n// No methods defined here.\n// Experience extends this using the concept of\n// ObjC category and defines a handler method\n// to handle all URL handler launches.\n\n@end\n\n// In .mm file, \n@implementation URLHandler\n\n// Empty\n\n@end\n</code></pre>\n<p>And in the <code>Experience</code> library, I'm extending them as shown below:</p>\n<pre><code>// In header file, extend the base class in Lifecycle library\n// by creating a category.\n@interface URLHandler (Experience)\n\n+ (void) handleURL:(NSURL *) url;\n\n@end\n\n// In .mm file,\n@implementation URLHandler (Experience)\n\n+ (void) handleURL:(NSURL *) url {\n Log([NSString stringWithFormat:@&quot;(ObjC++) url = %@&quot;, [url absoluteString]]);\n\n // Update the UI after 'understanding' the URL.\n}\n\n@end\n\n</code></pre>\n<p>And, in the onOpenURL(perform:) method, invoke handleURL: method,</p>\n<pre><code>WindowGroup {\n ContentView()\n .onOpenURL(perform: { (url: URL) in\n URLHandler.handleURL(url)\n })\n}\n</code></pre>\n<p>As per my understanding, everything seems fine... but I get a compilation error</p>\n<pre><code>Type 'URLHandler' has no member 'handleURL'\n</code></pre>\n<p>Isn't category a runtime feature? At runtime, handleURL: method should be part of <code>URLHandler</code>. But how do I get past this error at compile time?</p>\n<p>Is this not possible using ObjC? If yes, is there any other way?</p>\n<p><strong>Edit1</strong>: I am using the latest <a href="https://www.swift.org/documentation/cxx-interop/" rel="nofollow noreferrer">Cpp-Swift interop</a> introduced in WWDC 2023, which uses a module map to expose C++ and ObjC types to Swift. I believe I've done that correctly since the error is not <code>undefined symbol: URLHandler</code> but a method not being available in the class, which I implemented in the category.</p>\n"^^ . "asynchronous"^^ . "0"^^ . . . . . . "-1"^^ . "0"^^ . "2"^^ . . . . . "NSDictionary converted into nsdata and then nsdata converted to json string like below :\n NSMutableDictionary *paramsDic = [[NSMutableDictionary alloc] init];\n [paramsDic setValue:@"testTrial@5." forKey:@"password"];\n [paramsDic setValue:@"9123456789" forKey:@"loginId"];\n [paramsDic setValue:@"Mobile" forKey:@"loginType"];\n [paramsDic setValue:@"91" forKey:@"phoneCode"];\n [paramsDic setValue:@"Us" forKey:@"language"];\n [paramsDic setValue:@"4.3.12" forKey:@"version"];\n [paramsDic setValue:@"1711680146397" forKey:@"timestamp"];"^^ . . "0"^^ . . . "0"^^ . . . . . . . . . "1"^^ . . "Glad you made it work. However, random retaining without proper release will lead to memory leaks. If you must fix it properly I suggest to familiarise yourself with manual memory management. \n\nHere are some good summaries: https://stackoverflow.com/questions/2255861/property-retain-assign-copy-nonatomic-in-objective-c"^^ . . "1"^^ . . . . . "0"^^ . "0"^^ . "Instead of adding screenshots of your code, please add the actual code to the question. To capture the error message, right click on the red indicator and "Reveal in Issue Navigator"."^^ . . . . "0"^^ . "0"^^ . . . . "2"^^ . "Maybe this is because I am using jdoodle on-line compiler."^^ . "1"^^ . . "Playing audio stream using audio unit, crackling sound occurs"^^ . . . . "0"^^ . . . . "1"^^ . . "0"^^ . . "0"^^ . . . . "1"^^ . "MacOS App: How do we launch bundled helper program from main application?"^^ . "0"^^ . . "onesignal"^^ . . . "@esqew This is a linker error, so compilation already succeeded. I suspect he hasn't linked against glibc, although I thought that would be done by default."^^ . "<p>The fully qualified selector name (with the class name) is not required, even in methods not marked with <code>@objc</code>. Of course the selector itself must be either an Objective-C method or a Swift method marked with <code>@objc</code>.</p>\n<p>Oddly, none of the documentation shows any example of a <code>#selector</code> without the fully qualified name but I never use the fully qualified name and it works just fine. It works just like it does in Objective-C. As long as the compiler can find such a method on any known class in the project, the unqualified selector can be used in any context.</p>\n<p>Relevant documentation (with no unqualified examples):</p>\n<ul>\n<li><a href="https://docs.swift.org/swift-book/documentation/the-swift-programming-language/expressions#Selector-Expression" rel="nofollow noreferrer">Swift language reference</a></li>\n<li><a href="https://developer.apple.com/documentation/swift/using-objective-c-runtime-features-in-swift#Use-Selectors-to-Arrange-Calls-to-Objective-C-Methods" rel="nofollow noreferrer">Using Objective-C Runtime Features in Swift</a></li>\n</ul>\n<p>BTW - Xcode does not force a fully qualified name for me. If I type something like:</p>\n<pre><code>let sel = #selector(\n</code></pre>\n<p>and then type a letter such as <code>v</code>, Xcode offers lots of selectors that start with a <code>v</code> but it does not include any class name.</p>\n<p>Also note that the selector name does not require the parentheses and arguments except in cases where you need to disambiguate between overloaded method names.</p>\n<p>As an example, let's say we have a button handler in some iOS code. We need the selector for the call to <code>addTarget</code>. The handler method may look like this:</p>\n<pre><code>@objc func buttonTapped(_ button: UIButton) {\n}\n</code></pre>\n<p>The following are all valid uses of <code>#selector</code>:</p>\n<pre><code>#selector(SomeClass.buttonTapped(_:))\n#selector(SomeClass.buttonTapped)\n#selector(buttonTapped(_:))\n#selector(buttonTapped)\n</code></pre>\n<p>And if the referenced selector is in the same class as the <code>#selector</code> line, you can also prefix the selector name with <code>Self.</code>:</p>\n<pre><code>#selector(Self.buttonTapped(_:))\n#selector(Self.buttonTapped)\n</code></pre>\n<p>though there seems to be little reason to do so.</p>\n<p>The main reason to fully qualify the selector name with the class name is to avoid runtime issues by ensuring, at compile time, that the referenced method actually exists on the specified class.</p>\n"^^ . . "In your posted form data you see, to be sending `name` and `filename` but your server code is complaining that `file` is `null`. It looks like you have inconsistency between your server and client code"^^ . . . . . "Thank you for the information. I still get the error but that is all good to know. It is a very old library, looking deeper I think the issue is the library is missing a suitable simulator architecture. Is there a way to use a .a file to build what is needed? I am out of my depth when it comes to C stuff. The .a and .h files are all I have to work with."^^ . " That's quite hacky, but it instantly worked. Thank you very much. But asking for accessibility permissions is a big question to ask, so I likely make this intended window positioning rather an optional feature."^^ . "1"^^ . . "iOS apps don't run on a virtual machine. Both the Swift compiler and the Objective C compiler output ARM64 instructions. The Swift compiler understands how to output code to call Objective-C functions and how to be called by Objective-C functions."^^ . "<p>Im sure this is something that will be easy for someone with more objective C experience than me. I did not write this but I am stuck using it.</p>\n<p>I have a .h file: bleconfigLibrary with an interface:</p>\n<pre><code>@interface bleconfigLibrary : NSObject. \n</code></pre>\n<p>In a different .m file I have:</p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n#import &quot;BTCommands.h&quot;\n#import &quot;bleconfigLibrary.h&quot;\n#define MAX_BUF_SIZE (512)\n@implementation BTCommands\nbleconfigLibrary *handleRequest;\n\n+ (void)initialize{\n handleRequest = [bleconfigLibrary alloc];\n} \n</code></pre>\n<p>The problem seems to be:</p>\n<pre><code>handleRequest = [bleconfigLibrary alloc];\n</code></pre>\n<p>When I try to run on a simulator I get the error:</p>\n<pre><code>Undefined symbol: _OBJC_CLASS_$_bleconfigLibrary\n</code></pre>\n<p>But it runs fine on physical devices. If I comment out that section, it runs on the simulator.\nAny help would be appreciated.</p>\n"^^ . . "0"^^ . . "@DonMag Why though? Aren't UIViews essentially just controllers for layers, so I'm just organizing my layers in the order I need them. I have some CAShapeLayers that are just graphic paths so I don't really need to attach them to a UIView."^^ . "I can't reproduce your issue either, and this is _just a hunch_ but does the actual text get replaced, or is it only the visual feedback? In the latest macOS update Apple fixed a ton of weird layout issues in TextKit 1 compatibility mode, some of which sometimes caused glitches like this. The actual text value did get replaced, though."^^ . "@PtitXav no, each startDownload call is on a new instance. I've also tried maintaining the same instance, and making sure to cancel the datatask before starting a new one, but that also produces the same type of errors... :("^^ . . "0"^^ . . "objective-c-blocks"^^ . . "<p>First, there's a small bug here that when you fix the memory leak will cause crashes, so to fix that first, remove the <code>[rep release]</code> call. You must only call <code>release</code> when you have taken (shared) ownership:</p>\n<blockquote>\n<p>You take ownership of an object if you create it using a method whose name begins with &quot;alloc&quot; or &quot;new&quot; or contains &quot;copy&quot; (for example, alloc, newObject, or mutableCopy), or if you send it a retain message. You are responsible for relinquishing ownership of objects you own using release or autorelease. Any other time you receive an object, you must not release it.</p>\n</blockquote>\n<p>See <a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html#//apple_ref/doc/uid/20000994-BAJHFBGH" rel="nofollow noreferrer">Basic Memory Management Rules</a> for details.</p>\n<p>So, in CaptureWindowImageData, delete the line <code>[rep release]</code>.</p>\n<p>With that fixed, your problem is that you're generating large objects on the autorelease pool and never draining the pool. When you are called from a non-ObjC context, its is your responsibility to manage the pool. Since you're currently returning an autoreleased object, this requires a little bit of a dance to hold onto it. I haven't built this, but it should work:</p>\n<pre><code>// Rename this to Create... rather than Capture... It now returns a\n// retained object, so needs to have the word Create in its name.\n// https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029\nCFDataRef CreateWindowImageData(CGWindowID windowNumber) {\n // Create your pool\n NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];\n\n CGWindowID windowList[] = {windowNumber};\n\n // ...\n\n [nsImage release];\n // [rep release]; &lt;---- delete this; you don't own this object\n\n // Hold onto your imageData\n CFRetain(imageData);\n\n // Drain the rest of the pool\n [pool drain];\n\n return imageData;\n}\n</code></pre>\n<p>With that, your Go code should be correct (except for fixing the name of the function). It correctly releases the object already.</p>\n<p>Core Foundation and Foundation have extremely consistent naming conventions to indicate memory management. Once you learn the rules, you can know at glance when to call release and when not to.</p>\n<p>For ObjC (Foundation), look for alloc, new, copy, or retain, and or C (Core Foundation), look for Create, Copy, or Retain. Those all mean you must call release (or CFRelease). If you didn't call something with those names, you must not release the object.</p>\n<p>If you want an object to live beyond the current autorelease pool, you must retain it (or have created it with one of the words above). And if you are being called from a context that does not create an autorelease pool, it's up to you to create and drain it.</p>\n"^^ . "bugsnag"^^ . . . . . . . . "1"^^ . "0"^^ . . "I don't think it's problematic but `@"Conection"` -> `@"Connection"`? Also, could you ask POSTMAN to generate Objective-C code? It might help to see what's wrong by comparing the codes."^^ . . . "Selected Text Replacement Bug UITextView Mac Catalyst"^^ . "1"^^ . . "How to use pow() in Objective-C?"^^ . . . . "0"^^ . . . . "objective-c-runtime"^^ . . "1"^^ . "<p>I know this question been asked before. But None of the answers worked for me.<br/>\n<br/><strong>What is the requirements:</strong><br/>\non iOS app, user to be able to record a short audio file (30sec) then upload it to the server using https request.<br/>\nThe recording and saving temporary on the phone works very well.<br/>\nBut I couldn't get the upload part to work.<br/>\n<br/>My code to upload file on the API side as follow. Tested it with <code>Postman</code>, works very well. File received and saved as intended.<br/></p>\n<pre><code>[HttpPost]\npublic async Task&lt;IActionResult&gt; UploadFile([FromForm] IFormFile file, [FromForm] string name)\n {\n try\n {\n if(webHostEnvironment == null)\n {\n throw new SqlNullValueException(&quot;webHostEnvironment is null&quot;);\n }\n\n if (webHostEnvironment.ContentRootPath == null)\n {\n throw new SqlNullValueException(&quot;webHostEnvironment.ContentRootPath is null&quot;);\n }\n\n\n if(file == null)\n {\n throw new SqlNullValueException(&quot;File is null&quot;);\n }\n\n String path = Path.Combine(webHostEnvironment.ContentRootPath, &quot;uploads&quot;); \n if (file.Length &gt; 0)\n {\n string filePath = Path.Combine(path, file.FileName);\n using (Stream fileStream = new FileStream(filePath, FileMode.Create))\n {\n await file.CopyToAsync(fileStream);\n }\n }\n return BuildResponse(Ok().StatusCode, name);\n }\n catch(Exception ex)\n {\n throw new Exception(ex.Message );\n }\n }\n</code></pre>\n<p>Here's is my Objective-C code to upload the file:</p>\n<pre><code>-(void)uploadFile:(NSData*)fileData{\nif(fileData != nil){\n NSString *fileName = self.temporaryRecFile.path.lastPathComponent;\n NSString *urlString = @&quot;some url&quot;;//upload file url\n \n NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];\n [request setURL:[NSURL URLWithString:urlString]];\n [request setHTTPMethod:@&quot;POST&quot;];\n NSString *boundary = @&quot;---------------1234567890&quot;;\n NSString *contentType = [NSString stringWithFormat:@&quot;multipart/form-data; boundary=%@&quot;, boundary];\n [request addValue:contentType forHTTPHeaderField:@&quot;Content-Type&quot;];\n \n \n NSMutableData *bodyData = [[NSMutableData alloc] init];\n [bodyData appendData:[[NSString stringWithFormat:@&quot;\\r\\n--%@\\r\\n&quot;,boundary] dataUsingEncoding:NSUTF8StringEncoding]];\n [bodyData appendData:[[NSString stringWithString:[NSString stringWithFormat:@&quot;Content-Disposition: form-data; name=\\&quot;userfile\\&quot;; filename=\\&quot;%@\\&quot;\\r\\n&quot;, fileName]] dataUsingEncoding:NSUTF8StringEncoding]];\n [bodyData appendData:[@&quot;Content-Type: application/octet-stream\\r\\n\\r\\n&quot; dataUsingEncoding:NSUTF8StringEncoding]];\n [bodyData appendData:[NSData dataWithData:fileData]];\n [bodyData appendData:[[NSString stringWithFormat:@&quot;\\r\\n--%@--\\r\\n&quot;,boundary] dataUsingEncoding:NSUTF8StringEncoding]];\n \n [request setHTTPBody:bodyData];\n \n NSURLSession *session = [NSURLSession sharedSession];\n NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {\n \n dispatch_async(dispatch_get_main_queue(), ^{\n \n NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)response;\n NSInteger responseStatusCode = [httpResponse statusCode];\n \n if(error != nil)\n NSLog(@&quot;error uploading file %@&quot;, error.localizedDescription);\n else{\n NSLog(@&quot;response: %lu&quot;, responseStatusCode);\n NSLog(@&quot;response: %@&quot;, data);\n NSLog(@&quot;response: %@&quot;, [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);\n }\n });\n }];\n \n [dataTask resume];\n}\n</code></pre>\n<p>}\nThe answer I get is :</p>\n<pre><code>response: {&quot;code&quot;:500,&quot;reason&quot;:&quot;File is null&quot;}\n</code></pre>\n<p>Instead of <code>NSURLSessionDataTask</code> I tried to use <code>NSURLSessionUploadTask</code> but with no luck. I got:</p>\n<pre><code>Failed to read the request form. Multipart body length limit 16384 exceeded\n</code></pre>\n<p>Since Postman works very well to upload file using API endpoint. Then the problem must be on the iOS app side.\n<br/>\nAny ideas what might be the problem?\nThanks!</p>\n"^^ . . . "<p>Thanks to @Paulw11 who mentioned the <em><strong>inconsistency</strong></em> issue. <br/><br/>\nTook a fresh look at my code on both sides and realized that I made a mistake on the iOS form by calling the <code>file</code> as <code>userfile</code>. API expects <em>file</em>. So there should be two choices here:<br/>\n1- Change and rename userfile here: <code>Content-Disposition: form-data; name=\\&quot;userfile\\&quot;;</code> to <code>file</code> so that API recognizes it.\n<br/>2- Or keep any custom name of your choice and modify the API as follow:</p>\n<pre><code> public async Task&lt;IActionResult&gt; UploadFile([FromForm(Name = &quot;userfile&quot;)] IFormFile file, [FromForm(Name = &quot;filename&quot;)] string filename){\n //upload logic here \n }\n</code></pre>\n<p>And that solved my problem and file is now uploaded!</p>\n"^^ . "If you just want to test it, you can edit the scheme and run the app as root. Otherwise perhaps look at https://developer.apple.com/documentation/security/1397453-authorizationcreate?language=objc"^^ . . . "If you bring click in a text field, the keyboard comes up. If you then click off the text field, say to click "sign in" or "search", the keyboard hides and the webview is removed. No sign in or search can be done :-) I do have a 90% solution to this now, except testing has returned they get stuck (user error, but still not ideal). The "solution" was to not use any gesture recognizer, but to actually insert javascript that executes when double tap is recognized in the webview. So no conflicting gesture to foul things up."^^ . . "metal"^^ . . "Issue finding #import <FxPlug/FxPlugSDK.h> in Xcode following Apple tutorial"^^ . . "1"^^ . "1"^^ . . "0"^^ . . . . "Issue with + (void)load method not being called in Swift Package Manager (SPM) for Objective-C files in multi-target Swift library"^^ . . . "0"^^ . . . . . . . . . "0"^^ . . . . . . "<p>I would like to achieve simple thing but struggling for the whole day. :(</p>\n<p>I made a simple macOS app. In AppDelegate, applicationDidFinishLaunching, I would like to execute a helper program which is bundled together inside the app.</p>\n<p><a href="https://github.com/hkjlee109/objc-helper-example" rel="nofollow noreferrer">https://github.com/hkjlee109/objc-helper-example</a></p>\n<p>But I am getting an error.</p>\n<pre><code>Load failed: 5: Input/output error\nTry running `launchctl bootstrap` as root for richer errors.\n</code></pre>\n<p>Here's what I did:\n0. From</p>\n<ol>\n<li>I've a target called &quot;helper-agent&quot; which is a commandline application.</li>\n<li>For &quot;helper-agent&quot; application, I've added &quot;com.example.helper.agent.plist&quot; file.</li>\n</ol>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;\n\n&lt;plist version=&quot;1.0&quot;&gt;\n&lt;dict&gt;\n &lt;key&gt;Label&lt;/key&gt;\n &lt;string&gt;com.example.helper.agent&lt;/string&gt;\n &lt;key&gt;BundleProgram&lt;/key&gt;\n &lt;string&gt;Contents/Resources/helper-agent&lt;/string&gt;\n &lt;key&gt;MachServices&lt;/key&gt;\n &lt;dict&gt;\n &lt;key&gt;com.example.helper.agent&lt;/key&gt;\n &lt;true/&gt;\n &lt;/dict&gt;\n&lt;/dict&gt;\n&lt;/plist&gt;\n\n</code></pre>\n<p>And I've added two things for &quot;Build phase&quot; of main application.</p>\n<ol>\n<li>Copy Bundle Resources: Copy &quot;helper-agent&quot; application to &quot;Contents/Library/LaunchAgents&quot;</li>\n<li>Copy Files: Copy &quot;com.example.helper.agent.plist&quot; to &quot;Contents/Library/LaunchAgents&quot;</li>\n</ol>\n<p>Lastly, in AppDelegate, I am using below code to launch the helper.</p>\n<pre><code> NSTask* task = [NSTask new];\n task.launchPath = @&quot;/bin/launchctl&quot;;\n task.arguments = @[@&quot;load&quot;, @&quot;com.example.helper.agent.plist&quot;];\n [task launch];\n [task waitUntilExit];\n</code></pre>\n<p>I would be appreciated for any piece of advices or suggestions. Thanks!</p>\n<p><a href="https://github.com/hkjlee109/objc-helper-example" rel="nofollow noreferrer">https://github.com/hkjlee109/objc-helper-example</a></p>\n"^^ . . . "0"^^ . "1"^^ . "0"^^ . "<p>I am working on a metal renderer with the GLFW windowing api (the reason I use glfw is for portability). The problem is that the frame rate is capped at sixty which I do not want, after some googling I found you can modify the frame rate through an <code>MTKView</code>, though I cannot find how to get such an object.</p>\n<p>The questions is, can I get the <code>MTKView</code> through glfw somehow, or rather, <strong>how should I modify the frame rate in this situation?</strong></p>\n<p>Some sample code:</p>\n<pre><code>...\nCAMetalLayer* layer = [CAMetalLayer new];\n... \nNSWindow* window = glfwGetCocoaWindow(glfwWindow);\nwindow.contentView.layer = layer;\nwindwo.contentView.wantsLayer = YES;\n...\n</code></pre>\n<p>I must say I am completely new to Metal and I am not sure if using glfw is the way to go, I do definitely want to use Glfw since I rely on it on windows with Vulkan and I found some code can be cross platform with glfw.</p>\n<p>(edit) Rendering happens as follows:</p>\n<pre><code> id &lt;CAMetalDrawable&gt; surface = ...;\n MTLRenderPassDescriptor* render_pass = ...;\n id &lt;MTLCommandQueue&gt; queue = ...;\n CAMetalLayer* layer = ...;\n id &lt;MTLRenderCommandEncoder&gt; command = ...;\n id &lt;MTLRenderPipelineState&gt; pipeline = ...;\n\n id &lt;MTLCommandBuffer&gt; command_buffer = [queue commandBuffer];\n render_pass.colorAttachments[0].texture = surface.texture;\n \n command = [command_buffer renderCommandEncoderWithDescriptor: render_pass];\n [command setRenderPipelineState: pipeline];\n [command endEncoding];\n \n [command_buffer presentDrawable: surface];\n [command_buffer commit];\n \n surface = [layer nextDrawable];\n</code></pre>\n<p>Thank you.</p>\n"^^ . "0"^^ . "launchd"^^ . . "Also check the response body from the server. It should tell you why there was a 400 response"^^ . . . . . . "launch"^^ . . "FYI - all of those variables just after the `@implementation` line are global variables. They are not instance variables to the class. If you ever create more than one instance of `GameWindow`, they will be sharing the values of those variables. To make them instance variables, they need to be within curly braces."^^ . . . . . . "<p>MacOS 12.6.8 Apple M1 Pro</p>\n<p>go version go1.20.7 darwin/arm64</p>\n<p>Invoking the function <strong><code>GetWindowImage</code></strong> leads to rapid memory expansion.</p>\n<p>Code:</p>\n<pre><code>package main\n\n/*\n#cgo CFLAGS: -x objective-c\n#cgo LDFLAGS: -framework Cocoa -framework ApplicationServices\n\n#import &lt;Cocoa/Cocoa.h&gt;\n#import &lt;ApplicationServices/ApplicationServices.h&gt;\n\nCGWindowID GetWindowNumber(const char *title) {\n NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];\n NSString *windowTitle = [NSString stringWithUTF8String:title];\n CFArrayRef windowList = CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly, kCGNullWindowID);\n CGWindowID windowNumber = 0;\n for (NSDictionary *entry in (__bridge NSArray *)windowList) {\n NSString *winTitle = [entry objectForKey:(id)kCGWindowName];\n // NSLog(@&quot;Window Title: %@&quot;, winTitle);\n if ([winTitle isEqualToString:windowTitle]) {\n windowNumber = (CGWindowID)[[entry objectForKey:(id)kCGWindowNumber] integerValue];\n break;\n }\n }\n CFRelease(windowList);\n [pool drain];\n return windowNumber;\n}\n\n\nCFDataRef CaptureWindowImageData(CGWindowID windowNumber) {\n CGWindowID windowList[] = {windowNumber};\n CFArrayRef windowArray = CFArrayCreate(NULL, (const void **)windowList, 1, NULL);\n CGImageRef image = CGWindowListCreateImageFromArray(CGRectNull, windowArray, kCGWindowImageDefault);\n NSImage *nsImage = [[NSImage alloc] initWithCGImage:image size:NSZeroSize];\n CFRelease(windowArray);\n CGImageRelease(image);\n\n NSBitmapImageRep *rep = [NSBitmapImageRep imageRepWithData:[nsImage TIFFRepresentation]];\n NSDictionary *props = [NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:1.0] forKey:NSImageCompressionFactor];\n CFDataRef imageData = (CFDataRef)[rep representationUsingType:NSBitmapImageFileTypePNG properties:props];\n\n [nsImage release];\n [rep release];\n\n return imageData;\n}\n*/\nimport &quot;C&quot;\nimport (\n &quot;bytes&quot;\n &quot;fmt&quot;\n &quot;image&quot;\n &quot;image/png&quot;\n &quot;unsafe&quot;\n)\n\nfunc GetWindowNumber(name string) uint {\n cTitle := C.CString(name)\n defer C.free(unsafe.Pointer(cTitle))\n return uint(C.GetWindowNumber(cTitle))\n}\n\nfunc GetWindowImage(windowNumber uint) (image.Image, error) {\n imageData := C.CaptureWindowImageData(C.uint(windowNumber))\n if imageData == C.CFDataRef(unsafe.Pointer(nil)) {\n return nil, fmt.Errorf(&quot;failed to get window image data for %d&quot;, windowNumber)\n }\n defer C.CFRelease(C.CFTypeRef(imageData))\n dataLength := C.CFDataGetLength(imageData)\n dataPtr := C.CFDataGetBytePtr(imageData)\n data := C.GoBytes(unsafe.Pointer(dataPtr), C.int(dataLength))\n return png.Decode(bytes.NewReader(data))\n}\n\nfunc main() {\n winId := GetWindowNumber(&quot;Clock&quot;)\n fmt.Println(winId)\n for i := 0; i &lt; 100; i++ {\n _, err := GetWindowImage(winId)\n if err != nil {\n panic(err)\n }\n }\n}\n</code></pre>\n<p>I'm currently unable to determine where the problem lies, whether it's in Objective-C or C.</p>\n<p>Please help diagnose the issue and guide on how to fix the code.</p>\n"^^ . . . . . "nsstring"^^ . . . "1"^^ . ".net-core"^^ . . "multithreading"^^ . . . "1"^^ . . . . . . . . . . "<p>I wonder if it is possible to use UICollectionViewCell with IBOutlet? As I always get this error</p>\n<p>*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'the cell returned from -collectionView:cellForItemAtIndexPath: was not retrieved by calling -dequeueReusableCellWithReuseIdentifier:forIndexPath: at index path</p>\n<p>Below is my code:</p>\n<pre><code>@property (nonatomic, strong) NSMutableArray *cellArray;\n@property (nonatomic, strong) IBOutlet UICollectionViewCell *sort1Cell;\n@property (nonatomic, strong) IBOutlet UICollectionViewCell *sort2Cell;\n@property (nonatomic, strong) IBOutlet UICollectionViewCell *sort3Cell;\n@property (nonatomic, strong) IBOutlet UICollectionViewCell *sort4Cell;\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n\n self.cellArray = [NSMutableArray array];\n [cellArray addObject:sort1Cell];\n [cellArray addObject:sort2Cell];\n [cellArray addObject:sort3Cell];\n [cellArray addObject:sort4Cell];\n [theCollectionView reloadData];\n}\n\n- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath\n{\n UICollectionViewCell *cell = [cellArray objectAtIndex:indexPath.row];\n return cell; //THE ERROR IS FROM HERE\n}\n</code></pre>\n<p>Or perhaps I am missing something?</p>\n"^^ . . . "1"^^ . . . . . "When the slide out button to the left appears, change the picture after clicking the button with the red circle drawn on it."^^ . . . . "uitoolbar"^^ . . . "<p>I'm trying to import a Swift class into an Objective-C file in Xcode. It works fine, based on exposing the class to Objective-C and importing the ProductModuleName-Swift.h Xcode generated file. The problem I'm having is that my app has multiple targets, and it seems that Xcode generates a different -Swift.h file for each target. So if I import the production -Swift.h, the dev target won't build, and vice versa.</p>\n<p>I've tried:</p>\n<p>- Importing both of them: doesn't work (neither will build due to not being able to locate the other)</p>\n<p>- Added conditional macros to only import the right file for the right target: when wrapped in the conditionals the Swift methods from the class are no longer locatable by Xcode and don't compile.</p>\n<p>My current solution, which does work, involves going into build settings for one of the targets and disconnecting the Generated Header Name from the Product Module Name, and manually giving it the same name as the other target. Now it compiles fine. However my concern is that I'm tinkering with something that shouldn't be changed and could have negative ramifications.</p>\n<p>So my question is - is there a better way of doing what I want to achieve? Thanks in advance.</p>\n<p>*LogStatements Swift class no longer found and doesn't compile -&gt;</p>\n<pre><code> #if PRODUCTION\n#import &quot;ProductionTarget-Swift.h&quot;\n#elif DEV #import &quot;DevelopmentTarget-Swift.h&quot;\n#endif\n\n@implementation STNetworkManager\n\n+ (void)saveDictionary:(NSDictionary *)dictionary withFileName:(NSString *)fileName {\n\nif (dictionary == nil || fileName == nil) {\nreturn;\n}\n// check if all objects are valid JSON objects\n\nif (![NSJSONSerialization isValidJSONObject:dictionary]) {\nNSLog(@&quot;Error saving dictionary, invalid JSON object: %@&quot;, dictionary);\nLogStatements *logging = [[LogStatements alloc] init]; [logging logger:@[@&quot;Hello from Objective-C&quot;]];\nreturn;\n}\n</code></pre>\n"^^ . . "@Paulw11 yes, the exception message would be great, but maybe not available if it's not a DEBUG build? Remember my main issue is I can't reproduce (neither can my beta testers), so only see the crash logs from users in the field. I have now added everything relevant from the crash dump I received from Apple to the question above."^^ . "0"^^ . . "1"^^ . "Is that macOS or iOS? Also, what is `e` here? Is it a local variable?"^^ . "0"^^ . . . "Crash in Google maps cocoapod in iOS project"^^ . "1"^^ . "0"^^ . "nsurlsession"^^ . . . . . . . "<p>The pixel buffers used by the <code>AVPlayerViewController</code> probably don't support the alpha channel by default (to save memory). But you can change the pixel format like this:</p>\n<pre class="lang-objectivec prettyprint-override"><code>AVPlayerViewController *controller = [[AVPlayerViewController alloc] init];\ncontroller.pixelBufferAttributes = @{kCVPixelBufferPixelFormatTypeKey: kCVPixelFormatType_32BGRA};\n</code></pre>\n"^^ . . . . . "Don’t know how to implement this. This is compiled code of Ionic for iOS APP and i am using iOS onsignal sdk in Xcode"^^ . "0"^^ . . . . "0"^^ . "1"^^ . . . . "2"^^ . . "chromakey"^^ . "Yeah but the point is that your Objective-C code isn't correct. If you use that same pattern in any class, the class will be wrong. It's important that you correctly declare instance variables to avoid bugs that will be difficult to track down."^^ . . "2"^^ . . . . . . . . . . "xcframework"^^ . "2"^^ . . . "Are you trying to insert a `UIView` ***under*** a layer of another view? Pretty sure that's not how layers work..."^^ . "In more recent MacOS versions it seems that the Accessibility API has become more restrictive and more focussed on supporting an individual application. Methods like mentioned in the following post do not seem to work anymore: https://stackoverflow.com/questions/6684278/getting-the-position-of-my-applications-dock-icon-using-cocoas-accessibility-a"^^ . . . . "<p><a href="https://i.sstatic.net/DTYcx.jpg" rel="nofollow noreferrer">enter image description here</a></p>\n<pre><code> -(nullable NSArray&lt;UIView*&gt;*) swipeTableCell:(nonnull MGSwipeTableCell*) cell swipeButtonsForDirection:(MGSwipeDirection)direction\n swipeSettings:(nonnull MGSwipeSettings*) swipeSettings expansionSettings:(nonnull MGSwipeExpansionSettings*) expansionSettings {\n swipeSettings.transition = MGSwipeTransition3D; // 滑出动画\n if (direction == MGSwipeDirectionRightToLeft) {\n expansionSettings.fillOnTrigger = YES;\n expansionSettings.threshold = 1.5;\n CGFloat padding = 10;\n MGSwipeButton *isTop = [MGSwipeButton buttonWithTitle:@&quot;&quot; icon:[UIImage imageNamed:@&quot;top&quot;] backgroundColor:[UIColor colorWithRed:243/256.0 green:243/256.0 blue:243/256.0 alpha:1] padding:padding callback:^BOOL(MGSwipeTableCell *sender) {\n NSIndexPath *indexPath = [self.tableView indexPathForCell:sender];\n TrackNumbersCellModel*model = self.dataSource[indexPath.row];\n if (model.isTop) {\n \n model.isTop = NO;\n [self.dataSource removeObject:model];\n [self.dataSource insertObject:model atIndex:self.dataSource.count - 1];\n [[TrackNumbersNetTools shareIntance] trackTable_MR_update_top_Entity:model.t_number isTop:NO];\n [self.tableView reloadData];\n \n }else{\n model.isTop = YES;\n [self.dataSource removeObject:model];\n [self.dataSource insertObject:model atIndex:0];\n [[TrackNumbersNetTools shareIntance] trackTable_MR_update_top_Entity:model.t_number isTop:YES];\n [self.tableView reloadData];\n }\n \n return YES;\n }];\n [isTop centerIconOverTextWithSpacing:7];\n \n MGSwipeButton *isDelete = [MGSwipeButton buttonWithTitle:@&quot;&quot; icon:[UIImage imageNamed:@&quot;delet&quot;] backgroundColor:[UIColor colorWithRed:243/256.0 green:243/256.0 blue:243/256.0 alpha:1] padding:padding callback:^BOOL(MGSwipeTableCell *sender) {\n NSIndexPath *indexPath = [self.tableView indexPathForCell:sender];\n TrackNumbersCellModel*model = self.dataSource[indexPath.row];\n [self.dataSource removeObjectAtIndex:indexPath.row];\n [self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft];\n [[TrackNumbersNetTools shareIntance] trackTable_MR_deleteEntity:model.t_number onFinished:^{\n if (self.deleteBlock) {\n self.deleteBlock();\n }\n }];\n \n return YES;\n }];\n [isDelete centerIconOverTextWithSpacing:7];\n return @[isTop,isDelete];\n }\n \n return nil;\n \n}\n</code></pre>\n<p>My problem is that when I click on the &quot;isTop&quot; MGSwipeButton. I tried to change the image on the MGSwipeButton and used the following method, but it didn't work. Please help.\nWith a link to &quot;MGSwipeTableCell&quot;:<a href="https://github.com/MortimerGoro/MGSwipeTableCell" rel="nofollow noreferrer">https://github.com/MortimerGoro/MGSwipeTableCell</a></p>\n<pre><code>-(BOOL)swipeTableCell:(MGSwipeTableCell*)cell tappedButtonAtIndex:(NSInteger)index direction:(MGSwipeDirection)direction fromExpansion:(BOOL)fromExpansion{\n if (direction == MGSwipeDirectionRightToLeft &amp;&amp; index == 0) {\n id button = cell.leftButtons[index];\n MGSwipeButton * pressedBtn = button;\n [pressedBtn setImage:[UIImage imageNamed:@&quot;yy&quot;] forState:UIControlStateNormal];\n NSLog(@&quot;pressedBtn title: %@&quot;,pressedBtn.titleLabel.text);}\n return YES;\n}\n</code></pre>\n"^^ . . . . "0"^^ . "0"^^ . . "I'm unable to run this program as-is. Are there other dependencies needed for it? `CGImageDestinationFinalize failed for output type 'public.tiff'`"^^ . "0"^^ . . . . "<p>I'm getting the following trying to run with Xcode's Simulator. The GTMSessionFetch framework is included in the project. I'm on an M3 (Apple Silicon) MacBook. Have had various problems trying to move code to this machine, so wondering if that's related. I simply added the Firebase frameworks to the project, added the -ObjC flag as suggested in the README.md.</p>\n<p>What is this &quot;file does not start with MH_MAGIC[_64], fat file, but missing compatible architecture ...&quot; stuff? Other questions seemingly related suggest it is a code signing problem.</p>\n<p>If I use Product-&gt;Build there's no problem. But running with the Simulator generates this in the console:</p>\n<pre><code>dyld[70392]: Library not loaded: @rpath/GTMSessionFetcher.framework/GTMSessionFetcher\n Referenced from: &lt;FFFF9F7B-88DA-3D82-B1CA-419DB7B97C71&gt; /Users/charlesjohnson/Library/Developer/CoreSimulator/Devices/C6358852-2298-4226-8839-F15331073CD2/data/Containers/Bundle/Application/F3C202F4-900E-4214-A3E1-F922CB071CA9/ASSIST for iPad.app/ASSIST for iPad\n Reason: tried: '/Users/charlesjohnson/Documents/iOS_Projects/ASSIST-main/assist_ios/DerivedData/ASSIST for iPad/Build/Products/Debug-iphonesimulator/GTMSessionFetcher.framework/GTMSessionFetcher' (file does not start with MH_MAGIC[_64], file does not start with MH_MAGIC[_64], file does not start with MH_MAGIC[_64], fat file, but missing compatible architecture (have 'i386,x86_64,arm64', need 'arm64')), '/Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/GTMSessionFetcher.framework/GTMSessionFetcher' (no such file), '/usr/lib/swift/GTMSessionFetcher.framework/GTMSessionFetcher' (no such file, not in dyld cache), '/Users/charlesjohnson/Library/Developer/CoreSimulator/Devices/C6358852-2298-4226-8839-F15331073CD2/data/Containers/Bundle/Application/F3C202F4-900E-4214-A3E1-F922CB071CA9/ASSIST for iPad.app/Frameworks/GTMSessionFetcher.framework/GTMSessionFetcher' (file does not start with MH_MAGIC[_64], file does not start with MH_MAGIC[_64], file does not start with MH_MAGIC[_64], fat file, but missing compatible architecture (have 'i386,x86_64,arm64', need 'arm64')), '/Users/charlesjohnson/Library/Developer/CoreSimulator/Devices/C6358852-2298-4226-8839-F15331073CD2/data/Containers/Bundle/Application/F3C202F4-900E-4214-A3E1-F922CB071CA9/ASSIST for iPad.app/Frameworks/GTMSessionFetcher.framework/GTMSessionFetcher' (file does not start with MH_MAGIC[_64], file does not start with MH_MAGIC[_64], file does not start with MH_MAGIC[_64], fat file, but missing compatible architecture (have 'i386,x86_64,arm64', need 'arm64')), '/Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/GTMSessionFetcher.framework/GTMSessionFetcher' (no such file), '/usr/lib/swift/GTMSessionFetcher.framework/GTMSessionFetcher' (no such file, not in dyld cache), '/Users/charlesjohnson/Library/Developer/CoreSimulator/Devices/C6358852-2298-4226-8839-F15331073CD2/data/Containers/Bundle/Application/F3C202F4-900E-4214-A3E1-F922CB071CA9/ASSIST for iPad.app/Frameworks/GTMSessionFetcher.framework/GTMSessionFetcher' (file does not start with MH_MAGIC[_64], file does not start with MH_MAGIC[_64], file does not start with MH_MAGIC[_64], fat file, but missing compatible architecture (have 'i386,x86_64,arm64', need 'arm64')), '/Users/charlesjohnson/Library/Developer/CoreSimulator/Devices/C6358852-2298-4226-8839-F15331073CD2/data/Containers/Bundle/Application/F3C202F4-900E-4214-A3E1-F922CB071CA9/ASSIST for iPad.app/Frameworks/GTMSessionFetcher.framework/GTMSessionFetcher' (file does not start with MH_MAGIC[_64], file does not start with MH_MAGIC[_64], file does not start with MH_MAGIC[_64], fat file, but missing compatible architecture (have 'i386,x86_64,arm64', need 'arm64')), '/Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/GTMSessionFetcher.framework/GTMSessionFetcher' (no such file)\nLogging Error: Failed to initialize logging system. Log messages may be missing. If this issue persists, try setting IDEPreferLogStreaming=YES in the active scheme actions environment variables.\n</code></pre>\n"^^ . . . . . . . "<blockquote>\n<p>I wonder if it is possible to use UICollectionViewCell with IBOutlet</p>\n</blockquote>\n<p>No, it isn't possible. (And even if it is, don't do it.) Cells are <em>reused</em>; they have no permanent existence within the collection view. You never know what cell object will be used at a given section/item position. Therefore you must <em>dequeue</em> the cell every time <code>cellForItemAtIndexPath</code> is called.</p>\n<p>There are ways to obtain a reference to a cell that actually exists within the collection view, at runtime. (Though in many case, the need to do even this is to be regarded as a Bad Smell.)</p>\n"^^ . . . . . "0"^^ . . . "0"^^ . . . . . . . "dock"^^ . . . . . . . . "0"^^ . . . . . . . . . . . "0"^^ . . . . . . "<p>I want to parse a Mach-O file so I use class-dump:</p>\n<pre class="lang-bash prettyprint-override"><code>class-dump -H xxx.app\n</code></pre>\n<p>But it throw an error:</p>\n<pre><code>class-dump[7747:13147879] Unknown load command: 0x00000032\n</code></pre>\n<p>And only generate one .h file: <code>CDStructures.h</code></p>\n<pre><code>//\n// Generated by class-dump 3.5 (64 bit).\n//\n// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.\n//\n\n</code></pre>\n<p>My class-dump version is 3.5.</p>\n"^^ . . "Try working with centers. Something like `CGPoint convertedTargetImageViewCenter = [v1 convertPoint:v4.center fromView:v4];`. Then set the `center` property of the image view to `convertedTargetImageViewCenter`."^^ . . . . . . "0"^^ . . "<p>Couple things to note...</p>\n<p>Layers - whether <code>CALayer</code>, <code>CAShapeLayer</code>, <code>CAGradientLayer</code>, etc - belong to a view. You <em>can</em> manipulate the appearance of the layers via the <code>.zPosition</code>.</p>\n<p>Also, a layer doesn't really exist on its own... it must be added as a sublayer to a view's layer.</p>\n<p>A view <em>has its own layer</em> ... so when trying to manipulate layer ordering, that must be taken into account.</p>\n<hr />\n<p>So, your goal is to have one view with multiple layers, another view with one or more layers, and <em>insert</em> the second view (and its layers) between layers of the first view.</p>\n<p>If we start with two views -- yellow with two <code>CAShapeLayer</code> sublayers; cyan with one <code>CAShapeLayer</code> sublayer:</p>\n<p><a href="https://i.sstatic.net/t7uGx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/t7uGx.png" alt="enter image description here" /></a></p>\n<p>Looks like this (with the layers separated out):</p>\n<p><a href="https://i.sstatic.net/m98lW.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/m98lW.png" alt="enter image description here" /></a></p>\n<p>and we want to <em>insert</em> cyanView (and its triangle sublayer) between the rectangle and oval layers of yellowView:</p>\n<p><a href="https://i.sstatic.net/VNxC3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/VNxC3.png" alt="enter image description here" /></a></p>\n<p>Let's add cyanView as a subview of yellowView, offset by 40,40 and <code>yellowView.clipsToBounds = true</code> so we can see it's a subview:</p>\n<p><a href="https://i.sstatic.net/72UP3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/72UP3.png" alt="enter image description here" /></a></p>\n<p>That gives us what we expect... but not what we want, because the rect and oval layers belong to yellowView.</p>\n<p>To move the oval layer to the top, we'll change the <code>.zPosition</code> properties:</p>\n<pre><code>// we don't want to mess with the .zPosition of yellow view's layer,\n// because it's the &quot;base&quot; of the hierarchy\nrectShapeLayer.zPosition = 1;\ncyanView.layer.zPosition = 2;\ntriShapeLayer.zPosition = 3;\novalShapeLayer.zPosition = 4;\n</code></pre>\n<p>and we get this result:</p>\n<p><a href="https://i.sstatic.net/22CVT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/22CVT.png" alt="enter image description here" /></a></p>\n<p>cyanView and its triangle layer are now between yellow view's rectangle and oval layers.</p>\n<p>Goal accomplished? Maybe...</p>\n<p>Let's look at the Debug View Hierarchy now:</p>\n<p><a href="https://i.sstatic.net/BJonm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/BJonm.png" alt="enter image description here" /></a></p>\n<p>Notice that the layers are not separated from their views.</p>\n<p>In the first Hierarchy images above, I used individual views just to show what we're trying to do.</p>\n<hr />\n<p>Now, managing the <code>.zPosition</code> values <em>may</em> work for you... but I would think it would be much easier to implement either only layers, or only views (we can change a view's layer class to eliminate the need to add a sublayer to every view).</p>\n<hr />\n<p>Here is some example code to produce the above:</p>\n<p><strong>ViewsAndLayersViewController.h</strong></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\nNS_ASSUME_NONNULL_BEGIN\n@interface ViewsAndLayersViewController : UIViewController\n@end\nNS_ASSUME_NONNULL_END\n</code></pre>\n<p><strong>ViewsAndLayersViewController.m</strong></p>\n<pre><code>#import &quot;ViewsAndLayersViewController.h&quot;\n\n@implementation ViewsAndLayersViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n self.view.backgroundColor = UIColor.systemBackgroundColor;\n \n info = [UILabel new];\n info.numberOfLines = 0;\n info.translatesAutoresizingMaskIntoConstraints = NO;\n [self.view addSubview:info];\n \n UILayoutGuide *g = self.view.safeAreaLayoutGuide;\n \n [NSLayoutConstraint activateConstraints:@[\n [info.leadingAnchor constraintEqualToAnchor:g.leadingAnchor constant:20.0],\n [info.trailingAnchor constraintEqualToAnchor:g.trailingAnchor constant:-20.0],\n [info.topAnchor constraintEqualToAnchor:g.topAnchor constant:20.0],\n ]];\n \n [self reset];\n \n}\n\n- (void)reset {\n [cyanView removeFromSuperview];\n [yellowView removeFromSuperview];\n cyanView = nil;\n yellowView = nil;\n \n yellowView = [UIView new];\n cyanView = [UIView new];\n rectShapeLayer = [CAShapeLayer new];\n ovalShapeLayer = [CAShapeLayer new];\n triShapeLayer = [CAShapeLayer new];\n \n yellowView.clipsToBounds = YES;\n \n [self.view addSubview:yellowView];\n [self.view addSubview:cyanView];\n \n CGRect r = CGRectMake(40.0, 160.0, 240.0, 200.0);\n yellowView.frame = r;\n cyanView.frame = CGRectOffset(r, 0.0, r.size.height + 20.0);\n \n yellowView.backgroundColor = UIColor.yellowColor;\n cyanView.backgroundColor = UIColor.cyanColor;\n \n for (CAShapeLayer *s in @[rectShapeLayer, ovalShapeLayer, triShapeLayer]) {\n s.fillColor = UIColor.clearColor.CGColor;\n s.lineWidth = 16;\n s.lineJoin = kCALineJoinRound;\n }\n \n rectShapeLayer.strokeColor = UIColor.systemRedColor.CGColor;\n ovalShapeLayer.strokeColor = UIColor.systemGreenColor.CGColor;\n triShapeLayer.strokeColor = UIColor.systemBlueColor.CGColor;\n \n [yellowView.layer addSublayer:rectShapeLayer];\n [yellowView.layer addSublayer:ovalShapeLayer];\n [cyanView.layer addSublayer:triShapeLayer];\n \n UIBezierPath *pth;\n CGRect pRect = CGRectInset(yellowView.bounds, 20.0, 20.0);\n CGPoint p;\n \n // rectangle path\n pth = [UIBezierPath bezierPathWithRect:pRect];\n rectShapeLayer.path = pth.CGPath;\n \n // oval path\n pth = [UIBezierPath bezierPathWithOvalInRect:pRect];\n ovalShapeLayer.path = pth.CGPath;\n \n // triangle path\n pth = [UIBezierPath new];\n p = CGPointMake(CGRectGetMidX(pRect), CGRectGetMinY(pRect));\n [pth moveToPoint:p];\n p = CGPointMake(CGRectGetMaxX(pRect), CGRectGetMaxY(pRect));\n [pth addLineToPoint:p];\n p = CGPointMake(CGRectGetMinX(pRect), CGRectGetMaxY(pRect));\n [pth addLineToPoint:p];\n [pth closePath];\n triShapeLayer.path = pth.CGPath;\n \n info.text = @&quot;Tap to add cyanView as a subview of yellowView, offset by 40,40&quot;;\n iStep = 0;\n \n}\n- (void)touchesBegan:(NSSet&lt;UITouch *&gt; *)touches withEvent:(UIEvent *)event {\n ++iStep;\n \n switch (iStep) {\n case 1:\n [self step1];\n break;\n \n case 2:\n [self step2];\n break;\n \n case 3:\n [self step3];\n break;\n \n default:\n break;\n }\n}\n\n- (void)step1 {\n cyanView.frame = CGRectOffset(yellowView.bounds, 40.0, 40.0);\n [yellowView addSubview:cyanView];\n info.text = @&quot;Tap to arrange layers via .zPosition&quot;;\n}\n- (void)step2 {\n // we don't want to mess with the .zPosition of yellow view's layer,\n // because it's the &quot;base&quot; of the hierarchy\n rectShapeLayer.zPosition = 1;\n cyanView.layer.zPosition = 2;\n triShapeLayer.zPosition = 3;\n ovalShapeLayer.zPosition = 4;\n info.text = @&quot;Tap to reset...&quot;;\n}\n- (void)step3 {\n [self reset];\n}\n\n@end\n</code></pre>\n"^^ . "<p>I do have a fairly large obj-c static library I have converted to XCFramework and for the base that works great. Thing is, the old library compiled differently based on xcodebuild defines and created like 20 different variants, containing more header files, something like:</p>\n<p>base:\nHeaders</p>\n<ul>\n<li>mainheader.h</li>\n</ul>\n<p>variant1:\nHeaders</p>\n<ul>\n<li>mainheader.h</li>\n<li>customheader.h</li>\n</ul>\n<p>..</p>\n<p>However I failed to find a way from the commandline with xcodebuild to mark specific headers to be public to copy when creating the framework. I can make that magic with adding more targets, sure, but prefer to not go that route unless I have to</p>\n"^^ . "bridging-header"^^ . . . . . . . . "2"^^ . "cifilter"^^ . . . "Are you sure of that the data in Post should not be base64 or other encoding ?"^^ . "cashapelayer"^^ . . "0"^^ . "0"^^ . . "objective-c"^^ . "<p>As I understand it, Swift and Objective-C are interoperable. A project predominantly written in Swift can use Objctive-C libraries (or even C and C++ libraries) and vice versa.</p>\n<p>I know that Java and Kotlin can do this because they have the same runtime (JVM). But I've read that Swift has its own runtime separate from Objective-C's. So how are Swift and Objective-C interoperable?</p>\n"^^ . . . . . . "0"^^ . . . "1"^^ . . "Having trouble converting point that's on a rotated view with a (0, .5) anchor point"^^ . . . . "How to set frame rate in GLFW based metal application?"^^ . "<p>This is a great question that touches on some subtle details of how NSRunLoop works.</p>\n<p>The <code>-run</code> method is not intended to ever return. It may if there are no sources or timers, but this is <a href="https://developer.apple.com/documentation/foundation/nsrunloop/1412430-run?language=objc" rel="nofollow noreferrer">explicitly not promised</a> (emphasis added):</p>\n<blockquote>\n<p>Manually removing all known input sources and timers from the run loop is not a guarantee that the run loop will exit. <strong>macOS can install and remove additional input sources as needed to process requests targeted at the receiver’s thread.</strong> Those sources could therefore prevent the run loop from exiting.</p>\n<p>If you want the run loop to terminate, you shouldn't use this method....</p>\n</blockquote>\n<p>When you call <code>-performSelector:onThread:...</code>, the system will attach a <code>__NSThreadPerformPerform</code> run lop source if one does not already exist (this is an undocumented, internal type). Once attached, this source is never removed, but it is added lazily the first time it's needed.</p>\n<p>Timers are attached to run loops like sources. They are removed when they are invalidated (such as after they fire, if they do not repeat).</p>\n<p>Putting all these facts together explains the behavior.</p>\n<p>When there is no <code>-performSelector:onThread:...</code> call, then after the timer fires there are no sources or timers left on the run loop, and <code>-run</code> exits, terminating the thread, releasing the NSThread object, and calling <code>-dealloc</code>.</p>\n<p>When you do call <code>-performSelector:onThread:...</code>, then there is a <code>__NSThreadPerformPerform</code> source on the thread. It will never be removed, and so <code>-run</code> will never return. The thread will never terminate, and the NSThread object will never be released.</p>\n<p>If you want the thread terminate, you shouldn't use <code>-run</code>. Instead, use <code>-runMode:beforeDate:</code>. For example:</p>\n<pre><code>NSRunLoop *loop = [NSRunLoop currentRunLoop];\n\n// The docs don't warn you to do this. This adds a dummy source so that\n// the loop always has at least one. You can also use a repeating timer.\n[loop addPort:[NSMachPort new] forMode:NSDefaultRunLoopMode];\n\n// Infinite loop until `shouldKeepRunning` is false.\n// `runMode:beforeDate:` will process one source and then return.\n// (A timer is not a &quot;source&quot; for this purpose.)\nwhile (![self isCancelled] &amp;&amp; [loop runMode:NSDefaultRunLoopMode \n beforeDate:[NSDate distantFuture]]);\n</code></pre>\n<p>You can set <code>isCancelled</code> by calling <code>[thread cancel]</code>. Keep in mind that just cancelling won't immediately terminate this thread. It will terminate the next time a source-modifying <code>-performSelector:...</code> is called, after processing the selector.</p>\n<p>If you want to poll <code>shouldKeepRunning</code> instead, you can pass a <code>beforeDate:</code> of the next time you want to poll.</p>\n<p>If you don't want the thread to terminate, then <code>-run</code> is fine. Just add either a repeating timer or a dummy NSMachPort to keep it alive until the first message.</p>\n<p>As a very general rule, NSThread should be avoided in modern ObjC. <a href="https://developer.apple.com/library/archive/documentation/General/Conceptual/ConcurrencyProgrammingGuide/ThreadMigration/ThreadMigration.html" rel="nofollow noreferrer">GCD</a> provides better tools for most problems that were traditionally handled directly NSThread. But threads are still fully supported, so if that matches your needs, it's not wrong.</p>\n"^^ . "0"^^ . . "1"^^ . . . . . . . "Issue with NSString access from IBAction in a macOS app for 10.4 Tiger PPC in Xcode 2.5"^^ . . . . . . "0"^^ . . . . . . . "<p>I have configured an XPC service in my macOS application, and I've ensured that the service is set up correctly. However, whenever I try to establish a connection between my app and the XPC service, it always falls into the invalidationHandler block, indicating that the connection is being invalidated.</p>\n<p>I just want to test if the connection works at the moment, so I'm not concerned about specific functionality. I've checked my XPC service configuration, and everything seems to be in place.</p>\n<p>Here's a simplified version of my code, and some pictures that I provide for my setup of my project :</p>\n<p><a href="https://i.sstatic.net/qEiWK.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qEiWK.jpg" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/Pylho.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Pylho.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/3CBkI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3CBkI.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/4PLeu.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4PLeu.png" alt="enter image description here" /></a></p>\n<p>I'm struggling to figure out why the connection is being invalidated despite the proper configuration. Any insights or suggestions on how to troubleshoot and resolve this issue would be greatly appreciated. Thank you!</p>\n"^^ . "0"^^ . "0"^^ . "0"^^ . . "What could be the reason of the inconsistency? Could it be that all the API calls/endpoints `content-type` are `application/json` and this is the only `form-data` ? When printing the `response` of the `NSURLSessionDataTask` it says '"Content-Type" = ("application/json"); I don't have much experience in API and core.net so I'm a bit confused"^^ . "0"^^ . . "google-maps-sdk-ios"^^ . . "How to change the image on the MGSwipeButton in MGSwipeTableCell"^^ . . . "Undefined symbol: _OBJC_CLASS_$_ only on simulator"^^ . . . . . . "0"^^ . "uicollectionviewcell"^^ . "<p>I get this error &quot;this file must be compiled as obj-C++.</p>\n<p>If I downgrade to react-native 0.73.4, seems to work. I'm using the new React Native Architecture.</p>\n<p>How do make latest versions of react native and bugsnagreactnative work together?</p>\n<p><a href="https://i.sstatic.net/EzbTB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EzbTB.png" alt="enter image description here" /></a></p>\n"^^ . "1"^^ . . "1"^^ . . . . . "audiounit"^^ . "CIFilter 'apply:' is unavailable: not available on iOS"^^ . "0"^^ . . . "0"^^ . . . . "Thanks for firm answer, matt\n\nI'm just trying to display 4 static buttons. Each with different width, and I want it to fill horizontal space first, then move to next row if it is full. Thats why I want to use UICollectionView\n\nThis could be done with UITableView without error, but it can't fill horizontal space"^^ . . . "<p>I am facing an issue when ever I am trying to install app on iOS 17.4 app getting crashed on Launching. Crash occurred in FIRDLJavaScriptExecutor file and I also update the firebase pods to latest version. Even also getting same crashed.</p>\n<p><a href="https://i.sstatic.net/t3CZu.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/t3CZu.png" alt="enter image description here" /></a></p>\n<p>Getting this error.</p>\n"^^ . . "1"^^ . . "I think Maps SDK v8.3.1 fixes the issue. Can you confirm?"^^ . . . . . . "0"^^ . "Actually this occurred in FIRDLJavaScriptExecutor file that is Pod file. whenever I trying to launch app on iOS 17.4 Devices this has been crashed."^^ . "<p>I followed <a href="https://developer.apple.com/documentation/coreimage/applying_a_chroma_key_effect?language=objc" rel="nofollow noreferrer">this</a> document to make a chroma key filter for AVPlayerItem on iOS. I want all pixels that match a condition become transparent. For now, the condition is whether the pixel has hue value between 0.3 and 0.4 (green pixels).</p>\n<p>My filter:</p>\n<pre class="lang-objc prettyprint-override"><code>- (CGFloat) hueFromRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue {\n UIColor* color = [UIColor colorWithRed:red green:green blue:blue alpha:1];\n \n CGFloat hue, saturation, brightness;\n [color getHue:&amp;hue saturation:&amp;saturation brightness:&amp;brightness alpha:nil];\n \n return hue;\n}\n\n- (CIFilter&lt;CIColorCube&gt; *) chromaKeyFilterHuesFrom:(CGFloat)minHue to:(CGFloat)maxHue {\n const unsigned int size = 64;\n const size_t cubeDataSize = size * size * size * 4;\n NSMutableData* cubeData = [[NSMutableData alloc] initWithCapacity:(cubeDataSize * sizeof(float))];\n \n for (int z = 0; z &lt; size; z++) {\n CGFloat blue = ((double)z)/(size-1);\n for (int y = 0; y &lt; size; y++) {\n CGFloat green = ((double)y)/(size-1);\n for (int x = 0; x &lt; size; x++) {\n CGFloat red = ((double)x)/(size-1);\n \n CGFloat hue = [self hueFromRed:red green:green blue:blue];\n float alpha = (hue &gt;= minHue &amp;&amp; hue &lt;= maxHue) ? 0 : 1;\n float premultipliedRed = red * alpha;\n float premultipliedGreen = green * alpha;\n float premultipliedBlue = blue * alpha;\n [cubeData appendBytes:&amp;premultipliedRed length:sizeof(float)];\n [cubeData appendBytes:&amp;premultipliedGreen length:sizeof(float)];\n [cubeData appendBytes:&amp;premultipliedBlue length:sizeof(float)];\n [cubeData appendBytes:&amp;alpha length:sizeof(float)];\n }\n }\n }\n\n CIFilter&lt;CIColorCube&gt; *colorCubeFilter = CIFilter.colorCubeFilter;\n colorCubeFilter.cubeDimension = size;\n colorCubeFilter.cubeData = cubeData;\n return colorCubeFilter;\n}\n</code></pre>\n<p>In <code>ViewController</code>, I created a button to start the video player and apply the filter to <code>AVPlayerItem</code>. <code>[self chromaKeyFilterHuesFrom:0.3 to:0.4]</code> means filtering the green pixels:</p>\n<pre class="lang-objc prettyprint-override"><code>- (AVVideoComposition*) createVideoComposition:(AVPlayerItem *)_playerItem {\n CIFilter&lt;CIColorCube&gt;* chromaKeyFilter = [self chromaKeyFilterHuesFrom:0.3 to:0.4];\n AVMutableVideoComposition *composition = [AVMutableVideoComposition videoCompositionWithAsset: _playerItem.asset applyingCIFiltersWithHandler:^(AVAsynchronousCIImageFilteringRequest *_Nonnull request) {\n CIImage *image = request.sourceImage.imageByClampingToExtent;\n [chromaKeyFilter setValue:image forKey:kCIInputImageKey];\n CIImage *output = [chromaKeyFilter.outputImage imageByCroppingToRect:request.sourceImage.extent];\n [request finishWithImage:output context:nil];\n }];\n \n return composition;\n}\n\n- (IBAction)playVideo:(id)sender {\n NSString *path = [[NSBundle mainBundle] pathForResource:@&quot;my_video_has_green_pixels_zone&quot; ofType:@&quot;mp4&quot;];\n NSURL *url = [NSURL fileURLWithPath:path];\n AVPlayerItem* playerItem = [AVPlayerItem playerItemWithURL:url];\n playerItem.videoComposition = [self createVideoComposition:playerItem];\n \n AVPlayer *player = [AVPlayer playerWithPlayerItem:playerItem];\n player.actionAtItemEnd = AVPlayerActionAtItemEndNone;\n \n AVPlayerViewController *controller = [[AVPlayerViewController alloc] init];\n controller.player = player;\n controller.view.frame = self.view.bounds;\n controller.view.backgroundColor = UIColor.redColor;\n [[self view] addSubview:controller.view];\n [self presentViewController:controller animated:YES completion:nil];\n \n [player play];\n}\n</code></pre>\n<p>The filter works &quot;fine&quot;, except that the greens pixels become black instead of transparent. I can't figure out why or what makes those pixels become black.</p>\n<p><strong>UPDATE</strong></p>\n<p>I tried Frank's suggestion and changed from <code>AVPlayerViewController</code> to <code>AVPlayerLayer</code>, it's now working.</p>\n<pre><code>NSDictionary* pixelBufferAttributes = @{ (id)kCVPixelBufferPixelFormatTypeKey : @(kCVPixelFormatType_32BGRA) };\n\nAVPlayerLayer *layerPlayer = [AVPlayerLayer playerLayerWithPlayer:player];\n layerPlayer.videoGravity = AVLayerVideoGravityResizeAspect;\n layerPlayer.frame = self.view.frame;\n layerPlayer.pixelBufferAttributes = pixelBufferAttributes;\n [self.view.layer addSublayer:layerPlayer];\n</code></pre>\n<p>However, this is still not what I want since I have to use <code>AVPlayerViewController</code>.</p>\n"^^ . . "0"^^ . . . . . "0"^^ . "There is no practical way to convert a `.a` file built for one platform into a `.a` for another. The only practical approach is to rebuild the library from source. (For extremely small and simple libraries, and a reasonable expertise in ARM assembly and C, it can be done. I've done it once for a library that held a single function and less than 200 lines of code. But I wouldn't call it a "practical" solution. Even in that case, we finally were able to rebuild it from source.)"^^ . . . . . . "Yes, the issue still occurs with just a normal text view added to the view hierarchy, with setting the text container and layout manager. I'll edit the question to include this mode of re-recreating the issue."^^ . . . "0"^^ . . "0"^^ . "react-native"^^ . "0"^^ . . "May i know, what kind of information holding in nsdata"^^ . . . . . "" if I set it to 1, it renders at 1fps." it's exactly what it's supposed to do, it presents a drawable after waiting one second, which gives you 1 fps if you can encode all the command buffers in the frame in one second."^^ . . "<p>This looks like a WebKit/UIKit bug, the console is full of warnings related to the Input system, and other autolayout warnings, though the latter ones are unlikely to be the culprit.</p>\n<p>But you can work around it if you remove the webview after the keyboard is dismissed.</p>\n<p>Add these to <code>viewDidLoad</code>:</p>\n<pre><code>[NSNotificationCenter.defaultCenter addObserverForName:UIKeyboardWillShowNotification\n object:nil\n queue:nil\n usingBlock:^(NSNotification * _Nonnull notification) {\n self.keyboardIsVisible = YES;\n}];\n\n[NSNotificationCenter.defaultCenter addObserverForName:UIKeyboardDidHideNotification\n object:nil\n queue:nil\n usingBlock:^(NSNotification * _Nonnull notification) {\n self.keyboardIsVisible = NO;\n [self removeWebView];\n}];\n</code></pre>\n<p>, and update <code>removeWebView</code> to do its thing only if the <code>keyboardIsVisible</code> flag is off:</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (void)removeWebView {\n if (!self.keyboardIsVisible) {\n [webView stopLoading];\n webView.navigationDelegate = nil;\n webView.scrollView.delegate = nil;\n [webView removeFromSuperview];\n webView = nil;\n webViewIsActive = NO;\n }\n}\n</code></pre>\n<p>Also, one more thing, you'll need to <code>[self.view endEditing:YES]</code> instead of <code>[webView endEditing:YES]</code> for this to work:</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (void)handleDoubleTap:(UITapGestureRecognizer *)gestureRecognizer {\n if (webViewIsActive) {\n [self.view endEditing:YES];\n [self removeWebView];\n } else {\n [self addWebView];\n }\n}\n</code></pre>\n<p>You will also need to handle the situations where the user double taps a second time during the interval the keyboard is being dismissed (which takes around 600ms from what I noticed).</p>\n"^^ . . "XCFramework include additional public headers with xcodebuild"^^ . "0"^^ . . . . . . "1"^^ . "Does your app have permission to run launchctl? Second, I think you need the excact path for your .plist, add that from your bundle."^^ . "0"^^ . . . "<p>The Swift equivalent of Objective-C's <code>@selector()</code> expression, is <code>#selector()</code>. In Xcode, the Objective-C, <code>@selector()</code> expression will offer autocompletions for all available selectors and the selector expression is constructed with <em>just</em> the selector; e.g., <code>@selector(valueForKey:)</code>.</p>\n<p>In Swift, Xcode only sometimes offers autocompletions for a <code>#selector()</code> expression and we must explicitly qualify the selector with a type; e.g., <code>#selector(NSObject.value(forKey:))</code>.</p>\n<p>As far as I can tell, in an @objc context, Xcode will allow us to construct a <code>#selector()</code> expression without qualifying the selector with a type.</p>\n<p>For example:</p>\n<pre class="lang-swift prettyprint-override"><code>@objc @objcMembers class Individual: NSObject {\n func testFunc() {\n let sel = #selector(value(forKey:))\n }\n}\n</code></pre>\n<p>Is there any other context in which we can use an <code>#selector()</code> expression that isn't qualified by a type?</p>\n"^^ . . . "0"^^ . "0"^^ . "how to compile ios app using react native >= 0.73.5 , bugsnagreactnative >= 0.72.3?"^^ . . "0"^^ . . "But glfw is opensource so it should be pretty easy to figure out what it does."^^ . "1"^^ . . "ssl-certificate"^^ . . "<p>I am also experiencing the same issue on iOS version 17.4.1. Since it doesn't occur when not debugging, it seems to be a bug in Xcode.</p>\n<p>-- Part of FIRDLJavaScriptExecutor from FirebaseDynamicLinks --</p>\n<pre><code>NSString *htmlContent = [NSString stringWithFormat:@&quot;&lt;html&gt;&lt;head&gt;&lt;script&gt;%@&lt;/script&gt;&lt;/head&gt;&lt;/html&gt;&quot;, _script];\n\n_wkWebView = [[WKWebView alloc] init];\n_wkWebView.navigationDelegate = self;\n[_wkWebView loadHTMLString:htmlContent baseURL:nil];\n</code></pre>\n"^^ . . . . . . . "1"^^ . . "0"^^ . . "objective-c-swift-bridge"^^ . . "1"^^ . . . "0"^^ . . . "0"^^ . . . . "NSURLSessionDataTask Fail to upload audio file to server"^^ . . . "0"^^ . "0"^^ . . . "0"^^ . "1"^^ . . . "1"^^ . . "<p>I want to embed clients SSL certificate for iOS app using objective C for my React native project.\nI have tried lots of solutions but not getting any luck with it.</p>\n<p>So we have clients SSL certificate (.pem) which we need embed so that our API will work. I am getting 403 when calling our API I am sharing my code.</p>\n<pre><code>**MyURLSessionDelegate.mm**\n\n#import &quot;MyURLSessionDelegate.h&quot;\n#import &lt;Security/Security.h&gt;\n\n@implementation MyURLSessionDelegate\n\n+ (instancetype)sharedInstance {\n static MyURLSessionDelegate *sharedInstance = nil;\n static dispatch_once_t onceToken;\n dispatch_once(&amp;onceToken, ^{\n sharedInstance = [[MyURLSessionDelegate alloc] init];\n });\n return sharedInstance;\n}\n \n- (NSURLSession *)configuredSession {\n NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];\n NSLog(@&quot;MyURLSessionDelegate=====&gt;working=====&gt;line 16 : %@&quot;, sessionConfig);\n\n // Load the client certificate\n NSString *pathToCertificate = [[NSBundle mainBundle] pathForResource:@&quot;xyz&quot; ofType:@&quot;pem&quot;];\n NSLog(@&quot;pathToCertificate ====&gt; : %@&quot;, pathToCertificate);\n NSData *certificateData = [NSData dataWithContentsOfFile:pathToCertificate];\n NSLog(@&quot;MyURLSessionDelegate=====&gt;working=====&gt;line 21 : %@&quot;, certificateData);\n NSString *base64Certificate = [certificateData base64EncodedStringWithOptions:0];\n NSLog(@&quot;Base64 Encoded Certificate: %@&quot;, base64Certificate);\n \n\n\n if (!certificateData) {\n NSLog(@&quot;Client certificate not found&quot;);\n return nil;\n }\n \n // Create a custom SSL configuration with the client certificate\n NSDictionary *sslSettings = @{\n (NSString *)kCFStreamSSLCertificates: @[certificateData],\n (NSString *)kCFStreamSSLValidatesCertificateChain: @NO // Disable certificate chain validation if needed\n };\n \n sessionConfig.TLSMinimumSupportedProtocol = kTLSProtocol1;\n sessionConfig.TLSMaximumSupportedProtocol = kTLSProtocol12;\n sessionConfig.TLSMinimumSupportedProtocol = kTLSProtocol12;\n sessionConfig.TLSMaximumSupportedProtocol = kTLSProtocol13;\n \n sessionConfig.connectionProxyDictionary = sslSettings;\n \n // Create and return NSURLSession with custom configuration and delegate\n return [NSURLSession sessionWithConfiguration:sessionConfig delegate:self delegateQueue:nil];\n}\n\n#pragma mark - NSURLSessionDelegate Methods\n\n// Implement NSURLSessionDelegate methods as needed\n\n@end\n</code></pre>\n<pre><code>**AppDelegate.mm**\n\n#import &quot;AppDelegate.h&quot;\n\n#import &lt;Firebase.h&gt;\n\n#import &lt;React/RCTBundleURLProvider.h&gt;\n\n#import &lt;UserNotifications/UserNotifications.h&gt;\n\n#import &lt;RNCPushNotificationIOS.h&gt;\n\n#import &lt;TrustKit/TrustKit.h&gt;\n\n#import &quot;MyURLSessionDelegate.h&quot;\n\n#import &quot;SSLPinning.h&quot;\n\n#import &quot;ClientSecurity.h&quot;\n\n\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n\n{ \n\n [FIRApp configure];\n\n self.moduleName = @&quot;xyz_app&quot;;\n self.initialProps = @{};\n\n UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];\n\n center.delegate = self;\n\nNSURLSession *session = [[MyURLSessionDelegate sharedInstance] configuredSession];\n\nNSLog(@&quot;session configuration: %@&quot;, session.configuration);\n\n\n// Create the URL\n\nNSURL *url = [NSURL URLWithString:@&quot;https://test.example.com];\n\n\n\n// Create the request\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];\n\nrequest.HTTPMethod = @&quot;POST&quot;;\n\n\n\n// Set the parameters\n\nNSDictionary *parameters = @{@&quot;username&quot;: @“example”, @&quot;password&quot;: @“Example@123};\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\n// Set the request body\n\n[request setHTTPBody:postData];\n\n\n\n// Set the content type\n\n[request setValue:@&quot;application/json&quot; forHTTPHeaderField:@&quot;Content-Type&quot;];\n\n\n\n// Create a data task with the session\n\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n\n // Check for errors\n\n if (error) {\n\n NSLog(@&quot;SS Error: %@&quot;, error);\n\n return;\n\n }\n\n // Log the raw response data\n\n NSLog(@&quot;SS Raw Response Data: %@&quot;, [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);\n\n\n // Parse the response data (assuming it's JSON for example)\n\n NSError *jsonError = nil;\n\n NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&amp;jsonError];\n\n // Check for JSON parsing errors\n\n if (jsonError) {\n\n NSLog(@&quot;SS JSON Error: %@&quot;, jsonError);\n\n return;\n\n }\n\n // Now you can work with the JSON response\n\n NSLog(@&quot;SS Response: %@&quot;, json);\n\n}];\n\n\n\n// Resume the task to start the request\n\n[dataTask resume]; \n\n return [super application:application didFinishLaunchingWithOptions:launchOptions];\n\n}\n\n- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge\n\n{\n\n#if DEBUG\n\n return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@&quot;index&quot;];\n\n#else\n\n return [[NSBundle mainBundle] URLForResource:@&quot;main&quot; withExtension:@&quot;jsbundle&quot;];\n\n#endif\n\n}\n\n// Required for the register event.\n\n- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken\n\n{\n\n [RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];\n\n}\n\n// Required for the notification event. You must call the completion handler after handling the remote notification.\n\n- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo\n\nfetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler\n\n{\n\n [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];\n\n}\n\n// Required for the registrationError event.\n\n- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error\n\n{\n\n [RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error];\n\n}\n\n// Required for localNotification event\n\n- (void)userNotificationCenter:(UNUserNotificationCenter *)center\n\ndidReceiveNotificationResponse:(UNNotificationResponse *)response\n\n withCompletionHandler:(void (^)(void))completionHandler\n{\n [RNCPushNotificationIOS didReceiveNotificationResponse:response];\n}\n\n//Called when a notification is delivered to a foreground app.\n\n-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {\n completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);\n}\n\n@end\n</code></pre>\n<p>I am getting following error</p>\n<p>`session configuration:</p>\n<p>&lt;NSURLSessionConfiguration: 0x15df19980&gt;</p>\n<p>**\nMy info.plist file**</p>\n<pre><code>`&lt;key&gt;NSAppTransportSecurity&lt;/key&gt;\n&lt;dict&gt;\n &lt;key&gt;NSExceptionDomains&lt;/key&gt;\n &lt;dict&gt;\n &lt;key&gt;example.com&lt;/key&gt; &lt;!-- Replace with your domain --&gt;\n &lt;dict&gt;\n &lt;key&gt;NSTemporaryExceptionAllowsInsecureHTTPLoads&lt;/key&gt;\n &lt;true/&gt;\n &lt;key&gt;NSIncludesSubdomains&lt;/key&gt;\n &lt;true/&gt;\n &lt;key&gt;NSTemporaryExceptionMinimumTLSVersion&lt;/key&gt;\n &lt;string&gt;TLSv1.2&lt;/string&gt;\n &lt;key&gt;NSTemporaryExceptionRequiresForwardSecrecy&lt;/key&gt;\n &lt;false/&gt;\n &lt;key&gt;NSExceptionRequiresForwardSecrecy&lt;/key&gt;\n &lt;false/&gt;\n &lt;key&gt;NSRequiresCertificateTransparency&lt;/key&gt;\n &lt;false/&gt;\n &lt;key&gt;NSAllowsArbitraryLoads&lt;/key&gt;\n &lt;false/&gt;\n &lt;key&gt;NSAllowsLocalNetworking&lt;/key&gt;\n &lt;false/&gt;\n &lt;/dict&gt;\n &lt;/dict&gt;\n&lt;/dict&gt;\n`\n</code></pre>\n<p>Let me know whats going wrong here.</p>\n<p>I have tried above code but getting 403.</p>\n"^^ . . . . . "uicollectionview"^^ . . . "2"^^ . . "0"^^ . . . "cgpoint"^^ . . "objective-c++"^^ . . . "0"^^ . . "0"^^ . . . "0"^^ . . . "go"^^ . . "wkwebview"^^ . . . . . "0"^^ . . . "1"^^ . . . . "0"^^ . . . . . "0"^^ . "calayer"^^ . "0"^^ . "1"^^ . "Unlikely, your best bet is to check the server logs. When I encountered similar issues in the past, it was usually a simple mistake like forgotten `#available` directive or a more subtle difference, e.g. iPhone vs iPad."^^ . "0"^^ . . "<p>Dear <strong>Pranjali Wagh</strong></p>\n<p>First of all I recommends you to not use <code>CERTIFICATE</code> directly instead of it use <code>PUBLICK KEY</code> which don't have expiration issue.</p>\n<p>Now follow me step by step to integrate <strong>SSL Pinning</strong></p>\n<ol>\n<li><p>Use trustkit for SSL Pinning in IOS, inside podfile add:</p>\n<p><code>pod 'TrustKit', '1.6.5'</code></p>\n</li>\n<li><p>Inside <code>ios/AlmanaDoctorsApp/AppDelegate.m</code> add:</p>\n</li>\n</ol>\n<pre><code>#import &lt;TrustKit/TrustKit.h&gt; // Import TrustKit\n#import &lt;TrustKit/TSKPinningValidator.h&gt; // Import TSKPinningValidator\n#import &lt;TrustKit/TSKPinningValidatorCallback.h&gt; // Import TSKPinningValidatorCallback\n\n// in the end of Dynamic *t = [Dynamic new] before return\n\n// TrustKit configuration\n void (^loggerBlock)(NSString *) = ^void(NSString *message)\n {\n NSLog(@&quot;TrustKit log: %@&quot;, message);\n };\n [TrustKit setLoggerBlock:loggerBlock];\n\n NSDictionary *trustKitConfig =\n @{\n kTSKSwizzleNetworkDelegates: @YES,\n kTSKPinnedDomains: @{\n @&quot;pa-api.almanahospital.com.sa&quot; : @{\n kTSKIncludeSubdomains: @YES,\n kTSKEnforcePinning: @YES,\n kTSKDisableDefaultReportUri: @YES,\n kTSKPublicKeyHashes : @[\n @&quot;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=&quot;,\n @&quot;BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB=&quot;\n ],\n },\n },\n };\n [TrustKit initSharedInstanceWithConfiguration:trustKitConfig];\n [TrustKit sharedInstance].pinningValidatorCallback = ^(TSKPinningValidatorResult *result, NSString *notedHostname, TKSDomainPinningPolicy *policy) {\n if (result.finalTrustDecision == TSKTrustEvaluationFailedNoMatchingPin) {\n NSLog(@&quot;TrustKit certificate matching failed&quot;);\n // Handle certificate matching failure\n }\n };\n\n</code></pre>\n<ol start="3">\n<li>Replace <code>@&quot;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=&quot;</code> with actual <code>PUBLICK KEY</code> of your certificate. AND <code>BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB=</code> with your backup <code>PUBLICK KEY</code></li>\n</ol>\n<p>NOTE: if you don't have BACKUP Public key, its ok just add your publick key with <code>@&quot;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=&quot;</code> it will work fine.</p>\n<ol start="4">\n<li>Now install all dependencies <code>cd ios/</code> and <code> pod update</code></li>\n</ol>\n<p>Hope it will work as you as expected.</p>\n"^^ . . . "What if you declare `GetInputSizeFromUsage` in the `.h` file with C linkage (using `extern "C"`)?"^^ . . . "0"^^ . "<p>I'm following Apple's tutorial to build an FXPlug plugin manually: <a href="https://developer.apple.com/documentation/professional_video_applications/fxplug/building_an_fxplug_plug-in_manually?language=objc" rel="nofollow noreferrer">Building an FXPlug Plug-In Manually</a>. I've followed every step detailed in the tutorial, but I'm having trouble finding the <code>#import &lt;FxPlug/FxPlugSDK.h&gt;</code> header in Xcode.</p>\n<p>I've double-checked that I've followed all instructions correctly, including installing the necessary SDK files, but Xcode still can't find this header. I've reviewed my header search paths and inclusion paths configuration, but it doesn't seem to resolve the issue.</p>\n<p>Has anyone had a similar experience or have any idea why Xcode can't find this header even after following the tutorial step-by-step?</p>\n<p><a href="https://i.sstatic.net/4KVdb.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4KVdb.jpg" alt="Has anyone done that tutorial or is there a much simpler tutorial? , here is a photo of how I have my project so far." /></a></p>\n<p>Any help would be greatly appreciated. Thanks in advance.</p>\n"^^ . "0"^^ . . . "0"^^ . "2"^^ . . "Have you tried the Accessibility API?"^^ . . "<p>I have the following set-up of <code>CAShapeLayers</code> and <code>UIViews</code> attached to a <code>UIView</code>:</p>\n<pre><code>[self.layer addSublayer:self.shapeLayer1];\n\nif (someCase)\n{\n [self.layer addSublayer:self.shapeLayerOptional];\n}\n\n[self.layer addSublayer:self.shapeLayer2];\n[self addSubview: self.view1];\n</code></pre>\n<p>I want there to be functionality that allows the user to insert another <code>UIView</code>, let's call it <code>view0</code>, before shapeLayer2, but I don't know how to accomplish this. The parent <code>UIView</code> <code>subviews</code> property only includes <code>view1</code>, while its <code>layer.sublayers</code> property includes the layers of the shapelayers and subview1, but I don't want to insert <code>subview0.layer</code> into <code>layers.sublayers</code> because <code>subview0</code> has a <code>UITouchGestureRecognizer</code>. This seems like a simple design problem on the surface but it's really confusing me for some reason. Anyone have any recommended solutions? I want to try and avoid wrapping the <code>CAShapeLayers</code> into <code>UIViews</code> if I can.</p>\n"^^ . "1"^^ . . . . . . "macos"^^ . . . . . "Try dsdump by delek selander https://github.com/DerekSelander/dsdump"^^ . . . "0"^^ . . . . "0"^^ . . . "<p>Updated an app that used <code>UIWebView</code> to use <code>WKWebView</code> instead. However, the keyboard can be made to stay up and remain unresponsive following these steps:</p>\n<ul>\n<li>A <code>WKWebView</code> is opened to a URL that has input field(s) and attached to the superview.</li>\n<li>Input field is activated and the keyboard is displayed.</li>\n<li>Text can be entered with the keyboard as expected.</li>\n<li>An action is performed that removes the WKWebView from the superview while the keyboard is displayed. The keyboard is removed as expected along with the WKWebView.</li>\n<li>Open a new WKWebView to a URL that has input field(s) and attached to the superview.</li>\n<li>Activate an input field and a keyboard is displayed.</li>\n<li>An action is performed that removes the WKWebView from the superview while the keyboard is displayed.</li>\n</ul>\n<p>At this point, the keyboard will not go away, nor can it be made to go away.</p>\n<p>Clearly the desired behavior is for the keyboard to go away every time the webview is made to go away.</p>\n<p>I wrote a simple little test app and I can reproduce the issue outside the complexity of the app.</p>\n<p>So what is the acceptable method to dispose of a WKWebView? This is a code fragment of what does <strong>not</strong> work for me, leaving the keyboard lifeless on the second invocation as if it has been detached and forgotten.</p>\n<pre><code> [webView stopLoading];\n webView.navigationDelegate = nil;\n webView.scrollView.delegate = nil;\n [webView removeFromSuperview];\n webView = nil;\n</code></pre>\n<p>Here is a bit more of a working example. I tried to keep it simple and used a double tap to add/remove, but a button or timer works as well to trigger the adding/removing of the webview. I don't think it makes any difference. The issue appears to be disposing of a WKWebView while the keyboard is open and active.</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (void)viewDidLoad {\n [super viewDidLoad];\n\n webView = nil;\n webViewIsActive = FALSE;\n\n tap2Recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];\n tap2Recognizer.numberOfTouchesRequired = 1;\n tap2Recognizer.numberOfTapsRequired = 2;\n tap2Recognizer.delegate = self;\n [self.view addGestureRecognizer:tap2Recognizer];\n}\n\n- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer\n{\n return YES;\n}\n\n- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer\n{\n return YES;\n}\n\n- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch\n{\n return YES;\n}\n\n\n- (void)handleDoubleTap:(UITapGestureRecognizer *)gestureRecognizer\n{\n if (webViewIsActive) {\n if (keyboardIsVisible) [webView endEditing:true];\n else [self removeWebView];\n } else [self addWebView];\n}\n\n\n- (void)addWebView {\n webView = [[WKWebView alloc] initWithFrame:self.view.frame];\n webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;\n webView.allowsBackForwardNavigationGestures = false;\n webView.navigationDelegate = self;\n\n // Do any additional setup after loading the view.\n NSURL *url = [NSURL URLWithString:@&quot;https://google.com&quot;];\n NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];\n [webView loadRequest:requestObj];\n\n [self.view addSubview:webView];\n\n webViewIsActive = TRUE;\n}\n\n- (void)removeWebView {\n if (webView)\n {\n [webView stopLoading];\n webView.navigationDelegate = nil;\n webView.scrollView.delegate = nil;\n [webView removeFromSuperview];\n webView = nil;\n }\n\n webViewIsActive = FALSE;\n}\n</code></pre>\n<p>Edit: I've explored various bits of tracking the keyboard visibility to no avail for me. I've even gone so far as returning !self.keyboardIsVisible in the gesture delegates but it doesn't seem to make a difference. First time appears to work, second time gives me a keyboard that won't go away.</p>\n<p>One strange observation: if I bring up the keyboard, dismiss the keyboard, double tap out to close the webview, then double tap back in and bring up the keyboard, the keyboard is doa. So something gets initialized for the keyboard when it is first revealed and the double tap gesture nukes the keyboard after that.</p>\n"^^ . . "<h1>abc.h</h1>\n<pre><code>/**\n @function GetInputSizeFromUsage\n @abstract return frame width and height from usage\n @param usage PPVEUsage to be inqure\n @param width (out) the input width for usage\n @param height (out) the input height for usage\n */\nvoid GetInputSizeFromUsage(PPVEUsage usage, size_t *width, size_t *height);\n</code></pre>\n<h1>file1.m</h1>\n<pre><code>#import &lt;abc.h&gt;\nvoid GetInputSizeFromUsage(PPVEUsage usage, size_t *width, size_t *height)\n{\n switch(usage) {\n case UsageLandscape848x480:\n *width = 848;\n *height = 480;\n break;\n\n default:\n *width = 0;\n *height = 0;\n break;\n }\n\n}\n\n// This file uses this above function in various other functions and is fine to compile\n</code></pre>\n<h1>file2.mm</h1>\n<pre><code>#import &lt;abc.h&gt;\n\nsize_t GetInputSizeFromUsage(PPVEUsage usage)\n{\n size_t width, height;\n GetInputSizeFromUsage(usage, &amp;width, &amp;height);\n return (width * height);\n}\n</code></pre>\n<p>Error:\nUndefined symbol: GetInputSizeFromUsage(PPVEUsage, unsigned long*, unsigned long*)</p>\n<p>The error is due to file2.mm not being able to see the symbol. If I comment it out in file2.mm it compiles fine.</p>\n<p>Expecting it to be able to see the symbols</p>\n"^^ . . "Look at the documentation for `CIFilter` and the `apply:` methods. They are both clearly marked as only being available on macOS. Since you are building for iOS you can't use macOS-only methods."^^ . . "Hi @Aqeel Ahmad thank you so much for your response. Actually we used to use PUBLIC key in past with the same TrustKIt but now our client want us to use certificate directly, fo you know the way for it. I appreciate your help."^^ . "0"^^ . . "I was elated for a moment. You dispose of the webview when the keyboard is hidden, which makes it hard to actually actually use. If I remove that automatic removal, it all goes bad again. I'll update the question with some random observations, but I may just be sunk. I appreciate your time none the less!"^^ . . . "2"^^ . . "Thanks again for your response, but that too does not achieve what I am looking for, the frame rate remains the exact same (60)."^^ . . . . . . . . . . . . "thanks Scott will review this on Monday and feed back"^^ . . . . . . "@Paulw11 – Yep, good catch. The stack trace shows `NSObject`. But the exception message says the name of the actual type for which this failed. E.g., [here](https://i.sstatic.net/R5Q1f.png) I called a `Baz` method on a `Bar` object, where the stack trace reports the error on `NSObject`, but the exception message makes it clear what type of object the failure occurred. E.g., in my example, the `bazMethodNotInBar` was defined in `Baz`, but I forced a call to it from an instance of `Bar` (via an imprudent cast). So, Ecuador, can you show us the actual exception message?"^^ . "The actual text value is replaced. Interesting that others are unable to reproduce the issue (and zero customer feedback reporting the issue). I'm on M3 MacBook Pro running 14.4, I'll see if other devices are exhibiting the bug."^^ . "1"^^ . . "textkit"^^ . . "frame-rate"^^ . . . . "0"^^ . . "0"^^ . "0"^^ . . . "I will continue to search for alternatives and add them to this thread."^^ . . . "macros"^^ . . . . "ios-simulator"^^ . "0"^^ . . . . . "Inserting subview into view where I've added subviews and sublayers"^^ . . "0"^^ . . "<p>I am encrypting a json string and then converting it into NSData and trying to pass it as http body as per standard but it gives me sever error as 400 bad request whereas it works perfectly as expected in postman.\nBut failing I guess at iOS end , can someone highlight what could be wrong?</p>\n<p>Check below code for reference :</p>\n<pre><code>NSData *datas = [NSJSONSerialization dataWithJSONObject:paramsDic options:NSJSONWritingPrettyPrinted error:nil];\nNSString *jsonStrings = [[NSString alloc] initWithData:datas encoding:NSUTF8StringEncoding];\nNSString *jencWithPubKey = [EncryptionAlgorithm encryptString:jsonStrings publicKey:APP_PUBLIC_KEY2];\nNSData *data1 = [jencWithPubKey dataUsingEncoding:NSUTF8StringEncoding];\n\nNSLog(@&quot;Value of json string %@&quot;, jencWithPubKey);\n\nNSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:QMMemberLogin]];\nNSDictionary *heads =@{@&quot;User-Agent&quot;:@&quot;Apifox/1.0.0(https://apifox.com)&quot;,\n @&quot;Content-Type&quot;:@&quot;appliction/json; charset=UTF-8&quot;,\n @&quot;Accept&quot;:@&quot;*/*&quot;,\n @&quot;Conection&quot;:@&quot;keep-alive&quot;};\n[urlRequest setAllHTTPHeaderFields:heads];\n\n//Apply the data to the body\n[urlRequest setHTTPBody:data1];\n\n//create the Method &quot;GET&quot; or &quot;POST&quot;\n[urlRequest setHTTPMethod:@&quot;POST&quot;];\n\n\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;\n if(httpResponse.statusCode == 200)\n {\n NSError *parseError = nil;\n NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&amp;parseError];\n NSLog(@&quot;The response is - %@&quot;,responseDictionary);\n NSInteger success = [[responseDictionary objectForKey:@&quot;success&quot;] integerValue];\n if(success == 1)\n {\n NSLog(@&quot;Login SUCCESS&quot;);\n }\n else\n {\n NSLog(@&quot;Login FAILURE&quot;);\n }\n }\n else\n {\n NSLog(@&quot;Error&quot;);\n }\n}];\n[dataTask resume];\n</code></pre>\n<p>Above code I have tried in objective C</p>\n"^^ . . . . "Thank you @NewbieiOS for your reply but I got the solution - it was by public key which I was using for encryption was wrong . Once I changed it , the app works smoothly ,"^^ . . "1"^^ . . . "0"^^ . . . . . . . . "<p>In iOS application,</p>\n<p>Playing audio stream from BLE, using <code>TPCircularBuffer</code> and <code>Audio Unit.</code></p>\n<p>Sound plays well, but when buffer is empty and there are no bytes to play, it is causing crackling sound for instances.</p>\n<p>Here is my audio stream configuration,</p>\n<pre><code> AudioStreamBasicDescription audioFormat;\n audioFormat.mSampleRate = 8000.00;\n audioFormat.mFormatID = kAudioFormatLinearPCM;\n audioFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked | kAudioFormatFlagIsPacked;\n // || kAudioFormatFlagsNativeFloatPacked || kAudioFormatFlagIsSignedInteger\n //kAudioFormatFlagIsSignedInteger\n audioFormat.mFramesPerPacket = 1;\n audioFormat.mChannelsPerFrame = 1;\n audioFormat.mBitsPerChannel = 32;// Update when required\n audioFormat.mBytesPerPacket = 4; // Update when required\n audioFormat.mBytesPerFrame = 4; // Update when required\n \n</code></pre>\n<p><strong>Below is a Playback function of Audio Unit</strong></p>\n<pre><code>static OSStatus playbackCallback(void *inRefCon, \n AudioUnitRenderActionFlags *ioActionFlags, \n const AudioTimeStamp *inTimeStamp, \n UInt32 inBusNumber, \n UInt32 inNumberFrames, \n AudioBufferList *ioData) {\n\n//1\nfor (int i=0; i &lt; ioData-&gt;mNumberBuffers; i++) { \n\n IosAudioController *THIS = (__bridge IosAudioController *)inRefCon;\n\n int bytesAskingByPlayback = ioData-&gt;mBuffers[i].mDataByteSize;\n\n SInt16 *targetBuffer = (SInt16*)ioData-&gt;mBuffers[i].mData;\n\n // Pull audio from playthrough buffer\n int32_t availableBytesFromBuffer;\n\n SInt16 *sBuffer = TPCircularBufferTail(iosAudio.addressOfTPBuffer, &amp;availableBytesFromBuffer);\n \n int willRemainBytes = availableBytesFromBuffer - bytesAskingByPlayback;\n\n if (willRemainBytes &gt; 0) {\n memcpy(targetBuffer, sBuffer, bytesAskingByPlayback);\n TPCircularBufferConsume(iosAudio.addressOfTPBuffer,bytesAskingByPlayback);\n } else {\n\n\n //Note: Mostly need to update code here\n\n memcpy(targetBuffer, sBuffer, availableBytesFromBuffer);\n\n TPCircularBufferConsume(iosAudio.addressOfTPBuffer, availableBytesFromBuffer);\n\n }\n}\n return noErr;\n}\n</code></pre>\n<p>Buffer size is 16384</p>\n<p>Some solution said that i would fill the target buffer with 0s to silence but it is not working.</p>\n<p>Some Solution says that i could fill the target buffer with previous values to fill the gap.</p>\n"^^ . . . "0"^^ . "0"^^ . . . "@HangarRash It's https weather API endpoints. Nothing strange. The user can select weather API and I can see most failures are from the default one, but I get some from the ones users can switch to as well, so it's not URL specific."^^ . "1"^^ . . "0"^^ . . . "1"^^ . "0"^^ . . "<p>So this is a rather obscure issue but here goes.\nI have access to only 1 kind of Mac at work (I teach programming at a high school) and that's an old EMac 1.25Ghz. I've got it running Tiger. I also have a 1Ghz EMac at home also running Tiger, both have Xcode 2.5 installed.</p>\n<p>My app works fine for the most part but I find I am having issues writing to NSString variables from IBActions. I can read the strings fine and read and write to ints or bools, but NSStrings throw a BAD_EXEC_ACCESS error whenever I try to write to them if they are variables that exist outside the IBAction method. The code works fine on my Mac Pro at home, compiled for macOS 14, but not in Tiger, or Leopard. I've tried recompiling the app in Xcode 3.1 but get the same issues. I'm looking for a vet or 2 who can tell me how to correctly set up NSStrings to be accessed from the IBAction.</p>\n<p>Here's my code:</p>\n<pre class="lang-objc prettyprint-override"><code>#import &quot;GameWindow.h&quot;\n\n@implementation GameWindow\n\n// game variables\nint gameStage;\nint playerType;\nint startUpSetting;\nbool languageSelect;\nint playerPortrait;\nbool firstTimeGettingInput;\n\n//strings are char characters\n\nNSString *playerName;\nNSString *inputText;\nNSString *onGoingDisplayText;\n\n\n-(void)awakeFromNib{ //init the view here, set text, ect\n\n \n //define variable values\n \n gameStage = 0; //where we are in the game\n playerType = 0; //who we're playing as\n startUpSetting = 1; //this becomes 0 once start up perameters have been set\n languageSelect = 0; //0 is English, 1 is Japanese\n playerPortrait = 4; //what the players portrait looks like.\n firstTimeGettingInput = true; //has the game just started?\n \n //strings are char characters\n \n playerName = @&quot;Jyoubu&quot;; //player's name\n inputText = @&quot;&quot;; //the command or text the player has just typed\n onGoingDisplayText = @&quot;&quot;; //what the player has typed so far\n}\n\n-(IBAction) textSubmitted: (id) sender\n{ //run the code for when text has been submitted via the input area by pressing enter.\n\n \n\n //sort out strings\n\n\n\n NSString *introNameString;\n \n NSString *onGoingDisplayText2 = [mainTextView stringValue];//make a temp string of the current string value to stop crashes\n \n inputText = [inputTextView stringValue]; //save the input text\n \n inputText = [inputText lowercaseString];\n \n //const char *tempChar = (char *)[inputText UTF8String]; //convert the input text to all lower case\n NSLog(@&quot;player name: %@&quot;, playerName);\n \n if(languageSelect == 0){\n introNameString = [NSString stringWithFormat: @&quot;Greetings %@ %@&quot;, playerName, introStringEng];\n }\n}\n</code></pre>\n"^^ . "0"^^ . "Yes, fortunately I wont need more than 1 window for this app but I'll keep that in mind. Basically this app is sort of a glorified text adventure with a few GUI elements in the window."^^ . "<p>My project is using GoogleMap (8.3.0) version. It is working all good.\nBut suddenly it is crashing with the error :</p>\n<p><code> *** -[__NSDictionaryM setObject:forKeyedSubscript:]: key cannot be nil -[GMSStyleTableService checkStyleTableMemoryCacheForKey:callbackQueue:handler:]</code></p>\n<p>Here is what i tried to make sure mapview is not nil :</p>\n<pre class="lang-objectivec prettyprint-override"><code>if(self.mapView==nil) return;\n\nself.mapView.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);\n\nGMSPath *path = [GMSPath pathFromEncodedPath:pathString];\n\nGMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithPath:path];\n\nGMSPolyline *polyline = [GMSPolyline polylineWithPath:path];\npolyline.strokeWidth = 3;\npolyline.strokeColor = color.blue;\npolyline.map = self.mapView;\n\nGMSCameraPosition *camera = [self.mapView cameraForBounds:bounds insets:UIEdgeInsetsMake(32, 32, 32, 32)];\nself.mapView.camera = camera;\n\nGMSMarker *myMarker = [[GMSMarker alloc] init];\nmyMarker.position = self.myCoords;\nmyMarker.icon = [UIImage imageNamed:@&quot;dot.png&quot;];\nmyMarker.map = self.mapView;\n</code></pre>\n"^^ . . . "I mean, it works as expected. The layer is probably set up with vsync by default"^^ . . "Why is my Swift function not printing from inside the dataTask closure?"^^ . . . . . . "0"^^ . . . "0"^^ . "0"^^ . . "0"^^ . . "0"^^ . "0"^^ . . . . "CIFilter on AVPlayerItem: Chroma key filter make pixels become black instead of transparent"^^ . . . . "1"^^ . "macOS command line application. `e` is an instance of `EndpointInterface` class."^^ . . . . . . . . . "2"^^ . . "exponent"^^ . . "0"^^ . . "<p>Disabling <strong>Malloc Scribble</strong> in the scheme seems like a temporary fix for this until it gets resolved with a new version of Xcode.</p>\n<p><a href="https://i.sstatic.net/8A23SETK.png" rel="nofollow noreferrer">Screenshot</a></p>\n"^^ . . . . "cocoa"^^ . "0"^^ . "1"^^ . . . "1"^^ . . . . . . . . . . . "You have `self.webView` which means that the class that the code is in must have a property named `webView`. The error indicates that you do not."^^ . "0"^^ . . . . . . . "ObjC categories not recognised from a different target"^^ . "1"^^ . . "0"^^ . "1"^^ . . "<blockquote>\n<p>but when buffer is empty and there are no bytes to play.</p>\n</blockquote>\n<p>You need to start here and determine why this is happening. Ideally this should never happen. If it does happen, it should be rare and for a clear reason. If the upstream has paused, then you need to pause your downstream. If there is network latency, then you need to increase the size of your buffer.</p>\n<p>Anytime you inject a constant value, whether zero or the last value received, you're going to inject high frequency noise. This will sound like a small pop. If you do this often, then it will crackle. There are techniques for smoothing this, but they're fairly complex, and not something you should reach for before fixing your underlying under-run problem.</p>\n<p>If your upstream has variable latency, then you will need to buffer a bit (10ms, 50ms, 2000ms, it depends on how variable it is) before you start your downstream. If your buffers are drained, you'll need to pause your downstream until you can build your buffer up again.</p>\n<p>Sometimes, it's worth the occasional &quot;pop&quot; to avoid pausing the downstream, and that's when advice like &quot;fill with zeros&quot; or &quot;fill with last value&quot; come in. But if you're getting pops many times a second (and that's what &quot;crackle&quot; usually is), it likely means you're not buffering enough before starting your downstream.</p>\n<p>Depending on the nature of your audio, you also need to consider cases where there is a long pause in your upstream, and then you suddenly get a lot of past data. You have to decide at that point whether to keep it and increase latency, or discard it to get closer to &quot;real-time.&quot; The strategies for this completely depend on your use case and is a major part of designing any real-time system.</p>\n<p>Note that TPCircularBuffer and Audio Unit are pretty low-level tools, and put a lot of the work on you. Personally, I prefer building these kinds of systems with a bit higher-level tool like <a href="https://developer.apple.com/documentation/avfoundation/sample_buffer_playback#" rel="nofollow noreferrer">AVSampleBuffer</a>. It's still challenging and you need to understanding real-time systems, but AVFoundation will do a lot more of the work for you. (I personally often have to worry about things like pause, rewind, skip, and the like, so my problem may be enough different than yours that this advice isn't applicable.)</p>\n"^^ . . "0"^^ . . . "0"^^ . "audio"^^ . . . . "xcodebuild"^^ . . . "0"^^ . . . "<p>According to the documentation:</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (nullable CIImage *)apply:(CIKernel *)k\n arguments:(nullable NSArray *)args\n options:(nullable NSDictionary&lt;NSString *,id&gt; *)dict NS_AVAILABLE_MAC(10_4);\n\n- (nullable CIImage *)apply:(CIKernel *)k, ... NS_REQUIRES_NIL_TERMINATION NS_AVAILABLE_MAC(10_4) NS_SWIFT_UNAVAILABLE(&quot;&quot;);\n</code></pre>\n<p>There are two <code>apply</code> methods, however both of them was marked with <code>NS_AVAILABLE_MAC</code>. So it will not available on iOS, you need to find another way. Maybe <code>UIGraphicsBeginImageContextWithOptions</code> then re-draw image with alpha will fit this.</p>\n"^^ . "ios"^^ . "swift-package-manager"^^ . . . . . "<p>You can hack a solution together using calls to AppleScript per below; be forewarned that this does require your application to be <a href="https://support.apple.com/guide/mac-help/allow-accessibility-apps-to-access-your-mac-mh43185/mac" rel="nofollow noreferrer">whitelisted as an accessibility application in System Preferences</a> before this will work.</p>\n<p>Assuming the Dock is centered (see note 1 below), you would need to take the <code>int</code> value returned by this method and subtract it from <a href="https://stackoverflow.com/questions/4982656/programmatically-get-screen-size-in-mac-os-x">the full width of the screen itself</a>; the result of that calculation, then halved, should correspond to the amount of space on either side of the Dock on screen.</p>\n<pre><code>- (int) getDockWidth {\n // Define AppleScript source code to execute\n NSString *appleScriptSource = @&quot;&quot;\n &quot;tell application \\&quot;System Events\\&quot; to tell application process \\&quot;Dock\\&quot; to set dockSize to the size of list 1\\r&quot;\n &quot;return dockSize&quot;;\n \n // Create landing zone for the error dictionary that NSAppleScript can dump error information to\n NSDictionary *errorDict = NULL;\n NSAppleScript *appleScript = [[NSAppleScript alloc] initWithSource:appleScriptSource];\n NSAppleEventDescriptor *eventDescriptor = [appleScript executeAndReturnError:&amp;errorDict];\n if (errorDict != NULL) {\n [NSException exceptionWithName:@&quot;Error executing AppleScript&quot; reason:nil userInfo:errorDict];\n }\n return [[eventDescriptor descriptorAtIndex:1] int32Value];\n}\n</code></pre>\n<p>A couple of notes:</p>\n<ol>\n<li>This approach does not consider when the Dock has been pinned in a specific position on the screen differing from the centered default.</li>\n<li>In its current form, this method also does not currently support a scenario where a user has moved the Dock to reside anywhere else other than the bottom of the screen (i.e., left or right) although it would be trivial to detect with the addition of a few more lines of code.</li>\n<li>There is likely a better, more native way to do this through the Accessibility API &amp; without involving AppleScript. I'm just not personally aware of how that would look in practice.</li>\n</ol>\n"^^ . . . . "selector"^^ . . "Thanks for you reply, I tried `afterMinimumDuration` but when I set it to `0` or something really small like `0.000001`, then it keeps rendering at 60fps, however, if I set it to 1, it renders at 1fps.\nI am not sure if it is Glfw's doing, on windows with Vulkan I get ridiculous frame rates with the exact same code (apart from Vulkan >< Metal). If on Mac, I comment out the metal api calls (drawing, buffers, etc.) the frame rate is nearly 1000fps."^^ . "1"^^ . "qlpreviewcontroller"^^ . . . . . . . "class-dump -H throw Unknown load command: 0x00000032"^^ . "0"^^ . . "I didn't say you can't use UICollectionView. I said you can't statically get the cells by way of an IBOutlet. And you did not ask whether there is another way to lay out the buttons in the way you describe. I answered the question you actually asked."^^ . . "On macOS, you can disable vsync by setting `displaySyncEnabled` on `CAMetalLayer`. On other platforms, you can't tear the screen."^^ . . . . . . "3"^^ . . "This is a very open question. Am I guessing right that you are trying to get mTLS (Mutual Transport Layer Security) to work? That means you have the private key also on your client? (I guess you won't develop your application for the appstore?)"^^ . . . "0"^^ . . . . . . . . . . . . . . . . . . "@WarrenBurton I'm using the recent Cpp interoperability, which doesn't require a bridging header, but a module map to expose C++ and ObjC types to Swift. And the new interior is implemented correctly, because I'm able to access the URLHandler in Swift. The error is not `Undefined symbol URLHandler`, but a missing method, which I implemented in the category. Sorry, I missed to add the interop thing in the question."^^ . . . . "I was able to get things going by removing all the frameworks and using cocoapods to install firebase instead."^^ . . . . . . . "0"^^ . . "0"^^ . . . . . "<p>Why one isn't working in your situation requires more details to answer definitively.</p>\n<blockquote>\n<p>What is the difference between <code>char buffer[10];</code> and <code>char *buffer = malloc(10);</code>? I thought it was the same thing.</p>\n</blockquote>\n<p>This question is more answerable.</p>\n<p>In the former case, ten bytes are automatically allocated on the stack if located within a function. Attempting to return a pointer to that memory <code>outside</code> of the function will result in undefined behavior as that memory may be reused by another function call on the stack and therefore is no longer valid outside the function call.</p>\n<p>In the latter case using <code>malloc</code>, the memory is <em>dynamically</em> allocated. A pointer to it can be returned from a function and used in another function. However, the memory is not automatically reclaimed and must be deliberately freed with <code>free</code>.</p>\n<p>Depending on how you're using this memory, this may very well explain why using <code>malloc</code> works and <code>char buffer[10];</code> doesn't. I strongly suggest compiling with warnings on.</p>\n<h2>Stack space</h2>\n<p>With your edited code, where <code>bufferSize</code> is <code>200000000</code> we can now see that in <code>readFile2</code> and <code>readFile4</code> you're trying to put two hundred million bytes on the stack. This is a situation where you really would need dynamic allocation.</p>\n<p>Even with dynamic memory allocation, you're trying to allocate <em>two hundred million bytes</em> in one block. That's a lot of memory. You may want to rethink your approach to see if you can work in smaller chunks.</p>\n"^^ . . . "0"^^ . . . . . "ok nvm I am dumb. Objective-c inherits its functions from C, so when im defining a function in objective-c, im actually creating a C function. So in this case, I am trying to hook a C function"^^ . . "@JWWalker I cant tell. How do i find out?"^^ . . . "0"^^ . . "avfoundation"^^ . . "0"^^ . . . "0"^^ . . . . "OK so if you must use `LogDebug` etc. then you will need to create those functions yourself, which mimic what the macros do. Otherwise use `LogObjcWrapper` directly."^^ . . . . "Do you want to change the attributes before or after the window is torn off? How is the popover created?"^^ . . . . "You haven't told us anything about *when and how* you are trying to execute this code. Is your `ProgressBarView` already visible? Are you trying to do this too early? Either inside your custom view's init or inside the controller's `viewDidLoad`?"^^ . . "0"^^ . . "0"^^ . . "Need some clarifications about dispatch_queue_create and RunLoop. Sharing RunLoop between them"^^ . . . . "grand-central-dispatch"^^ . . . "<p>I have created UITabbar for my app and as per the requirements all the information will come from the API. Once I received the response I have downloaded the image and set to UITabbar Item.\nI have used the following code to download the image.</p>\n<pre><code>for (int i=0; i&lt;[tabbarItemImageArray count]; i++) {\n\n NSURLSession *session = [NSURLSession sharedSession];\n [[session dataTaskWithURL:[tabbarItemImageArray objectAtIndex:i]\n completionHandler:^(NSData *data,\n NSURLResponse *response,\n NSError *error) {\n \n UIImage *imagemain=[UIImage imageWithData:data];\n \n dispatch_async(dispatch_get_main_queue(), ^(){\n \n if (i &lt; 5) {\n \n if (imagemain != nil) {\n\n\n UIImage *resizedImage = [[WSUtils sharedObject] resizeImageForTabbarItem:imagemain scaledToSize:CGSizeMake(25,25)];\n\n self.tabBarController.tabBar.items[i].image = [resizedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];\n self.tabBarController.tabBar.items[i].selectedImage = resizedImage;\n }\n \n self.tabBarController.tabBar.items[i].title = [tabbarItemNameArray objectAtIndex:i];\n self.tabBarController.tabBar.unselectedItemTintColor = [UIColor colorWithRed:35/255.0 green:63/255.0 blue:136/255.0 alpha:1.0];\n }\n \n });\n\n }] resume];\n</code></pre>\n<p>tabbarItemImageArray is Array of NSURL object which contains the image url. I have created UITabbarController programmatically. These are the properties I have used.</p>\n<pre><code>self.tabBarController = [[UITabBarController alloc] init];\nself.tabBarController.delegate = self;\nself.tabBarController.view.backgroundColor = [UIColor whiteColor];\nself.tabBarController.viewControllers = tabbarArray;\nself.tabBarController.tabBar.backgroundColor = [UIColor whiteColor];\nself.tabBarController.tabBar.layer.shadowColor = [UIColor blackColor].CGColor;\nself.tabBarController.tabBar.layer.shadowOffset = CGSizeMake(0.0, 0.0);\nself.tabBarController.tabBar.layer.shadowRadius = 5;\nself.tabBarController.tabBar.layer.shadowOpacity = 0.3;\nself.tabBarController.tabBar.layer.masksToBounds = NO;\nself.tabBarController.tabBar.layer.cornerRadius = 30;\nself.tabBarController.tabBar.backgroundImage = [[UIImage alloc] init];\nself.tabBarController.tabBar.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;\nself.tabBarController.selectedIndex = 0;\n</code></pre>\n<p>This will give following result. See Highlight UITabbar in Red color.\n<a href="https://i.sstatic.net/aXcnb.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/aXcnb.jpg" alt="enter image description here" /></a></p>\n<p>If I download an image and add it to the image assets in Xcode and Run the app it shows clean image. See below image.</p>\n<p><a href="https://i.sstatic.net/EbhAq.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EbhAq.jpg" alt="enter image description here" /></a></p>\n<p>I have spent full day on this and nothing has found. Any help will appreaciated even if it is in a swift.</p>\n<p>Updated:\nI have tried 25x25, 50x50 and 75x75 image. I have uploaded one by one all 3 size of image and tried but it is not working. I am attaching example icon of 50x50 image. which I have used for above screen shots.\n<a href="https://i.sstatic.net/zVBYx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zVBYx.png" alt="enter image description here" /></a></p>\n<p>I have resized 50x50 image to 25x25 for tabbar items, as 50x50 is too big to fit in Tabbar. Following method I have used to do resize.</p>\n<pre><code>-(UIImage*) resizeImageForTabbarItem:(UIImage*)image scaledToSize:(CGSize)newSize {\n\nfloat width = newSize.width;\n float height = newSize.height;\n\n UIGraphicsBeginImageContext(newSize);\n CGRect rect = CGRectMake(0, 0, width, height);\n\n float widthRatio = image.size.width / width;\n float heightRatio = image.size.height / height;\n float divisor = widthRatio &gt; heightRatio ? widthRatio : heightRatio;\n\n width = image.size.width / divisor;\n height = image.size.height / divisor;\n\n rect.size.width = width;\n rect.size.height = height;\n\n //indent in case of width or height difference\n float offset = (width - height) / 2;\n if (offset &gt; 0) {\n rect.origin.y = offset;\n }\n else {\n rect.origin.x = -offset;\n }\n\n [image drawInRect: rect];\n\n UIImage *smallImage = UIGraphicsGetImageFromCurrentImageContext();\n UIGraphicsEndImageContext();\n\n return smallImage;\n</code></pre>\n<p>}</p>\n"^^ . . . . "1"^^ . . "Please provide enough code so others can better understand or reproduce the problem."^^ . . . "0"^^ . . "Excuse the delay - i now checked in the Activity Monitor - and the application reports being NOT sand boxed. I can start the application from a terminal with parameters successfully. Any ideas?"^^ . . . "0"^^ . "<p>I'm trying to add a custom font to my app but it doesn't appear when the app is running:</p>\n<ol>\n<li>Added the files to the project</li>\n</ol>\n<p><a href="https://i.sstatic.net/qnF8L.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qnF8L.png" alt="enter image description here" /></a></p>\n<ol start="2">\n<li>Checked the font is within the Target Membership</li>\n</ol>\n<p><a href="https://i.sstatic.net/wBM23.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wBM23.png" alt="enter image description here" /></a></p>\n<ol start="3">\n<li>Added the fonts to the app plist under the &quot;Fonts provided by application&quot;:</li>\n</ol>\n<p><a href="https://i.sstatic.net/CXkt4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/CXkt4.png" alt="enter image description here" /></a></p>\n<ol start="4">\n<li>Checked the fonts are within the Target/ Build Phases/ Copy Bundle Resources:</li>\n</ol>\n<p><a href="https://i.sstatic.net/SQTqT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/SQTqT.png" alt="enter image description here" /></a></p>\n<ol start="5">\n<li>Installed the fonts in the Font Book</li>\n</ol>\n<p>After that, when I run the app:</p>\n<pre><code>for (NSString* family in [UIFont familyNames])\n{\n NSLog(@&quot;FONT FAMILY: %@&quot;, family);\n \n for (NSString* name in [UIFont fontNamesForFamilyName: family])\n {\n NSLog(@&quot;FONT: %@&quot;, name);\n }\n}\n</code></pre>\n<p>All fonts except the JetBrains ones are available. What am I missing?</p>\n"^^ . "0"^^ . . "1"^^ . "1"^^ . . . "3"^^ . . . . . . . "How to access Objective-C @property with name instead of self.name?"^^ . . . . . "xcode"^^ . . . "In C you can have variable length arrays on the stack, where the length is determined by a variable. Keep in mind, though, that stack space is limited, so ensure that variable is relatively small."^^ . "0"^^ . . . "Double-check everything... I just downloaded the JetBrains fonts, added them to my project - https://i.sstatic.net/VStT4.png - defined them in "Fonts provided by application" - https://i.sstatic.net/r1bzc.png - and no problems - https://i.sstatic.net/vbe6v.png ---- As a side note - no need to install the fonts in Font Book."^^ . . . "0"^^ . . . . . . . . . "0"^^ . "There are two applications here, the one being launched and the one doing the launching. Which one are you saying is not sandboxed?"^^ . . . "thanks for the information, it's probably indeed be the size that's causing problems on the stack. I don't think free exists in Objective-C for SDK versions for Mac OS older than 10.13 High Sierra. I can't find any information on how to use free in Objective-C for an SDK older than that. There has to be another way to free the memory, if I run my application in instruments I see a lot of memory kept by malloc that doesn't appear to be freed after the function finishes and only goes away when the application restarts. ARC doesn't see the malloc stuff and I can't use standard C functions."^^ . . . . "1"^^ . . . . "uikeyboard"^^ . "<p>I'm attempting to seize focus on a USB card reader such that only my program interacts with the card read events. With the code below, it is registering when the card reader is connected or removed correctly, but it does not log card read events. I know they are happening though, because the machine makes a noise for each character read.</p>\n<p>I got most of this code from <a href="https://stackoverflow.com/questions/8676135/osx-hid-filter-for-secondary-keyboard">here</a></p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n#import &lt;IOKit/hid/IOHIDManager.h&gt;\n#import &lt;IOKit/hid/IOHIDUsageTables.h&gt;\n#include &lt;IOKit/hid/IOHIDValue.h&gt;\n\n#define KEYS 4\n\nconst char* keyboard_map(int scancode)\n{\n //char * letter;\n switch (scancode) {\n case 0x04: return &quot;a&quot;;\n case 0x05: return &quot;b&quot;;\n case 0x06: return &quot;c&quot;;\n case 0x07: return &quot;d&quot;;\n case 0x08: return &quot;e&quot;;\n case 0x09: return &quot;f&quot;;\n case 0x0A: return &quot;g&quot;;\n case 0x0B: return &quot;h&quot;;\n case 0x0C: return &quot;i&quot;;\n case 0x0D: return &quot;j&quot;;\n case 0x0E: return &quot;k&quot;;\n case 0x0F: return &quot;l&quot;;\n case 0x10: return &quot;m&quot;;\n case 0x11: return &quot;n&quot;;\n case 0x12: return &quot;o&quot;;\n case 0x13: return &quot;p&quot;;\n case 0x14: return &quot;q&quot;;\n case 0x15: return &quot;r&quot;;\n case 0x16: return &quot;s&quot;;\n case 0x17: return &quot;t&quot;;\n case 0x18: return &quot;u&quot;;\n case 0x19: return &quot;v&quot;;\n case 0x1A: return &quot;w&quot;;\n case 0x1B: return &quot;x&quot;;\n case 0x1C: return &quot;y&quot;;\n case 0x1D: return &quot;z&quot;;\n case 0x1E: return &quot;1&quot;;\n case 0x1F: return &quot;2&quot;;\n case 0x20: return &quot;3&quot;;\n case 0x21: return &quot;4&quot;;\n case 0x22: return &quot;5&quot;;\n case 0x23: return &quot;6&quot;;\n case 0x24: return &quot;7&quot;;\n case 0x25: return &quot;8&quot;;\n case 0x26: return &quot;9&quot;;\n case 0x27: return &quot;0&quot;;\n case 0x28: return &quot;Return (Enter)&quot;;\n \n default:\n return &quot;&quot;;\n }\n return &quot;&quot;;\n}\n\nvoid Handle_InputCallback(void* inContext, IOReturn inResult, void* inSender, IOHIDValueRef value)\n{\n IOHIDElementRef elem = IOHIDValueGetElement(value);\n\n uint16_t scancode = IOHIDElementGetUsage(elem);\n \n if (scancode &lt; 4 || scancode &gt; 231)\n return;\n \n printf(&quot;%s\\n&quot;, keyboard_map(scancode));\n NSLog(@&quot;Key event received&quot;);\n}\n\n\n\nstatic void Handle_DeviceMatchingCallback(void * inContext, IOReturn inResult, void * inSender, IOHIDDeviceRef inIOHIDDeviceRef)\n{\n NSLog(@&quot;Connected&quot;);\n}\n\nstatic void Handle_RemovalCallback(void * inContext, IOReturn inResult, void * inSender, IOHIDDeviceRef inIOHIDDeviceRef)\n{\n NSLog(@&quot;Removed&quot;);\n}\n\n\nint main(int argc, const char * argv[])\n{\n @autoreleasepool {\n IOHIDManagerRef manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDManagerOptionNone);\n \n if (CFGetTypeID(manager) != IOHIDManagerGetTypeID()) {\n exit(1);\n }\n \n int vendorId = 0x0C27;\n //vendorId = 0x1234;\n int productId = 0x3BFA;\n //productId = 0x5678;\n int usagePage = kHIDPage_GenericDesktop;\n int usage = kHIDUsage_GD_Keyboard;\n \n CFStringRef keys[KEYS] = {\n CFSTR(kIOHIDVendorIDKey),\n CFSTR(kIOHIDProductIDKey),\n CFSTR(kIOHIDDeviceUsagePageKey),\n CFSTR(kIOHIDDeviceUsageKey),\n };\n \n CFNumberRef values[KEYS] = {\n CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &amp;vendorId),\n CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &amp;productId),\n CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &amp;usagePage),\n CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &amp;usage),\n };\n \n CFDictionaryRef matchingDict = CFDictionaryCreate(kCFAllocatorDefault,\n (const void **) keys, (const void **) values, KEYS,\n &amp;kCFTypeDictionaryKeyCallBacks, &amp;kCFTypeDictionaryValueCallBacks);\n\n for (int i=0; i&lt;KEYS; i++) {\n CFRelease(keys[i]);\n CFRelease(values[i]);\n }\n \n IOHIDManagerSetDeviceMatching(manager, matchingDict);\n CFRelease(matchingDict);\n \n IOHIDManagerRegisterDeviceMatchingCallback(manager, Handle_DeviceMatchingCallback, NULL);\n IOHIDManagerRegisterDeviceRemovalCallback(manager, Handle_RemovalCallback, NULL);\n IOHIDManagerRegisterInputValueCallback(manager, Handle_InputCallback, NULL);\n \n IOHIDManagerScheduleWithRunLoop(manager, CFRunLoopGetMain(), kCFRunLoopDefaultMode);\n \n IOHIDManagerOpen(manager, kIOHIDOptionsTypeSeizeDevice);\n\n CFRunLoopRun();\n //[[NSRunLoop mainRunLoop] run];\n }\n return 0;\n}\n\n</code></pre>\n<p>Ideally I would like to store all characters read before a return (0x028) in a string, but first and formost I'd like to actually be able to interact with the characters being read.</p>\n<p>Edit: When replacing <code>IOHIDManagerOpen( manager, kIOHIDOptionsTypeSeizeDevice );</code> with <code>IOHIDManagerOpen( manager, kIOHIDOptionsTypeNone ); </code> it starts logging the input, but does not seize the device.</p>\n<p>No matter which option is used, it does not seize the device and prevent it from receiving data on a different window, if that window has focus.</p>\n<p>When the SeizeDevice option is used, it returns this message: IOConnectCallMethod(kIOHIDLibUserClientOpen):e00002c1</p>\n"^^ . "I tried your code and I don't see any memory issues. Do you have any diagnostic tools enabled like zombies? What "activity monitor" do you mean, where is the pie chart? What is your macOS version and hardware?"^^ . . . . . . . . . . "I recompiled the code and now free suddenly works like it should, I looked in Instruments and it makes a clear difference, the memory immediately drops to almost 0 when I free everything up as soon as it's not necessary anymore. I don't know why Xcode describes it as being a thing for IOAudioPort since it works for everything. Apple's documentation says 10.13 and higher but it works fine for me and I wouldn't know why some C functions aren't available in Objective-C. I'm finally starting to understand the stack and heap a bit more. Thanks a lot for the help!"^^ . "swift"^^ . . . . . . . . "0"^^ . "<p>I am trying to hook a function called addition. The implementation looks something like this:</p>\n<pre><code>NSNumber *addition(NSNumber *num1, NSNumber *num2) {\n double result = [num1 doubleValue] + [num2 doubleValue];\n return @(result);\n}\n</code></pre>\n<p>Reading the theos documentation <a href="https://theos.dev/docs/logos-syntax" rel="nofollow noreferrer">here</a>, I have written a theos tweak as follows:</p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\nNSInteger addition(NSInteger num1, NSInteger num2);\n\n%hookf(NSInteger, addition, NSInteger num1, NSInteger num2) {\n return 99;\n}\n</code></pre>\n<p>However, it results in this error:</p>\n<pre><code>==&gt; Linking tweak objchooker (armv7)…\nld: warning: -multiply_defined is obsolete\nUndefined symbols for architecture armv7:\n &quot;_addition&quot;, referenced from:\n __logosLocalInit in Tweak.x.f54e192c.o\nld: symbol(s) not found for architecture armv7\nclang: error: linker command failed with exit code 1 (use -v to see invocation)\nmake[3]: *** [/Users/hnin.sin/Desktop/objchooker/.theos/obj/debug/armv7/objchooker.dylib] Error 1\nmake[2]: *** [/Users/hnin.sin/Desktop/objchooker/.theos/obj/debug/armv7/objchooker.dylib] Error 2\nmake[1]: *** [internal-library-all_] Error 2\nmake: *** [objchooker.all.tweak.variables] Error 2\n</code></pre>\n<p>%hook and %hookf both works on my swift test app but only %hook works on this objective-c app. Am I doing something wrongly for %hookf or does %hookf not work in objective-c apps?</p>\n"^^ . "Always use `FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)` don't hard code urls"^^ . . "Cannot reproduce. Please show a [mcve]."^^ . . . . "@Paulw11 thank you. is it possible to do this indirectly? to read the whole hostname-to-ip table for the local network, then reverse and use it?\n\nAnd I am already reading mDNS advertisements, but they still don't give hostnames for most devices on LAN"^^ . . . "<p><code>performBlockAndWait</code> is an easy source of deadlocks. Many deadlocks are timing-sensitive, so if you add breakpoints, you can completely change the timing and create or avoid deadlocks that may happen in other cases. Even so, the race conditions exist and must be addressed. Your stack trace will show you exactly how this is happening, so start there.</p>\n<p>It is critical that anything in a <code>performBlockAndWait</code> be very simple and not itself rely on any other blocking operations that might re-enter. If your <code>peformBlockAndWait</code> calls any non-trivial method, you need to explore whether that method could also block. Ideally, you should entirely avoid <code>performBlockAndWait</code> and use the simpler <code>perform</code> instead.</p>\n"^^ . "0"^^ . . . . . . "0"^^ . . . . "0"^^ . "UIAppFonts is the correct key. Xcode can show you English descriptions for known keys when you edit the file (in this case "Fonts provided by application"), but the raw key actually in the file should be UIAppFonts. If you typed in the English description as the raw key, then it won't work. If there was an accidental space or something in the key, it won't work either."^^ . . . . "0"^^ . "0"^^ . "2"^^ . "0"^^ . . . "0"^^ . "0"^^ . "0"^^ . "core-data"^^ . "Thanks, Rob. I will use it for the timer."^^ . "When you access `foo` you are accessing the ivar directly. When you use `[self foo]` or `self.foo` you access the property via the getter. This is why it is a bad idea to use `foo` instead of `self.foo` in Objective-C unless you specifically need to bypass the getter. TLDR: change `foo` to `self.foo` in your objective c code."^^ . . "<p>One approach is to mask a <code>CAGradientLayer</code> with a <code>CAShapeLayer</code>. The shape layer should have an arc as its <code>path</code>, and a <code>lineCap</code> of <code>.round</code>.</p>\n<pre><code>class FadingProgressView: UIView {\n let shapeLayer = CAShapeLayer()\n let gradientLayer = CAGradientLayer()\n \n override init(frame: CGRect) {\n super.init(frame: frame)\n backgroundColor = .clear\n layer.addSublayer(gradientLayer)\n gradientLayer.mask = shapeLayer\n gradientLayer.colors = [UIColor.blue.cgColor, UIColor.white.cgColor, UIColor.white.cgColor]\n gradientLayer.type = .conic\n gradientLayer.startPoint = CGPoint(x: 0.5, y: 0.5)\n gradientLayer.endPoint = CGPoint(x: 0.4, y: 0)\n gradientLayer.locations = [0, 0.75, 1]\n gradientLayer.backgroundColor = UIColor.clear.cgColor\n \n shapeLayer.fillColor = nil\n shapeLayer.strokeColor = CGColor(gray: 0, alpha: 1)\n shapeLayer.lineWidth = 5\n shapeLayer.lineCap = .round\n \n let animation = CABasicAnimation(keyPath: &quot;transform.rotation&quot;)\n animation.fromValue = CGFloat.pi * 2\n animation.toValue = 0\n animation.duration = 1\n animation.repeatCount = .greatestFiniteMagnitude\n layer.add(animation, forKey: &quot;transform.rotation&quot;)\n }\n \n override func layoutSubviews() {\n super.layoutSubviews()\n gradientLayer.frame = bounds\n shapeLayer.frame = bounds\n let path = UIBezierPath(\n arcCenter: .init(x: bounds.midX, y: bounds.midY),\n radius: bounds.width / 2 - 20,\n startAngle: 1.55 * .pi, endAngle: .pi, clockwise: true)\n shapeLayer.path = path.cgPath\n }\n \n required init?(coder: NSCoder) {\n fatalError(&quot;init(coder:) has not been implemented&quot;)\n }\n}\n</code></pre>\n<p>Usage:</p>\n<pre><code>class MyViewController: UIViewController {\n override func viewDidLoad() {\n let progress = FadingProgressView(frame: CGRect(x: 200, y: 200, width: 100, height: 100))\n view.addSubview(progress)\n }\n}\n</code></pre>\n"^^ . . . . "0"^^ . . "@Willeke I created a sample code and tested it. This is all the code necessary to fill up the inactive RAM in just a couple seconds. If you set activity monitor to refresh fast you can see the allocated memory grow to 200MB and immediately free that 200MB after having loaded it. The inactive memory grows at the same rate but is never freed."^^ . . . . "0"^^ . . "0"^^ . . . . . . "1"^^ . . "0"^^ . . "0"^^ . "Thanks for the reply; I am reviewing where I have preformBlockAndWait."^^ . . . . "4"^^ . . . . . "<p>The problem is not Swift vs Objective-C. Try the two from within a same app and you will receive the folder.</p>\n<p>The problem is app vs widget, each of which has a unique, separate sandbox. You can use an “app group” if you want the app and widget access a shared container.</p>\n<ul>\n<li><p>See <a href="https://developer.apple.com/documentation/xcode/configuring-app-groups/" rel="nofollow noreferrer">Configuring App Groups</a> for information about adding the app group capability in Xcode.</p>\n</li>\n<li><p>You access this container with <a href="https://developer.apple.com/documentation/foundation/nsfilemanager/1412643-containerurlforsecurityapplicati/" rel="nofollow noreferrer"><code>containerURLForSecurityApplicationGroupIdentifier:</code></a> from Objective-C:</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSURL *baseUrl = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:@&quot;group.com.domain.foo&quot;];\n</code></pre>\n</li>\n<li><p>And from Swift, use <a href="https://developer.apple.com/documentation/foundation/filemanager/1412643-containerurl" rel="nofollow noreferrer"><code>containerURL(forSecurityApplicationGroupIdentifier:)</code></a>:</p>\n<pre class="lang-swift prettyprint-override"><code>guard let baseUrl = FileManager.default\n .containerURL(forSecurityApplicationGroupIdentifier: &quot;group.com.domain.foo&quot;)\nelse {\n fatalError(&quot;app group container not found&quot;)\n}\n</code></pre>\n</li>\n</ul>\n"^^ . "@Willeke Thanks for letting me know, I did indeed mix that up while simplifying the code. I updated the provided code, now it's more like the original code but I still removed parts because there is a lot of it that isn't related to the problem. If you can't replicate the issue and want the full original code I can provide you it all."^^ . "0"^^ . . . . . "runloop"^^ . "You can only `free` that which has been allocated using `malloc`, `realloc`, or `calloc`."^^ . . . . . . . . . . "0"^^ . "That's why Apple recommend to use properties in Objective-C and doesn't allow use ivars in Swift"^^ . . . "0"^^ . . . "@trojanfoe Thank you for your comments. The format string is merely to add a line feed so that the entries don't run together; each is on a separate line. I will edit the answer to add an NSMutableArray so that it will trap multiple entries. I couldn't tell from the initial post how many strings were involved."^^ . "0"^^ . "<p><strong>TL;DR</strong> What was the correct way to access an Objective-C <code>@property (...) foo</code> as <code>foo</code> instead of <code>self.foo</code>?</p>\n<p>Details:</p>\n<p>One of my iOS projects still uses some Objective-C code I have written several years ago.</p>\n<pre><code>// SomeObject.h\n@interface SomeObject : NSObject\n@property (nonatomic, readonly) NSString *foo;\n@end\n\n// SomeObject.m\n@implementation SomeObject { ... }\n@synthesize foo;\n\n- (void)someMethod {\n foo = @&quot;bar&quot;;\n}\n\n- (void)otherMethod {\n NSLog(@&quot;Foo: %@&quot;, foo); // ---&gt; &quot;bar&quot;\n}\n@end\n</code></pre>\n<p>This works fine as intended. Now I would like to use a getter to access some new Swift code instead of setting <code>foo</code> manually:</p>\n<pre><code>// SomeObject.m\n@implementation SomeObject { ... }\n@synthesize foo;\n\n- (NSString *)foo {\n return [SwiftObject getFoo];\n}\n\n- (void)otherMethod {\n NSLog(@&quot;Foo: %@&quot;, foo); // ---&gt; nil\n NSLog(@&quot;Foo: %@&quot;, self.foo); // ---&gt; &quot;swiftBar&quot;\n}\n@end\n</code></pre>\n<p>So, using the getter only works correct when using <code>self.foo</code> instead of just <code>foo</code>. This is not a big problem but it would require to replaces all usage of <code>foo</code> with <code>self.foo</code> in the existing code.</p>\n<p>Is there a clean way to avoid this, use the <code>foo</code> getter and still use <code>foo</code> instead of <code>self.foo</code>?</p>\n"^^ . "0"^^ . "Is it possible to change behavior and attributes of the window of an NSPopover?"^^ . . . . . . . "0"^^ . . "0"^^ . . . . . . . . . "@Rob Thank you for your consideration. I have added an image in question which I have downloaded from API url. I have used same image in assets folder. I have added 50x50 image in 1x, 2x and 3x for testing purpose and run the app. It gives clear icon as you can see attached above screen shot no 2. As you mentioned I have used 50x50 and 75x75 and resize them to smaller size like 25x25 but result is same."^^ . "1"^^ . . . . . . . "https://stackoverflow.com/a/42168798/341994"^^ . . . . . "2"^^ . . . "0"^^ . "<p>Objective-C doesn't really care if the object that gets set as delegate actually conforms to the protocol. If it doesn't, there will be a run-time crash, but as long as your class implements the protocol methods correctly, you can assign it as a delegate.</p>\n<p>What is most likely happening with your code is that the private class' delegate is declared <code>weak</code> and since nothing else is retaining it, it is immediately deallocated.</p>\n<p>If you keep a strong reference to <code>MyDelegate</code>, then assign that to the private class, it will likely work.</p>\n"^^ . . "1"^^ . . . "1"^^ . . . "0"^^ . "I've seen that code used in answers up to 2020 or so. So, do you know of any other way of redirecting NSLog to a file I designate on the phone?"^^ . . . . "0"^^ . "0"^^ . . . . "Post code as text"^^ . . . "<p>I believe, in this case, you need to redirect <code>stdout</code> to get NSLogs into a file. It's working for me (with Swift, with <code>.log</code> file, along with <code>stderr</code>)...</p>\n<p>You could try n check it like this:</p>\n<pre><code>freopen([logPath fileSystemRepresentation],&quot;a+&quot;,stderr);\nfreopen([logPath fileSystemRepresentation],&quot;a+&quot;,stdout);\n</code></pre>\n<p>For more details: <a href="https://stackoverflow.com/a/41680336/5546312">https://stackoverflow.com/a/41680336/5546312</a></p>\n"^^ . . "automatic-ref-counting"^^ . . . "<p>Not all devices support multi-camera sessions (even though the <code>AVCaptureMultiCamSession</code> can still be instantiated).</p>\n<p>You can determine at runtime whether or not they're supported via the <a href="https://developer.apple.com/documentation/avfoundation/avcapturemulticamsession/3183002-multicamsupported?language=objc" rel="nofollow noreferrer"><code>multiCamSupported</code></a> class property:</p>\n<pre class="lang-objectivec prettyprint-override"><code>if ( !AVCaptureMultiCamSession.multiCamSupported ) {\n // can't add multiple inputs\n}\n</code></pre>\n"^^ . . . "Circular progress bar in iOS with alpha long progress"^^ . . . . . "Usually you would know whether it is sandboxed because you set that option when you built the app. But it is also possible to show a column in the Activity Monitor utility to see which running apps are sandboxed."^^ . . . . . . . "0"^^ . "<p>I tried to write a IOS app to understand how <code>customVideoCompositorClass</code> works.\nHowever after my code, I got a black video with correct sound. <code>sourcePixelBuffer</code> is always nil. Where did I miss?</p>\n<p>My video source: MPEG-4 AAC、H.264</p>\n<p>My code:</p>\n<pre><code>#import &lt;AVFoundation/AVFoundation.h&gt;\n#import &quot;AAPLViewController.h&quot;\n\n@implementation CustomVideoCompositor\n\n- (nullable id&lt;AVVideoCompositionInstruction&gt;)requiredSourceTrackIDsForFrame:(CMTime)frameTime {\n return nil;\n}\n\n- (NSArray&lt;AVVideoCompositionInstruction *&gt; *)requiredPixelBufferAttributesForRenderContext {\n return nil;\n}\n\n- (void)startVideoCompositionRequest:(AVAsynchronousVideoCompositionRequest *)request {\n // Extract source pixel buffer\n NSArray *a = request.sourceTrackIDs;\n CVPixelBufferRef sourcePixelBuffer = [request sourceFrameByTrackID: (int)a[0]];\n\n [request finishWithComposedVideoFrame:sourcePixelBuffer];\n}\n\n- (NSDictionary *)sourcePixelBufferAttributes {\n return @{\n (id)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32BGRA)\n };\n}\n\n- (void)renderContextChanged:(AVVideoCompositionRenderContext *)newRenderContext {\n}\n\n@end\n</code></pre>\n<pre><code>- (void)viewDidLoad\n{\n [super viewDidLoad];\n\n NSURL *url = [[NSBundle mainBundle] URLForResource:@&quot;1&quot; withExtension:@&quot;mov&quot;];\n AVAsset *asset = [AVAsset assetWithURL:url];\n \n AVMutableVideoComposition *videoComposition = [AVMutableVideoComposition videoCompositionWithPropertiesOfAsset:asset];\n videoComposition.customVideoCompositorClass = [CustomVideoCompositor class];\n \n AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset];\n playerItem.videoComposition = videoComposition;\n\n AVPlayer *player = [AVPlayer playerWithPlayerItem:playerItem];\n AVPlayerViewController *controller = [[AVPlayerViewController alloc] init];\n self.playerViewController = controller;\n \n CGSize videoSize = [[[asset tracksWithMediaType:AVMediaTypeVideo] firstObject] naturalSize];\n\n [self addChildViewController:controller];\n [self.view addSubview:controller.view];\n\n controller.view.frame = CGRectMake(-70, 270, videoSize.width * SCALE, videoSize.height * SCALE);\n controller.view.transform = CGAffineTransformMakeRotation(M_PI_2);\n controller.player = player;\n controller.showsPlaybackControls = YES;\n [player pause];\n [player play];\n}\n</code></pre>\n<pre><code></code></pre>\n"^^ . . "<p>I have found the solution. Resize the image actually causing the issue. If you used following method it will resize the image with maintaining image quality.</p>\n<p><strong>Swift 5.0</strong></p>\n<pre><code>extension UIImage {\n\nfunc resize(targetSize: CGSize) -&gt; UIImage {\n return UIGraphicsImageRenderer(size:targetSize).image { _ in\n self.draw(in: CGRect(origin: .zero, size: targetSize))\n }\n}\n</code></pre>\n<p>}</p>\n<p><strong>Objective C:</strong></p>\n<pre><code>-(UIImage*) resizeImage:(UIImage*)image scaledToSize:(CGSize)newSize {\n\nUIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:newSize];\n\nUIImage *resizedImage = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull context) {\n \n CGPoint point = CGPointZero;\n CGRect aRect = { point, newSize };\n \n [image drawInRect:aRect];\n \n }];\n\nreturn resizedImage;\n</code></pre>\n<p>}</p>\n<p>I have found the answer from the following link. <a href="https://stackoverflow.com/a/49060676/2384760">https://stackoverflow.com/a/49060676/2384760</a></p>\n"^^ . . "Use `NSInputStream` instead of `NSData` for reading file. And buffer size should be equal to memory page size."^^ . "Custom Font (.ttf) added to project not available within app"^^ . . . . . . . . "1"^^ . . "0"^^ . . . . "0"^^ . . "1"^^ . . "Objective-C char array initialization causes EXC_BAD_ACCESS when accessing property"^^ . "They use `LogDebug` in Swift code? I don't see how."^^ . . . . . . . "The SDK is developed in Objective-C. I am using Swift in which I want the logs of SDK. I hope I make my self clear."^^ . . . . . . "<p>I'm working on a MacOS Cocoa app written solely in <code>Objective-C</code>.</p>\n<p>The app is a &quot;Status Item&quot; app, with tiny visual footprint as an icon on the menu-bar (<code>NSStatusItem</code>), which opens an <code>NSMenu</code>. One of the <code>NSMenuItem</code> objects in this <code>NSMenu</code> shows/hides a popover. This is the IBAction:</p>\n<pre><code>-(IBAction)showPreventionStatus:(id)sender {\n if (self.statusPopover.isShown) {\n // hide it\n [self.statusPopover performClose:self];\n [(NSMenuItem *)sender setTitle:@&quot;Show Prevention State&quot;];\n }\n else {\n [self.statusPopover showRelativeToRect:[self.statusItem.button bounds]\n ofView:self.statusItem.button\n preferredEdge:NSMaxYEdge];\n [(NSMenuItem *)sender setTitle:@&quot;Hide Prevention State&quot;];\n }\n}\n</code></pre>\n<p>Where</p>\n<pre><code>@property (strong) IBOutlet NSPopover *statusPopover;\n</code></pre>\n<p>is defined in my XIB and connected to this property of my AppDelegate.</p>\n<p>Almost all of the UI is defined in a single .XIB, including the <code>NSPopover</code>, its <code>NSPopoverController</code>, and the <code>NSView</code> hierarchy presented by this <code>NSPopover</code>. Most objects are connected to my AppDelegate.m which contains all the <code>IBActions</code> etc.</p>\n<p><a href="https://i.sstatic.net/65qKqYSB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/65qKqYSB.png" alt="enter image description here" /></a></p>\n<p>When open, the popover looks like this (removed some of the details):</p>\n<p><a href="https://i.sstatic.net/oJQSaWSA.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/oJQSaWSA.png" alt="Popover window, sans text" /></a></p>\n<p>This <code>NSPopover</code> (configured to be transient) can be torn off, and then it looks like a floating window/panel. The popover displays an NSView which is defined and attached to the popover in a normal .xib file (see screenshot above)</p>\n<p>I can obtain the <strong>underlying window</strong> object from the NSPopover like this:</p>\n<pre><code>NSWindow *statusWindow = [self.statusIconView window];\n</code></pre>\n<p>where <code>self.statusIconView</code> can be ANY <code>NSView</code> in the view hierarchy of the pop-over.</p>\n<p>The statusWindow looks like a normal NSWindow - but any attempt to change its attributes (I'm trying to make it resizable for instance) is ignored.</p>\n<p>I tried to inspect it in the debugger - and found out that its class is special:</p>\n<pre><code>NSPopoeverWindow : NSPanel : NSWindow\n</code></pre>\n<p><code>NSPopoeverWindow</code> seems to be a private Cocoa class, since I can't find it in the AppKit headers. However, it subclasses <code>NSPanel</code> which in turn is a subclass of <code>NSWindow</code>. I suspect this special class overrides and ignores much of the <code>NSWindow</code> functionality and behavior.</p>\n<p>I tried to manipulate this window object in many of the <code>NSPopover</code> delegate methods (before and after it is shown, before and after it is detached etc.) to no avail. It simply ignores everything I do to it.</p>\n<p>After applying change/modification to any of its properties/attributes, if I &quot;get&quot; its new state - I see the property/attribute unchanged. My calls were NOT applied.</p>\n<hr />\n<p>Is there a way to force it to &quot;behave&quot; the way I need?</p>\n<ol>\n<li>to be resizable.</li>\n<li>to become &quot;key&quot; and some of its elements/controls to become first-responders. E.g. currently an editable text field inside the view can't be edited, refuses keyboard commands (for copy/paste/select-all)</li>\n</ol>\n<p>I did NOT create this window, and I did not anywhere in my code determine its class. It's NSPopover (or maybe NSPopoverController) who do this.</p>\n"^^ . "0"^^ . . . "2"^^ . . . . "arrays"^^ . . . . . . "@JWWalker: Please answer this question, so i can accept it."^^ . . . "<p>According to the documentation of the <code>arguments</code> property of the <code>NSWorkspaceOpenConfiguration</code> class, a sandboxed app cannot pass arguments to another app that it is launching. So make sure that your helper application is not sandboxed.</p>\n"^^ . . . . . . . . "0"^^ . . . . . . "4"^^ . . . . "What was the wrong key? How did Xcode *not* use the right key?"^^ . . "nsurlsessiondownloadtask"^^ . . . . . . . . . . "It sounds like you're saying there is no way for my widget to know the file path to the directory created by my app, when the app calls the ObjC method mentioned in my OP, and that the solution is to either patch React Native Async Storage to write the file to a shared container or create a native module to accomplish the same. Is that right?"^^ . . "3"^^ . . . "What's inside/outside the auto-release pool loop? Post a [mre] please."^^ . . . . . "1"^^ . "0"^^ . . "<p>I am working on a project in which I have added an SDK using pod. There are some logs within the SDK code they have added using NSLog wrapper as:</p>\n<pre class="lang-objc prettyprint-override"><code>#define LogDebug(message, ...) { \\\n [LogObjcWrapper logDebug:[NSString stringWithFormat: message, ##__VA_ARGS__] file:@__FILE__ function:[NSString stringWithFormat:@&quot;%s&quot;, __FUNCTION__] line:__LINE__]; \\\n}\n</code></pre>\n<p>I want the logs, printed using above wrapper, in my project debug console in Xcode. I am not sure how to get that logs.</p>\n<p>Eg. that I want to get in the debug console is :</p>\n<blockquote>\n<p>LogDebug(@&quot;[FileModule.m] removeExtraFilesFromCount: %@. removeItemAtPath: %@\\n&quot;, @(count), &lt;fiel_path&gt;);</p>\n</blockquote>\n<p>Here the FileModule.m is a file from SDK in which the SDK developer have added the code as above to show the log. I want to retrieve that log, which currently I am not able to get.</p>\n<p>Expected Output:</p>\n<blockquote>\n<p>&quot;[FileModule.m] removeExtraFilesFromCount: 0. removeItemAtPath: /Users/apple/Library/Developer/Xcode/DerivedData/...&quot;</p>\n</blockquote>\n<p>SDK is Developed in Objective-C. I am using Xcode 15.2 on macOS 14.4.1. The wift version in my app is Swift 5.</p>\n"^^ . . . "0"^^ . "0"^^ . "1"^^ . "qt"^^ . . . . "0"^^ . . . "0"^^ . . . . . . "0"^^ . . . . . . "Sorry about that, @DonMag. Yes, `ProgressBarView` is already visible by the super view. This code is being called after initializing the views in `initWithFrame` of `ProgressBarView`. I've managed to fix the issue by calling `[self setNeedsLayout]` after calling `[self layoutIfNeeded]`."^^ . . . . "fonts"^^ . . . . "0"^^ . . . "0"^^ . . . . "0"^^ . . . . "<p>I'm developing iOS framework with Objective-C.</p>\n<p>I create a <code>dispatch_queue_t</code> by using <code>dispatch_queue_create</code>. And call <code>CFRunLoopRun()</code> for run the runloop in the queue.</p>\n<p>But, It looks like the dispatch_queue_t has share the RunLoop. Some classes has add an invalid timer, and when I call the <code>CFRunLoopRun()</code>, It crashed on my side.</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (void)viewDidLoad {\n [super viewDidLoad];\n \n self.queue1 = dispatch_queue_create(&quot;com.queue1&quot;, DISPATCH_QUEUE_CONCURRENT);\n self.queue2 = dispatch_queue_create(&quot;org.queue2&quot;, DISPATCH_QUEUE_CONCURRENT);\n}\n\n- (IBAction)btnButtonAction:(id)sender {\n \n dispatch_async(self.queue1, ^{\n \n NSString *runloop = [NSString stringWithFormat:@&quot;%@&quot;, CFRunLoopGetCurrent()];\n runloop = [runloop substringWithRange:NSMakeRange(0, 22)];\n NSLog(@&quot;Queue1 %p run: %@&quot;, self.queue1, runloop);\n \n //NSTimer *timer = [[NSTimer alloc] initWithFireDate:[NSDate date] interval:1 target:self selector:@selector(wrongSeletor:) userInfo:nil repeats:NO];\n //[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];\n });\n \n dispatch_async(self.queue2, ^{\n NSString *runloop = [NSString stringWithFormat:@&quot;%@&quot;, CFRunLoopGetCurrent()];\n runloop = [runloop substringWithRange:NSMakeRange(0, 22)];\n NSLog(@&quot;Queue2 %p run: %@&quot;, self.queue2, runloop);\n \n CFRunLoopRun();\n });\n}\n</code></pre>\n<p>Some time they take same RunLoop:</p>\n<p><a href="https://i.sstatic.net/wGcv3.png" rel="nofollow noreferrer">https://i.sstatic.net/wGcv3.png</a></p>\n<p>=====</p>\n<p>You can see the crash by uncomment the code of <code>NSTimer</code>. The NSTimer has been added in <code>queue1</code>, but it still running when call <code>CFRunLoopRun()</code> in <code>queue2</code>.</p>\n<p>I have read some description like: <a href="https://stackoverflow.com/questions/38000727/need-some-clarifications-about-dispatch-queue-thread-and-nsrunloop">need some clarifications about dispatch queue, thread and NSRunLoop</a></p>\n<p>They told that: <code>system creates a run loop for the thread</code>. But, in my check, they are sharing the RunLoop.</p>\n<p>This is sad for me, because I facing that crashes happen when calling <code>CFRunLoopRun()</code> on production.</p>\n"^^ . "hid"^^ . . "2"^^ . . "1"^^ . . . . . . . "0"^^ . . . . . . . . . . . . . "-1"^^ . . "javascript"^^ . . . . . "2"^^ . "0"^^ . . . "Why does my app hang when breakpoints are disabled?"^^ . . "@MottiShneor Are you sure the class is `NSPopoeverWindow` and not `_NSPopoverWindow`?"^^ . "@PtitXav Yes, I was intended to pass enum to notification, the rawValues is for testing, since the allocate error."^^ . . "see this:\nhttps://github.com/NightwindDev/Tweak-Tutorial/blob/main/hookf.md"^^ . . "0"^^ . "0"^^ . . . . . "2"^^ . . "0"^^ . . . . . . "avcapturesession"^^ . . . "<blockquote>\n<p>TL;DR What was the correct was to access a Objective-C <code>@property (...) foo</code> as <code>foo</code> instead of <code>self.foo</code>?</p>\n</blockquote>\n<p>It's not possible to access an Objective-C property using a bare name, without a target (i.e., without <code>self.</code>) — this is because <a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocProperties.html#//apple_ref/doc/uid/TP30001163-CH17-SW18" rel="nofollow noreferrer"><code>@property</code> is a shorthand for generating getter + setter <em>methods</em></a> on a type, and method calls always require an object to be called on.</p>\n<p>Instead, your first snippet of code works for an unrelated reason:</p>\n<ul>\n<li>By default, declaring a bare <code>@property</code> without a corresponding <code>@synthesize</code> directive will <a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocProperties.html#//apple_ref/doc/uid/TP30001163-CH17-SW18#//apple_ref/doc/uid/TP30001163-CH17-SW9" rel="nofollow noreferrer">generate an instance variable for you</a> to store the actual value in the property. In the case of a property like <code>foo</code>, the default generated ivar will be <code>_foo</code></li>\n<li>However, you can provide your own name for the variable with an explicit <code>@synthesize</code> directive, and when you do that, you can access the ivar with any name that you want:\n<ul>\n<li>Leaving out the <code>@synthesize</code> directive is equivalent to <code>@synthesize foo=_foo;</code> (i.e., map the <code>foo</code> property to a <code>_foo</code> ivar)</li>\n<li><code>@synthesize foo;</code> on its own is equivalent to <code>@synthesize foo=foo;</code> (i.e., map the <code>foo</code> property to a <code>foo</code> ivar)</li>\n<li><code>@synthesize foo=bar;</code> maps the <code>foo</code> property to a <code>bar</code> ivar</li>\n</ul>\n</li>\n</ul>\n<p>It happens to be that in Objective-C classes, ivars <em>are</em> accessed by their bare name directly — in the case of your <code>SomeObject</code> class, writing <code>foo</code> refers to the ivar itself, <em>not</em> to the property.</p>\n<ul>\n<li>In your original code, because the <code>foo</code> property is actually using the <code>foo</code> ivar (because you're not implementing the <code>foo</code> method yourself), <code>foo</code> and <code>self.foo</code> happen to return the same value</li>\n<li>In your updated code, you explicitly synthesize a <code>foo</code> ivar with the <code>@synthesize</code> directive, but then provide your own implementation for the <code>foo</code> getter, which is what's called when you write <code>self.foo</code>. Because the <code>foo</code> ivar is never set, it gets a <code>nil</code> value by default</li>\n</ul>\n<p>In other words, you can't avoid writing <code>self.foo</code> when referring to properties, and in general, it's recommended you avoid <code>@synthesize foo;</code> in order to avoid possible mixups when accessing the method vs. the ivar directly.</p>\n"^^ . . . . . . "Objective C - freopen command creates file but does not redirect output"^^ . "It was the `char buffer[10]` crash in the original examples that threw us all off. Pushing 10 bytes on to the stack would invariably not be a problem. But 200mb would easily cause a problem. And `malloc`, accessing memory from the heap, avoids stack memory limitations. Thanks for clarifying the question. So, did Chris answer your question?"^^ . . . . . . . . . . "1"^^ . . . "0"^^ . "2"^^ . . "1"^^ . "1"^^ . . . "1"^^ . "5"^^ . . "Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/257506/discussion-between-er-vihar-and-trojanfoe)."^^ . . . . . . . . . . "4"^^ . "0"^^ . . "0"^^ . . "Swift + Objective C swizzling class_getInstanceMethod is returning nil"^^ . . "<p>I'm using the following lines in my app delegate <code>didFinishLaunchingWithOptions</code> method to attempt to redirect <code>NSLog</code> output to a file. This is code that's in many SO answers.</p>\n<pre><code>NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);\nNSString *documentsDirectory = [paths objectAtIndex:0];\nNSString *logPath = [documentsDirectory stringByAppendingPathComponent:@&quot;mylog.txt&quot;];\nfreopen([logPath fileSystemRepresentation],&quot;a+&quot;,stderr);\n</code></pre>\n<p>The file is getting created, but it's empty. Also, from what I understand this should stop the <code>NSLog</code> messages from appearing in the Xcode console but they still show up.</p>\n<p>All help appreciated.</p>\n"^^ . . . . . . "0"^^ . "It is not generally possible to do this. To get a host name for an ip address requires that the reverse domain lookup (for a host `1.2.3.4` this is `4.3.2.1.in-addr.arpa`) is set up in DNS. This will not be the case for most home LANs. It may be set up in enterprise networks where the DHCP server can take care of this."^^ . . . "<p>When a bluetooth keyboard is linked to an iPhone and being used, the virtual keyboard is hidden. <strong>How can I disable this behaviour?</strong></p>\n<p>My app is built using React Native Expo and <strong>requires access to the soft keyboard and physical bluetooth keyboard simultaniously as functions need to be triggered remotely</strong>. However when the bluetooth keyboard is connected the virtual keyboard hides off screen until the keyboard is disconnected.</p>\n<p>I'm aware that some keyboards have a shortcut for bringing the keyboard back up, but this isn't a solution for me sadly- I need to find a way to prevent the keyboard from hiding at all.</p>\n<p>I've been playing with the native ios folder and Objective C files to see if there's a way to hard code this functionality, following various threads on SO but no success yet. I'm not familiar with the native code at all but I'm confident what I want can't be achieved in JSX. I will be looking for a solution on android too but I'm focusing on getting iOS working first.</p>\n<p>With the number of posts around this topic over the years already, someone <em>must</em> have found a solution?</p>\n<p>Any points in the right direction or tips on tackling the native code would be appreciated.</p>\n<p>Thank you.</p>\n<h1>Here is one of the things I tried in AppDelegate.mm already:</h1>\n<p>added these lines to AppDelegate.mm:</p>\n<p><code>#import &lt;React/RCTRootView.h&gt;</code></p>\n<p><code>[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldBegan:) name:UITextFieldTextDidBeginEditingNotification object:nil];</code></p>\n<pre><code>\n- (void)textFieldBegan:(NSNotification *)theNotification {\n UITextField *theTextField = [theNotification object];\n\n if (!inputAccessoryView) {\n inputAccessoryView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 1)];\n }\n\n theTextField.inputAccessoryView = inputAccessoryView;\n\n [self performSelector:@selector(forceKeyboard) withObject:nil afterDelay:0];\n}\n\n- (void)forceKeyboard {\n inputAccessoryView.superview.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height - 265, [UIScreen mainScreen].bounds.size.width, 265);\n}```\n\n\n```- (BOOL)application:(UIApplication *)application shouldAllowExtensionPointIdentifier:(UIApplicationExtensionPointIdentifier)extensionPointIdentifier {\n if ([extensionPointIdentifier isEqualToString:UIApplicationKeyboardExtensionPointIdentifier]) {\n return NO;\n }\n return YES;\n}```\n\n//Then rebuilt the project. No change in keyboard behaviour.\n</code></pre>\n"^^ . "1"^^ . . . . "1"^^ . . . . "0"^^ . . "appkit"^^ . . . . "1"^^ . "1"^^ . . . . . "0"^^ . "<p>I'm just getting started using AVFoundation to capture video from an iPhone's cameras. I've been successful in capturing from either front or back camera individually. However, I've run into trouble when attempting to capture from both simultaneously:</p>\n<pre class="lang-objectivec prettyprint-override"><code>bool\naddDevice(AVCaptureSession *session, bool front)\n{\n AVCaptureDevicePosition position = front? AVCaptureDevicePositionFront: AVCaptureDevicePositionBack;\n AVCaptureDevice *device;\n AVCaptureDeviceInput *input;\n NSError *error;\n\n device = [AVCaptureDevice defaultDeviceWithDeviceType:AVCaptureDeviceTypeBuiltinWideAngleCamera mediaType:AVMediaTypeVideo position:position];\n if ( !device ) {\n NSLog(@&quot;Cannot create %s device&quot;, front? &quot;front&quot; : &quot;back&quot;);\n return false;\n }\n\n input = [AVCaptureDeviceInput deviceInputWithDevice:device error&amp;error];\n if ( !input ) {\n NSLog(@&quot;Cannot create input for %s device: %@&quot;, front? &quot;front&quot; : &quot;back&quot;, [error localizedDescription]);\n return false;\n }\n\n if ( ![session canAddInput:input] ) {\n NSLog(@&quot;Cannot add input for %s device&quot;, front? &quot;front&quot; : &quot;back&quot;);\n return false;\n }\n [session addInput:input];\n \n return true;\n}\n\nAVCaptureSession *\nstartSession()\n{\n AVCaptureMultiCamSession *session;\n\n session = [AVCaptureMultiCamSession new];\n if ( !addDevice(session, true) || !addDevice(session, false) ) {\n return nil;\n }\n\n // add output\n\n [session startRunning];\n\n return session;\n}\n</code></pre>\n<p>The front device is added successfully but <code>[session canAddInput:input]</code> fails for the back device. As I mentioned before, I can take pictures from either device individually.</p>\n<p>I've tried reversing the order in which I add the cameras and then it's the front camera that can't be added. So, the issue does appear to be adding multiple inputs.</p>\n"^^ . . "1"^^ . . . . "0"^^ . . . . . . "@Willeke That does indeed. So it's a permissions issue that I thought was supposed to be resolved within System Settings > Privacy and Security, but it appears it still has to be run as root. Thank you!"^^ . "0"^^ . . . "Missing animation on constraint change using UIKit and Objective-C"^^ . "0"^^ . . "0"^^ . "%hookf can also be used to hook into swift functions, but why not objective-c too?"^^ . . "0"^^ . . "<p>I've been looking through questions and solutions to my problem (getting hostnames from a set of IPs on iOS) for a few days. Only three IP resolution methods seem to be listed for anyone, and neither worked for me, for different reasons.</p>\n<p>Method 1: using NSHost</p>\n<pre><code>[[NSHost currentHost] names]\n</code></pre>\n<p>Problem with method 1: NSHost is NOT useable on iOS - only macOS</p>\n<p>Method 2: using POSIX getaddrinfo</p>\n<pre><code>+(NSString *)getHostFromIPAddress:(NSString*)ipAddress {\n struct addrinfo *result = NULL;\n struct addrinfo hints;\n\n memset(&amp;hints, 0, sizeof(hints));\n hints.ai_flags = AI_NUMERICHOST;\n hints.ai_family = PF_UNSPEC;\n hints.ai_socktype = SOCK_STREAM;\n hints.ai_protocol = 0;\n\n int error;\n struct addrinfo *results = NULL;\n\n error = getaddrinfo([ipAddress cStringUsingEncoding:NSASCIIStringEncoding], NULL, NULL, &amp;results);\n if (error != 0)\n {\n NSLog (@&quot;Could not get any info for the address&quot;);\n return @&quot;&quot;; // or exit(1);\n }\n \n NSString *resString = @&quot;&quot;;\n \n\n for (struct addrinfo *r = results; r; r = r-&gt;ai_next)\n {\n char hostname[NI_MAXHOST] = {0};\n error = getnameinfo(r-&gt;ai_addr, r-&gt;ai_addrlen, hostname, sizeof hostname, NULL, 0 , 0);\n if (error != 0)\n {\n continue; // try next one\n }\n else\n {\n NSLog (@&quot;Found hostname: %s&quot;, hostname);\n return [NSString stringWithUTF8String:hostname];;\n break;\n }\n }\n\n freeaddrinfo(results);\n return @&quot;&quot;;\n}\n\n@end\n</code></pre>\n<p>Problem with method 2: instead of hostnames, it returns the same IP address it was given.</p>\n<p>Method 3: using CFHostRef (the most popular method)</p>\n<pre><code>+(NSString *)getHostFromIPAddress:(NSString*)ipAddress {\n struct addrinfo *result = NULL;\n struct addrinfo hints;\n \n memset(&amp;hints, 0, sizeof(hints));\n hints.ai_flags = AI_NUMERICHOST;\n hints.ai_family = PF_UNSPEC;\n hints.ai_socktype = SOCK_STREAM;\n hints.ai_protocol = 0;\n \n int errorStatus = getaddrinfo([ipAddress cStringUsingEncoding:NSASCIIStringEncoding], NULL, &amp;hints, &amp;result);\n if (errorStatus != 0) {\n return nil;\n }\n \n CFDataRef addressRef = CFDataCreate(NULL, (UInt8 *)result-&gt;ai_addr, result-&gt;ai_addrlen);\n if (addressRef == nil) {\n return nil;\n }\n freeaddrinfo(result);\n \n CFHostRef hostRef = CFHostCreateWithAddress(kCFAllocatorDefault, addressRef);\n if (hostRef == nil) {\n return nil;\n }\n CFRelease(addressRef);\n \n BOOL succeeded = CFHostStartInfoResolution(hostRef, kCFHostNames, NULL);\n if (!succeeded) {\n return nil;\n }\n \n NSMutableArray *hostnames = [NSMutableArray array];\n \n CFArrayRef hostnamesRef = CFHostGetNames(hostRef, NULL);\n for (int currentIndex = 0; currentIndex &lt; [(__bridge NSArray *)hostnamesRef count]; currentIndex++) {\n [hostnames addObject:[(__bridge NSArray *)hostnamesRef objectAtIndex:currentIndex]];\n }\n \n return hostnames[0];\n}\n\n@end\n</code></pre>\n<p>Problem with method 3: succeeded is ALWAYS false. Getting the hostname never works with this method.</p>\n<p>Method sources: <a href="https://stackoverflow.com/questions/43463996/get-host-name-from-ip-address-ios-10">Get host name From IP address iOS 10</a>, <a href="https://stackoverflow.com/questions/29938938/how-to-resolve-the-hostname-of-a-device-in-my-lan-from-its-ip-address-on-this-la?rq=3">how to resolve the hostname of a device in my LAN from its ip address on this LAN?</a>, <a href="https://stackoverflow.com/questions/65700070/get-the-list-of-devices-with-their-hostnames-and-ip-addresses-on-lan-in-ios-swif">Get the list of devices with their hostnames and ip addresses on LAN in iOS swift 5</a>\nTried code from every one of them, all failed.</p>\n<p>Is it possible to fix any of the methods above or use different ones?\nUsing iPhone 15 (simulator).</p>\n"^^ . "0"^^ . . "0"^^ . . . . "I'm honestly unsure. I don't know how to see what lines have fired, when running the code."^^ . . "0"^^ . "0"^^ . . . "1"^^ . . "1"^^ . . "<p>Fixed it by adding <code>[self setNeedsLayout]</code> after calling <code>[self layoutIfNeeded]</code>.</p>\n<pre class="lang-objectivec prettyprint-override"><code>[self layoutIfNeeded];\n[self setNeedsLayout];\n \n[UIView animateWithDuration:1.5\n animations:^{\n progressForegroundWidthConstraint.constant = progressBarWidth * progressPercentage / 100;\n [self layoutIfNeeded];\n }\n];\n</code></pre>\n"^^ . . . . . . "memory"^^ . "hook"^^ . . . . . . . . . . "0"^^ . "1"^^ . "0"^^ . "Cannot add multiple inputs to AVCaptureMultiCamSession"^^ . . . . . "<p>After much trial and error, I found out that it is actually possible to hook onto Objective-C functions.</p>\n<p>The thing that I was missing here that was causing this error:</p>\n<pre><code>Undefined symbols for architecture armv7:&quot;_addition&quot;, \nreferenced from:\n __logosLocalInit in Tweak.x.f54e192c.o\nld: symbol(s) not found for architecture armv7\n</code></pre>\n<p>was that I did not add this to the end of the tweak</p>\n<pre><code>%ctor {\n %init(addition= MSFindSymbol(NULL, &quot;_addition&quot;));\n}\n</code></pre>\n<p>and that is important because this function was created by me and THEOS doesn't really know where it is unless it searches for it during runtime with the help of the symbol I have provided.</p>\n<p>the whole tweak looks something like this</p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n#import &lt;Foundation/Foundation.h&gt;\n%hookf(NSNumber *, addition, NSNumber *num1, NSNumber *num2) {\n return @99;\n}\n%ctor {\n %init(addition= MSFindSymbol(NULL, &quot;_addition&quot;));\n}\n</code></pre>\n"^^ . . . . . . . "2"^^ . . "0"^^ . "Cocoa application produces a lot of "inactive" memory"^^ . . . . "0"^^ . "0"^^ . . . . . "voice-to-text"^^ . . "0"^^ . "**Never run a run loop in a dispatch queue callback.** A run loop needs a dedicated thread, and GCD queues don't have dedicated threads (except the main queue, which always uses the main thread). You should only ever run a run loop on the main thread, or on a thread you created. A dispatch queue is not a thread."^^ . . . . . "This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/36155233)"^^ . . "1"^^ . . . "You can get protocol dynamically with Objective-C runtime functions."^^ . . "@trojanfoe, this code is from SDK. And I want to get the logs which they use to print using "LogDebug". I don't want to change any code from SDK."^^ . . . . . "You need read that SDK's documentation and find out how to enable longs in it. As we doesn't know which library you are using, we can't help you."^^ . . "For the sake of clarity: please check if this is really your debuggger output: `NSPopoeverWindow : NSPanel : NSWindow`"^^ . . "0"^^ . . . "0"^^ . . . . . "0"^^ . . . "<p>Nvm, I figured out the solution. I was mistakenly using <code>class_getInstanceMethod</code>.</p>\n<p>I needed to use <code>class_getClassMethod</code> instead because it's not a instance method.</p>\n<p>Here's the working solution:</p>\n<pre><code>extension ASTextNode {\n\n @objc static func swizzledHighlightColor() -&gt; CGColor {\n return UIColor.red.cgColor\n }\n \n static func swizzle() {\n let originalSelector = NSSelectorFromString(&quot;_highlightColorForStyle:&quot;)\n let swizzledSelector = #selector(ASTextNode.swizzledHighlightColor)\n \n print(&quot;originalSelector: \\(originalSelector)&quot;)\n print(&quot;swizzledSelector: \\(swizzledSelector)&quot;)\n \n let originalMethod = class_getClassMethod(self, originalSelector)\n let swizzledMethod = class_getClassMethod(self, swizzledSelector)\n \n print(&quot;originalMethod: \\(String(describing: originalMethod))&quot;)\n print(&quot;swizzledMethod: \\(String(describing: swizzledMethod))&quot;)\n \n if let originalMethod = originalMethod, let swizzledMethod = swizzledMethod {\n method_exchangeImplementations(originalMethod, swizzledMethod)\n }\n \n let selectorPerformed = ASTextNode.perform(originalSelector)\n print(&quot;selectorPerformed: \\(String(describing: selectorPerformed))&quot;)\n }\n}\n</code></pre>\n"^^ . "<p>%hookf Used to hook into C functions, not Objective-C methods.</p>\n"^^ . "0"^^ . . "1"^^ . "@HangarRash Thank you for your consideration. I have edited the question you can find the image in question. I have used 5 different sizes 25x25, 50x50, 75x75, 100x100, 150x150. As any image which has size greater then 25x25 not fit in Tabbar and go out of the tabbar so I have resized them. I am using bigger image and try to scal smaller but result is same."^^ . . . . . "uitabbaritem"^^ . "A few orders of magnitude to consider what you should allocate on the stack vs heap: IIRC, the stack size is 1mb in iOS, and defaults to 8mb in macOS (though it can be overridden by linker options). Generally, I would shy away from stack allocations in excess of a kb or two except in the most extraordinary cases."^^ . . . . . "<p>I can call a private API's method by <code>getClassFromString:</code> and <code>performSelector:</code> in Objective-C, or use the <a href="https://github.com/mhdhejazi/Dynamic" rel="nofollow noreferrer">Dynamic</a> library to call them easily in Swift. However, I can't set a delegate for a private API because I can't get a protocol dynamically and make a class conform it.</p>\n<p>I've tried to copy the procotol's define and make a class conform it, then used <code>[/*id*/ performSelector:NSSelectorFromString(@&quot;setDelegate&quot;) withObject:[[MyDelegate alloc] init]];</code> in Objective-C. But it seems no effect.</p>\n"^^ . "1"^^ . "I think the difference lies in the different executable types - one being an application, the other being an extension (which often operate via app groups)"^^ . . "I assume you based that code on an SO answer from 2011? I believe that Xcode 15 no longer captures `stderr` to show `NSLog` entries, and instead gets it from the system log. So you could argue that the output is already going to file..."^^ . "0"^^ . "1"^^ . . "bridging-header"^^ . . . . "0"^^ . "1"^^ . . . "0"^^ . . . . . "0"^^ . "0"^^ . . "<p>I was getting an error EXC_BAD_ACCESS for seemingly no reason. After a lot of debugging I found the problem but I have no idea why it occurs.\nHere's some examples of when it happens:</p>\n<ul>\n<li>MyObject.h</li>\n</ul>\n<pre><code>@interface MyFile : NSObject\n\n@property (strong) NSFileHandle *handle;\n\n@end\n\n@interface MyClass : NSObject\n{\n int bufferSize;\n NSMutableArray *files;\n}\n\n- (void)readFile1;\n- (void)readFile2;\n- (void)readFile3;\n- (void)readFile4;\n\n@end\n</code></pre>\n<ul>\n<li>MyObject.m</li>\n</ul>\n<pre><code>@implementation MyObject\n\n- (id)init\n{\n bufferSize = 200000000;\n // Initialize files array, add a file object and open the file handle.\n}\n\n- (void)readFile1\n{\n UInt64 bytesToProcess;\n file = [files objectAtIndex:0];\n char *buffer = malloc(bufferSize);\n \n do @autoreleasepool {\n NSFileHandle *handle = [file handle];\n bytesToProcess = [data = [handle readDataOfLength:bufferSize] length];\n [data getBytes:buffer length:bytesToProcess]; // This works fine.\n // Modify the buffer.\n } while (bytesToProcess);\n}\n\n- (void)readFile2\n{\n UInt64 bytesToProcess;\n file = [files objectAtIndex:0];\n char buffer[bufferSize];\n \n do @autoreleasepool {\n NSFileHandle *handle = [file handle]; // This throws EXC_BAD_ACCESS.\n bytesToProcess = [data = [handle readDataOfLength:bufferSize] length];\n [data getBytes:buffer length:bytesToProcess];\n // Modify the buffer.\n } while (bytesToProcess);\n}\n\n- (void)readFile3\n{\n UInt64 bytesToProcess;\n file = [files objectAtIndex:0];\n char buffer[10];\n \n do @autoreleasepool {\n NSFileHandle *handle = [file handle];\n bytesToProcess = [data = [handle readDataOfLength:10] length];\n [data getBytes:buffer length:bytesToProcess]; // This works fine.\n // Modify the buffer.\n } while (bytesToProcess);\n}\n\n- (void)readFile4\n{\n UInt64 bytesToProcess;\n file = [files objectAtIndex:0];\n \n do @autoreleasepool {\n NSFileHandle *handle = [file handle];\n bytesToProcess = [data = [handle readDataOfLength:bufferSize] length];\n char buffer[bufferSize];\n [data getBytes:buffer length:bytesToProcess]; // This throws EXC_BAD_ACCESS.\n // Modify the buffer.\n } while (bytesToProcess);\n}\n\n@end\n</code></pre>\n<p>I don't understand why this became a problem out of nowhere, the code was working for a long time and consistently stopped working all of a sudden. I assume malloc allocates the memory a bit differently. I don't understand how initializing an array makes my object inaccessible, I don't expect it to overwrite allocated memory.\nWhat is the difference between <code>char buffer[10];</code> and <code>char *buffer = malloc(10);</code>? I thought it was the same thing.</p>\n"^^ . . . "<p>It turns out I need to transform <code>TrackID</code> ranther than cast it to <code>int</code> directly</p>\n<pre><code>- (void)startVideoCompositionRequest:(AVAsynchronousVideoCompositionRequest *)request {\n // Extract source pixel buffer\n NSArray *sourceTrackIDs = request.sourceTrackIDs;\n if (sourceTrackIDs.count == 0) {\n NSLog(@&quot;No source track IDs found in the request&quot;);\n return;\n }\n\n CMPersistentTrackID trackID = [sourceTrackIDs[0] intValue]; // Assuming only one track ID is provided\n \n CVPixelBufferRef sourcePixelBuffer = [request sourceFrameByTrackID: trackID];\n \n if (!sourcePixelBuffer) {\n NSLog(@&quot;Failed to extract source pixel buffer for track ID: %d&quot;, trackID);\n return;\n }\n \n [request finishWithComposedVideoFrame:sourcePixelBuffer];\n</code></pre>\n"^^ . "objective-c"^^ . "I didn't downvote your answer, but I can see why someone might have. This is terribly expensive logging code. Firstly open the log file _once_ per process, not every log call. Secondly what's going on with that `format` string?"^^ . "How to prevent the virtual keyboard from hiding when a physical bluetooth keyboard is connected? (iOS)"^^ . . . . "0"^^ . "1"^^ . . . "0"^^ . . . . . . "How to use theos %hookf to hook an objective-c function in an iOS app?"^^ . "0"^^ . . "0"^^ . "1"^^ . "0"^^ . "I'll add that the direct reference to the ivar `foo` is equivalent to `self->foo` which is of course quite different from `self.foo`."^^ . . . . . "@Paulw11 can you write it as an answer so I can accept it?"^^ . . "0"^^ . . "<p>The framework will install in the current ios directory.</p>\n<p><strong>Important Note:-</strong>\nMake sure your sdk is present in this directory project_root_directory/ios and add you sdk in xcode</p>\n<p><a href="https://i.sstatic.net/YQoZwdx7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/YQoZwdx7.png" alt="enter image description here" /></a></p>\n<p><strong>Step 1:-</strong></p>\n<ul>\n<li>Move to project_root_directory/ios</li>\n</ul>\n<p><strong>Step 2:-</strong></p>\n<p>Run this command</p>\n<ul>\n<li>ruby &lt;(curl <a href="https://connect.squareup.com/readersdk-installer" rel="nofollow noreferrer">https://connect.squareup.com/readersdk-installer</a>) install <br />\n--app-id YOUR_SQUARE_READER_APP_ID <br />\n--repo-password YOUR_SQUARE_READER_REPOSITORY_PASSWORD</li>\n</ul>\n<p>Make sure to replace YOUR_SQUARE_READER_APP_ID with your Square Reader application ID and YOUR_SQUARE_READER_REPOSITORY_PASSWORD with your Square Reader repository password.</p>\n"^^ . "0"^^ . . "-1"^^ . . "0"^^ . . . "0"^^ . . "How to set delegate for a private API in Swift or Objective-C?"^^ . "Use `dispatch_source` for creating timers. Forget about `NSTimer`"^^ . . "0"^^ . . . . . "0"^^ . . "cross-platform"^^ . . "asyncstorage"^^ . . . . "swizzle"^^ . . "2"^^ . "keyboard"^^ . . . . . . . "0"^^ . . . . . . . . "lldb"^^ . . . . "You can use marcos but it's to dirty, better to use find+replace"^^ . . . "-1"^^ . "0"^^ . . . . . . . . "0"^^ . . . "<p>I have a parent UIView called <code>ProgressBarView</code>. Inside, I've setup a UIView called <code>progressForeground</code> that is responsible for showing the actual percentage of the progress bar. I want <code>progressForeground</code> to animate to its set width constraint. This is how I setup the view:</p>\n<pre class="lang-objectivec prettyprint-override"><code>UIView *progressForeground = [[UIView alloc] init];\n \n[self addSubview:progressForeground];\n \nprogressForeground.translatesAutoresizingMaskIntoConstraints = NO;\n[progressForeground.heightAnchor constraintEqualToConstant:frame.size.height].active = YES;\nprogressForeground.backgroundColor = [UIColor colorWithWhite:1.0 alpha:1.0];\n[progressForeground.leadingAnchor constraintEqualToAnchor:progressBackground.leadingAnchor].active = YES;\n[progressForeground.centerYAnchor constraintEqualToAnchor:progressBackground.centerYAnchor].active = YES;\nprogressForeground.layer.cornerRadius = 5;\n</code></pre>\n<p>After I've setup the neccessary constraint, I've added a width constraint and changed its value inside an animation block like so:</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSLayoutConstraint *progressForegroundWidthConstraint = [NSLayoutConstraint constraintWithItem:progressForeground\n attribute:NSLayoutAttributeWidth\n relatedBy:NSLayoutRelationEqual\n toItem:nil\n attribute:NSLayoutAttributeNotAnAttribute\n multiplier:1.0\n constant:0\n ];\n \nprogressForegroundWidthConstraint.active = YES;\n \n[self layoutIfNeeded];\n[UIView animateWithDuration:5\n animations:^{\n progressForegroundWidthConstraint.constant = 60;\n [self layoutIfNeeded];\n }\n];\n</code></pre>\n<p>As it was mentioned <a href="https://stackoverflow.com/questions/12622424/how-do-i-animate-constraint-changes">here</a>, I've made sure to call <code>layoutIfNeeded</code> method on the parent view to flush any pending animations.</p>\n<p>I expect the width of the <code>progressForegroundView</code> to change with an animation, however it just directly jumps to the value of 60 without any animation. What's wrong here?</p>\n<p>I've tried to animate the progressForegroundView, however it only jumped to the designated value without any animation</p>\n"^^ . "Post code and errors as text and avoid using homemade abbreviations."^^ . . . . "Are you using any CoreGraphics methods ? As the memory is not always release immediately and can lead to memory shortage ."^^ . "1"^^ . . . "2"^^ . . . . . . "The helper application was indeed sandboxed! Obviously that is the default setting! That was the problem. Work now as expected. @JWWalker Thank you so much."^^ . "1"^^ . . . . "1"^^ . . . . . "react-native"^^ . . . . . . . . "<p>I am developing software in Objective-C that reads files in chunks and processes them. I noticed with very large files it slows down a lot. Looking in activity monitor it's pretty clear what's going on. When in the system memory tab, the pie chart shows what the memory is used for. When running my application, the blue part of the chart fills up entirely until there is no green left. Once the green is gone, it starts doing a ton of page-outs and the disk starts being used to it's maximum.</p>\n<p>From my understanding the inactive memory is memory that was used by an application and is left allocated when that application closes and given back to the application when it opens again. I am using ARC and for every malloc and calloc I use free to make sure everything is freed as soon as possible. When I look in Instruments, it shows the memory is all freed and there are no leaks. I assume Mac OS is marking the memory I used as inactive, maybe it thinks my application is going to need it again. The loop that's causing the problem is an auto-release pool so I would expect it to free up the memory properly.</p>\n<p>Here's code that replicates the issue:</p>\n<pre><code>//\n// main.m\n// memory issue\n//\n// Created by Lasse Lauwerys on 21/04/24.\n// Copyright (c) 2024 Lasse Lauwerys. All rights reserved.\n//\n\n#import &lt;Foundation/Foundation.h&gt;\n\nint main(int argc, const char * argv[])\n{\n @autoreleasepool {\n NSLog(@&quot;Reading file...&quot;);\n UInt32 bufferSize = 200000000;\n NSFileHandle *fileHandle = [NSFileHandle fileHandleForReadingAtPath:@&quot;/path/to/large/file&quot;];\n UInt64 bytesToProcess;\n NSData *data;\n do @autoreleasepool { // This loop reads the file into ram in chunks of 200MB and frees it after each iteration.\n bytesToProcess = [data = [fileHandle readDataOfLength:bufferSize] length];\n } while (bytesToProcess);\n NSLog(@&quot;Finsihed!&quot;);\n }\n return 0;\n}\n</code></pre>\n<p>It fills the inactive memory to 100% even with just a 2GB file.</p>\n<p>I can't find any helpful info about this on Google. I don't think it's a memory leak as the inactive memory is supposed to be like free memory in case it's necessary.\nThe <code>purge</code> command frees up the memory and stops the page-outs, making everything fast again. But that doesn't stay for long, you can visually see the blue area grow and after a couple seconds it's full again.</p>\n<p>Is this caused by malloc or by creating instances of Objective-C classes? How can I stop it from marking the freed memory as inactive?</p>\n"^^ . "<p>I am probably missing something as usual. But I am still not sure why it would crash with unrecognized method crash. I have the following snippet:</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSObject *obj = [NSObject new];\n if (@available(iOS 17.0, *)) {\n if (obj.isAccessibilityElementBlock != nil) {\n BOOL flag = obj.isAccessibilityElementBlock();\n }\n } else {\n NSLog(@&quot;Not ios 17 &quot;);\n }\n</code></pre>\n<p>The crash happens on that line: <code>if (obj.isAccessibilityElementBlock != nil)</code><br>\n<code>[NSObject isAccessibilityElementBlock]: unrecognized selector sent to instance</code><br>\nthe property is defined and exists at least in public header (and in dynamic method list):<br>\n<code>@property (nullable, nonatomic, copy) AXBoolReturnBlock isAccessibilityElementBlock</code></p>\n<p>trying to do similar in swift:</p>\n<pre class="lang-swift prettyprint-override"><code>let obj: NSObject = NSObject()\nlet fun = obj.isAccessibilityElementBlock()\n</code></pre>\n<p>I get a compile error:<br>\n<code>Static member 'isAccessibilityElementBlock' cannot be used on instance of type 'NSObject'</code> <br>\nBUT its not static, (a little bit strange error)<br>\nSo my question is appropriate behaviour? and what will be the correct way to use those api?</p>\n"^^ . . . . . . . "0"^^ . "0"^^ . . . "uikit"^^ . "Objective-C enums can't have functions or computed properties. This might be the reason behind the crash. The best option would be to pass the raw value through the `userInfo` and convert it to an enum value on the recipient side, which you have already done."^^ . . "Seize Device and Work with input on MacOS"^^ . . "I’m not a React Native Async Storage user, so I’m not sure I can advise you on this. FWIW, issue [#126](https://github.com/react-native-async-storage/async-storage/issues/126) seems to (a) have raised the question; and (b) has been marked as “complete”. So maybe there are some breadcrumbs you can follow from there to find the solution for your issue."^^ . "How to open file with a specific Application Bundle?"^^ . . "0"^^ . "<p>I have an app that uses several ManagedObjectContexts.</p>\n<p>I am using Objective-C.</p>\n<p>One MOC is created with NSPrivateQueueConcurrencyType. The rest are created with NSMainQueueConcurrencyType.</p>\n<p>I am using [performBlockAndWait:] whenever I work with my MOCs.</p>\n<p>When I run my app with breakpoints disabled, the app will hang. The stack trace says that there are 2 threads trying to run performBlockAndWait.</p>\n<p>If I run my app with breakpoints enabled and I have several breakpoints that will interrupt my code, the app will not hang.</p>\n<p>I have searched online and while I have seen some entries about hangs, nothing has helped nor have I found anything that matches my situation.</p>\n<p>I am clearly missing something (or a lot of somethings) in how performBlockAndWait works and when it is or is not appropriate to use.</p>\n<p>Very much would like some help/hints. This is very frustrating.</p>\n<p>Xcode version is 15.3, deployment target for iOS/iPadOS is 16.4.</p>\n"^^ . . . "Thank everyone, your words mean a lot to me."^^ . . "0"^^ . "1"^^ . . "0"^^ . "0"^^ . . "0"^^ . "2"^^ . "0"^^ . . . . . . "0"^^ . . . . "Usage of Accessibility blocks in iOS 17 (isAccessibilityElementBlock)"^^ . . . . "Thank you. It seems like this is what I was looking for - only it will probably (untested yet) help the "torn off: (detached) window - not the behavior of the standard popover window (before detached). \n\nI'm talking about making a text-field editable, and becoming "key" window)"^^ . . . . "<p>I am using AsyndDisplayKit/Texture where:</p>\n<p><a href="https://github.com/TextureGroup/Texture/blob/923901a1cebf0b6c51627aca2a6748dee84af143/Source/ASTextNode.mm#L934" rel="nofollow noreferrer">https://github.com/TextureGroup/Texture/blob/923901a1cebf0b6c51627aca2a6748dee84af143/Source/ASTextNode.mm#L934</a></p>\n<p>ASTextNode has this function:</p>\n<pre><code>+ (CGColorRef)_highlightColorForStyle:(ASTextNodeHighlightStyle)style\n{\n return [UIColor colorWithWhite:(style == ASTextNodeHighlightStyleLight ? 0.0 : 1.0) alpha:1.0].CGColor;\n}\n</code></pre>\n<p>Unfortunately, it's not exposed. So I am unable to change the highlight color. So I am trying to swizzle it using this:</p>\n<pre><code>extension ASTextNode {\n \n @objc func swizzledHighlightColor() -&gt; CGColor {\n return UIColor.red.cgColor\n }\n \n static func swizzle() {\n let originalSelector = NSSelectorFromString(&quot;_highlightColorForStyle:&quot;)\n \n let swizzledSelector = #selector(ASTextNode.swizzledHighlightColor)\n \n print(&quot;originalSelector: \\(originalSelector)&quot;)\n print(&quot;swizzledSelector: \\(swizzledSelector)&quot;)\n \n let originalMethod = class_getInstanceMethod(self, originalSelector)\n let swizzledMethod = class_getInstanceMethod(self, swizzledSelector)\n \n print(&quot;originalMethod: \\(String(describing: originalMethod))&quot;)\n print(&quot;swizzledMethod: \\(String(describing: swizzledMethod))&quot;)\n \n if let originalMethod = originalMethod, let swizzledMethod = swizzledMethod {\n method_exchangeImplementations(originalMethod, swizzledMethod)\n }\n }\n}\n</code></pre>\n<p>Here, <code>method_exchangeImplementations</code> fails because the <code>originalMethod</code> gotten by <code>class_getInstanceMethod</code> is returning nil. The output of above is:</p>\n<pre><code>originalSelector: _highlightColorForStyle:\nswizzledSelector: swizzledHighlightColor\noriginalMethod: nil\nswizzledMethod: Optional(0x00000001046b5e09)\n</code></pre>\n<p>To debug, I printed this and it does work:</p>\n<pre><code>let selectorPerformed = ASTextNode.perform(originalSelector) \nprint(&quot;selectorPerformed: \\(String(describing: selectorPerformed))&quot;)\n</code></pre>\n<p>prints:</p>\n<pre><code>selectorPerformed: Optional(Swift.Unmanaged&lt;Swift.AnyObject&gt;(_value: &lt;CGColor 0x30333c8c0&gt; [&lt;CGColorSpace 0x303430120&gt; (kCGColorSpaceICCBased; kCGColorSpaceModelMonochrome; Generic Gray Gamma 2.2 Profile; extended range)] ( 1 1 )))\n</code></pre>\n<p>So, the <code>originalSelector</code> is correct. Why's <code>class_getInstanceMethod</code> failing then?</p>\n<p><strong>EDIT:</strong> I figured out the problem. I posted solution below.</p>\n"^^ . "Of course not... Debugger doesn't have such output. This is an "Objective-C"-like definition of inheritance. What I do in debugger is "po [popoverWindow super] to know it's superclass, and it outputs NSPanel class. Then - in the headers of Cocoa NSPanel publicly inherits NSWindow"^^ . "ios-bluetooth"^^ . . "Module 'SquareReaderSDK' not found in IOS (React Native)"^^ . . "0"^^ . . . "<p>Sounds like you need to implement <code>-[NSPopoverDelegate detachableWindowForPopover:]</code> and provide a window of the kind you want.</p>\n"^^ . "<p>I added a Swift file to an old OC project and called the Swift method in the OC file. During the debugging process, I found that the po command of lldb could not print the contents of the NSDictionary and could only tell me how many files there were elements,\nAs you can see from the console, the print method in the code is not affected.</p>\n<p><a href="https://i.sstatic.net/7zquB.png" rel="nofollow noreferrer">enter image description here</a></p>\n<p>and the e command also reported a generic error</p>\n<p><a href="https://i.sstatic.net/gjvFv.png" rel="nofollow noreferrer">enter image description here</a></p>\n<p>But when the same object is returned to the OC file, the po command of lldb can print\nout the content, and the e command will not report an error.</p>\n<p><a href="https://i.sstatic.net/GqGDI.png" rel="nofollow noreferrer">enter image description here</a></p>\n<p>Then I created a new OC project, integrated all third-party libraries of the old project, and performed the same operation, and found that this problem did not occur.</p>\n<p><a href="https://i.sstatic.net/M8d30.png" rel="nofollow noreferrer">enter image description here</a></p>\n<p>Has anyone encountered the same problem? I hope someone can help solve it.</p>\n"^^ . . . . . . . . "0"^^ . . "iphone-privateapi"^^ . . . . . . "I tried your code and the text field is editable."^^ . . . "0"^^ . . . . . "0"^^ . . "3"^^ . "In the notification you pass the enum not its rawValue. Why do you want to use the rawValue as you declared it as objc which enable it to be shared with Objective-C ?"^^ . . . . "0"^^ . "0"^^ . . "theos"^^ . . . . "1"^^ . "What size is the blurry image? Maybe it's a tiny image and it's blurry because it's being scaled bigger."^^ . . . . "Some devices may also support SNMP, but you need to know the appropriate community string to access the data. There may also be other methods such as Bonjour/mDNS advertisements from some devices but there is no general method apart from reverse dns."^^ . "0"^^ . "0"^^ . . . "0"^^ . . "1"^^ . . . "0"^^ . . "1"^^ . . "Most local networks don't have a forward dns either, but even if it did, no, you can't initiate a zone transfer without authentication."^^ . . "Wouldn't you use `LogObjcWrapper` directly?"^^ . . . . . . . "macos"^^ . "1"^^ . "<p>I'm encountering an issue with integrating the SquareReaderSDK into my iOS project. Despite following the documentation and ensuring that I've properly added the SDK to my project, Xcode still reports that it cannot find the SquareReaderSDK module.</p>\n<p>Here are the steps I've taken so far:</p>\n<ol>\n<li><p>I've added the SquareReaderSDK framework to my project by dragging it into the &quot;Frameworks, Libraries, and Embedded Content&quot; section of my target settings.</p>\n</li>\n<li><p>I've made sure that the framework is listed under &quot;Link Binary With Libraries&quot; in the &quot;Build Phases&quot; settings for my target.</p>\n</li>\n<li><p>I've imported the SquareReaderSDK module in the appropriate files where I need to use it.</p>\n</li>\n</ol>\n<p>I've tried cleaning the build folder, deleting derived data, and restarting Xcode, but the issue persists.</p>\n<p>Is there anything else I might be missing or any additional steps I need to take to properly integrate the SquareReaderSDK into my project? Any help or insights would be greatly appreciated.</p>\n<p><strong>Versions:</strong></p>\n<ul>\n<li><p>&quot;react-native&quot;: &quot;0.72.3&quot;,</p>\n</li>\n<li><p>&quot;react-native-square-reader-sdk&quot;: &quot;^1.4.3&quot;</p>\n</li>\n</ul>\n<p><strong>Device:</strong><br />\nIOS simulator: IPhone 15</p>\n<p><strong>Error Screenshot:</strong></p>\n<p><a href="https://i.sstatic.net/7oji3P4e.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7oji3P4e.png" alt="enter image description here" /></a></p>\n<p>I have followed the documnentation of sqaure reader sdk.<br />\n<a href="https://github.com/square/react-native-square-reader-sdk/blob/master/docs/get-started.md#step-5-install-reader-sdk-for-ios" rel="nofollow noreferrer">https://github.com/square/react-native-square-reader-sdk/blob/master/docs/get-started.md#step-5-install-reader-sdk-for-ios</a></p>\n"^^ . . . "Getting hostname from IP (on LAN) programmatically. Tried three methods, neither worked"^^ . . "Does `CFRunLoopGetMain` work before `CFRunLoopRun`?"^^ . . "OK so my understanding is that Xcode 15 no longer redirects `stderr` to its debug console; instead it gets the entries from the system log. So you are best to use `os_log` to write your log messages and ignore those macros."^^ . . "code added , please check @JoakimDanielson"^^ . "NSLog wrapper in Objective-C not working in Swift"^^ . . . . "<p>I'm facing an issue that occurs on iOS 14.6, when trying to pass an @objc enum <code>ConnectState</code> to dictionary value, the app will crash with malloc error:</p>\n<pre><code>AppName(645,0x16f61f000) malloc: can't allocate region\n:*** mach_vm_map(size=1152921504606863360, flags: 100) failed (error code=3)\nAppName(645,0x16f61f000) malloc: *** set a breakpoint in malloc_error_break to debug\n</code></pre>\n<pre><code>@objc enum ConnectState: UInt8 {\n case connected = 0x00\n case disConnected = 0x01\n var description: String {\n switch self {\n case .connected:\n return &quot;connected&quot;\n case .disConnected:\n return &quot;disConnected&quot;\n }\n }\n}\n\nstruct ConstValue {\n static let connectState = &quot;connectState&quot;\n}\n</code></pre>\n<p>I set a malloc_error_break breakpoint, and it stopped at <code>userInfo[ConstValue.connectState] = connectState.rawValue</code>,</p>\n<pre><code>func connectStateChange(_ connectState: ConnectState, _ serialNumber: String) {\n var userInfo: [String: Any] = [:]\n //ConstValue.connectState is a string declared in ConstValue struct\n userInfo[ConstValue.connectState] = connectState.rawValue//breakPoint\n userInfo[ConstValue.serialNumber] = serialNumber\n NotificationCenter.default.post(name: Notification.Name(Global.HomeDeviceStateChange), object: nil, userInfo: userInfo)\n}\n</code></pre>\n<p>I also tried to init a ConstValue enum by it's rawValue and pass it to <code>userInfo</code>'s value, sadly didn't workout.</p>\n<pre><code>guard let connectStateItem = ConnectState(rawValue: connectState.rawValue) else {\n uniLogger.error(TAG, &quot;\\(#function) Error, Failed to init a ConnectState item from it's rawValue: \\(connectState.rawValue)&quot;)\n return\n}\nuserInfo[ConstValue.connectState] = connectStateItem\nuserInfo[ConstValue.serialNumber] = serialNumber\n</code></pre>\n<p>If I simply pass the parameter to notification's userInfo would work fine, but I need post both serialNumber and ConnectState, and why would this work?</p>\n<pre><code>func connectStateChange(_ connectState: ConnectState, _ serialNumber: String) {\n NotificationCenter.default.post(name: Notification.Name(Global.HomeDeviceStateChange), object: nil, userInfo: [ConstValue.connectState:connectState])\n}\n</code></pre>\n"^^ . . . . . "HelloWorld of "customVideoCompositorClass" but get black video"^^ . . . . . "0"^^ . . . "1"^^ . . . . . "0"^^ . "@PtitXav I'm not using CoreGraphics. I'm pretty sure the "inactive" memory is not allocated memory anymore but it's memory that is reserved in case the application is closed and opened again but it's freed when other applications need it. The problem is that it's producing so much inactive memory while running that it starts paging immediately and that ruins the file read speeds. The only solution I have now is constantly running the `purge` command to clean the inactive memory, but that's a bad solution."^^ . "0"^^ . . . "<p>Found the answer.</p>\n<p>Changed the &quot;Fonts provided by application&quot; key in the .plist file with &quot;UIAppFonts&quot; and the font started to work</p>\n"^^ . . . . . . . . "enums"^^ . . . . . . "1"^^ . . . . . "method-swizzling"^^ . . . . . "0"^^ . . . "cfrunloop"^^ . . "No, you would need to write your own logger code."^^ . . "3"^^ . "Your code doesn't compile, post real code please (probably `[data getBytes:buffer length:10]`). Does `NSFileHandle *handle = […]` crash? I don't see a property in your code."^^ . "nslog"^^ . "1"^^ . "network-programming"^^ . . "0"^^ . "Thanks, Rob. I very much appreciate your guidance."^^ . . "0"^^ . "0"^^ . . "<p>The following source code creates a C function called <em>MyLog()</em>. You would need to include this function inline in your project and call it just like you would NSLog(), ie <em>MyLog(@&quot;Some text.&quot;);</em> . Multiple strings from this function are then written to your log file by adding an NSMutableArray.</p>\n<pre><code>NSMutableArray *strings; // At the top of your app\n\nvoid MyLog( NSString *formatString, ... ) {\n va_list ap;\n va_start( ap, formatString );\n \n NSString *format = [[NSString alloc] initWithFormat:@&quot;%@\\n&quot;, formatString];\n NSString *string = [[NSString alloc] initWithFormat:format arguments:ap];\n [strings addObject:string];\n\n NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);\n NSString *documentsDirectory = [paths objectAtIndex:0];\n NSString *logPath = [documentsDirectory stringByAppendingPathComponent:@&quot;mylog.txt&quot;];\n NSString *arrayStr = [strings componentsJoinedByString:@&quot;&quot;];\n NSData* data = [arrayStr dataUsingEncoding:NSUTF8StringEncoding];\n [[NSFileManager defaultManager] createFileAtPath:logPath contents:data attributes:nil];\n \n va_end( ap );\n}\n\nInitialize the function with 'strings = [NSMutableArray array];' called at the beginning of your app // eg in AppDelegate's -applicationDidFinishLaunching: method \n</code></pre>\n<p><strong>Alternative method to remove 'logPath' code from logging function:</strong></p>\n<pre><code>NSMutableArray *strings;\nNSString *logPath; // At the top of your app\n\nvoid MyLog( NSString *formatString, ... ) {\n va_list ap;\n va_start( ap, formatString );\n \n NSString *format = [[NSString alloc] initWithFormat:@&quot;%@\\n&quot;, formatString];\n NSString *string = [[NSString alloc] initWithFormat:format arguments:ap];\n [strings addObject:string];\n NSString *arrayStr = [strings componentsJoinedByString:@&quot;&quot;];\n NSData* data = [arrayStr dataUsingEncoding:NSUTF8StringEncoding];\n [[NSFileManager defaultManager] createFileAtPath:logPath contents:data attributes:nil];\n \n va_end( ap );\n}\n</code></pre>\n<p>Use AppDelegate's method -applicationDidFinishLaunching to initialize NSMutableArray and obtain the logPath:</p>\n<pre><code>- (void) applicationDidFinishLaunching: (NSNotification *)notification {\n strings = [NSMutableArray array];\n NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);\n NSString *documentsDirectory = [paths objectAtIndex:0];\n logPath = [documentsDirectory stringByAppendingPathComponent:@&quot;mylog.txt&quot;];\n}\n\n</code></pre>\n"^^ . . . . . "Passing an @objc enum to dictionary value will causes an allocate issue?"^^ . . "0"^^ . "I’d recommend sharing, for one of the tabs, (a) the asset from the assets library; and (b) the corresponding asset downloaded by the data task (e.g., write the `Data` received to a file). But, in short, see [HIG – Tab bars – Target dimensions](https://developer.apple.com/design/human-interface-guidelines/tab-bars#Target-dimensions) for recommended asset dimensions. Your images look like they are some smaller size that has been scaled to fit the UI."^^ . "ipad"^^ . "2"^^ . "1"^^ . "<p>I uploaded a 2-minute audio file, and the transcript results began after half of the audio was processed. However, the result.formattedString started a new string instead of appending to the already transcribed text.</p>\n<p>This issue occur only onDeviceTranscript, How to fix it? <a href="https://i.sstatic.net/yTHAV.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/yTHAV.png" alt="enter image description here" /></a></p>\n<pre><code>NSLocale *locale =[[NSLocale alloc] initWithLocaleIdentifier:[[NSLocale preferredLanguages] firstObject]];\n SFSpeechRecognizer* recognizer = [[SFSpeechRecognizer alloc] initWithLocale:locale];\n SFSpeechURLRecognitionRequest* request = [[SFSpeechURLRecognitionRequest alloc] initWithURL:[NSURL fileURLWithPath:filePath]];\n\n if(device){\n request.requiresOnDeviceRecognition = YES;\n }\n\n [recognizer recognitionTaskWithRequest:request resultHandler:^(SFSpeechRecognitionResult * _Nullable result, NSError * _Nullable error) {\n if (error) {\n convertedString(textString);\n }\n else {\n textString = [[result bestTranscription] formattedString];\n }\n if (result.isFinal)\n {\n convertedString([[result bestTranscription] formattedString]);\n }\n }];\n</code></pre>\n"^^ . "2"^^ . "0"^^ . . . "1"^^ . . "Are your apps sandboxed? Docs for the `arguments` property of `NSWorkspaceOpenConfiguration ` say "If the calling process is sandboxed, the system ignores the value of this property.""^^ . . . . . . . . "My text fields get to become editable, but 1. Command-C won't copy its value, even after "Select All" from the "Edit" menu, Cmd-A will intermittently select text - many times it won't."^^ . "Yes, `po` doesn't work in Swift. See [What's the difference between "p" and "po" in Xcode's LLDB debugger?](https://stackoverflow.com/questions/28806423/whats-the-difference-between-p-and-po-in-xcodes-lldb-debugger)."^^ . . . . . "Why does Swift FileManager.default.urls(...) return a different result than ObjC implementation (iOS simulator)?"^^ . "0"^^ . . "0"^^ . . "0"^^ . . . "0"^^ . . "cocoa"^^ . . . . . "malloc"^^ . "0"^^ . . "0"^^ . "0"^^ . . . "1"^^ . . . . "0"^^ . "@DonMag is true, I created a project from scratch and the font is available. But there is no missing steps in my main project. Any ideas?"^^ . . . "Some things (edibility of text field) I want for both states (popover or torn-window). \nOthers (resizability) I only want for the "torn" (detached) state."^^ . "UITabbar item image Downloaded from server shows blur but if use same image from assets folder it works fine"^^ . . "0"^^ . "1"^^ . "1"^^ . . . "1"^^ . . . . "Swift lldb cannot print NSDictionary and NSArray"^^ . . "<p>I wrote an application in Qt for macOS &amp; Windows. Now we want to communicate with that app from the browser using custom protocols. As it seems not possible to add this to Qt I tried to build a Cocoa helper app that just receives the message created in the browser from macOS using a custom protocol. That so far works and was simple.</p>\n<p>But I can't manage to get it to open a document in my (separate Qt) application.</p>\n<p>Trial 1:</p>\n<pre><code>void launchApplicationBundleWithArguments(NSString *bundleIdentifier, NSString *executablePath, NSArray&lt;NSString *&gt; *arguments) \n{\n NSWorkspace *workspace = [NSWorkspace sharedWorkspace];\n NSURL *url = [workspace URLForApplicationWithBundleIdentifier:bundleIdentifier];\n \n if (url) {\n NSError *error = nil;\n \n NSDictionary *configuration = @{NSWorkspaceLaunchConfigurationArguments: launchArguments};\n \n if (![workspace launchApplicationAtURL:url options:NSWorkspaceLaunchDefault configuration:configuration error:&amp;error]) {\n NSLog(@&quot;Error launching application: %@&quot;, error);\n } \n } else {\n NSLog(@&quot;Application bundle with identifier %@ not found&quot;, bundleIdentifier);\n }\n}\n</code></pre>\n<p>This launches my application, but won't send the file's path (stored in arguments) to the command line of my main application. No error is reported.</p>\n<p>Trial 2:</p>\n<pre><code>NSWorkspaceOpenConfiguration* configuration = [NSWorkspaceOpenConfiguration new];\n[configuration setArguments: launchArguments];\n [configuration setPromptsUserIfNeeded: YES];\n [workspace openApplicationAtURL: [NSURL fileURLWithPath: executablePath] configuration: configuration completionHandler:^(NSRunningApplication* app, NSError* error) {\n if (error) {\n NSLog(@&quot;Failed to run the app: %@&quot;, error.localizedDescription);\n }\n }];\n</code></pre>\n<p>This fails with a message box saying that my helper application does not have sufficient access rights to start the other application.</p>\n<p>How can this be done?</p>\n"^^ . "-1"^^ . . . . . . . "0"^^ . . "After careful review and corrections, my problem appears to be resolved! Thanks!"^^ . . "<p>React Native Async Storage calls the following method to find an appropriate directory in the Simulator's file system:\n<code>NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) .firstObject</code></p>\n<p>By opening Finder, it can be observed this evaluates on my machine to <code>~/Library/Developer/CoreSimulator/Devices/6A36BEDF-71DA-4A9B-9CDD-EBC6BCE11BC0/data/Containers/Data/Application/D258BA62-85FF-4288-95BF-D1318C63B947/Library/Application Support/</code></p>\n<p>I now hope, in my SwiftUI extension widget for the same React Native iOS app, to access this folder. But when I call <code>FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first</code>, this evaluates to <code>/Users/brandon/Library/Developer/CoreSimulator/Devices/6A36BEDF-71DA-4A9B-9CDD-EBC6BCE11BC0/data/Library/Application Support/</code></p>\n<p>As you can see, the results for these are quite different. Why does the Swift method appear to find a different folder and how I can I alter it to access the one the ObjC method finds?</p>\n<p>I'm expecting the Swift code to evaluate to the same as that generated by React Native Async Storage in ObjC</p>\n"^^ . "ios"^^ . "Does the data on the stack need to be of a constant size or can the size be determined using a variable that can change depending on the previous code? Thanks for explaining the difference, it makes more sense now. I am experienced with managed languages so I'm not used to manual memory management. If I try to use `free(buffer)`I get an error "Expected expression" and the description of the free function is "free(void *) Frees all of the resources allocated by the IOAudioPort". Could it be that I have to use an alternative to free in Objective-C?"^^ . . "In objective-c SFSpeechRecognizer resultHandler is not work properly when request type is OnDeviceTranscript?"^^ . "@trojanfoe, I have updated my question which might help you to get clear idea about my requirements"^^ . "ip-address"^^ . . "<p>There are some ways for creating a circular progress bar in iOS (<a href="https://thulzmtetwa.medium.com/how-to-create-a-circular-progress-bar-using-uikit-swift-ios-6154470b28ef" rel="nofollow noreferrer">Example</a>).</p>\n<p><a href="https://i.sstatic.net/e50YJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/e50YJ.png" alt="enter image description here" /></a></p>\n<p>But I'd like to achieve an effect where the head of the progressbar is rounded and the progress alpha fades along the way. Something like this:</p>\n<p><a href="https://i.sstatic.net/SBZwY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/SBZwY.png" alt="enter image description here" /></a></p>\n<p>Any ideas how can achieve this kind of effects?</p>\n"^^ . . "nsrunloop"^^ . . . . . . . . . "sfspeechrecognizer"^^ . . . "<p>tl;dr</p>\n<p>There are several problems with this run loop code. But, if the intent was simply to run a timer on a dispatch queue, we would generally use a <a href="https://developer.apple.com/documentation/dispatch/dispatch_source?language=objc" rel="nofollow noreferrer">dispatch source</a> timer, eliminating much of this confusion.</p>\n<hr />\n<p>The typical run loop pattern entails creating a dedicated thread, getting a run loop for that thread, and calling one of the “run” methods to spin on that thread, processing run loop events, such as timer events. (See point 2 in <a href="https://stackoverflow.com/a/38031658/1271826">this answer</a> for an example.)</p>\n<p>A dispatch queue is a different approach. When we dispatch a “work item” to a dispatch queue, that queue will fetch a (random) worker thread from a pool of threads, run that work item on that worker thread, and, when the work item is done, return that worker thread to the thread pool, making it available for future dispatches.</p>\n<p>So that leads us to several observations regarding your code snippet:</p>\n<ol>\n<li><p>The dispatch to <code>queue1</code> makes no sense. You print a run loop, but do not “run” on it, but instead just finish, thereby returning the worker thread to the thread pool. That thread is now available to be used again by future GCD dispatches. It would have only made sense if you spun on that run loop with a “run” method, thereby tying that thread to that run loop and preventing GCD from reusing that thread.</p>\n</li>\n<li><p>Using a concurrent queue in this context is confusing. Run loops spin on a given thread. Creating a <em>concurrent</em> queue for this purpose makes no sense. What work will be done concurrently on that queue while the run loop spins on one of the worker threads? It suggests a conceptual misunderstanding of how run loops work.</p>\n</li>\n<li><p>The idea of indefinitely spinning on a run loop on a GCD worker thread, at all, is ill-advised. The general concept of dispatch queues is that they achieve efficiency by fetching an existing worker thread from the pool, performing the work item, and returning that thread to the pool. The idea of indefinitely tying up a worker thread is arguably antithetical to the motivating idea behind GCD. You can do it, but generally, we would avoid tying up a GCD worker thread indefinitely.</p>\n</li>\n<li><p>If you are academically interested in how run loops work, this exploration is fine. But if you intended to just run a timer on a dispatch queue, then run loops and <code>NSTimer</code> is an antiquated, pre-GCD approach. A dispatch timer would be much simpler (see below).</p>\n</li>\n</ol>\n<hr />\n<p>If you want to run something on a dispatch queue, we generally do not use <code>NSTimer</code>. Instead, we would use a dispatch timer. That requires no run loop at all.</p>\n<p>Unlike a <code>NSTimer</code> we need to keep our own strong reference to the timer:</p>\n<pre class="lang-objectivec prettyprint-override"><code>@property (nonatomic, strong) dispatch_source_t timer;\n</code></pre>\n<p>Then, to start a timer:</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (void)startTimer {\n dispatch_queue_t queue = dispatch_queue_create(&quot;com.domain.app.timer&quot;, DISPATCH_QUEUE_SERIAL);\n self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);\n dispatch_source_set_timer(self.timer, DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC, 0.1 * NSEC_PER_SEC);\n dispatch_source_set_event_handler(self.timer, ^{\n // this is called when the timer fires\n });\n dispatch_resume(self.timer);\n}\n</code></pre>\n<p>To stop the timer, release it:</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (void)stopTimer {\n self.timer = nil;\n}\n</code></pre>\n"^^ . "0"^^ . . . . . . . . . . . . "0"^^ . "kotlin-multiplatform"^^ . "presentmodalviewcontroller"^^ . . . . . "1"^^ . . . "0"^^ . . "<p>The .pch file is prepended to every file you compile (c, c++, or objc) for that target, so if you are importing an ObjC header, it should be inside the <code>#ifdef __OBJC__</code> section. Otherwise the import will be unknown to non-objc files being compiled. Foundation/Foundation.h is an ObjC specific header.</p>\n"^^ . . . . . "1"^^ . "uploaded i tried swift code"^^ . "0"^^ . "yes, I used UISheetPresentationController"^^ . "I don't have knowledge of cmake. Also in my command I have specified --macos_archs but not sure like you said why it cross-compiled binaries for Linux. Are you sure?"^^ . . . . . "How to save a part of a string that does not have a fixed lenght in objective C?"^^ . . . "avfoundation"^^ . . . . . "<blockquote>\n<p>the issue seems to be that objective-c doesn't have an equivalent to content.updating(from: intent)</p>\n</blockquote>\n<p>Try <a href="https://developer.apple.com/documentation/usernotifications/unnotificationcontent/updating(from:)?language=objc" rel="nofollow noreferrer"><code>contentByUpdatingWithProvider:error:</code></a>. It should be equivalent to <code>updating(from:)</code>.</p>\n"^^ . "0"^^ . . . "freeze"^^ . "0"^^ . . . . . . . "unit-testing"^^ . "Looks like a threading issue related to navigation"^^ . . . . "0"^^ . "0"^^ . "<p>I am trying to get iOS communication notifications working in objective-C and no matter which variations I try, the icon keeps getting attached as attachment and not as notification icon</p>\n<pre><code>#import &lt;OneSignalFramework/OneSignalFramework.h&gt;\n#import &lt;Intents/Intents.h&gt;\n#import &lt;UserNotifications/UserNotifications.h&gt;\n#import &quot;NotificationService.h&quot;\n\n@interface NotificationService ()\n\n@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);\n@property (nonatomic, strong) UNNotificationRequest *receivedRequest;\n@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;\n\n@end\n\n@implementation NotificationService\n\n- (INSendMessageIntent *)genMessageIntentFromRequest:(UNNotificationRequest *)request {\n NSDictionary *custom = request.content.userInfo[@&quot;custom&quot;];\n if (![custom isKindOfClass:[NSDictionary class]]) {\n return nil;\n }\n\n NSDictionary *a = custom[@&quot;a&quot;];\n if (![a isKindOfClass:[NSDictionary class]]) {\n return nil;\n }\n\n NSString *name = a[@&quot;name&quot;];\n NSString *urlString = a[@&quot;url&quot;];\n if (!name || !urlString) {\n return nil;\n }\n\n NSURL *url = [NSURL URLWithString:urlString];\n if (!url) {\n return nil;\n }\n\n INPersonHandle *handle = [[INPersonHandle alloc] initWithValue:nil type:INPersonHandleTypeUnknown];\n INImage *avatar = [INImage imageWithURL:url];\n INPerson *sender = [[INPerson alloc] initWithPersonHandle:handle\n nameComponents:nil\n displayName:name\n image:avatar\n contactIdentifier:nil\n customIdentifier:nil];\n\n if (@available(iOSApplicationExtension 14.0, *)) {\n return [[INSendMessageIntent alloc] initWithRecipients:nil\n outgoingMessageType:INOutgoingMessageTypeOutgoingMessageText\n content:nil\n speakableGroupName:nil\n conversationIdentifier:nil\n serviceName:nil\n sender:sender\n attachments:nil];\n } else {\n // Fallback on earlier versions\n return nil;\n }\n}\n\n- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {\n self.receivedRequest = request;\n self.contentHandler = contentHandler;\n self.bestAttemptContent = [request.content mutableCopy];\n \n NSDictionary *userInfo = request.content.userInfo;\n NSLog(@&quot;Payload: %@&quot;, userInfo);\n \n if (@available(iOSApplicationExtension 15.0, *)) {\n INSendMessageIntent *intent = [self genMessageIntentFromRequest:request];\n if (intent) {\n INInteraction *interaction = [[INInteraction alloc] initWithIntent:intent response:nil];\n interaction.direction = INInteractionDirectionIncoming;\n\n [interaction donateInteractionWithCompletion:^(NSError * _Nullable error) {\n if (error == nil) {\n if (self.bestAttemptContent) {\n self.bestAttemptContent.title = intent.sender.displayName;\n self.bestAttemptContent.subtitle = self.bestAttemptContent.title;\n self.bestAttemptContent.body = self.bestAttemptContent.body;\n\n NSString *urlString = userInfo[@&quot;custom&quot;][@&quot;a&quot;][@&quot;url&quot;];\n NSURL *imageURL = [NSURL URLWithString:urlString];\n [self downloadImageFromURL:imageURL completion:^(UNNotificationAttachment *attachment) {\n if (attachment) {\n self.bestAttemptContent.attachments = @[attachment];\n }\n [self forwardRequestToExtension];\n }];\n } else {\n [self forwardRequestToExtension];\n }\n } else {\n [self forwardRequestToExtension];\n }\n }];\n } else {\n [self forwardRequestToExtension];\n }\n } else {\n [self forwardRequestToExtension];\n }\n}\n\n- (void)downloadImageFromURL:(NSURL *)url completion:(void (^)(UNNotificationAttachment *))completion {\n NSURLSessionDataTask *downloadTask = [[NSURLSession sharedSession] dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n if (data &amp;&amp; !error) {\n NSString *tempDirectory = NSTemporaryDirectory();\n NSString *imagePath = [tempDirectory stringByAppendingPathComponent:@&quot;image.jpg&quot;];\n [data writeToFile:imagePath atomically:YES];\n NSURL *imageURL = [NSURL fileURLWithPath:imagePath];\n UNNotificationAttachment *attachment = [UNNotificationAttachment attachmentWithIdentifier:@&quot;media&quot; URL:imageURL options:nil error:nil];\n completion(attachment);\n } else {\n completion(nil);\n }\n }];\n [downloadTask resume];\n}\n\n- (void)forwardRequestToExtension {\n if (self.receivedRequest &amp;&amp; self.bestAttemptContent) {\n [OneSignal didReceiveNotificationExtensionRequest:self.receivedRequest\n withMutableNotificationContent:self.bestAttemptContent\n withContentHandler:self.contentHandler];\n }\n}\n\n- (void)serviceExtensionTimeWillExpire {\n if (self.contentHandler &amp;&amp; self.bestAttemptContent) {\n [OneSignal serviceExtensionTimeWillExpireRequest:self.receivedRequest withMutableNotificationContent:self.bestAttemptContent];\n self.contentHandler(self.bestAttemptContent);\n }\n}\n\n@end\n</code></pre>\n<p>the interesting part is that I have no issue of making it work with Swift and the following code</p>\n<pre><code>import UserNotifications\nimport Intents\nimport OneSignalExtension\n\nclass NotificationService: UNNotificationServiceExtension {\n \n private var contentHandler: ((UNNotificationContent) -&gt; Void)?\n private var receivedRequest: UNNotificationRequest?\n private var bestAttemptContent: UNMutableNotificationContent?\n\n private func genMessageIntent(from request: UNNotificationRequest) -&gt; INSendMessageIntent? {\n guard let custom = request.content.userInfo[&quot;custom&quot;] as? [String: Any],\n let a = custom[&quot;a&quot;] as? [String: Any],\n let name = a[&quot;name&quot;] as? String, // Name that will appear\n let urlString = a[&quot;url&quot;] as? String, // Photo that will appear\n let url = URL(string: urlString) else {\n return nil\n }\n\n let handle = INPersonHandle(value: nil, type: .unknown)\n let avatar = INImage(url: url)\n let sender = INPerson(personHandle: handle, nameComponents: nil, displayName: name, image: avatar, contactIdentifier: nil, customIdentifier: nil)\n\n if #available(iOSApplicationExtension 14.0, *) {\n return INSendMessageIntent(\n recipients: nil,\n outgoingMessageType: .outgoingMessageText,\n content: nil,\n speakableGroupName: nil,\n conversationIdentifier: nil,\n serviceName: nil,\n sender: sender,\n attachments: nil\n )\n } else {\n // Fallback on earlier versions\n return nil\n }\n }\n \n override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -&gt; Void) {\n self.receivedRequest = request\n self.contentHandler = contentHandler\n self.bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)\n \n let userInfo = request.content.userInfo\n print(&quot;Payload:&quot;, userInfo)\n\n \n if #available(iOSApplicationExtension 15.0, *) {\n guard let intent = genMessageIntent(from: request) else {\n forwardRequestToExtension()\n return\n }\n \n let interaction = INInteraction(intent: intent, response: nil)\n interaction.direction = .incoming\n \n interaction.donate { [weak self] error in\n guard let self = self, error == nil else { return }\n \n do {\n let content = try request.content.updating(from: intent)\n self.bestAttemptContent = (content.mutableCopy() as? UNMutableNotificationContent)\n self.forwardRequestToExtension()\n } catch {\n // Handle errors appropriately\n }\n }\n } else {\n forwardRequestToExtension()\n }\n }\n\n private func forwardRequestToExtension() {\n guard let receivedRequest = receivedRequest, let bestAttemptContent = bestAttemptContent else { return }\n OneSignalExtension.didReceiveNotificationExtensionRequest(receivedRequest, with: bestAttemptContent, withContentHandler: contentHandler)\n }\n \n override func serviceExtensionTimeWillExpire() {\n guard let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent else { return }\n OneSignalExtension.serviceExtensionTimeWillExpireRequest(receivedRequest!, with: bestAttemptContent)\n contentHandler(bestAttemptContent)\n }\n}\n</code></pre>\n<p>the issue seems to be that objective-c doesn't have an equivalent to <code>content.updating(from: intent)</code> and all answers I have been able to find have not worked for me. I need it in objective-c because onesignal-expo-plugin is in objective-c</p>\n"^^ . "<p>I´ve created a basic iPhone application for iOS 17.5 using XCode where I would like to scan a PIV card (ID06) and just log the result. I´ve tried to minimize the code as much as possible, but whatever I do I receive:</p>\n<blockquote>\n<p>-[NFCTagReaderSession _connectTag:error:]:744 Error Domain=NFCError Code=2 &quot;Missing required entitlement&quot;\nUserInfo={NSLocalizedDescription=Missing required entitlement}</p>\n</blockquote>\n<p>after I`ve connected to the card.</p>\n<p>I`ve tripplechecked the signing certificate to include NFC option in Apple developer portal, and also deleted the certificate locally on my computer to be sure it uses the latest.</p>\n<p>Here´s my ViewController:</p>\n<p><strong>ViewController.h</strong></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n#import &lt;CoreNFC/CoreNFC.h&gt;\n\n@interface ViewController : UIViewController &lt;NFCTagReaderSessionDelegate&gt;\n\n@property (nonatomic, strong) NFCTagReaderSession *nfcSession;\n\n@end\n</code></pre>\n<p><strong>Viewcontroller.m</strong></p>\n<pre><code>#import &quot;ViewController.h&quot;\n\n@implementation ViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n [self startScanning];\n}\n\n- (void)startScanning {\n self.nfcSession = [[NFCTagReaderSession alloc] initWithPollingOption:NFCPollingISO14443 delegate:self queue:nil];\n self.nfcSession.alertMessage = @&quot;Hold your iPhone near the NFC tag.&quot;;\n [self.nfcSession beginSession];\n}\n\n- (void)tagReaderSession:(NFCTagReaderSession *)session didDetectTags:(NSArray&lt;__kindof id&lt;NFCTag&gt;&gt; *)tags {\n id&lt;NFCTag&gt; tag = [tags firstObject];\n \n [session connectToTag:tag completionHandler:^(NSError * _Nullable error) {\n if (error != nil) {\n [session invalidateSessionWithErrorMessage:@&quot;Connection failed&quot;];\n return;\n }\n \n id&lt;NFCISO7816Tag&gt; iso7816Tag = [tag asNFCISO7816Tag];\n NSLog(@&quot;Connected: %@&quot;, iso7816Tag);\n \n // FOLLOWING APDU COMMAND CAN BE REMOVED, THE RESULT IS THE SAME\n NSData *readCertCommandData = [NSData dataWithBytes:(unsigned char[]){0x00, 0xB0, 0x00, 0x00, 0x10} length:5];\n NFCISO7816APDU *readCertCommand = [[NFCISO7816APDU alloc] initWithInstructionClass:0x00\n instructionCode:0xB0\n p1Parameter:0x00\n p2Parameter:0x00\n data:readCertCommandData\n expectedResponseLength:256];\n\n [iso7816Tag sendCommandAPDU:readCertCommand completionHandler:^(NSData *responseData, uint8_t sw1, uint8_t sw2, NSError * _Nullable error) {\n if (error) {\n NSLog(@&quot;Error sending read certificate APDU: %@&quot;, error.localizedDescription);\n [self.nfcSession invalidateSessionWithErrorMessage:@&quot;Session invalidated&quot;];\n } else {\n NSLog(@&quot;Read Certificate Response Data: %@&quot;, responseData);\n NSLog(@&quot;Status Word: %02X %02X&quot;, sw1, sw2);\n [self.nfcSession invalidateSession];\n }\n }];\n }];\n}\n\n- (void)tagReaderSessionDidBecomeActive:(NFCTagReaderSession *)session {\n NSLog(@&quot;NFC session did become active&quot;);\n}\n\n- (void)tagReaderSession:(NFCTagReaderSession *)session didInvalidateWithError:(NSError *)error {\n NSLog(@&quot;NFC session did invalidate with error: %@&quot;, error.localizedDescription);\n}\n\n@end\n</code></pre>\n<p>And also my .entitlements:</p>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;\n&lt;plist version=&quot;1.0&quot;&gt;\n&lt;dict&gt;\n &lt;key&gt;com.apple.developer.nfc.readersession.formats&lt;/key&gt;\n &lt;array&gt;\n &lt;string&gt;TAG&lt;/string&gt;\n &lt;string&gt;NDEF&lt;/string&gt;\n &lt;/array&gt;\n&lt;/dict&gt;\n&lt;/plist&gt;\n</code></pre>\n<p>And my Info.plist:</p>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;\n&lt;plist version=&quot;1.0&quot;&gt;\n&lt;dict&gt;\n &lt;key&gt;NFCReaderUsageDescription&lt;/key&gt;\n &lt;string&gt;Need NFC to scan&lt;/string&gt;\n &lt;key&gt;com.apple.developer.nfc.readersession.iso7816.select-identifiers&lt;/key&gt;\n &lt;array&gt;\n &lt;string&gt;A000000116071&lt;/string&gt;\n &lt;/array&gt;\n&lt;/dict&gt;\n&lt;/plist&gt;\n</code></pre>\n<p>The log when executing this on my iPhone 15 Pro Max (iOS 17.5.1):</p>\n<pre><code>NFC session did become active\n-[NFCTagReaderSession _connectTag:error:]:744 Error Domain=NFCError Code=2 &quot;Missing required entitlement&quot;\nUserInfo={NSLocalizedDescription=Missing required entitlement}\nConnected: &lt;NFCISO7816Tag: 0x30159d300&gt;\nError sending read certificate APDU: Session invalidated\nNFC session did invalidate with error: Session invalidated by user\n</code></pre>\n<p>So question is, why does it connect to the card, but then invalidate the session right after?</p>\n<p>Any help is appreciated, I`m out of ideas!</p>\n"^^ . "0"^^ . "How is it possible to pause the execution of `viewDidLoad` while in the middle of it? I thought you have to complete this function in order for main queue to pick up the next task. Or am i understanding it incorrectly? Also what did I do differently from the link I provided?"^^ . "opencv"^^ . . "Now I follow you! I can reuse entityObj after I save a record by writing: entityObj = [NSEntityDescription insertNewObjectForEntityForName:@"MyEntity" inManagedObjectContext:myContext]; Then fill the record with new data and save it again. Still, this Core Data stuff is hard to wrap your head around."^^ . . . . "<p>If you want to code objective-c or include objective-c headers in a C++ file, you need to rename the <code>.cc</code> or <code>.cpp</code> file extension to <code>.mm</code>.</p>\n<blockquote>\n<p>In my .cpp file I've also included this:</p>\n<pre><code>#if defined(SDL_PLATFORM_MACOS)\n#include &lt;Cocoa/Cocoa.h&gt;\n#include &lt;Foundation/Foundation.h&gt;\n#include &lt;QuartzCore/CAMetalLayer.h&gt;\n</code></pre>\n</blockquote>\n<p>You're including objective-c headers in a c++ file. I recommend following the link in <a href="https://stackoverflow.com/a/3684159/7033336">this stackoverflow answer</a></p>\n"^^ . "<p>I am trying to create a simple database table of records using Core Data and Objective-C. I understand that instances of NSManagedObject is what I store those records in, but how many entity records can I store in a single NSManagedObject? If only one, then how do I declare multiple instances of NSManagedObjects with unique identifiers for, in this example 'entityObj', which must be provided by the user at runtime?</p>\n<p>In this example, MyEntity contains three NSString attributes (city, county, name). Here's how I'm declaring an NSManagedObject.</p>\n<pre><code> NSManagedObject *entityObj = [NSEntityDescription insertNewObjectForEntityForName:@&quot;MyEntity&quot; inManagedObjectContext:myContext];\n \n // fill the entityObj with data\n [entityObj setValue:@&quot;Edmonton&quot; forKey:@&quot;city&quot;];\n [entityObj setValue:@&quot;Canada&quot; forKey:@&quot;country&quot;];\n [entityObj setValue:@&quot;Bill&quot; forKey:@&quot;name&quot;];\n \n</code></pre>\n<p>This stores one record of data, but I need to store more of them. How can I specify the value of 'entityObj' at runtime? I tried saving one record, reusing the same 'entityObj' with new data and saving again, but that just replaces the contents of the previous record. Is there a way I can store more than one of these records in a single NSManagedObject? Intuitively, I'm thinking I might be able to make my NSManagedObject an array of MyEntity records. `</p>\n"^^ . . . . "1"^^ . . . "1"^^ . "1"^^ . "<p>This is a follow on question from <a href="https://stackoverflow.com/questions/78478022/how-to-obtain-updated-timezone-identifiers-on-macos">this question</a>.</p>\n<p>I have this test program that I am using to debug a larger cross-language program (Go/Obj-C).</p>\n<pre><code>#include &lt;Foundation/Foundation.h&gt;\n\nint main() {\n while (1) {\n const char *tz = [[[NSCalendar autoupdatingCurrentCalendar] timeZone] name] UTF8String];\n printf(&quot;%s\\n&quot;, tz);\n sleep(1);\n }\n}\n</code></pre>\n<p>From the <a href="https://developer.apple.com/documentation/foundation/nscalendar/1413771-autoupdatingcurrentcalendar#discussion" rel="nofollow noreferrer">documentation</a></p>\n<blockquote>\n<p>Settings you get from this calendar do change as the user’s settings change (contrast with <a href="https://developer.apple.com/documentation/foundation/nscalendar/1408501-currentcalendar" rel="nofollow noreferrer">currentCalendar</a>).</p>\n<p>Note that if you cache values based on the calendar or related information those caches will of course not be automatically updated by the updating of the calendar object.</p>\n</blockquote>\n<p>I would expect running this program and then, while it is running changing the time zone in settings, would result in the printed time zone identifier to follow the changes. This does not happen (Running a single iteration and looping in the shell does work as expected since presumably the program is obtaining an environment at program start). I am not caching anything here.</p>\n<p>Is there something that I need to do to make this follow the the current time zone?</p>\n"^^ . . "crashlytics"^^ . . . . . "0"^^ . . . . "2"^^ . . "0"^^ . . . . . . . . . . . . . . . "kortschak, FWIW, when you are looking at the Apple documentation, in the upper right hand corner, it will tell you whether it is Swift documentation or Objective-C documentation (and if it is some type available from both languages, you can toggle back and forth between them)."^^ . . . . "All of the types are listed in the docs. Maybe https://developer.apple.com/documentation/uniformtypeidentifiers/uttype/3551579-text ?"^^ . . . . . . . "tauri"^^ . "0"^^ . "1"^^ . "0"^^ . . "1"^^ . "Thanks Rob. In the C code I have a second sleep, which should give things enough time to update, and in the actual Go program, we have sleep and numerous syscalls and GC that would also be relinquishing time to the OS, so I would have thought we'd see the expected behaviour, but we don't."^^ . . . "Error: Unnamed type used 'BOOL' in iOS project XCode"^^ . "<p>I have an NSTableView where the user clicks a button to add a new row. This goes to an IBAction that inserts an object in the NSArrayController and then uses editColumn:row:withEvent:select: to put the new row into edit mode for the user.</p>\n<p>The problem is that once editColumn:row:withEvent:select: is fired all rows in the tableview turn gray, ie the tableview loses focus. I've tried reseting first responder before and after calling editColumn but nothing works. Once the new row is inserted and everything turns gray I have to select rows one at a time before their text will turn normal (black) again.</p>\n<p>How can I programmatically set a row/column to edit mode without this happening?</p>\n<pre><code>-(IBAction)addAttribute:(id)sender\n {\n TKSpecialObject *theObject = [TKSpecialObject new];\n [self.myArrayController insertObject:theObject atArrangedObjectIndex:self.myArrayController.count];\n [self.view.window makeFirstResponder:theTableView];\n [self.myTableView editColumn:0 row:[self.myTableView selectedRow] withEvent:nil select:YES]; \n }\n</code></pre>\n<p><a href="https://i.sstatic.net/oF7kppA4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/oF7kppA4.png" alt="enter image description here" /></a></p>\n"^^ . "0"^^ . "<p>I'm building a Swift Package distributed in the form of an XCFramework.</p>\n<p>Importing the resulting binary inside a Swift application works just fine, but trying to import it inside of an Objective-c application does not. (<code>file not found</code> or <code>module not found</code> at import statement).</p>\n<p>For testing purpose, I just drag n drop the XCFramework into my projects to import it.</p>\n<p>What am I missing?</p>\n<p>Here is the Swift Package definition:</p>\n<pre class="lang-swift prettyprint-override"><code>let package = Package(\n name: &quot;MySDK&quot;,\n platforms: [.iOS(.v14)],\n products: [\n .library(\n name: &quot;MySDK&quot;,\n type: .dynamic,\n targets: [&quot;MySDK&quot;]),\n ],\n targets: [\n .target(\n name: &quot;MySDK&quot;),\n .testTarget(\n name: &quot;MySDKTests&quot;,\n dependencies: [&quot;MySDK&quot;]),\n ]\n)\n</code></pre>\n<p>and here is the build script, using <code>xcodebuild</code> (there is no intermediate Xcode project):</p>\n<pre class="lang-bash prettyprint-override"><code># Build for iOS simulator\nxcodebuild \\\n -workspace ${WORKSPACE} \\\n -scheme ${SCHEME} \\\n -configuration ${CONFIGURATION} \\\n -destination &quot;generic/platform=iOS Simulator&quot; \\\n -archivePath &quot;${BUILD_DIR}/archives/${SCHEME}-Simulator&quot; \\\n BUILD_DIR=${BUILD_DIR} \\\n SKIP_INSTALL=NO \\\n DEFINES_MODULE=YES \\\n SWIFT_INSTALL_OBJC_HEADER=YES \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n OTHER_SWIFT_FLAGS=&quot;-DCOCOAPODS&quot;\n\n# Build for iOS device\nxcodebuild \\\n -workspace ${WORKSPACE} \\\n -scheme ${SCHEME} \\\n -configuration ${CONFIGURATION} \\\n -destination &quot;generic/platform=iOS&quot; \\\n -archivePath &quot;${BUILD_DIR}/archives/${SCHEME}-Device&quot; \\\n BUILD_DIR=${BUILD_DIR} \\\n SKIP_INSTALL=NO \\\n DEFINES_MODULE=YES \\\n SWIFT_INSTALL_OBJC_HEADER=YES \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n OTHER_SWIFT_FLAGS=&quot;-DCOCOAPODS&quot;\n\n######################\n# Create universal xcframework\n######################\nxcodebuild -create-xcframework \\\n -framework ${SCHEME}/${BUILD_DIR}/Release-iphoneos/PackageFrameworks/${SCHEME}.framework \\\n -framework ${SCHEME}/${BUILD_DIR}/Release-iphonesimulator/PackageFrameworks/${SCHEME}.framework \\\n -output ${SCHEME}/${BUILD_DIR}/${SCHEME}.xcframework\n\n# Add SwiftModules to XCframework\nmkdir ${SCHEME}/${BUILD_DIR}/${SCHEME}.xcframework/ios-arm64/${SCHEME}.framework/Modules\ncp -r ${SCHEME}/${BUILD_DIR}/Release-iphoneos/${SCHEME}.swiftmodule ${SCHEME}/${BUILD_DIR}/${SCHEME}.xcframework/ios-arm64/${SCHEME}.framework/Modules/\n\nmkdir ${SCHEME}/${BUILD_DIR}/${SCHEME}.xcframework/ios-arm64_x86_64-simulator/${SCHEME}.framework/Modules\ncp -r ${SCHEME}/${BUILD_DIR}/Release-iphonesimulator/${SCHEME}.swiftmodule ${SCHEME}/${BUILD_DIR}/${SCHEME}.xcframework/ios-arm64_x86_64-simulator/${SCHEME}.framework/Modules/\n\n</code></pre>\n"^^ . . . "I may have some trouble understanding "transferred the execution back to the run loop". Can the execution of a function be paused (and then execute another function) without switching thread? I am always under the impression that the execution of a function can be paused when switching thread (aka thread context switch), but didn't know that it's also possible within one thread. that's surprising."^^ . . . . . . . . "1"^^ . "0"^^ . "xcode"^^ . . "0"^^ . . "0"^^ . . . "uidocumentpickerviewcontroller"^^ . "1"^^ . . "0"^^ . . "I got the solution, added as answer for the question. thank you Vadim Belyaev."^^ . "3"^^ . "0"^^ . "Hi @trojanfoe, I have debugged it with break point in XCODE. testHandler was called but uncaughtExceptionhandler wasn't."^^ . "1"^^ . "applepay"^^ . . "1"^^ . "1"^^ . . . . . "0"^^ . . "1"^^ . . "swiftui"^^ . . "<p>I'm updating some old code to avoid deprecated stuff and to use new APIs with UIDocumentPickerViewController. I used to have to list a bunch of custom strings for various file types like so:</p>\n<pre><code>NSArray&lt;NSString*&gt; *types = @[\n (__bridge NSString *)kUTTypePDF,\n (__bridge NSString *)kUTTypeText,\n \n @&quot;com.microsoft.word.doc&quot;,\n @&quot;org.openxmlformats.wordprocessingml.document&quot;,\n \n @&quot;com.microsoft.excel.xls&quot;,\n @&quot;org.openxmlformats.spreadsheetml.sheet&quot;,\n \n @&quot;com.microsoft.powerpoint.ppt&quot;,\n @&quot;org.openxmlformats.presentationml.presentation&quot;,\n \n @&quot;com.apple.iwork.pages.sffpages&quot;,\n @&quot;com.apple.iwork.numbers.sffnumbers&quot;,\n @&quot;com.apple.keynote.key&quot;,\n \n @&quot;public.zip-archive&quot;,\n];\n\nUIDocumentPickerViewController *picker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:types inMode:UIDocumentPickerModeImport];\n</code></pre>\n<p>But I want to use the newer <code>-initForOpeningContentTypes</code> and use <code>UTType</code> which has many more built-in types that also cover lots of forms of those types. For example, instead of having to declare <code>com.microsoft.excel.xls</code> and <code>org.openxmlformats.spreadsheetml.sheet</code> in order to cover xls and xlsx files, I can just declare:</p>\n<pre><code>NSArray&lt;UTType*&gt; *types = @[\n UTTypePDF,\n UTTypeText,\n UTTypePresentation,\n UTTypeSpreadsheet,\n UTTypeZIP,\n [UTType typeWithIdentifier:@&quot;com.microsoft.word.doc&quot;],\n [UTType typeWithIdentifier:@&quot;org.openxmlformats.wordprocessingml.document&quot;],\n [UTType typeWithIdentifier:@&quot;com.apple.iwork.pages.sffpages&quot;],\n];\n\nUIDocumentPickerViewController *picker = [[UIDocumentPickerViewController alloc] initForOpeningContentTypes:types asCopy:YES];\n</code></pre>\n<p>However, I cannot find a built-in <code>UTType</code> that will cover &quot;word processing documents&quot; like doc, docx, and pages. As far as I can tell, I still need to use raw string constants for those, but I'm hoping there is a built-in type I can use and maybe I'm just missing it in the documentation.</p>\n<p>Is there a word-processing doc UTType that covers <code>doc</code>, <code>docx</code>, <code>pages</code>, etc, similar to how <code>UTTypeSpreadsheet</code> covers <code>xls</code>, <code>xlsx</code>, <code>numbers</code>, etc?</p>\n"^^ . . "what happens when you put the #import <Foundation/Foundation.h> inside the #if __OBJC__ section? If there are straight C or C++ files being compiled they may not know what BOOL or other ObjC stuff is."^^ . . . . "0"^^ . . "1"^^ . . . . "swift"^^ . "0"^^ . . "You haven't blocked the main thread because at no time did you call a blocking `wait`. `RunUntilDate` will prevent further execution within `viewDidLoad` but the main run loop is still processing. You have certainly made the UI of your app non-responsive for three seconds. For a deadlock to occur you need three things - Mutual exclusion, no preemption and hold & wait - You don't have "hold & wait" in this case."^^ . . . . "0"^^ . . "ios-frameworks"^^ . "0"^^ . . "0"^^ . . . . . . "-3"^^ . . . . . "how search best epsilon and delta for lcs matrix(what object function)"^^ . . . . . . . "Indirectly, yes. Your completion block is in the run loop timer queue. Because you are keeping the RunLoop running it will eventually call your completion handler. As I said, use `Thread.sleep` instead and you will see a deadlock because you will have blocked the thread and prevented the RunLoop from running."^^ . . . . "2"^^ . . . "tuya"^^ . . . . . . "1"^^ . "2"^^ . "0"^^ . . . . . "0"^^ . "0"^^ . . . "core-data"^^ . . . "0"^^ . . . . . "0"^^ . . . "capacitor"^^ . . . "0"^^ . "0"^^ . "0"^^ . . . "1"^^ . "0"^^ . . "I need the AVCaptureDevice to create the AVCaptureDeviceInput, how will I mock it? The init method of AVCaptureDeviceInput needs a valid AVCaptureDevice. See other question that follows your method: https://stackoverflow.com/questions/56027178/mock-avcapturedeviceinput-for-testing"^^ . . "enumeration"^^ . "The manual insets are required cause this is a scrollview inside a bigger outter scrollview (to adjust views). In this case insets are (0,0,0,0). They are not responsible for the "glitch" (already tried).\nThe headers are not used in my tables. (dont need any sort or drag/drop functions)."^^ . "0"^^ . . "nsautoreleasepool"^^ . "0"^^ . . "1"^^ . "Huh. That's actually NULL. So progress, of sorts."^^ . "Just `typeWithFilenameExtension:` doesn't work?"^^ . . "0"^^ . . "0"^^ . "<p>Your's <code>[NSRunLoop.currentRunLoop runUntilDate...</code> is doing main's runloop job, so deadlock doesn't occur.</p>\n<p>It's secret technic of converting asynchronous functions to synchronous.\nBut you should use it only in emergency cases where converting code to asynchronous is not possible.</p>\n"^^ . . . "0"^^ . . . . . . "security"^^ . "0"^^ . "How to get the Apple Pay Pane in Objective-C on MacOS"^^ . "How do i do that?"^^ . . . . . . . "0"^^ . . "0"^^ . . . . . . . . "For others with equally limited Objective C background, the required header is `<Foundation/Foundation.h>`."^^ . "1"^^ . . . . . . "I don't know. You are the one using the tool"^^ . . . . "<p>For my cross-platform project (Mac &amp; Windows), I coded a generic C++ collection view (i.e. table view) leveraging the NSStackView from the AppKIt in Objective-C (as I can mix ObjC and C++ together easily) on the Mac.</p>\n<p>The individual rows are themselves a horizontal NSStackView, both for the header displaying the column titles and the data rows.</p>\n<p>I also embed a search box and a scroll view to manage large number of data rows.</p>\n<p>The actual view hierarchy is as following:</p>\n<pre><code>NSStackView(vertical)\n L NSSearchField\n L NSStackView(horizontal) - the header row\n L NSScrollView(vertical)\n L NSStackView(vertical)\n L NSStackView(horizontal) - the data row\n L ...\n</code></pre>\n<p>Here's how it looks:</p>\n<p><a href="https://i.sstatic.net/f5BmfUN6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/f5BmfUN6.png" alt="enter image description here" /></a></p>\n<p>The collection view is within a split view on the right.\nWhen I resize the left view, the collection view stick to the split line except for the header row which remains on the RIGHT (see below):</p>\n<p><a href="https://i.sstatic.net/WR1H4ZwX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WR1H4ZwX.png" alt="enter image description here" /></a></p>\n<p>To display hierarchical information, I customized the NSStackView for both collection and list of rows with isFlipped returning YES.</p>\n<p>Here's my code:</p>\n<pre><code>@interface FlippedStackView : NSStackView\n{\n}\n\n- ( id ) initWithBackground: ( BOOL ) value;\n\n- ( BOOL ) isFlipped;\n\n@end\n\n@implementation FlippedStackView\n\n- ( id ) initWithBackground: ( BOOL ) value\n{\n self = [ super init ];\n if( self )\n {\n if( value == YES )\n {\n self.spacing = 0.0;\n [ self.layer setBackgroundColor:[ NSColor windowBackgroundColor ].CGColor ];\n }\n }\n \n return self;\n}\n\n- ( BOOL ) isFlipped\n{\n return YES;\n}\n\n@end\n\n// --------------------\n\n@implementation MacUICollectionView\n\n- ( id ) initWithBackground: ( BOOL ) value\n{\n M_LOG_FUNCTION( MacUICollectionView::initWithBackground )\n \n self = [ super init ];\n if( self )\n {\n // General layout setting\n self.translatesAutoresizingMaskIntoConstraints = NO;\n self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;\n self.orientation = NSUserInterfaceLayoutOrientationVertical;\n self.wantsLayer = YES;\n self.spacing = 0.0;\n \n if( value == YES )\n {\n self.spacing = 0.0;\n [ self.layer setBackgroundColor:[ NSColor windowBackgroundColor ].CGColor ];\n }\n\n // Initialize search field and header values\n _searchField = nil;\n _header = nil;\n\n // Create the scroll view\n NSScrollView * scrollView = [[NSScrollView alloc] init ];\n scrollView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;\n scrollView.hasVerticalScroller = YES;\n scrollView.autohidesScrollers = YES;\n scrollView.drawsBackground = NO;\n\n // Get the contentView of the NSScrollView (which is the NSClipView)\n [ [ scrollView contentView] setDrawsBackground: NO ];\n \n // Create stack view for rows\n _stackViewForRows = [ [ FlippedStackView alloc ] initWithBackground: false ]; // Customize frame size\n _stackViewForRows.translatesAutoresizingMaskIntoConstraints = NO;\n _stackViewForRows.orientation = NSUserInterfaceLayoutOrientationVertical;\n _stackViewForRows.spacing = 0.0;\n\n // Add row stack view to scroll view\n scrollView.documentView = _stackViewForRows;\n \n [ self addView: scrollView inGravity:NSStackViewGravityTop ];\n }\n\n return self;\n}\n\n// --------------------\n\n- ( BOOL ) isFlipped\n{\n M_LOG_FUNCTION( MacUICollectionView::isFlipped )\n \n return YES;\n}\n// --------------------\n\n- ( void ) displaySearchField: ( NSSearchField * ) value\n{\n M_LOG_FUNCTION( MacUICollectionView::displaySearchField )\n \n if( _searchField == value )\n return;\n \n if( _searchField != nil )\n [ self removeView: _searchField ];\n\n if( value != nil )\n {\n [ self insertView: value atIndex: 0 inGravity: NSStackViewGravityLeading ];\n NSNumber * hMargin = @( ( CGFloat ) kMacUIStandardPadding );\n [ self addConstraints: [ NSLayoutConstraint constraintsWithVisualFormat: @&quot;|-&gt;=hMargin-[value]-&gt;=hMargin-|&quot;\n options: 0\n metrics: NSDictionaryOfVariableBindings( hMargin )\n views: NSDictionaryOfVariableBindings( value ) ] ];\n [ self addConstraints: [ NSLayoutConstraint constraintsWithVisualFormat: @&quot;V:|-&gt;=hMargin-[value]-&gt;=hMargin-|&quot;\n options: 0\n metrics: NSDictionaryOfVariableBindings( hMargin )\n views: NSDictionaryOfVariableBindings( value ) ] ];\n }\n _searchField = value;\n}\n\n// --------------------\n\n- ( void ) displayHeader: ( NSView * ) value\n{\n M_LOG_FUNCTION( MacUICollectionView::displayHeader )\n \n if( _header == value )\n return;\n\n if( _header != nil )\n // Remove the header\n [ self removeView: _header ];\n else\n {\n // Add the header\n [ self insertView: value atIndex: ( _searchField == nil ? 0 : 1 ) inGravity: NSStackViewGravityTop ];\n }\n\n _header = value;\n}\n\n// --------------------\n\n- ( void ) addRow: ( NSView * ) value atIndex: ( int ) index\n{\n M_LOG_FUNCTION( MacUICollectionView::addRow )\n \n [ _stackViewForRows insertView: value atIndex: index inGravity: NSStackViewGravityLeading ];\n}\n\n// --------------------\n\n- ( void ) removeRow: ( NSView * ) value\n{\n M_LOG_FUNCTION( MacUICollectionView::removeRow )\n \n [ _stackViewForRows removeView: value ];\n}\n\n@end\n</code></pre>\n<p>So, my question is: how do I force the header row's NSStackView to stick to the LEFT ? I tried several layout constraint instructions but without success...</p>\n"^^ . "Now you can check, code updated"^^ . . "Lol, that code is coming from gpt and I'm not confirm yet, sry"^^ . . . . "Click o keys and the logs tab you can sometimes get more info in those"^^ . . . "dynamic-island"^^ . "twitterkit"^^ . "-1"^^ . . . "Error building C++ code on MacOS using CMake. Error with Cocoa and Foundations"^^ . . . . . . . "<p>I think, without a runloop, the calendar isn't updated. If you just want to get the current time zone then use <a href="https://developer.apple.com/documentation/corefoundation/cftimezone?language=objc" rel="nofollow noreferrer">CFTimeZone</a>.</p>\n<pre><code>CFTimeZoneResetSystem();\nCFTimeZoneRef timeZone = CFTimeZoneCopySystem();\nconst char *tz = CFStringGetCStringPtr(CFTimeZoneGetName(timeZone), kCFStringEncodingUTF8);\nCFRelease(timeZone);\n</code></pre>\n"^^ . "Your question is tagged Objective-C but you link to Swift-only constructs. For ObjcC check here, the intro spells it pretty much out: https://developer.apple.com/documentation/foundation/nstimezone?language=objc"^^ . . . . "Thanks for the great in-depth answer! Are you sure about 'KVObservablePublisher'? Compiler complains about it and I can't find any symbol with that name anywhere ..."^^ . . "1"^^ . . . . "0"^^ . . . "0"^^ . "0"^^ . "<p>I have 3 view controllers, VC1, VC2, and VC3, that are instantiated when the app starts.\nI want to present them modally in a loop, like this:</p>\n<pre><code>VC1 -&gt; VC2 -&gt; VC3 -&gt; VC1\n</code></pre>\n<p>On each view controller, I'm presenting the next view controller like this:</p>\n<pre><code>[self presentModalViewController:nextViewController animated:TRUE];\n</code></pre>\n<p>The issue is when I execute that line from VC3, for presenting again the first view controller VC1, the app hangs and becomes completely unresponsive.\nAs soon as that line is executed, I can see on Xcode CPU usage jumping from 0% to 99% and memory from 20MB to 1GB. I cannot even pause execution using the debugger, I can only quit the process.\nNo errors on the console either.</p>\n<p>My project doesn't have anything else, it's just these 3 view controllers, each with a button to present the next view controller in the loop.<br>\nIs this navigation flow not supported by the system or am I doing something wrong?</p>\n<p>I tried doing the same thing using segues on the storyboard, and that works fine. But I need to understand why it doesn't work using <code>UIViewController.presentModalViewController</code>.</p>\n<p>This is basically the code for each view controller:</p>\n<pre><code>#import &quot;VC2.h&quot;\n\n@implementation VC2\n\n- (IBAction)onNextButtonClicked:(id)sender {\n [self presentModalViewController:_nextViewController animated:TRUE];\n}\n\n@end\n</code></pre>\n"^^ . . "2"^^ . . . . . . . . "@Willeke Yes, thank you! I didn't need to sub-class, as you mentioned in your solution, but rather took note that you mentioned "The cell-based NSTableView draws all cells in placeholder style when an empty cell is edited" and just added a default value to the inserted object and it works great."^^ . . . . . . "-1"^^ . . "0"^^ . . . "0"^^ . . . . . . . . "nfc"^^ . . . . . "expo"^^ . . . . . . . . "0"^^ . . . . "0"^^ . "How to Call API without open app when user click action from interactive notification?"^^ . . "1"^^ . . . . . . . "The problem was that the code was in applicationDidFinishLaunching.\n\n\nOnce we set up a probleme UI with a button linked to calling Apple Pay, the Pane appeared."^^ . . . . . . "The answer is in the last column. Turn off the pointless warnings"^^ . . . . . . "How do I create a simple database table of attributes of NSManagedObjects using Core Data and Objective-C?"^^ . "1"^^ . "0"^^ . "0"^^ . . . . . . . . . . . . "0"^^ . . . "1"^^ . . . . . "[Using Autorelease Pool Blocks](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmAutoreleasePools.html) might help."^^ . "<p>I integrated Firebase Crashlytic into my iOS app and got this crash report from other user.</p>\n<p><a href="https://i.sstatic.net/fzk1rIB6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/fzk1rIB6.png" alt="enter image description here" /></a></p>\n<p>Looking at stack trace, I don't know what the issue is.</p>\n<p>I'm also unable unable to replicate the crash issue at my own device. Does anybody have idea what should I check or fix?</p>\n"^^ . . . "1"^^ . . . . . . "0"^^ . . . . . "arrays"^^ . . "0"^^ . . . . . . . . . "Worth taking a look at what glfw does. Since they handle this exact type of dilemma in their CMake code:\nhttps://github.com/glfw/glfw/blob/master/src/CMakeLists.txt"^^ . . "epsilon"^^ . "How to serve a React production build using Telegraph iOS Server Library?"^^ . "AppKit catches exceptions. From where or when do you call `testHandler`? Have you tried an exception breakpoint?"^^ . . . . . "0"^^ . . "1"^^ . . "macos-sonoma"^^ . . "@Willeke This took me to the right direction. When a table header isn't needed you just can set it to nil. This removes the glitch. Thank you"^^ . "0"^^ . "0"^^ . "0"^^ . . . . "@Willeke I have checked the timing and place for `testHandler` and found something. If I call `testHandler` just after `NSSetUncaughtExceptionHandler`, `uncaughtExceptionhandler` can catch this exception. But if I call `testHandler` in other function like `applicationWillTerminate`, `uncaughtExceptionhandler` failed to catch the exception."^^ . . "0"^^ . "0"^^ . . "objc2"^^ . . . "<p>i need to show time format in dateTimePicker is 12/24 hour time format based on my app settings not show based on device time format General-&gt; time -&gt; 12/24 hour, i try to change Locale also like</p>\n<p>&quot;\nreturn timeFormat.isEqual(&quot;HH:mm&quot;) ? Locale(identifier: &quot;en_GB&quot;) : Locale(identifier: &quot;en_US_POSIX&quot;)</p>\n<p>&quot;</p>\n<p>but its work in Gregorian calendar, when i set japanese calendar in device setting dateTimePicker shows wrong year like doesn't show &quot;Reiwa&quot; prefix of the year. how to fix it, anyone face this problem</p>\n<p><a href="https://i.sstatic.net/2fGGFxBM.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2fGGFxBM.jpg" alt="issue image in my app" /></a></p>\n<p><a href="https://i.sstatic.net/2fZVKhtM.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2fZVKhtM.jpg" alt="expected solution image" /></a></p>\n<pre><code>import UIKit\n</code></pre>\n<p>class ViewController: UIViewController {</p>\n<pre><code>let dateTextField = UITextField()\nlet datePickerContainer = UIView()\nlet datePicker = UIDatePicker()\nlet toolbar = UIToolbar()\n\noverride func viewDidLoad() {\n super.viewDidLoad()\n \n setupDateTextField()\n setupDatePickerContainer()\n setupToolbar()\n setupDatePicker()\n}\n\nfunc setupDateTextField() {\n dateTextField.placeholder = &quot;Select date and time&quot;\n dateTextField.borderStyle = .roundedRect\n dateTextField.translatesAutoresizingMaskIntoConstraints = false\n view.addSubview(dateTextField)\n \n // Constraints\n NSLayoutConstraint.activate([\n dateTextField.centerXAnchor.constraint(equalTo: view.centerXAnchor),\n dateTextField.centerYAnchor.constraint(equalTo: view.centerYAnchor),\n dateTextField.widthAnchor.constraint(equalToConstant: 200),\n dateTextField.heightAnchor.constraint(equalToConstant: 40)\n ])\n \n dateTextField.addTarget(self, action: #selector(showDatePicker), for: .editingDidBegin)\n}\n\nfunc setupDatePickerContainer() {\n datePickerContainer.backgroundColor = .white\n datePickerContainer.layer.cornerRadius = 10\n datePickerContainer.layer.shadowColor = UIColor.black.cgColor\n datePickerContainer.layer.shadowOpacity = 0.3\n datePickerContainer.layer.shadowOffset = CGSize(width: 0, height: 5)\n datePickerContainer.layer.shadowRadius = 10\n datePickerContainer.translatesAutoresizingMaskIntoConstraints = false\n view.addSubview(datePickerContainer)\n \n // Constraints\n NSLayoutConstraint.activate([\n datePickerContainer.centerXAnchor.constraint(equalTo: view.centerXAnchor),\n datePickerContainer.centerYAnchor.constraint(equalTo: view.centerYAnchor),\n datePickerContainer.widthAnchor.constraint(equalToConstant: 350),\n datePickerContainer.heightAnchor.constraint(equalToConstant: 450)\n ])\n \n datePickerContainer.isHidden = true\n}\n\nfunc setupDatePicker() {\n datePicker.datePickerMode = .dateAndTime\n datePicker.preferredDatePickerStyle = .inline\n datePicker.locale = Locale(identifier: &quot;en_POSIX&quot;) // Ensure 12-hour time format\n datePicker.translatesAutoresizingMaskIntoConstraints = false\n datePicker.addTarget(self, action: #selector(dateChanged), for: .valueChanged)\n datePickerContainer.addSubview(datePicker)\n \n // Constraints\n NSLayoutConstraint.activate([\n datePicker.leadingAnchor.constraint(equalTo: datePickerContainer.leadingAnchor, constant: 10),\n datePicker.trailingAnchor.constraint(equalTo: datePickerContainer.trailingAnchor, constant: -10),\n datePicker.topAnchor.constraint(equalTo: datePickerContainer.topAnchor, constant: 10),\n datePicker.bottomAnchor.constraint(equalTo: toolbar.topAnchor, constant: -10)\n ])\n}\n\nfunc setupToolbar() {\n toolbar.sizeToFit()\n toolbar.translatesAutoresizingMaskIntoConstraints = false\n let doneButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(doneButtonTapped))\n toolbar.setItems([doneButton], animated: true)\n datePickerContainer.addSubview(toolbar)\n \n // Constraints\n NSLayoutConstraint.activate([\n toolbar.leadingAnchor.constraint(equalTo: datePickerContainer.leadingAnchor),\n toolbar.trailingAnchor.constraint(equalTo: datePickerContainer.trailingAnchor),\n toolbar.bottomAnchor.constraint(equalTo: datePickerContainer.bottomAnchor),\n toolbar.heightAnchor.constraint(equalToConstant: 44)\n ])\n}\n\n@objc func showDatePicker() {\n view.endEditing(true) // Dismiss the keyboard if any other input is active\n datePickerContainer.isHidden = false\n}\n\n@objc func dateChanged() {\n // Update the text field with the selected date and time based on user format\n let dateFormatter = DateFormatter()\n dateFormatter.dateFormat = getUserPreferredDateFormat()\n dateTextField.text = dateFormatter.string(from: datePicker.date)\n}\n\n@objc func doneButtonTapped() {\n datePickerContainer.isHidden = true\n dateTextField.resignFirstResponder()\n}\n\nfunc getUserPreferredDateFormat() -&gt; String {\n // Here you should implement how you get the user's preferred date format\n // For example purposes, let's assume the user wants &quot;dd/MM/yyyy HH:mm&quot;\n return &quot;dd/MM/yyyy HH:mm&quot;\n}\n</code></pre>\n<p>}</p>\n"^^ . . . "python"^^ . . "1"^^ . "0"^^ . . . "apple-push-notifications"^^ . . "1"^^ . . . . . . "c++"^^ . . . "1"^^ . . . "1"^^ . . "I want to send it every Sunday at 10:30 am only. But if the user takes any reading (or skips today's notification) and skips upcoming notification, then it will show next Sunday. @Rob"^^ . "0"^^ . . . . . . . "How is the header stack view created? Post a [mre] please."^^ . . . . . "0"^^ . . . "<p>So I finally found the problem. By adding the correct AID to Info.plist, the connection to the PIV card is established and APDU commands can be executed.</p>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;\n&lt;plist version=&quot;1.0&quot;&gt;\n&lt;dict&gt;\n &lt;key&gt;NFCReaderUsageDescription&lt;/key&gt;\n &lt;string&gt;Need NFC to scan&lt;/string&gt;\n &lt;key&gt;com.apple.developer.nfc.readersession.iso7816.select-identifiers&lt;/key&gt;\n &lt;array&gt;\n &lt;string&gt;A00000030800001000&lt;/string&gt;\n &lt;/array&gt;\n&lt;/dict&gt;\n&lt;/plist&gt;\n</code></pre>\n"^^ . "Click that textField then calendar will be open and click month and year section top left corner of calendar. now will show the wheel of month and year now you can notice year is not contains "Reiwa" prefix only showing a number only thats my issue"^^ . . . "0"^^ . "Yes, exactly, that's how my Storyboard was set up.\nThanks for the detailed explanation, this is the answer I was looking for."^^ . . "<pre><code>[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error) {\n \n if (session) {\n dispatch_async(dispatch_get_main_queue(), ^{\n [self presentViewController:composer animated:YES completion:nil];\n });\n } else {\n [self showAlertWithMessage:@&quot;You must log in before presenting a composer.&quot; andTitle:@&quot;No Twitter Accounts Available&quot;];\n }\n}];\n</code></pre>\n<p>trying to login to twitter to share image.</p>\n<p>My Twitter ConsumerKey and ConsumerSecret both are correct and valid And the redirect url in developer portal is also according to guidelines like twitterkit-consumerkey://.</p>\n<p>But I am unable to login and get the session details. The error shown is:</p>\n<p>[TWTRURLSessionDelegate] Cancelling API request, SSL certificate is invalid.</p>\n<p>[TwitterKit] Cannot verify session credentials.</p>\n<p>[TWTRURLSessionDelegate] Cancelling API request, SSL certificate is invalid.</p>\n<p>[TwitterKit] Error obtaining user auth token.</p>\n<p>Error code is: -999(cancelled)</p>\n<p>It is redirect back to app saying the above error details.</p>\n<p>Any kind of lead or help is highly appreciated.</p>\n"^^ . . . . "Is Capability of "Near Field Communication Tag Reading" is enougf for reading NFC ?"^^ . "<p>I have an iOS app and I receive some crashes related to _objc_msgSend. I only know that this crash happens when backgrounding the app.\nThe crash log:</p>\n<pre><code>Exception Type: EXC_BAD_ACCESS (SIGSEGV)\nException Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000\nException Codes: 0x0000000000000001, 0x0000000000000000\nVM Region Info: 0 is not in any region. Bytes before following region: 4334944256\n REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL\n UNUSED SPACE AT START\n---&gt; \n __TEXT 102620000-102628000 [ 32K] r-x/r-x SM=COW /var/containers/Bundle/Application/C85DDECD-E4EE-4590-B8AE-116E75F437A0\nTermination Reason: SIGNAL 11 Segmentation fault: 11\nTerminating Process: exc handler [32190]\n\nTriggered by Thread: 0\n\n\nThread 0 name:\nThread 0 Crashed:\n0 libobjc.A.dylib 0x000000019acf0c90 lookUpImpOrForward + 72 (objc-runtime-new.mm:7399)\n1 libobjc.A.dylib 0x000000019acec0c4 _objc_msgSend_uncached + 68 (:-1)\n2 UIKitCore 0x00000001a52d07d4 -[UIViewController dealloc] + 860 (UIViewController.m:3275)\n3 UIKitCore 0x00000001a5398e14 -[UINavigationController dealloc] + 296 (UINavigationController.m:871)\n4 UIKitCore 0x00000001a57909ec -[_UISplitViewControllerColumnContents .cxx_destruct] + 44 (UISplitViewControllerPanelImpl.m:439)\n5 libobjc.A.dylib 0x000000019acec75c object_cxxDestructFromClass(objc_object*, objc_class*) + 116 (objc-class.mm:457)\n6 libobjc.A.dylib 0x000000019acec490 objc_destructInstance + 80 (objc-runtime-new.mm:9125)\n7 libobjc.A.dylib 0x000000019acec438 _objc_rootDealloc + 80 (NSObject.mm:2136)\n8 CoreFoundation 0x00000001a2db63f8 cow_cleanup + 164 (NSDictionaryM.m:141)\n9 CoreFoundation 0x00000001a2db6304 -[__NSDictionaryM dealloc] + 148 (NSDictionaryM.m:407)\n10 libobjc.A.dylib 0x000000019acec75c object_cxxDestructFromClass(objc_object*, objc_class*) + 116 (objc-class.mm:457)\n11 libobjc.A.dylib 0x000000019acec490 objc_destructInstance + 80 (objc-runtime-new.mm:9125)\n12 libobjc.A.dylib 0x000000019acec438 _objc_rootDealloc + 80 (NSObject.mm:2136)\n13 UIKitCore 0x00000001a5790a74 -[UISplitViewControllerPanelImpl dealloc] + 100 (UISplitViewControllerPanelImpl.m:704)\n14 libobjc.A.dylib 0x000000019acec75c object_cxxDestructFromClass(objc_object*, objc_class*) + 116 (objc-class.mm:457)\n15 libobjc.A.dylib 0x000000019acec490 objc_destructInstance + 80 (objc-runtime-new.mm:9125)\n16 libobjc.A.dylib 0x000000019acec438 _objc_rootDealloc + 80 (NSObject.mm:2136)\n17 UIKitCore 0x00000001a50a6900 -[UIResponder dealloc] + 124 (UIResponder.m:195)\n18 UIKitCore 0x00000001a52d090c -[UIViewController dealloc] + 1172 (UIViewController.m:3306)\n19 libobjc.A.dylib 0x000000019ace9f84 AutoreleasePoolPage::releaseUntil(objc_object**) + 212 (NSObject.mm:918)\n20 libobjc.A.dylib 0x000000019ace9e10 objc_autoreleasePoolPop + 260 (NSObject.mm:2184)\n21 UIKitCore 0x00000001a50d1904 -[_UIAfterCACommitBlock run] + 92 (_UIAfterCACommitQueue.m:155)\n22 UIKitCore 0x00000001a50d16d4 -[_UIAfterCACommitQueue flush] + 164 (_UIAfterCACommitQueue.m:228)\n23 UIKitCore 0x00000001a50d15ec _runAfterCACommitDeferredBlocks + 496 (UIApplication.m:3123)\n24 UIKitCore 0x00000001a50d1378 _cleanUpAfterCAFlushAndRunDeferredBlocks + 100 (UIApplication.m:3087)\n25 UIKitCore 0x00000001a50b8a88 _afterCACommitHandler + 64 (UIApplication.m:3138)\n26 CoreFoundation 0x00000001a2ddfd3c __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36 (CFRunLoop.c:1789)\n27 CoreFoundation 0x00000001a2dde738 __CFRunLoopDoObservers + 552 (CFRunLoop.c:1902)\n28 CoreFoundation 0x00000001a2ddde50 __CFRunLoopRun + 1028 (CFRunLoop.c:2983)\n29 CoreFoundation 0x00000001a2ddd968 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)\n30 GraphicsServices 0x00000001e70d34e0 GSEventRunModal + 164 (GSEvent.c:2196)\n31 UIKitCore 0x00000001a5250edc -[UIApplication _run] + 888 (UIApplication.m:3692)\n32 UIKitCore 0x00000001a5250518 UIApplicationMain + 340 (UIApplication.m:5282)\n33 SwiftUI 0x00000001a7c17860 closure #1 in KitRendererCommon(_:) + 168 (UIKitApp.swift:51)\n34 SwiftUI 0x00000001a7c176a8 runApp&lt;A&gt;(_:) + 152 (UIKitApp.swift:14)\n35 SwiftUI 0x00000001a78339fc static App.main() + 132 (App.swift:114)\n36 Myapp 0x0000000102629654 static iOSApp.$main() + 52 (iOSApp.swift:0)\n37 Myapp 0x0000000102629654 main + 64\n38 dyld 0x00000001c62fed84 start + 2240 (dyldMain.cpp:1298)\n</code></pre>\n<p>Do you have any idea where this crash might originate or why it happens? The crash log indicates it's related to a deallocated instance. Is this related to the AppDelegate? How can I determine the line where the exception happens?</p>\n<h3>These are two possible causes that I THINK could be related:</h3>\n<h2>Possible cause nr 1:</h2>\n<p>UINotificationFeedbackGenerator</p>\n<pre><code>DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {\n \n let generator = UINotificationFeedbackGenerator()\n generator.notificationOccurred(.success)\n\n}\n</code></pre>\n<h2>Possible cause nr 2:</h2>\n<p>@EnvironmentObject, the way declared:</p>\n<pre><code>@EnvironmentObject var appState: AppStateForUser\n</code></pre>\n<p>the class its an ObservableObject:</p>\n<pre><code>class AppStateForUser: ObservableObject {\n @Published var selectedIndex: Int = 0\n}\n</code></pre>\n<p>And the way that I use in code:</p>\n<pre><code>DispatchQueue.main.asyncAfter(deadline: .now() + 3) {\n self.appState.selectedIndex = 1\n}\n</code></pre>\n<p>Could these 2 snippets be the cause of the crash? If so, which one of them or which one of them its the most likely to be related to the crash?</p>\n"^^ . . "1"^^ . . . "0"^^ . . . "1"^^ . . "You are not reading that stacktrace correctly; it actually crashed in `pb_check_proto3_default_value + 342`. Expand the arrow between frames 0 and 23 to get more context that will help you track it down."^^ . "split"^^ . . . . . . . . . . . . . . . . . . "1"^^ . "expo-notifications"^^ . . . . "<p>Thank you, @Willeke, for your suggestion. In fact, I just realized that I don't understand at all how the auto layout feature of AppKit is working !</p>\n<p>So, instead of loosing my hair with endless attempts, I just created a copycat of UWP's StackPanel in ObjC. And it is now working as intended:</p>\n<p><a href="https://i.sstatic.net/cGfVhegY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/cGfVhegY.png" alt="enter image description here" /></a></p>\n<p>Here's my code for MacUIStackPanel just in case:</p>\n<pre><code>enum MacUIStackPanelOrientation {\n MacUIVerticalStack,\n MacUIHorizontalStack\n};\n\nenum MacUIStackPanelAlignment {\n MacUICenterStack,\n MacUILeftStack,\n MacUIRightStack,\n MacUITopStack,\n MacUIBottomStack\n};\n\n// --------------------\n\n@interface MacUIStackPanel : MacUIFlippedView\n{\n MacUIStackPanelOrientation orientation;\n MacUIStackPanelAlignment alignment;\n\n BOOL autoResize;\n NSSize size;\n \n BOOL hasBackground;\n NSColor * backgroundColor;\n\n BOOL hasBorder;\n CoreServices::Coordinate borderThickness;\n NSColor * borderColor;\n\n CoreServices::Coordinate padding;\n CoreServices::Coordinate spacing;\n\n CoreServices::List&lt; NSView * &gt; children;\n}\n\n- ( id ) init;\n\n- ( BOOL ) autoResize;\n- ( void ) autoResize: ( BOOL ) value;\n\n- ( MacUIStackPanelOrientation ) orientation;\n- ( void ) orientation: ( MacUIStackPanelOrientation ) value;\n\n- ( MacUIStackPanelAlignment ) alignment;\n- ( void ) alignment: ( MacUIStackPanelAlignment ) value;\n\n- ( BOOL ) hasBackground;\n- ( void ) hasBackground: ( BOOL ) value;\n\n- ( NSColor * ) backgroundColor;\n- ( void ) backgroundColor: ( NSColor * ) value;\n\n- ( BOOL ) hasBorder;\n- ( void ) hasBorder: ( BOOL ) value;\n\n- ( CoreServices::Coordinate ) borderThickness;\n- ( void ) borderThickness: ( CoreServices::Coordinate ) value;\n\n- ( NSColor * ) borderColor;\n- ( void ) borderColor: ( NSColor * ) value;\n\n- ( CoreServices::Coordinate ) padding;\n- ( void ) padding: ( CoreServices::Coordinate ) value;\n\n- ( CoreServices::Coordinate ) spacing;\n- ( void ) spacing: ( CoreServices::Coordinate ) value;\n\n- ( void ) addView: ( NSView * ) view;\n- ( void ) insertView: ( NSView * ) view atIndex: ( CoreServices::Index ) index;\n- ( void ) removeView: ( NSView * ) view;\n- ( void ) removeViewAtIndex: ( CoreServices::Index ) index;\n- ( Counter ) countOfViews;\n\n- ( void ) updateLayout;\n\n- ( void ) setFrame:( NSRect ) frameRect;\n- ( void ) drawRect:( NSRect ) dirtyRect;\n\n@end\n\n@implementation MacUIStackPanel\n\n- ( id ) init\n{\n M_LOG_FUNCTION( MacUIStackPanel::init )\n \n\n self = [ super init ];\n if( self )\n {\n orientation = MacUIHorizontalStack;\n alignment = MacUICenterStack;\n\n hasBackground = NO;\n backgroundColor = [ NSColor controlBackgroundColor ];\n\n hasBorder = NO;\n borderThickness = 1.0;\n borderColor = [ NSColor gridColor ];\n\n padding = 0.0;\n spacing = 0.0;\n\n children.MakeEmpty();\n [ self setClipsToBounds: YES ];\n }\n \n return self;\n}\n\n// --------------------\n\n- ( BOOL ) autoResize\n{\n M_LOG_FUNCTION( MacUIStackPanel::autoResize )\n \n return autoResize;\n}\n// --------------------\n\n- ( void ) autoResize: ( BOOL ) value\n{\n M_LOG_FUNCTION( MacUIStackPanel::autoResize )\n \n if( autoResize == value )\n return;\n\n if( value == YES )\n [ self setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable ];\n else\n [ self setAutoresizingMask: NSViewNotSizable ];\n \n autoResize = value;\n}\n\n// --------------------\n\n- ( BOOL ) isFlipped\n{\n // M_LOG_FUNCTION( MacUIStackPanel::isFlipped )\n \n return YES;\n}\n\n// --------------------\n\n- ( MacUIStackPanelOrientation ) orientation\n{\n M_LOG_FUNCTION( MacUIStackPanel::orientation )\n \n return orientation;\n}\n\n// --------------------\n\n- ( void ) orientation: ( MacUIStackPanelOrientation ) value\n{\n M_LOG_FUNCTION( MacUIStackPanel::orientation )\n \n if( orientation == value )\n return;\n\n orientation = value;\n alignment = MacUICenterStack;\n \n [ self updateLayout ];\n}\n\n// --------------------\n\n- ( MacUIStackPanelAlignment ) alignment\n{\n M_LOG_FUNCTION( MacUIStackPanel::alignment )\n \n return alignment;\n}\n\n// --------------------\n\n- ( void ) alignment: ( MacUIStackPanelAlignment ) value\n{\n M_LOG_FUNCTION( MacUIStackPanel::alignment )\n \n if( alignment == value )\n return;\n \n if( orientation == MacUIVerticalStack )\n switch( value )\n {\n case MacUICenterStack:\n case MacUILeftStack:\n case MacUIRightStack:\n break;\n default:\n return;\n }\n else\n switch( value )\n {\n case MacUICenterStack:\n case MacUITopStack:\n case MacUIBottomStack:\n break;\n default:\n return;\n }\n\n alignment = value;\n \n [ self updateLayout ];\n}\n\n// --------------------\n\n- ( BOOL ) hasBackground\n{\n M_LOG_FUNCTION( MacUIStackPanel::hasBackground )\n \n return hasBackground;\n}\n\n// --------------------\n\n- ( void ) hasBackground: ( BOOL ) value\n{\n M_LOG_FUNCTION( MacUIStackPanel::hasBackground )\n \n if( hasBackground == value )\n return;\n \n hasBackground = value;\n}\n\n// --------------------\n\n- ( NSColor * ) backgroundColor\n{\n M_LOG_FUNCTION( MacUIStackPanel::backgroundColor )\n \n return backgroundColor;\n}\n\n// --------------------\n\n- ( void ) backgroundColor: ( NSColor * ) value\n{\n M_LOG_FUNCTION( MacUIStackPanel::backgroundColor )\n \n if( backgroundColor == value )\n return;\n \n backgroundColor = value;\n}\n\n// --------------------\n\n- ( BOOL ) hasBorder\n{\n M_LOG_FUNCTION( MacUIStackPanel::hasBorder )\n \n return hasBorder;\n}\n\n// --------------------\n\n- ( void ) hasBorder: ( BOOL ) value\n{\n M_LOG_FUNCTION( MacUIStackPanel::hasBorder )\n \n if( hasBorder == value )\n return;\n \n hasBorder = value;\n}\n\n// --------------------\n\n- ( CoreServices::Coordinate ) borderThickness\n{\n M_LOG_FUNCTION( MacUIStackPanel::borderThickness )\n \n return borderThickness;\n}\n\n// --------------------\n\n- ( void ) borderThickness: ( CoreServices::Coordinate ) value\n{\n M_LOG_FUNCTION( MacUIStackPanel::hasBorder )\n \n if( borderThickness == value || value &lt; 0.0 )\n return;\n \n borderThickness = value;\n}\n\n// --------------------\n\n- ( NSColor * ) borderColor\n{\n M_LOG_FUNCTION( MacUIStackPanel::borderColor )\n \n return borderColor;\n}\n\n// --------------------\n\n- ( void ) borderColor: ( NSColor * ) value\n{\n M_LOG_FUNCTION( MacUIStackPanel::borderColor )\n \n if( borderColor == value )\n return;\n \n borderColor = value;\n}\n\n// --------------------\n\n- ( CoreServices::Coordinate ) padding\n{\n M_LOG_FUNCTION( MacUIStackPanel::padding )\n \n return padding;\n}\n\n// --------------------\n\n- ( void ) padding: ( CoreServices::Coordinate ) value\n{\n M_LOG_FUNCTION( MacUIStackPanel::padding )\n \n if( value &gt;= 0.0 &amp;&amp; padding != value )\n {\n padding = value;\n \n [ self updateLayout ];\n }\n}\n\n// --------------------\n\n- ( CoreServices::Coordinate ) spacing\n{\n M_LOG_FUNCTION( MacUIStackPanel::spacing )\n \n return spacing;\n}\n\n// --------------------\n\n- ( void ) spacing: ( CoreServices::Coordinate ) value\n{\n M_LOG_FUNCTION( MacUIStackPanel::spacing )\n \n if( value &gt;= 0.0 &amp;&amp; spacing != value )\n {\n spacing = value;\n \n [ self updateLayout ];\n }\n}\n\n// --------------------\n\n- ( void ) addView: ( NSView * ) view\n{\n M_LOG_FUNCTION( MacUIStackPanel::addView )\n \n if( children.HasItem( view ) == true )\n return;\n \n children.AddItem( view );\n [ self addSubview: view ];\n \n [ self updateLayout ];\n}\n\n// --------------------\n\n- ( void ) insertView: ( NSView * ) view atIndex: ( CoreServices::Index ) index\n{\n M_LOG_FUNCTION( MacUIStackPanel::insertView )\n \n if( children.HasItem( view ) == true ||\n index &lt; 0 || index &gt; children.CountOfItems() )\n return;\n \n children.AddItemAtIndex( index, view );\n [ self addSubview: view ];\n \n [ self updateLayout ];\n}\n\n// --------------------\n\n- ( void ) removeView: ( NSView * ) view\n{\n M_LOG_FUNCTION( MacUIStackPanel::removeView )\n \n Index index;\n \n index = children.FindItem( view );\n if( index == kNullIndex )\n return;\n \n children.RemoveItemAtIndex( index );\n [ view removeFromSuperview ];\n \n [ self updateLayout ];\n}\n\n// --------------------\n\n- ( void ) removeViewAtIndex: ( CoreServices::Index ) index\n{\n M_LOG_FUNCTION( MacUIStackPanel::removeViewAtIndex )\n\n if( index &lt; 0 || index &gt;= children.CountOfItems() )\n return;\n\n NSView * view;\n \n view = * children.GetItemAtIndex( index );\n \n children.RemoveItemAtIndex( index );\n [ view removeFromSuperview ];\n \n [ self updateLayout ];\n}\n\n// --------------------\n\n- ( Counter ) countOfViews\n{\n M_LOG_FUNCTION( MacUIStackPanel::countOfViews )\n \n return children.CountOfItems();\n}\n\n// --------------------\n\n- ( void ) updateLayout\n{\n M_LOG_FUNCTION( MacUIStackPanel::updateLayout )\n\n M_LOG_FUNCTION_MESSAGE( LogLevel::Debug, &quot;current size: width=%.1f, height=%.1f&quot;, size.width, size.height )\n M_LOG_FUNCTION_MESSAGE( LogLevel::Debug, &quot;current frame: x=%.1f, y=%.1f, width=%.1f, height=%.1f&quot;,\n [ self frame ].origin.x,\n [ self frame ].origin.y,\n [ self frame ].size.width,\n [ self frame ].size.height )\n\n CoreServices::Coordinate current[2];\n bool direction;\n \n direction = ( orientation == MacUIVerticalStack );\n \n current[direction] = ( hasBorder ? borderThickness : 0.0 ) + padding;\n current[!direction] = 0.0;\n \n // First pass: position the children along the direction line\n M_LOG_FUNCTION_MESSAGE( LogLevel::Debug, &quot;First pass: position the children along the direction line&quot; )\n for( Index index = 0; index &lt; children.CountOfItems(); index++ )\n {\n NSView * view;\n CoreServices::Point size;\n \n view = * children.GetItemAtIndex( index );\n size.SetX( [view frame].size.width );\n size.SetY( [view frame].size.height );\n \n M_LOG_FUNCTION_MESSAGE( LogLevel::Debug, &quot;\\t[%d] %p, width=%.1f height=%.1f&quot;, index, view, size[0], size[1] )\n \n if( index &gt; 0 )\n current[direction] += spacing;\n \n [ view setFrameOrigin: NSMakePoint( !direction?current[0]:0.0, direction?current[1]:0.0 )];\n \n current[direction] += size[direction];\n current[!direction] = M_MAXIMUM( current[!direction], size[!direction] );\n }\n \n current[direction] += ( hasBorder ? borderThickness : 0.0 ) + padding;\n current[!direction] += 2 * ( ( hasBorder ? borderThickness : 0.0 ) + padding );\n\n if( autoResize == YES )\n {\n current[direction] = M_MAXIMUM( current[direction], direction ? self.frame.size.height : self.frame.size.width );\n current[!direction] = M_MAXIMUM( current[!direction], direction ? self.frame.size.width : self.frame.size.height );\n }\n\n size = NSMakeSize( current[0], current[1] );\n M_LOG_FUNCTION_MESSAGE( LogLevel::Debug, &quot;new size: width=%.1f, height=%.1f&quot;, size.width, size.height )\n if( autoResize == NO )\n [ self setFrameSize: size ];\n \n // Second pass: update the alignemnt of the children\n M_LOG_FUNCTION_MESSAGE( LogLevel::Debug, &quot;Second pass: update the alignemnt of the children&quot; )\n for( Index index = 0; index &lt; children.CountOfItems(); index++ )\n {\n NSView * view;\n CoreServices::Point size;\n CoreServices::Coordinate position[2];\n \n view = * children.GetItemAtIndex( index );\n size.SetX( [view frame].size.width );\n size.SetY( [view frame].size.height );\n position[0] = [view frame].origin.x;\n position[1] = [view frame].origin.y;\n\n switch( alignment )\n {\n case MacUICenterStack:\n position[!direction] = ( current[!direction] - size[!direction] ) / 2.0;\n break;\n \n case MacUILeftStack:\n case MacUITopStack:\n position[!direction] = ( hasBorder ? borderThickness : 0.0 ) + padding;\n break;\n \n case MacUIRightStack:\n case MacUIBottomStack:\n position[!direction] = current[!direction] - size[!direction] - ( ( hasBorder ? borderThickness : 0.0 ) + padding );\n break;\n }\n \n [ view setFrameOrigin: NSMakePoint( position[0], position[1] ) ];\n \n M_LOG_FUNCTION_MESSAGE( LogLevel::Debug, &quot;\\t[%d] %p, width=%.1f height=%.1f, x=%.1f, y=%.1f&quot;, index, view, size[0], size[1], position[0], position[1] )\n }\n \n [ self setNeedsDisplay: YES ];\n}\n\n// --------------------\n\n- ( void ) setFrame:( NSRect ) frameRect\n{\n M_LOG_FUNCTION( MacUIStackPanel::setFrame )\n \n char buffer[64];\n [ identifier getCString: buffer maxLength:64 encoding:NSUTF8StringEncoding ];\n \n M_LOG_FUNCTION_MESSAGE( LogLevel::Debug, &quot;\\'%s\\' frameRect: x=%.1f, y=%.1f, width=%.1f, height=%.1f&quot;,\n buffer,\n frameRect.origin.x,\n frameRect.origin.y,\n frameRect.size.width,\n frameRect.size.height )\n\n [ super setFrame: frameRect ];\n \n M_LOG_FUNCTION_MESSAGE( LogLevel::Debug, &quot;\\'%s\\' frame: x=%.1f, y=%.1f, width=%.1f, height=%.1f&quot;,\n buffer,\n self.frame.origin.x,\n self.frame.origin.y,\n self.frame.size.width,\n self.frame.size.height )\n\n if( autoResize == YES )\n {\n [ self updateLayout ];\n [ self setNeedsDisplay: YES ];\n }\n}\n\n// --------------------\n\n- ( void ) drawRect:( NSRect ) dirtyRect\n{\n M_LOG_FUNCTION( MacUIStackPanel::drawRect )\n \n M_LOG_FUNCTION_MESSAGE( LogLevel::Debug, &quot;\\tframe: x=%.1f, y=%.1f, width=%.1f, height=%.1f&quot;,\n [ self frame ].origin.x,\n [ self frame ].origin.y,\n [ self frame ].size.width,\n [ self frame ].size.height )\n M_LOG_FUNCTION_MESSAGE( LogLevel::Debug, &quot;\\tbounds: x=%.1f, y=%.1f, width=%.1f, height=%.1f&quot;,\n [ self bounds ].origin.x,\n [ self bounds ].origin.y,\n [ self bounds ].size.width,\n [ self bounds ].size.height )\n \n NSRect background;\n \n background = NSMakeRect( 0.0, 0.0, size.width, size.height );\n \n // Draw the background?\n if( hasBackground == YES )\n {\n [ backgroundColor set ];\n NSRectFill( background );\n }\n \n // Draw the border?\n if( hasBorder == YES )\n {\n NSBezierPath * borderPath = [ NSBezierPath bezierPathWithRect:NSInsetRect( background, borderThickness / 2.0, borderThickness / 2.0 ) ];\n [ borderColor setStroke ];\n [ borderPath setLineWidth: borderThickness ];\n [ borderPath stroke ];\n }\n\n [ super drawRect: dirtyRect ];\n}\n\n@end\n</code></pre>\n"^^ . . . "@Cy-4AH I'm not sure you understand the point. I know how I can force it to work, I'm trying to figure out if there is an -elegant- and -proper- way to make it work. Sure, I could add `xls` and `xlsx` and `numbers`, etc with `typeWithFilenameExtension:`, but I would much rather use the conceptual type of `UTTypeSpreadsheet` so that iOS can handle every type of spreadsheet it knows instead of just the filename extensions that I could think of at the time... and then have users screw me over by removing the file extensions from their docs or something. They've been known to do weird stuff."^^ . . "<p>No, there are no common identifiers among the word processing file formats, except the very general <code>public.item</code>, <code>public.content</code> etc.</p>\n<p>You can view the UTType &quot;tree&quot; using the <code>mdls</code> command. These are the results for .doc, .docx, .pages:</p>\n<pre><code>% mdls -name kMDItemContentTypeTree foo.pages\nkMDItemContentTypeTree = (\n &quot;com.apple.iwork.pages.sffpages&quot;,\n &quot;public.data&quot;,\n &quot;public.item&quot;,\n &quot;public.composite-content&quot;,\n &quot;public.content&quot;\n)\n% mdls -name kMDItemContentTypeTree foo.docx\nkMDItemContentTypeTree = (\n &quot;org.openxmlformats.wordprocessingml.document&quot;,\n &quot;org.openxmlformats.openxml&quot;,\n &quot;public.data&quot;,\n &quot;public.item&quot;,\n &quot;public.composite-content&quot;,\n &quot;public.content&quot;\n)\n% mdls -name kMDItemContentTypeTree foo.doc\nkMDItemContentTypeTree = (\n &quot;com.microsoft.word.doc&quot;,\n &quot;public.data&quot;,\n &quot;public.item&quot;,\n &quot;public.composite-content&quot;,\n &quot;public.content&quot;\n)\n</code></pre>\n<p>Spreadsheets on the other hand, have <code>public.spreadsheet</code> in common:</p>\n<pre><code>% mdls -name kMDItemContentTypeTree foo.numbers \nkMDItemContentTypeTree = (\n &quot;com.apple.iwork.numbers.sffnumbers&quot;,\n &quot;public.data&quot;,\n &quot;public.item&quot;,\n &quot;public.composite-content&quot;,\n &quot;public.content&quot;,\n &quot;public.spreadsheet&quot;\n)\n% mdls -name kMDItemContentTypeTree foo.xlsx \nkMDItemContentTypeTree = (\n &quot;org.openxmlformats.spreadsheetml.sheet&quot;,\n &quot;org.openxmlformats.openxml&quot;,\n &quot;public.data&quot;,\n &quot;public.item&quot;,\n &quot;public.composite-content&quot;,\n &quot;public.content&quot;,\n &quot;public.spreadsheet&quot;\n)\n</code></pre>\n"^^ . . "So the question is more: Find the email address + dot (optional ?), then from that range, keep only what's after? So this question might help: https://stackoverflow.com/questions/8413291/extract-emails-from-string-in-objective-c"^^ . . "1"^^ . . . "0"^^ . . "See [this](https://gist.github.com/robertmryan/98669fcb526c37e449551521e90f91d5?permalink_comment_id=5068140#gistcomment-5068140) for example that works in Go (using `dispatch_main`). There might be other ways, too: I'm not a Go programer. But the problem is not the calendar, per se, but rather the interaction with Go’s threading model. BTW, re `autoUpdatingCurrent`, but you don't need that. You aren't referring to the same calendar instance on every call, so it doesn't matter if it is auto-updating or not."^^ . . "<p>We have VoIP feature in our iOS app which uses CallKit to handle calls. In new iOS devices with dynamic island I'm seeing an avatar in incoming call with nothing in it.\nI want to disable this but I don't know how to do it. Either remove this avatar or populate it, but having empty avatar doesn't look good.</p>\n<p><code>CXCallUpdate</code> has a property <code>_localizedCallerImageURL</code> but it is private. I don't see any other way to set or remove this avatar.</p>\n<pre><code> CXCallUpdate *update = [[CXCallUpdate alloc] init];\nupdate.localizedCallerName = aCall.callerIdString;\nupdate.localizedCallerImageURL = nil; // Not accessible \n[self.cxProvider reportNewIncomingCallWithUUID:aCall.cxUUID update:update completion:^(NSError *error) {\n if (error) {\n</code></pre>\n<p><a href="https://i.sstatic.net/DdyX2wP4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/DdyX2wP4.png" alt="enter image description here" /></a></p>\n"^^ . "1"^^ . . . . . . "if you call `someOtherFunction()` in `viewDidLoad` is execution paused? No, you have transferred it to `someOtherFunction`. In your case you have transferred it to `runUntilDate` and that function will continue to perform tasks in the run loop"^^ . "1"^^ . . . . . . . . . . "0"^^ . "Crash when connecting an AVAudioSinkNode to my AVAudioEngine"^^ . . . "0"^^ . . . . "It appears to grow monotonically over minutes. I haven't checked for longer periods. I don't know what I should expect in terms of memory management response for ref counted memory here, so I will see if I can get it to crash with OoM."^^ . "Where is the header view? Which setting causes the issue? What are you trying to accomplish with the insets and the `CGFLOAT_MIN` header view?"^^ . . "Yes sorry I forgot to mark it as such!"^^ . "0"^^ . . "Yes, I think the autoupdating calendar isn't polling."^^ . . "nsscrollview"^^ . . . "you can schedule the date by miniusing some seconds from current date like ?"^^ . "Final query (not an ObjC dev). I need to CFRelease the timeZone. Correct? And since CFStringGetCStringPtr is AFAIUI returning a ref to inside that struct, this will also release//free tz?"^^ . . "0"^^ . . . . . "function"^^ . . "Kotlin multi platform project can't find iOS Framework"^^ . "0"^^ . "0"^^ . . "0"^^ . "0"^^ . . . . "0"^^ . . "core-audio"^^ . . "This is not possible. Do you realise that `@objc public func description() -> String` doesn't even compile?"^^ . "1"^^ . "2"^^ . . . . . . . . . . "apple-m1"^^ . . "0"^^ . . "I don't think the question is asking about entitlements. It's about access permissions, which is a different thing entirely."^^ . . . . . "onesignal"^^ . . . . . "<p>Your post is lacking some details -- however...</p>\n<p>I'm assuming you have your Storyboard / Segues setup like this:</p>\n<p><a href="https://i.sstatic.net/TMw16edJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TMw16edJ.png" alt="enter image description here" /></a></p>\n<p>That &quot;works&quot; -- well, it doesn't crash (right away) -- because each button is presenting a <em><strong>new instance</strong></em> of the next view controller.</p>\n<p>If you cycle through your 3 &quot;present&quot; segues a couple times, then go into Debug View Hierarchy, it will look something like this:</p>\n<p><a href="https://i.sstatic.net/rUWoy9rk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rUWoy9rk.png" alt="enter image description here" /></a></p>\n<p>When you try to do this via code, you stated:</p>\n<p><em>&quot;VC1, VC2, and VC3, that are instantiated when the app starts&quot;</em></p>\n<p>So, let's say you have <code>_vc1</code>, <code>_vc2</code> and <code>_vc3</code>, and you present <code>_vc1</code>.</p>\n<p><code>_vc1</code> then presents <code>_vc2</code>, which presents <code>_vc3</code>, which then <em><strong>tries to present <code>_vc1</code></strong></em>. But, that instance of <code>_vc1</code> is already in the view hierarchy, presenting <code>_vc2</code> presenting <code>_vc3</code> ... and you end up with (effectively) an infinite loop.</p>\n<p>A &quot;carousel of presents&quot; is a bit of an unusual interface... but, if that's what your goal is, you'll need to take another approach.</p>\n<p>One option would be to present a <em>single view controller</em>, which would instantiate and load the 3 VCs as child view controllers.</p>\n<p>Each child's view would be overlaid. When you want to go from VC1 to VC2, you can simulate the presentation by:</p>\n<ul>\n<li>align VC2's view's Top to &quot;main&quot; view's bottom</li>\n<li>bring VC2's view to the front</li>\n<li>animate VC2's view up to the Top</li>\n</ul>\n<p>If you're interested, I posted a quick example of that approach here: <a href="https://github.com/DonMag/PresentCarousel" rel="nofollow noreferrer">https://github.com/DonMag/PresentCarousel</a></p>\n"^^ . . . . . "<p>I was able to fix that error by including my framework directory inside the <code>cinterop</code></p>\n<pre><code>iosTarget.compilations[&quot;main&quot;].apply {\n val opencv2 by cinterops.creating{\n\n includeDirs(&quot;src/iosMain/opencv2.framework&quot;) # This line\n}\n</code></pre>\n"^^ . "0"^^ . "0"^^ . . . . . . . . "<p>In a larger ObjC/Swift-mixed codebase I have an ObjC protocol <code>MyObjCProtocol &lt;NSObject&gt;</code> that other ObjC classes need to conform to. It declares a string property <code>@property (copy) NSString *myString</code>.</p>\n<p>Now, one of my Swift objects has a property <code>conformsToObjCProtocol</code> that is declared conforming to this protocol:</p>\n<pre><code>let conformsToObjCProtocol: MyObjCProtocol\n</code></pre>\n<p>This all works well.\nBut when I try to observe <code>myString</code> using Combine like this:</p>\n<pre><code>let cancellable = conformsToObjCProtocol.publisher(for: \\.myString).sink { print($0) }\n</code></pre>\n<p>I get an error <code>Value of type 'any MyObjCProtocol' has no member 'publisher'</code>.</p>\n<p>I believe it should work because MyObjCProtocol is declared conforming to NSObject. I did add MyObjCProtocol.h to the bridging header too so that's not it. I can't rewrite the protocol in Swift because I need ObjC classes to conform to it. What can I do about this?</p>\n"^^ . . "0"^^ . "<p>I have text that has no fixed length, like:</p>\n<pre><code>NSString *stringToSplit = @&quot;0.01 EUR sent from sender.email@domain.com. Hi. I'm sending you a free credit. Talk to you.&quot;;\n</code></pre>\n<p>I need to save in a string only the part after the “.com. “\nThe problems are as follows:</p>\n<ul>\n<li>stringToSplit does not have a fixed length.</li>\n<li>the domain of the internet addresses can vary (.com/.org/.it etc...)</li>\n</ul>\n<p>What I tried to do was this:</p>\n<pre><code>NSString *stringToSplit = @&quot;0.01 EUR sent from sender.email@domain.com. Hi. I'm sending you a free credit. Talk to you.&quot;;\n\nNSArray *firstSeparatedText = [stringToSplit componentsSeparatedByString:@&quot;@&quot;];\n\nNSArray *secondSeparatedText = [[firstSeparatedText lastObject] componentsSeparatedByString:@&quot;.&quot;];\n\nNSMutableArray *arr = [NSMutableArray arrayWithArray:secondSeparatedText];\n\nNSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)];\n[arr removeObjectsAtIndexes:indexSet];\n\nNSMutableString *textToShow = [[NSMutableString alloc] init];\nfor (NSObject * obj in arr)\n{\n [textToShow appendString:[obj description]];\n}\n</code></pre>\n<p>The problem is precisely that using the componentsSeparatedByString: method, the saved text would be</p>\n<blockquote>\n<p>“Hi I'm sending you a free credit Talk to you”</p>\n</blockquote>\n<p>but I need to save the dots as well.</p>\n<p>Basically I would like to save only the text that is after the email address (followed by the dot).</p>\n"^^ . "0"^^ . . . . "1"^^ . . . . . . "0"^^ . "MacOS: How do I give my program permissions during development?"^^ . "<p>The issue you're facing is due to the fact that even though your protocol <code>MyObjCProtocol</code> inherits from <code>NSObject</code>, Combine doesn't automatically recognize the properties for publishing. The <code>publisher(for:)</code> method is an extension provided by Combine for objects that support key-value observing (KVO), which doesn't directly apply to protocols in Objective-C.</p>\n<p>Here is a solution in Swift to address this problem:</p>\n<ol>\n<li><p><strong>Create an extension for NSObject</strong>: You can create an extension for <code>NSObject</code> that provides a publisher method for KVO-compatible properties.</p>\n</li>\n<li><p><strong>Use AnyObject instead of MyObjCProtocol</strong>: Since Combine requires a concrete reference and your protocol is just an abstraction, you need to use <code>AnyObject</code> and ensure that your concrete object conforms to the protocol.</p>\n</li>\n</ol>\n<p>Here is an example of how you can do this:</p>\n<ol>\n<li><strong>Extension for NSObject</strong>:</li>\n</ol>\n<pre class="lang-swift prettyprint-override"><code>import Combine\nimport Foundation\n\nextension NSObject {\n func publisher&lt;T&gt;(for keyPath: KeyPath&lt;NSObject, T&gt;) -&gt; AnyPublisher&lt;T, Never&gt; {\n Publishers.KVObservablePublisher(object: self, keyPath: keyPath)\n .eraseToAnyPublisher()\n }\n}\n</code></pre>\n<ol start="2">\n<li><strong>Observing the property</strong>:</li>\n</ol>\n<pre class="lang-swift prettyprint-override"><code>import Combine\n\n// Ensure your concrete object is an NSObject and conforms to the protocol\nlet objcObject: AnyObject = conformsToObjCProtocol as AnyObject\n\n// Force cast objcObject to NSObject to use the extension\nguard let nsObject = objcObject as? NSObject else {\n fatalError(&quot;The object is not an NSObject&quot;)\n}\n\n// Create the publisher and subscribe to it\nlet cancellable = nsObject.publisher(for: \\.myString).sink { newValue in\n print(newValue)\n}\n</code></pre>\n<p>Ensure that <code>myString</code> is properly exposed for KVO in your Objective-C class. This should resolve the issue and allow you to observe changes in the property using Combine.</p>\n"^^ . "<p>I gather that you intend to add a recurring user notification (say, every Sunday at 10:30 a.m.), but you want the ability to optionally skip the first one.</p>\n<p>A single, repeating, user notification is incapable of that: It will fire on every match of the date components, including the first one you may have wanted to skip.</p>\n<p>In this case, I would suggest scheduling a series of individual, non-repeating notifications. But, because there is a limit as to how many non-repeating notifications you can schedule (64 the last time I checked), I might fallback to a single repeating notification if you do not need to skip the first one:</p>\n<pre class="lang-swift prettyprint-override"><code>nonisolated func schedule(\n title: String,\n subtitle: String,\n body: String,\n skipFirst: Bool = false,\n weekday: Int,\n hour: Int,\n minute: Int\n) async throws {\n UNUserNotificationCenter.current().removeAllPendingNotificationRequests()\n\n if skipFirst {\n try await scheduleMultipleIndividualSkippingFirst(\n title: title,\n subtitle: subtitle,\n body: body,\n weekday: weekday,\n hour: hour,\n minute: minute\n )\n } else {\n try await scheduleSingleRepeating(\n title: title,\n subtitle: subtitle,\n body: body,\n weekday: weekday,\n hour: hour,\n minute: minute\n )\n }\n}\n</code></pre>\n<p>Where you have two renditions, one that schedules a single repeating user notification, and another that schedules a series of non-repeating user notifications, one for each of the future dates:</p>\n<pre class="lang-swift prettyprint-override"><code>private nonisolated func scheduleSingleRepeating(\n title: String,\n subtitle: String,\n body: String,\n weekday: Int,\n hour: Int,\n minute: Int\n) async throws {\n let components = DateComponents(hour: hour, minute: minute, weekday: weekday)\n\n let trigger = UNCalendarNotificationTrigger(dateMatching: components, repeats: true)\n\n let request = notificationRequest(\n identifier: Bundle.main.bundleIdentifier! + &quot;.repeating&quot;,\n title: title,\n subtitle: subtitle,\n body: body,\n trigger: trigger\n )\n\n try await UNUserNotificationCenter.current().add(request)\n}\n\nprivate nonisolated func scheduleMultipleIndividualSkippingFirst(\n title: String,\n subtitle: String,\n body: String,\n weekday: Int,\n hour: Int,\n minute: Int\n) async throws {\n let components = DateComponents(hour: hour, minute: minute, weekday: weekday)\n\n // skip the first one\n\n var date = Calendar.current.nextDate(after: .now, matching: components, matchingPolicy: .nextTime)\n\n // but now schedule a year worth of individual user notifications\n for i in 0 ..&lt; 52 {\n date = date.flatMap { Calendar.current.nextDate(after: $0, matching: components, matchingPolicy: .nextTime) }\n guard let date else { return }\n\n let triggerComponents = Calendar.current.dateComponents([.day, .month, .year, .hour, .minute], from: date)\n let trigger = UNCalendarNotificationTrigger(dateMatching: triggerComponents, repeats: false)\n\n let request = notificationRequest(\n identifier: Bundle.main.bundleIdentifier! + &quot;.individual\\(i)&quot;,\n title: title,\n subtitle: subtitle,\n body: body,\n trigger: trigger\n )\n\n try await UNUserNotificationCenter.current().add(request)\n }\n}\n\nprivate nonisolated func notificationRequest(\n identifier: String,\n title: String,\n subtitle: String,\n body: String,\n trigger: UNNotificationTrigger\n) -&gt; UNNotificationRequest {\n let notificationContent = UNMutableNotificationContent()\n notificationContent.title = title\n notificationContent.subtitle = subtitle\n notificationContent.body = body\n\n return UNNotificationRequest(identifier: identifier, content: notificationContent, trigger: trigger)\n}\n</code></pre>\n<p>Admittedly this process of scheduling a series of individual user notifications is not ideal, as you are limited to 64 of them, but then, again, if the user never opens your app for over a year, it may be a moot point.</p>\n<hr />\n<p>In my original answer, below, I assumed you were just trying to add user notifications for every non-weekend day of the week. I now gather that this was not your intent, but I will keep it here for posterity’s sake.</p>\n<hr />\n<p>The main issue is that <code>dateComponents.weekday = 2 + 7</code> pattern will not work. You want a <code>weekday</code> value that is in the range of <code>1..&lt;8</code>. Setting it to 9, as you have in your code snippet, is unlikely to work.</p>\n<p>If you really want the next <em>weekday</em> (i.e., excluding weekends) at the appointed hour and minute, the simple <code>UNCalendarNotificationTrigger(dateMatching:repeats:)</code> approach will not work. You want to set the date components to match one of the values in 1..&lt;8. So, there are two possible approaches:</p>\n<ul>\n<li><p>You might schedule five repeating notifications, one for each non-weekend day of the week (e.g., Mon-Fri in common western calendars):</p>\n<pre class="lang-swift prettyprint-override"><code>for weekday in Calendar.current.weekdaysExcludingWeekends() {\n let notificationContent = UNMutableNotificationContent()\n notificationContent.title = &quot;Title&quot;\n notificationContent.subtitle = &quot;Subtitle&quot;\n notificationContent.body = &quot;Body&quot;\n\n let components = DateComponents(hour: datePicker.date.hour(), minute: datePicker.date.minute(), weekday: weekday)\n print(weekday, components.hour!, components.minute!)\n\n let trigger = UNCalendarNotificationTrigger(dateMatching: components, repeats: true)\n\n let request = UNNotificationRequest(identifier: &quot;cocoacasts_local_notification.\\(weekday)&quot;, content: notificationContent, trigger: trigger)\n\n try await notificationCenter.add(request)\n}\n</code></pre>\n<p>Where:</p>\n<pre class="lang-swift prettyprint-override"><code>extension Calendar {\n func weekdaysExcludingWeekends() -&gt; [Int] {\n let now: Date = .now\n let daysOfWeek = Calendar.current.range(of: .weekday, in: .weekOfYear, for: now) ?? 1..&lt;8\n return daysOfWeek.filter { weekday in\n let date = Calendar.current.date(bySetting: .weekday, value: weekday, of: now)!\n return !Calendar.current.isDateInWeekend(date)\n }\n }\n}\n</code></pre>\n</li>\n<li><p>You could alternatively schedule non-repeating notifications, and calculate a series of individual non-weekend <code>Date</code> for the given hour and minute:</p>\n<pre class="lang-swift prettyprint-override"><code>let calendar = Calendar.current\nlet date = calendar.nextWeekday(after: date, hour: 14, minute: 0)\nlet components = calendar.dateComponents([.day, .month, .year, .hour, .minute], from: date)\nlet notificationTrigger = UNCalendarNotificationTrigger(dateMatching: components, repeats: false)\n</code></pre>\n<p>Where:</p>\n<pre class="lang-swift prettyprint-override"><code>extension Calendar {\n func nextWeekday(after startDate: Date = .now, hour: Int, minute: Int) -&gt; Date {\n var date = startDate\n\n let components = DateComponents(calendar: self, hour: hour, minute: minute)\n\n repeat {\n date = nextDate(after: date, matching: components, matchingPolicy: .nextTime)!\n } while isDateInWeekend(date)\n\n return date\n }\n}\n</code></pre>\n<p>But that only creates one notification. You would have to repeat this for all individual future notifications that you want. (And there are a limited number of notification you can set, so if you really want repeating notifications, you’d probably want to pursue the first option, above.)</p>\n</li>\n</ul>\n<hr />\n<p>There are other issues here:</p>\n<ol>\n<li><p>Probably unrelated, but you set the delegate for the <code>UNUserNotificationCenter</code> in the view controller.</p>\n<p>The <a href="https://developer.apple.com/documentation/usernotifications/unusernotificationcenter/delegate" rel="nofollow noreferrer">documentation</a> is clear that this must do this in the app delegate. (I know that Cocoacasts tutorial does it in the view controller, but you really should do it in the app delegate.)</p>\n<blockquote>\n<p>To guarantee that your app responds to all actionable notifications, you must set the value of this property before your app finishes launching. For an iOS app, this means updating this property in the <code>application(_:willFinishLaunchingWithOptions:)</code> or <code>application(_:didFinishLaunchingWithOptions:)</code> method of the app delegate. Notifications that cause your app to be launched or delivered shortly after these methods finish executing.</p>\n</blockquote>\n<p>So, either have the app delegate conform to <code>UNUserNotificationCenterDelegate</code>, or, better, have it instantiate some other, service object to conform to this protocol. But the setting of the notification center delegate must happen in <code>didFinishLaunchingWithOptions</code> or <code>willFinishLaunchingWithOptions</code>.</p>\n</li>\n<li><p>You are setting the <code>categoryIdentifier</code> for the <code>UNMutableNotificationContent</code>.</p>\n<p>For the vast majority of notifications, we would not do that. You only do that if you really have your <code>UNUserNotificationCenterDelegate</code> implement <code>userNotificationCenter(_:didReceive:withCompletionHandler:)</code> (or its <code>async</code> brethren, <code>userNotificationCenter(_:didReceive:)</code>)</p>\n<pre class="lang-swift prettyprint-override"><code>extension AppDelegate: UNUserNotificationCenterDelegate {\n func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async {\n switch response.actionIdentifier {\n case &quot;ShowSomething&quot;:\n await doSomethingSpectacular()\n default:\n print(&quot;unknown category&quot;)\n }\n }\n}\n</code></pre>\n<p>(As an aside, just like you put <code>categoryID</code> in a constant, I would tend to do the same with the action identifiers, avoiding littering my codebase with string literals, but I wanted to keep it simple.)</p>\n<p>Anyway, again, that is a less common use-case. Generally we would not set <code>categoryIdentifier</code> for the notification content at all. But that is up to you. But if you do, you must support it in the <code>UNUserNotificationCenterDelegate</code>.</p>\n<p>Now, if (a) you need this behavior; and (b) you implemented one of the <code>userNotificationCenter(_:didReceive:)</code> methods in your delegate, then forgive this observation. But that implementation was not included in the question, and I just wanted to note that sometimes if one neglects to implement a required delegate method, it can interfere with the correct behavior.</p>\n</li>\n</ol>\n"^^ . . "1"^^ . "How to get time zone from autoupdatingCurrentCalendar to update?"^^ . . . . "Could you clarify why in project written in C++ you are including Objective-C headers? How C++ should work with `NSString` for example?"^^ . . . . . . "0"^^ . . "1"^^ . . "0"^^ . . . . "2"^^ . "1"^^ . "0"^^ . "0"^^ . . "Debug it and add a breakpoint in `uncaughtExceptionhandler` to see if it's being called."^^ . . . . "0"^^ . "0"^^ . . . . . . . . "nstableview"^^ . "0"^^ . "appkit"^^ . . . . . . "Also perhaps [this helps](https://stackoverflow.com/questions/78122789/crash-in-nanopb-ios-17-4-0)?"^^ . "exception"^^ . "As I don't see your CLI, I cannot be completely sure, but these scripts are intended to be helpers for cross-compilation, as Clang which is the default Mac compiler is a cross-compiler in nature. Anyhow, `cmake` seems a pretty easy tool to learn and use"^^ . . "1"^^ . "Does this answer your question? [steps for use core data as database in my iOS app in Objective C](https://stackoverflow.com/questions/32153397/steps-for-use-core-data-as-database-in-my-ios-app-in-objective-c)"^^ . "1"^^ . "notifications"^^ . "<p>as I observed in my case, The <strong>Empty User Avatar</strong> comes when the <em>remoteHandle</em>'s has an empty string as a value. so by checking if the remote handle value is not an empty string, you can avoid this issue.</p>\n<p>the case for an empty user's Avatar(in the dynamic island)</p>\n<pre><code>let handle = &quot;&quot;\nlet callUpdate = CXCallUpdate()\ncallUpdate.remoteHandle = CXHandle(type: .phoneNumber, value: handle)\n</code></pre>\n<p>The fix is simply check if <em>handle</em> is an empty string or nil if yes then replace it with any keyword or number like Unknown.</p>\n"^^ . . . "1"^^ . "0"^^ . . "0"^^ . . "0"^^ . . "0"^^ . . . "Backswipe with Capacitor 6"^^ . . . . . . . . . . "<p>I was able to get a solution working for Capacitor 6 by following the steps listed here: <a href="https://capacitorjs.com/docs/ios/custom-code" rel="nofollow noreferrer">https://capacitorjs.com/docs/ios/custom-code</a></p>\n<ol>\n<li>Create a file under <code>App/plugins/SwipeGesture</code> called <code>SwipeGesturePlugin.swift</code> by adding the file via xcode.</li>\n</ol>\n<pre class="lang-swift prettyprint-override"><code>// SwipeGesturePlugin.swift\nimport Foundation\nimport Capacitor\n\n@objc(SwipeGesturePlugin)\npublic class SwipeGesturePlugin: CAPPlugin, CAPBridgedPlugin {\n public let identifier = &quot;SwipeGesturePlugin&quot;\n public let jsName = &quot;SwipeGesture&quot;\n public let pluginMethods: [CAPPluginMethod] = []\n\n override public func load() {\n if let webView = bridge?.webView as? WKWebView {\n webView.allowsBackForwardNavigationGestures = true\n }\n }\n}\n</code></pre>\n<ol start="2">\n<li>Now we need to add a view controller file to the xcode project.</li>\n</ol>\n<ul>\n<li>Right click on your App project folder, click &quot;New File...&quot;</li>\n<li>Select &quot;Cocoa Touch Class&quot; then click &quot;Next&quot;</li>\n<li>Name the file whatever you want, I named it PluginViewController</li>\n<li>Change Subclass of to &quot;UIViewController&quot;</li>\n<li>Change Language to Swift and next until the file is created</li>\n<li>Replace the file contents with the following:</li>\n</ul>\n<pre class="lang-swift prettyprint-override"><code>// PluginViewController.swift\nimport UIKit\nimport Capacitor\n\nclass PluginViewController: CAPBridgeViewController {\n override open func capacitorDidLoad() {\n bridge?.registerPluginInstance(SwipeGesturePlugin())\n }\n}\n\n</code></pre>\n<ol start="3">\n<li>Now we need to change the Main.storyboard to reference our new PluginViewController based on this documentation: <a href="https://capacitorjs.com/docs/ios/viewcontroller#edit-mainstoryboard" rel="nofollow noreferrer">https://capacitorjs.com/docs/ios/viewcontroller#edit-mainstoryboard</a></li>\n</ol>\n<ul>\n<li>Double click on Main.storyboard</li>\n<li>Expand &quot;Plugin View Controller Scene&quot;</li>\n<li>Click on Bridge View Controller</li>\n<li>In your menu bar click View &gt; Inspectors &gt; Identity (⌥ ⌘ 4)</li>\n<li>Change the class to <code>PluginViewController</code></li>\n</ul>\n<ol start="4">\n<li>If you have any .m files from your previous version of the plugin, that can safely be deleted.</li>\n</ol>\n"^^ . "0"^^ . "The `autoupdatingCurrentCalendar` *is* auto-updating. See [this Swift example](https://gist.github.com/robertmryan/98669fcb526c37e449551521e90f91d5). The problem here is not with the auto-updating calendar, but I am guessing that it is a result that you are spinning on the main thread, which never gives the calendar to get updated with the new timezone."^^ . "0"^^ . . . "<p>I have tried integrating <code>OpenCV</code> in a <code>native macOS app</code> with <code>Swift</code> and it results in bunch of <code>linker errors</code>. I have an <code>M1 Mac</code> and below are the two ways in which I have tried.</p>\n<p><strong>First Way:</strong></p>\n<p>First I did <code>brew install opencv</code> , I created a native <code>macOS</code> app with <code>swift</code> using <code>Xcode</code>, I went to <code>/usr/local/Cellar/opencv</code> in finder and dragged and dropped all the opencv libraries in FrameWorks, Libraries and Embedded Content of my app from the lib folder of <code>opencv</code>.</p>\n<p><a href="https://i.sstatic.net/ZL6eIYdm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ZL6eIYdm.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/plebmrfg.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/plebmrfg.png" alt="enter image description here" /></a></p>\n<p>Then In <code>Build Settings</code> -&gt; I searched for <code>Header Search Path</code> and added <code>/usr/local/Cellar/opencv/4.9.0_8/include/opencv4</code> and kept it as <code>recursive</code></p>\n<p>Then created <code>OpenCVWrapper.h</code></p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n#import &lt;Cocoa/Cocoa.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface OpenCVWrapper : NSObject\n\n+ (NSImage *)convertToGrayscale:(NSImage *)image;\n\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<p>Then created <code>OpenCVWrapper.mm</code></p>\n<pre><code>#import &lt;opencv2/opencv.hpp&gt;\n#import &lt;opencv2/imgcodecs/macosx.h&gt;\n#import &quot;OpenCVWrapper.h&quot;\n\n@implementation OpenCVWrapper\n\n+ (NSImage *)convertToGrayscale:(NSImage *)image {\n // Convert NSImage to cv::Mat\n cv::Mat cvImage = [self cvMatFromNSImage:image];\n\n // Convert to grayscale\n cv::Mat grayImage;\n cv::cvtColor(cvImage, grayImage, cv::COLOR_BGR2GRAY);\n\n // Convert cv::Mat back to NSImage\n NSImage *grayNSImage = [self nsImageFromCvMat:grayImage];\n return grayNSImage;\n}\n\n// Helper function to convert NSImage to cv::Mat\n+ (cv::Mat)cvMatFromNSImage:(NSImage *)image {\n CGImageRef imageRef = [image CGImageForProposedRect:NULL context:NULL hints:nil];\n NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage:imageRef];\n\n cv::Mat mat((int)bitmapRep.pixelsHigh, (int)bitmapRep.pixelsWide, CV_8UC4, (void *)bitmapRep.bitmapData, (int)bitmapRep.bytesPerRow);\n cv::Mat matBGR;\n cv::cvtColor(mat, matBGR, cv::COLOR_RGBA2BGR);\n return matBGR;\n}\n\n// Helper function to convert cv::Mat to NSImage\n+ (NSImage *)nsImageFromCvMat:(const cv::Mat&amp;)cvMat {\n NSData *data = [NSData dataWithBytes:cvMat.data length:cvMat.elemSize() * cvMat.total()];\n CGColorSpaceRef colorSpace;\n if (cvMat.type() == CV_8UC1) {\n colorSpace = CGColorSpaceCreateDeviceGray();\n } else {\n colorSpace = CGColorSpaceCreateDeviceRGB();\n }\n\n CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data);\n CGImageRef imageRef = CGImageCreate(cvMat.cols, // width\n cvMat.rows, // height\n 8, // bits per component\n 8 * cvMat.elemSize(), // bits per pixel\n cvMat.step.p[0], // bytesPerRow\n colorSpace, // colorspace\n kCGImageAlphaNone | kCGBitmapByteOrderDefault,// bitmap info\n provider, // CGDataProviderRef\n NULL, // decode\n false, // should interpolate\n kCGRenderingIntentDefault // intent\n );\n NSImage *image = [[NSImage alloc] initWithCGImage:imageRef size:NSMakeSize(cvMat.cols, cvMat.rows)];\n\n CGImageRelease(imageRef);\n CGDataProviderRelease(provider);\n CGColorSpaceRelease(colorSpace);\n\n return image;\n}\n\n@end\n</code></pre>\n<p>Then I created <code>PrefixHeader.pch</code></p>\n<pre><code>#ifndef PrefixHeader_pch\n#define PrefixHeader_pch\n\n#ifdef __cplusplus\n#include &lt;opencv2/opencv.hpp&gt;\n#endif\n\n#endif\n</code></pre>\n<p>In <code>Bridging-Header</code> I added <code>#import &quot;OpenCVWrapper.h&quot;</code></p>\n<p>In <code>Build Settings</code> -&gt; I set <code>Precompile Prefix Header</code> -&gt; yes &amp; <code>PrefixHeader</code>-&gt; <code>$(SRCROOT)/mymacosapp/PrefixHeader.pch</code></p>\n<p>After doing all this I get error saying</p>\n<pre><code>Undefined symbols for architecture arm64:\n &quot;cv::Mat::Mat(int, int, int, void*, unsigned long)&quot;, referenced from:\n +[OpenCVWrapper cvMatFromNSImage:] in OpenCVWrapper.o\n &quot;cv::Mat::Mat()&quot;, referenced from:\n +[OpenCVWrapper convertToGrayscale:] in OpenCVWrapper.o\n +[OpenCVWrapper cvMatFromNSImage:] in OpenCVWrapper.o\n &quot;cv::Mat::~Mat()&quot;, referenced from:\n +[OpenCVWrapper convertToGrayscale:] in OpenCVWrapper.o\n +[OpenCVWrapper convertToGrayscale:] in OpenCVWrapper.o\n +[OpenCVWrapper convertToGrayscale:] in OpenCVWrapper.o\n +[OpenCVWrapper convertToGrayscale:] in OpenCVWrapper.o\n +[OpenCVWrapper cvMatFromNSImage:] in OpenCVWrapper.o\n +[OpenCVWrapper cvMatFromNSImage:] in OpenCVWrapper.o\n +[OpenCVWrapper cvMatFromNSImage:] in OpenCVWrapper.o\n +[OpenCVWrapper cvMatFromNSImage:] in OpenCVWrapper.o\n ...\n &quot;cv::cvtColor(cv::_InputArray const&amp;, cv::_OutputArray const&amp;, int, int)&quot;, referenced from:\n +[OpenCVWrapper convertToGrayscale:] in OpenCVWrapper.o\n +[OpenCVWrapper cvMatFromNSImage:] in OpenCVWrapper.o\n &quot;cv::Mat::total() const&quot;, referenced from:\n +[OpenCVWrapper nsImageFromCvMat:] in OpenCVWrapper.o\nld: symbol(s) not found for architecture arm64\nclang: error: linker command failed with exit code 1 (use -v to see invocation)\n</code></pre>\n<p><strong>Second Way:</strong></p>\n<p>I created a new <code>native</code> macOS project. I just copied <code>OpenCVWrapper.h</code>, <code>OpenCVWrapper.mm</code> &amp; <code>Bridging Header</code> &amp; <code>PrefixHeader.pch</code> from what I shared in the First Way</p>\n<p>I downloaded the <code>OpenCV</code> source code from <code>Github</code>. then I ran</p>\n<pre><code>python3 platforms/apple/build_xcframework.py --out build_all \\\n--macos_deployment_target 12.15 \\\n--macos_archs arm64 \\\n--build_only_specified_archs True \\\n--without objc\n</code></pre>\n<p>From the <code>build_all</code> folder , it created a <code>opencv2.xcframework</code> which I dragged it inside <code>Frameworks, Libraries and Embedded Content</code> of <code>Xcode</code></p>\n<p>I get error saying</p>\n<pre><code>Undefined symbols for architecture arm64:\n &quot;_clBuildProgram&quot;, referenced from:\n _clBuildProgram_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCompileProgram&quot;, referenced from:\n _clCompileProgram_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateBuffer&quot;, referenced from:\n _clCreateBuffer_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateCommandQueue&quot;, referenced from:\n _clCreateCommandQueue_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateContext&quot;, referenced from:\n _clCreateContext_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateContextFromType&quot;, referenced from:\n _clCreateContextFromType_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateImage&quot;, referenced from:\n _clCreateImage_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateImage2D&quot;, referenced from:\n _clCreateImage2D_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateImage3D&quot;, referenced from:\n _clCreateImage3D_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateKernel&quot;, referenced from:\n _clCreateKernel_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateKernelsInProgram&quot;, referenced from:\n _clCreateKernelsInProgram_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateProgramWithBinary&quot;, referenced from:\n _clCreateProgramWithBinary_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateProgramWithBuiltInKernels&quot;, referenced from:\n _clCreateProgramWithBuiltInKernels_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateProgramWithSource&quot;, referenced from:\n _clCreateProgramWithSource_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateSampler&quot;, referenced from:\n _clCreateSampler_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateSubBuffer&quot;, referenced from:\n _clCreateSubBuffer_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateSubDevices&quot;, referenced from:\n _clCreateSubDevices_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clCreateUserEvent&quot;, referenced from:\n _clCreateUserEvent_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueBarrier&quot;, referenced from:\n _clEnqueueBarrier_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueBarrierWithWaitList&quot;, referenced from:\n _clEnqueueBarrierWithWaitList_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueCopyBuffer&quot;, referenced from:\n _clEnqueueCopyBuffer_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueCopyBufferRect&quot;, referenced from:\n _clEnqueueCopyBufferRect_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueCopyBufferToImage&quot;, referenced from:\n _clEnqueueCopyBufferToImage_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueCopyImage&quot;, referenced from:\n _clEnqueueCopyImage_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueCopyImageToBuffer&quot;, referenced from:\n _clEnqueueCopyImageToBuffer_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueFillBuffer&quot;, referenced from:\n _clEnqueueFillBuffer_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueFillImage&quot;, referenced from:\n _clEnqueueFillImage_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueMapBuffer&quot;, referenced from:\n _clEnqueueMapBuffer_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueMapImage&quot;, referenced from:\n _clEnqueueMapImage_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueMarker&quot;, referenced from:\n _clEnqueueMarker_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueMarkerWithWaitList&quot;, referenced from:\n _clEnqueueMarkerWithWaitList_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueMigrateMemObjects&quot;, referenced from:\n _clEnqueueMigrateMemObjects_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueNDRangeKernel&quot;, referenced from:\n _clEnqueueNDRangeKernel_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueNativeKernel&quot;, referenced from:\n _clEnqueueNativeKernel_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueReadBuffer&quot;, referenced from:\n _clEnqueueReadBuffer_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueReadBufferRect&quot;, referenced from:\n _clEnqueueReadBufferRect_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueReadImage&quot;, referenced from:\n _clEnqueueReadImage_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueTask&quot;, referenced from:\n _clEnqueueTask_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueUnmapMemObject&quot;, referenced from:\n _clEnqueueUnmapMemObject_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueWaitForEvents&quot;, referenced from:\n _clEnqueueWaitForEvents_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueWriteBuffer&quot;, referenced from:\n _clEnqueueWriteBuffer_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueWriteBufferRect&quot;, referenced from:\n _clEnqueueWriteBufferRect_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clEnqueueWriteImage&quot;, referenced from:\n _clEnqueueWriteImage_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clFinish&quot;, referenced from:\n _clFinish_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clFlush&quot;, referenced from:\n _clFlush_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetCommandQueueInfo&quot;, referenced from:\n _clGetCommandQueueInfo_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetContextInfo&quot;, referenced from:\n _clGetContextInfo_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetDeviceIDs&quot;, referenced from:\n _clGetDeviceIDs_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetDeviceInfo&quot;, referenced from:\n _clGetDeviceInfo_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetEventInfo&quot;, referenced from:\n _clGetEventInfo_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetEventProfilingInfo&quot;, referenced from:\n _clGetEventProfilingInfo_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetExtensionFunctionAddress&quot;, referenced from:\n _clGetExtensionFunctionAddress_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetExtensionFunctionAddressForPlatform&quot;, referenced from:\n _clGetExtensionFunctionAddressForPlatform_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetImageInfo&quot;, referenced from:\n _clGetImageInfo_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetKernelArgInfo&quot;, referenced from:\n _clGetKernelArgInfo_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetKernelInfo&quot;, referenced from:\n _clGetKernelInfo_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetKernelWorkGroupInfo&quot;, referenced from:\n _clGetKernelWorkGroupInfo_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetMemObjectInfo&quot;, referenced from:\n _clGetMemObjectInfo_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetPlatformIDs&quot;, referenced from:\n _clGetPlatformIDs_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetPlatformInfo&quot;, referenced from:\n _clGetPlatformInfo_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetProgramBuildInfo&quot;, referenced from:\n _clGetProgramBuildInfo_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetProgramInfo&quot;, referenced from:\n _clGetProgramInfo_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetSamplerInfo&quot;, referenced from:\n _clGetSamplerInfo_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clGetSupportedImageFormats&quot;, referenced from:\n _clGetSupportedImageFormats_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clLinkProgram&quot;, referenced from:\n _clLinkProgram_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clReleaseCommandQueue&quot;, referenced from:\n _clReleaseCommandQueue_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clReleaseContext&quot;, referenced from:\n _clReleaseContext_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clReleaseDevice&quot;, referenced from:\n _clReleaseDevice_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clReleaseEvent&quot;, referenced from:\n _clReleaseEvent_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clReleaseKernel&quot;, referenced from:\n _clReleaseKernel_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clReleaseMemObject&quot;, referenced from:\n _clReleaseMemObject_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clReleaseProgram&quot;, referenced from:\n _clReleaseProgram_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clReleaseSampler&quot;, referenced from:\n _clReleaseSampler_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clRetainCommandQueue&quot;, referenced from:\n _clRetainCommandQueue_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clRetainContext&quot;, referenced from:\n _clRetainContext_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clRetainDevice&quot;, referenced from:\n _clRetainDevice_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clRetainEvent&quot;, referenced from:\n _clRetainEvent_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clRetainKernel&quot;, referenced from:\n _clRetainKernel_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clRetainMemObject&quot;, referenced from:\n _clRetainMemObject_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clRetainProgram&quot;, referenced from:\n _clRetainProgram_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clRetainSampler&quot;, referenced from:\n _clRetainSampler_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clSetEventCallback&quot;, referenced from:\n _clSetEventCallback_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clSetKernelArg&quot;, referenced from:\n _clSetKernelArg_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clSetMemObjectDestructorCallback&quot;, referenced from:\n _clSetMemObjectDestructorCallback_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clSetUserEventStatus&quot;, referenced from:\n _clSetUserEventStatus_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clUnloadCompiler&quot;, referenced from:\n _clUnloadCompiler_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clUnloadPlatformCompiler&quot;, referenced from:\n _clUnloadPlatformCompiler_pfn in opencv2[arm64][115](opencl_core.o)\n &quot;_clWaitForEvents&quot;, referenced from:\n _clWaitForEvents_pfn in opencv2[arm64][115](opencl_core.o)\nld: symbol(s) not found for architecture arm64\nclang: error: linker command failed with exit code 1 (use -v to see invocation)\n</code></pre>\n"^^ . "0"^^ . . . . . . "Please check https://stackoverflow.com/a/35999230/833395 you might missed something, for testing just put dateComponents.seconds = 5, so every 5 seconds local notification will trigger"^^ . . . "0"^^ . . . . . . "1"^^ . "You can use `NSDataDetector`"^^ . . "0"^^ . . . . . "@Blurzschyter This seems to be Firebase dependency issue as highlighted in below to links.\n1) https://github.com/firebase/firebase-ios-sdk/issues/12632\n2) https://github.com/firebase/firebase-ios-sdk/issues/11403\nI would recommend you to update your firebase dependency to 10.28.1 version as mentioned by Firebase Team that this issue has been fixed."^^ . . "How can I send an iOS local push to a specific date and schedule it weekday for a particular time?"^^ . . "<p>Your build is completely wrong. The script you use is from <a href="https://github.com/opencv/opencv/tree/4.x/platforms" rel="nofollow noreferrer">here</a>, and this directory contains only the scripts intended to be used for <strong>cross-compilation</strong> for the platform that differs from your actual hardware. From your CLI, I would suppose that your build tries to create <code>arm64</code> cross-compiled binaries for Linux, but packages them into the MacOS-native X-Framework distribution archive.</p>\n<p>In this situation it is highly recommended to remove the current build, and then install <code>cmake</code> via homebrew, run it like this:</p>\n<pre class="lang-bash prettyprint-override"><code>mkdir build &amp;&amp; cd build\ncmake -LAH ..\n</code></pre>\n<p>...and inspect the printed variables with their developer hints. Then you may set everything up and prepare your XFramework archive with the architecture properly deducted.</p>\n"^^ . . . "0"^^ . . "iOS Communication Notification icon"^^ . "<p>I want to add and send an iOS local push notification to a specific date and want to schedule it by weekday for a specific time (hour, minute). I wanted to send this reminder weekday-wise but want to remove today's if use already took/achieved his today's goal. I've tried with the code below but failed to send it, please check the code below.</p>\n<pre><code>import UIKit\nimport UserNotifications\n\npublic extension Date {\n func noon(using calendar: Calendar = .current) -&gt; Date {\n calendar.date(bySettingHour: 12, minute: 0, second: 0, of: self)!\n }\n func day(using calendar: Calendar = .current) -&gt; Int {\n calendar.component(.day, from: self)\n }\n func weekday(using calendar: Calendar = .current) -&gt; Int {\n calendar.component(.weekday, from: self)\n }\n func hour(using calendar: Calendar = .current) -&gt; Int {\n calendar.component(.hour, from: self)\n }\n func minute(using calendar: Calendar = .current) -&gt; Int {\n calendar.component(.minute, from: self)\n }\n func second(using calendar: Calendar = .current) -&gt; Int {\n calendar.component(.second, from: self)\n }\n func adding(_ component: Calendar.Component, value: Int, using calendar: Calendar = .current) -&gt; Date {\n calendar.date(byAdding: component, value: value, to: self)!\n }\n func monthSymbol(using calendar: Calendar = .current) -&gt; String {\n calendar.monthSymbols[calendar.component(.month, from: self)-1]\n }\n func addDay(n: Int) -&gt; Date {\n let calendar = Calendar.current\n return calendar.date(byAdding: .day, value: n, to: self)!\n }\n}\n\nclass ViewController: UIViewController, UNUserNotificationCenterDelegate {\n private let categoryID = &quot;Category&quot;\n \n override func viewDidLoad() {\n super.viewDidLoad()\n \n UNUserNotificationCenter.current().delegate = self\n let actionShowSomething = UNNotificationAction(identifier: &quot;ShowSomething&quot;, title: &quot;Show Something&quot;, options: [])\n let category = UNNotificationCategory(identifier: categoryID, actions: [actionShowSomething], intentIdentifiers: [], options: [])\n UNUserNotificationCenter.current().setNotificationCategories([category])\n }\n \n @IBAction func addNotification(_ sender: Any) {\n UNUserNotificationCenter.current().removeAllPendingNotificationRequests()\n // Request Notification Settings\n UNUserNotificationCenter.current().getNotificationSettings { (notificationSettings) in\n switch notificationSettings.authorizationStatus {\n case .notDetermined:\n self.requestAuthorization(completionHandler: { (success) in\n guard success else { return }\n self.scheduleLocalNotification()\n })\n case .authorized:\n self.scheduleLocalNotification()\n case .denied:\n print(&quot;Application Not Allowed to Display Notifications&quot;)\n case .provisional:\n break\n case .ephemeral:\n break\n @unknown default:\n break\n }\n }\n }\n \n private func requestAuthorization(completionHandler: @escaping (_ success: Bool) -&gt; ()) {\n // Request Authorization\n UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { (success, error) in\n if let error = error {\n print(&quot;Request Authorization Failed (\\(error), \\(error.localizedDescription))&quot;)\n }\n completionHandler(success)\n }\n }\n \n // MARK: - ScheduleLocalNotification\n private func scheduleLocalNotification() {\n let notificationContent = UNMutableNotificationContent()\n notificationContent.title = &quot;Title&quot;\n notificationContent.subtitle = &quot;Subtitle&quot;\n notificationContent.body = &quot;Body&quot;\n notificationContent.categoryIdentifier = categoryID\n \n var dateComponents = DateComponents()\n let calendar = Calendar.current\n dateComponents.calendar = calendar\n let date = Date()\n let second = calendar.component(.second, from: date)\n dateComponents.weekday = 2 + 7 // Monday = 2\n dateComponents.second = second + 30\n \n let notificationTrigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true)\n \n let notificationRequest = UNNotificationRequest(identifier: &quot;cocoacasts_local_notification&quot;, content: notificationContent, trigger: notificationTrigger)\n \n UNUserNotificationCenter.current().add(notificationRequest) { (error) in\n if let error = error {\n print(&quot;Unable to Add Notification Request (\\(error), \\(error.localizedDescription))&quot;)\n }\n }\n }\n}\n</code></pre>\n"^^ . . . . . . . . . . "0"^^ . "How to call a Swift enum function to get string in objc?"^^ . "Is `mainWindow.contentViewController` `nil`?"^^ . "<p>Following this <a href="https://georghoeller.dev/capacitor-ng-back-swipe/" rel="nofollow noreferrer">tutorial</a> around january of 2024 with Capacitorjs version 5 helped me to add navigating back using backswipe on ios devices.</p>\n<p>However now, using Capacitor 6, I'm no longer able to make it work.</p>\n<p>I looked up Capacitor's custom plugin <a href="https://capacitorjs.com/docs/plugins/tutorial/ios-implementation" rel="nofollow noreferrer">docs</a>, to see if anything changed.</p>\n<p>I followed their steps, creating <code>group</code> called <code>plugins</code>, under it group <code>Backswipe</code>.\n<code>Backswipe</code> group contains 3 files, but when I run the code, backswipe to navigate doesn't work.</p>\n<p>What else could I do?</p>\n<pre><code>// App/App/plugins/Backswipe/BackswipePlugin.m\n\n#import &lt;Foundation/Foundation.h&gt;\n#import &lt;Capacitor/Capacitor.h&gt;\n\nCAP_PLUGIN(BackswipePlugin, &quot;BackswipePlugin&quot;,)\n</code></pre>\n<pre><code>// App/App/plugins/Backswipe/BackswipePlugin.swift\n\nimport Foundation\nimport Capacitor\n\n@objc(BackswipePlugin)\npublic class BackswipePlugin: CAPPlugin {\n \n override public func load() {\n bridge?.webView?.allowsBackForwardNavigationGestures = true;\n }\n}\n</code></pre>\n<pre><code>// App/App/plugins/Backswipe/App Name-Bridging-Header.h\n\n//\n</code></pre>\n<p>I also tried renaming <code>BackswipePlugin.m</code> to <code>Backswipe.m</code>, didn't help.</p>\n<p>My other guess is if the space in autogenerated bridging header could be causing the problems.</p>\n<p>Any help is welcome, thank you.</p>\n"^^ . "<p>I got the solution for my question. It is available only from iOS 16.</p>\n<pre><code>if (@available(iOS 16.0, *)) {\n UISheetPresentationControllerDetent *mediumDetentOne = [UISheetPresentationControllerDetent customDetentWithIdentifier:@&quot;semifullScreen&quot; resolver:^CGFloat(id&lt;UISheetPresentationControllerDetentResolutionContext&gt; _Nonnull context) {\n return self.view.frame.size.height-90;\n }];\n sheet.detents = @[\n mediumDetentOne,\n ];\n}\n</code></pre>\n"^^ . . . "PJSIP Outgoing call"^^ . . . "0"^^ . "-1"^^ . . . . "But I want to skip today and want to reschedule it for next weekday, is it possible?"^^ . "2"^^ . . . . "unusernotificationcenter"^^ . . . . "0"^^ . . "You should build your own date picker."^^ . . "0"^^ . . "cmake"^^ . "1"^^ . "0"^^ . . "0"^^ . . . . "1"^^ . "0"^^ . . . . . . . "0"^^ . . "Objective-c conforming protocols property attributes conflict"^^ . . . . . . . . "0"^^ . . . . . "0"^^ . "iOS devices with dynamic island shows empty user avatar. How to disable it?"^^ . "1"^^ . . "0"^^ . "0"^^ . . . . . . . "0"^^ . . . . "0"^^ . . "1"^^ . "0"^^ . "1"^^ . . . "App crashes when running Python code from Flutter/Native MACOS application"^^ . . "<p>I have tried to get audio input (and output at the same time) using the <code>AVAudioSourceNode</code> and <code>AVAudioSinkNode</code>. The problem is, I haven't been able to find a proper sample on how to set it up, even on Apple's website. I do basically this:</p>\n<pre><code>AVAudioEngine* m_engine = [AVAudioEngine new];\nAVAudioSession* m_avSession = AVAudioSession.sharedInstance;\n\nif (![m_avSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&amp;error] ||\n ![m_avSession setActive:true withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:&amp;error])\n{\n m_logger.Error(&quot;Could not activate Audio Session: &quot;, error.description);\n}\n\nAVAudioSinkNode* CreateInputNode(AVAudioFormat* format)\n{\n AVAudioSinkNodeReceiverBlock block = [checker, format] (const AudioTimeStamp* timestamp, AVAudioFrameCount frameCount, const AudioBufferList* inputData) {\n ProcessAudioForInput(format, inputData, frameCount);\n return OSStatus(noErr);\n };\n return [[AVAudioSinkNode alloc] initWithReceiverBlock:block];\n}\n\nAVAudioSessionRouteDescription* route = m_avSession.currentRoute;\nAVAudioFormat* inputFormat = [m_engine.inputNode inputFormatForBus:FIRST_AUDIO_BUS];\nauto sinkNode = CreateInputNode(inputFormat);\nif (sinkNode) {\n [m_engine attachNode:sinkNode];\n [m_engine connect:sinkNode to:m_engine.inputNode format:inputFormat];\n channelCount = inputFormat.channelCount;\n}\nelse {\n m_logger.Error(&quot;Could not create input node&quot;);\n}\n</code></pre>\n<p>The <code>[m_engine connect:sinkNode</code> line generates an exception, which I have strictly no idea how to debug:</p>\n<pre><code>*** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: inSrcImpl-&gt;NumberOutputs() &gt; 0'\n</code></pre>\n<p>Could anyone help or point me to proper resources explaining how to set this up, instead of going blind. Note that I have watched some videos from the WWC, like <a href="https://developer.apple.com/videos/play/wwdc2019/510/" rel="nofollow noreferrer">https://developer.apple.com/videos/play/wwdc2019/510/</a> but the source code and explanations are not helping me solve this problem.</p>\n"^^ . . . "entitlements"^^ . . "1"^^ . "1"^^ . . "Thanks again. Yes, I was thinking that the problem is essentially two concurrency models that are fighting each other. The real application has the polling happen in a goroutine, so it looks like I need to add `C.dispatch_main()` somewhere sensible. As a non-mac dev, I find this horrifying, but I guess if it has to happen, it has to happen. Thank you so much for digging into this. I'll also play with the auto-updating part."^^ . "Please show the actual code that "is not working for me". Explain, with reference to that code, what you are hoping to do and what is happening instead."^^ . "0"^^ . . . . "<p>Can I make a class conforms to two protocols with same property but different access level attribute?</p>\n<p>E.g.</p>\n<pre><code>@interface Test () &lt;ProtocolA, ProtocolB&gt; {\n}\n@end\n\n@protocol ProtocolA &lt;NSObject&gt;\n@property(nonatomic, readwrite) id prop;\n@end\n\n@protocol ProtocolB &lt;NSObject&gt;\n@property(nonatomic, readonly) id prop;\n</code></pre>\n<p>What I'm trying to achieve is to expose <code>prop</code> only in test environment. In test cases, I'll set <code>prop</code> to be a mocked object.</p>\n<p>Thanks!</p>\n<p>I tried to expose <code>prop</code> in ProtocolB to be <code>readwrite</code> and set it successfully in tests, however, this is less ideal since I sacrifice the access level.</p>\n"^^ . . . . "0"^^ . . "0"^^ . "1"^^ . . . "0"^^ . . . . "0"^^ . . . "0"^^ . . . "0"^^ . "Crash issue in iOS related to fopen_s(__sFILE**, char const*, char const*)"^^ . . . . "0"^^ . "In this case please provide the code and describe what you're actually getting as a result, otherwise it's impossible to guess."^^ . . "<p>Each instance of <code>NSManagedObject</code> holds the data for one single &quot;record&quot;. You can store as many <code>NSManagedObject</code> instances in your <code>ManagedObjectContext</code> as you like.</p>\n<p>Best practice in Core Data is to define <code>NSManagedObject</code> subclasses for each kind of data, to allow type checking and to generate accessors. In your example, <code>MyEntity</code> would be a subclass of <code>NSManagedObject</code>.</p>\n<p>If you create an owning &quot;Data Model&quot; class, that's the place to hang entities, but they're managed for you by <code>NSPersistentContainer</code>/<code>NSPersistentStoreCoordinator</code>. There are recent WWDC videos from Apple on modern Core Data. Much of the attribute and relationship generation is handled automatically for you now. See <a href="https://developer.apple.com/documentation/coredata/core_data_stack" rel="nofollow noreferrer">https://developer.apple.com/documentation/coredata/core_data_stack</a>.</p>\n"^^ . "0"^^ . "<p>I am trying to build a cross platform application on MacOS which is written in C++. In my CMake I've included</p>\n<pre><code>cmake_minimum_required(VERSION 3.28)\nproject(lel LANGUAGES C CXX)\n\nif(APPLE)\n enable_language(OBJC)\nendif()\n</code></pre>\n<p>In my .cpp file I've also included this:</p>\n<pre><code>#if defined(SDL_PLATFORM_MACOS)\n#include &lt;Cocoa/Cocoa.h&gt;\n#include &lt;Foundation/Foundation.h&gt;\n#include &lt;QuartzCore/CAMetalLayer.h&gt;\n</code></pre>\n<p>The error I get is the following:</p>\n<pre><code>In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:\nIn file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:9:\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:601:1: error: expected unqualified-id\n@class NSString, Protocol;\n</code></pre>\n<p>I know the reason is that MacOS uses Objective C to build programs and the codebase is C++. But I don't know how to get around this issue. I've tried to wrap my includes with</p>\n<pre><code>#ifdef __OBJC__\n#include &lt;Cocoa/Cocoa.h&gt;\n#include &lt;Foundation/Foundation.h&gt;\n#include &lt;QuartzCore/CAMetalLayer.h&gt;\n#endif\n</code></pre>\n<p>But it just causes errors saying it can't identify any of the 'Types' which would have been included from the includes.</p>\n<p>How do I get around this issue? Thanks in advance.</p>\n"^^ . . "Swift property conforming to ObjC protocol has no member 'publisher'"^^ . "_objc_msgSend crash swiftui"^^ . "<p>I'm building app using expo, and integrated notification using <a href="https://docs.expo.dev/versions/latest/sdk/notifications/" rel="nofollow noreferrer">expo-notification</a>.\nAlso, I made the interactive notification using <a href="https://docs.expo.dev/versions/latest/sdk/notifications/#manage-notification-categories-interactive-notifications" rel="nofollow noreferrer"><code>setNotificationCategoryAsync</code></a>.</p>\n<p>I added postpone action to action of notification, and I want to send postpone event to server side.</p>\n<p>Please explain how can we do it with expo. if impossible with expo, native solution that using objective-c also good for me.</p>\n"^^ . . . "1"^^ . . . "1"^^ . "foundation"^^ . . . "crash-dumps"^^ . "2"^^ . . . . . . . . . "0"^^ . . . . . . . . "Gerd and Rob, thank you both. That looks like it will have been the issue. I'll try with that (correct) documentation."^^ . "0"^^ . . . "2"^^ . "1"^^ . . "0"^^ . "<p><code>@objc</code> for bridging Swift enum to Objective-c enum only supports integer types as the raw value.</p>\n<pre class="lang-swift prettyprint-override"><code>@objc public func description() -&gt; String { ... }\n</code></pre>\n<p>The above code will throw an error at compile time:</p>\n<blockquote>\n<p>@objc can only be used with members of classes, @objc protocols, and concrete extensions of classes</p>\n</blockquote>\n<p>You can try this approach, define a class in Swift to add <code>objc</code> annotation:</p>\n<pre class="lang-swift prettyprint-override"><code>@objc class ResultCodeReader: NSObject {\n @objc static func getDescription(from resultCode: ResultCode) -&gt; String {\n resultCode.description()\n }\n}\n</code></pre>\n<p>Then you're able to get the <code>ResultCode</code> description from Objective-c:</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSString *desc = [ResultCodeReader getDescriptionFrom:ResultCodeNoError];\n</code></pre>\n"^^ . . . . . "0"^^ . "1"^^ . . . "<p>how search best epsilon and delta for lcs matrix(what object function)</p>\n<p>I want to use heuristic algorithms to search the value of epsilon and delta to find the best epsilon for time series data. I don't know how to write the objective function.</p>\n"^^ . . . . "Sounds like your question has been answered!"^^ . "0"^^ . . . . . "2"^^ . . "Mock AVCaptureDeviceInput for unit tests"^^ . . "rust"^^ . "<p>You have to add an <code>Entitlements.plist</code> file to your Tauri app and define the path to that file in the <code>tauri.bundle.macOS.entitlements</code> setting. See the <a href="https://tauri.app/v1/guides/building/macos" rel="nofollow noreferrer">macOS Bundle page</a> in the Tauri guide. You will also find a <a href="https://developer.apple.com/documentation/bundleresources/entitlements" rel="nofollow noreferrer">link to the description of the various entitlements</a> there.</p>\n<p>The <code>Entitlements.plist</code> file could look like this:</p>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;\n&lt;plist version=&quot;1.0&quot;&gt;\n&lt;dict&gt;\n &lt;key&gt;com.apple.security.app-sandbox&lt;/key&gt;\n &lt;true/&gt;\n &lt;key&gt;com.apple.security.files.user-selected.read-write&lt;/key&gt;\n &lt;true/&gt;\n &lt;key&gt;com.apple.security.print&lt;/key&gt;\n &lt;true/&gt;\n&lt;/dict&gt;\n&lt;/plist&gt;\n</code></pre>\n"^^ . . "<p>I think you've got your arrows reversed, it should be</p>\n<p><code>inputNode -&gt; sinkNode</code></p>\n<p>not</p>\n<p><code>sinkNode -&gt; inputNode</code>,</p>\n<p>so try this instead</p>\n<pre><code>[m_engine connect: m_engine.inputNode to:sinkNode format:inputFormat];\n</code></pre>\n"^^ . "When need to call the Objective C nsautoreleasepool() on Rust side?"^^ . . . "objective-c"^^ . . . . "-1"^^ . . . . "0"^^ . "0"^^ . . "1"^^ . "0"^^ . . "1"^^ . "1"^^ . . . "<p>I use the <a href="https://github.com/madsmtm/objc2" rel="nofollow noreferrer"><strong>objc2</strong></a> library and their <a href="https://github.com/madsmtm/objc2/tree/master/framework-crates/objc2-app-kit" rel="nofollow noreferrer"><strong>AppKit</strong></a> bindings in my project.</p>\n<p>Everything is good but I am not an Objective C developer and a little confused by the Rust implementation of <code>autoreleasepool</code>.</p>\n<p>For example,</p>\n<pre><code>fn set_icon(&amp;self, icon: Option&lt;&amp;Icon&gt;) {\n autoreleasepool(|_| {\n let mtm = MainThreadMarker::from(self);\n let app = NSApp(mtm);\n match icon {\n Some(icon) =&gt; {\n let ns_image = icon.get_impl().get_native();\n unsafe { app.setApplicationIconImage(Some(&amp;ns_image)) };\n }\n None =&gt; unsafe { app.setApplicationIconImage(None) },\n }\n });\n}\n</code></pre>\n<p>macOS <code>Icon</code> implementation:</p>\n<pre><code>struct IconImpl {\n mtm: MainThreadMarker,\n native: MainThreadBound&lt;Id&lt;NSImage&gt;&gt;,\n}\n\nimpl IconImpl {\n fn get_native(&amp;self) -&gt; &amp;Id&lt;NSImage&gt; { self.native.get(self.mtm) }\n}\n</code></pre>\n<p>Should I use the <code>autoreleasepool</code> in such cases?</p>\n<p>Theoretically there can be an existed icon which will be replaced by a new one and it will lead to memory leaks (at least I think so). On the other hand, the previous icon can be set from the <code>Icon</code> instance too and then I don't need to release it cuz my <code>Icon</code> implementation will release it automatically on <code>drop()</code>.</p>\n"^^ . . . . . "But that means I would have to uniquely identify each object, and I need to do that at runtime."^^ . "0"^^ . . . . . . . "0"^^ . . . "0"^^ . . . . . . . . . . . . "cross-platform"^^ . . . . . . . . "Twitter Login error obtaining user auth token"^^ . . "2"^^ . "From the Tauri page: "Entitlements control what APIs your app will have access to". Yes, they are not the same, but sandboxed apps need to state which capabilities they want to have. The question does not tell which permissions are required, but if the library needs the network, camera, USB or whatever, it is worth a try."^^ . "<p>I am doing some experiment based on this answer: <a href="https://stackoverflow.com/a/17921058/767653">https://stackoverflow.com/a/17921058/767653</a></p>\n<p>This is my minimum reproducible code:</p>\n<pre><code>\n- (void)viewDidLoad {\n [super viewDidLoad];\n \n __block BOOL completed = NO;\n [self doMyWork:^{\n completed = YES;\n }];\n \n while (!completed) {\n [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]];\n }\n}\n\n</code></pre>\n<p>My understanding is that, this code has a deadlock. Because the completion block is run on main thread, so in order for the completion block to run, <code>viewDidLoad</code> must return. And in order for <code>viewDidLoad</code> to return, completion block must be run to toggle the <code>completed</code> flag (hence circular wait).</p>\n<p>However, when I run it, there's no deadlock in this code. Where I did understand wrongly?</p>\n"^^ . . . . . "-1"^^ . . "<p>The <code>.def</code> file you showed is missing the entry for <code>headers =</code>. See step 5 in the section on <a href="https://kotlinlang.org/docs/multiplatform-ios-dependencies.html#add-a-library-without-cocoapods" rel="nofollow noreferrer">Add a library without CocoaPods</a>.</p>\n<blockquote>\n<ol start="5">\n<li>Provide values for two mandatory properties:</li>\n</ol>\n<ul>\n<li><p>headers describes which headers will be processed by cinterop.</p>\n</li>\n<li><p>package sets the name of the package these declarations should be put into.</p>\n</li>\n</ul>\n</blockquote>\n<p>For example:</p>\n<pre><code>headers = DateTools.h\npackage = DateTools\n</code></pre>\n"^^ . "callkit"^^ . . . . . "0"^^ . "0"^^ . "0"^^ . "Parsing email addresses correctly is very hard, there are so many edge cases. \nAs @Cy-4AH suggested `NSDataDetector` is a better solution. This is a non-trivial problem!"^^ . . ""Missing required entitlement" after connecting to ID06 (ISO-DEV)"^^ . "0"^^ . "delta"^^ . "1"^^ . "0"^^ . . "Sorry, I forgot memory management. `timeZone` must be released. If a function name contains the word "Get", you do not own the object. Does the test app continue to leak if you let it run a little longer?"^^ . . "0"^^ . . . . . "<p><strong>I think we need to make some changes inside the code and take help of protocols.</strong></p>\n<p>As you say &quot;I have a class that receives an AVCaptureDevice object as a parameter and I'd like to test it&quot; and &quot;inside my class, this instance is used to create an AVCaptureDeviceInput object as follows:&quot;</p>\n<p><strong>So pass both AVCaptureDevice and AVCaptureDeviceInput as parameters.\nAnd make use of protocols to create mockCaptureDevice and mockCaptureDeviceInput.</strong></p>\n<p>like as follows =&gt;</p>\n<pre><code>protocol CaptureDeviceInputAbility {}\nextension AVCaptureDeviceInput: CaptureDeviceInputAbility {}\n\nprotocol CaptureDeviceAbility {}\nextension AVCaptureDevice: CaptureDeviceAbility {}\n\n// Mock objects\nclass MockCaptureDeviceInput: CaptureDeviceInputAbility {}\nclass MockCaptureDevice: CaptureDeviceAbility {}\n</code></pre>\n<p><strong>Note use protocols as types , instead on concrete types to add mockings!</strong> like below</p>\n<pre><code>func yourMethod(captureDevice: CaptureDeviceAbility, captureDeviceInput: \nCaptureDeviceInputAbility) {\n\n}\n\nlet mockDevice = MockCaptureDevice()\nlet mockInput = MockCaptureDeviceInput()\nyourMethod(captureDevice: mockDevice, captureDeviceInput: mockInput)\n</code></pre>\n"^^ . . "How to obtain updated timezone identifiers on MacOS?"^^ . . "0"^^ . . . "0"^^ . . "0"^^ . "<p>I need to present a viewcontroller that present 2/3 of the screen from the bottom, remaining part of the screen is blur view. How can I set this? I need in objective c.</p>\n<p>tried modelPresentaionStyle with different values but did not get it.</p>\n"^^ . . . . "<p>I'm developing an iOS app using Swift and PJSIP for SIP calling. I want to dynamically update the phone number displayed in the app when a call is initiated.</p>\n<p>Here's the relevant part of my code:</p>\n<pre class="lang-swift prettyprint-override"><code>import PJSUA2\n\nvoid make_call(char* name, char* sip_id, char* sip_server){\n pj_status_t status;\n /* If URL is specified, make call to the URL. */\n char sip_uri[80];\n sprintf(sip_uri, &quot;\\&quot;%s\\&quot; &lt;sip:%s@%s&gt;&quot;,name, sip_id, sip_server);\n pj_str_t uri = pj_str(sip_uri);\n pjsua_call_setting call_set;\n pjsua_call_setting_default(&amp;call_set);\n status = pjsua_call_make_call(account_id, &amp;uri, &amp;call_set, NULL, NULL, NULL);\n if (status != PJ_SUCCESS)\n error_exit(&quot;Error making call&quot;, status);\n}\n\n</code></pre>\n"^^ . . . "0"^^ . . . . . "react-native"^^ . "0"^^ . . . . . . . . . "1"^^ . . "uikit"^^ . . . "Thankyou, the error was resolved by putting all objective c guards and code inside the #if OBJC section"^^ . . . . "UIViewController.presentModalViewController hangs indefinitely"^^ . "0"^^ . . "Standard UTType for Word Docs with UIDocumentPickerViewController?"^^ . "0"^^ . . "<p>I am trying to get the updated timezone identifier for a cross-platform application. I have the Linux side handled, but am having difficulty finding information around how to get this on MacOS (not my native OS) using Objective-C (not my native language). (The application is written in Go, so the foreign calls need to be to Objective-C rather than Swift).</p>\n<p>I have found the documentation for <a href="https://developer.apple.com/documentation/foundation/timezone" rel="nofollow noreferrer"><code>struct TimeZone</code></a> and <a href="https://developer.apple.com/documentation/foundation/timezone/2292819-autoupdatingcurrent" rel="nofollow noreferrer"><code>autoupdatingCurrent</code></a> which look to be the things that I want.</p>\n<p>It looks to me like I want to get <a href="https://developer.apple.com/documentation/foundation/timezone/2293601-identifier" rel="nofollow noreferrer"><code>autoupdatingCurrent.identifier</code></a>, but I am unable to find any clear example of how to do this. As far as I can see from the documentation, I should just be able to reference <code>autoupdatingCurrent.identifier</code> to get the string, but this is not working for me, so I am obviously missing something.</p>\n<p>Can someone either point me to good documentation for this, or point to/provide a brief example that I can learn from?</p>\n"^^ . . . . "<p>From Objective-C, you want to use the classes that start with <code>NS</code> (e.g., <a href="https://developer.apple.com/documentation/foundation/nscalendar?language=objc" rel="nofollow noreferrer"><code>NSCalendar</code></a> rather than Swift’s <code>Calendar</code>, <a href="https://developer.apple.com/documentation/foundation/nstimezone?language=objc" rel="nofollow noreferrer"><code>NSTimeZone</code></a> rather than Swift’s <code>TimeZone</code>, etc.).</p>\n<p>Thus, in Objective-C (for me in Los Angeles, CA):</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSString *name = NSCalendar.autoupdatingCurrentCalendar.timeZone.name;\nNSLog(@&quot;timezone name %@&quot;, name); // America/Los_Angeles\n\nNSString *name2 = [[[NSCalendar autoupdatingCurrentCalendar] timeZone] name];\nNSLog(@&quot;timezone name %@&quot;, name2); // America/Los_Angeles\n\nNSString *abbreviation = NSCalendar.autoupdatingCurrentCalendar.timeZone.abbreviation;\nNSLog(@&quot;timezone abbreviation %@&quot;, abbreviation); // PDT (aka, “Pacific Daylight Time”)\n\nNSString *abbreviation2 = [[[NSCalendar autoupdatingCurrentCalendar] timeZone] abbreviation];\nNSLog(@&quot;timezone abbreviation %@&quot;, abbreviation2); // PDT\n\nNSString *abbreviation3 = [NSCalendar.autoupdatingCurrentCalendar.timeZone abbreviationForDate:[NSDate now]];\nNSLog(@&quot;timezone abbreviation %@&quot;, abbreviation3); // PDT\n\nNSString *abbreviation4 = [[[NSCalendar autoupdatingCurrentCalendar] timeZone] abbreviationForDate:[NSDate now]];\nNSLog(@&quot;timezone abbreviation %@&quot;, abbreviation4); // PDT\n</code></pre>\n<p>I include both the contemporary “dot syntax”, as well as the legacy Objective-C <code>[…]</code> syntax. I assume you would use the former, the “dot syntax”, from Go, but I am not familiar with how these “Foundation” types are exposed. But, hopefully, the above helps.</p>\n<hr />\n<p>You reference <a href="https://developer.apple.com/documentation/foundation/timezone" rel="nofollow noreferrer"><code>struct TimeZone</code></a>. That is a Swift <code>struct</code>. I gather you are not interested in Swift interfaces, but if you were, here are demonstrations of the Swift API:</p>\n<pre class="lang-swift prettyprint-override"><code>let name = Calendar.autoupdatingCurrent.timeZone.identifier\nprint(&quot;timezone name&quot;, name); // America/Los_Angeles\n\nif let abbreviation = Calendar.autoupdatingCurrent.timeZone.abbreviation(for: .now) {\n print(&quot;timezone abbreviation&quot;, abbreviation); // PDT\n}\n</code></pre>\n<hr />\n<p>FWIW, you reference <code>autoupdatingCurrent.identifier</code>. That is the identifier for the calendar (e.g. <code>gregorian</code> vs <code>chinese</code>), not the timezone. And that is Swift. In Objective-C, it would be:</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSString *calendarIdentifier = NSCalendar.autoupdatingCurrentCalendar.calendarIdentifier;\nNSLog(@&quot;calendar identifier = %@&quot;, calendarIdentifier); // gregorian\n\nNSString *calendarIdentifier2 = [[NSCalendar autoupdatingCurrentCalendar] calendarIdentifier];\nNSLog(@&quot;calendar identifier = %@&quot;, calendarIdentifier2); // gregorian\n</code></pre>\n"^^ . "0"^^ . "1"^^ . "Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/257703/discussion-between-paulw11-and-omgpop)."^^ . "May be some 3rd party lib also calling `NSSetUncaughtExceptionHandler` to."^^ . "0"^^ . . . "0"^^ . . . . . "0"^^ . "Even when I do, this seems to leak."^^ . . "0"^^ . . "1"^^ . "1"^^ . "0"^^ . "1"^^ . . "@AMIT – in my answer below, I assumed that when you said “weekday-wise”, that you meant it in the everyday use of the term (e.g., Mon-Fri in common Gregorian calendars). Is that correct? Or did you want the notification to fire every day, both “weekdays” and “weekends”? (The `Calendar` API’s use of the term `weekday` is confusing, IMHO, actually meaning “day of the week”, including weekends.)"^^ . . . . . . "0"^^ . "<p>When a table header isn't needed you just can set it to nil. This removes the glitch.\nCredits to @willeke for pushing me to the right direction</p>\n"^^ . . "0"^^ . . "<p>It turns out that, the same way <code>xcodebuild create-xcframework</code> does not copy the <code>.modulemap</code>, it also not not copy the Swift headers.</p>\n<p>Here is a working script that copies both from the derived data. It also make it easy to add platforms.</p>\n<pre class="lang-bash prettyprint-override"><code>for PLATFORM in &quot;iOS&quot; &quot;iOS Simulator&quot;; do\n\n case $PLATFORM in\n &quot;iOS&quot;)\n RELEASE_FOLDER=&quot;Release-iphoneos&quot;\n ;;\n &quot;iOS Simulator&quot;)\n RELEASE_FOLDER=&quot;Release-iphonesimulator&quot;\n ;;\n esac\n \n ARCHIVE_PATH=$RELEASE_FOLDER\n\n xcodebuild archive \\\n -workspace $WORKSPACE \\\n -scheme $SCHEME \\\n -destination &quot;generic/platform=$PLATFORM&quot; \\\n -archivePath $ARCHIVE_PATH \\\n -derivedDataPath &quot;.build&quot; \\\n SKIP_INSTALL=NO \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES\n\n FRAMEWORK_PATH=&quot;$ARCHIVE_PATH.xcarchive/Products/usr/local/lib/$SCHEME.framework&quot;\n MODULES_PATH=&quot;$FRAMEWORK_PATH/Modules&quot;\n mkdir -p $MODULES_PATH\n \n HEADERS_PATH=&quot;$FRAMEWORK_PATH/Headers&quot;\n mkdir -p $HEADERS_PATH\n\n BUILD_PRODUCTS_PATH=&quot;.build/Build/Intermediates.noindex/ArchiveIntermediates/$SCHEME/BuildProductsPath&quot;\n INTERMEDIATE_BUILD_FILES_PATH=&quot;.build/Build/Intermediates.noindex/ArchiveIntermediates/$SCHEME/IntermediateBuildFilesPath&quot;\n RELEASE_PATH=&quot;$BUILD_PRODUCTS_PATH/$RELEASE_FOLDER&quot;\n SWIFT_MODULE_PATH=&quot;$RELEASE_PATH/$SCHEME.swiftmodule&quot;\n RESOURCES_BUNDLE_PATH=&quot;$RELEASE_PATH/${SCHEME}_${SCHEME}.bundle&quot;\n\n # Copy Swift modules\n if [ -d $SWIFT_MODULE_PATH ]\n then\n cp -r $SWIFT_MODULE_PATH $MODULES_PATH\n fi\n \n SWIFT_HEADER=&quot;$INTERMEDIATE_BUILD_FILES_PATH/$SCHEME.build/$RELEASE_FOLDER/$SCHEME.build/Objects-normal/arm64/$SCHEME-Swift.h&quot;\n\n if [ -f &quot;$SWIFT_HEADER&quot; ]\n then\n cp -p $SWIFT_HEADER $HEADERS_PATH || exit -2\n fi\n\n # Copy resources bundle, if exists\n if [ -e $RESOURCES_BUNDLE_PATH ]\n then\n cp -r $RESOURCES_BUNDLE_PATH $FRAMEWORK_PATH\n fi\n \ndone\n\nxcodebuild -create-xcframework \\\n -framework Release-iphoneos.xcarchive/Products/usr/local/lib/$SCHEME.framework \\\n -framework Release-iphonesimulator.xcarchive/Products/usr/local/lib/$SCHEME.framework \\\n -output $SCHEME.xcframework\n</code></pre>\n"^^ . . "Did you use [UISheetPresentationController](https://developer.apple.com/documentation/uikit/uisheetpresentationcontroller)?"^^ . "Yes, I have consider that scene too. Instead of creating AVCaptureDeviceInput from AVCaptureDevice. You should try changing your code implementation by creating a method and having two parameters , one for captureDevice and one for CaptureDeviceInput. In testing pass two mock objects using protocols like I have explained in my previous comment and in actual code you should pass real objects. For that you need to modify your actual code."^^ . . . "bluetooth"^^ . "0"^^ . . "0"^^ . . "0"^^ . . . . "protocols"^^ . . . "0"^^ . . "<p>I'm following <a href="https://kotlinlang.org/docs/multiplatform-ios-dependencies.html#add-a-framework-without-cocoapods" rel="nofollow noreferrer">the documentation</a> for adding a iOS framework without cocoapods to a KMM project,</p>\n<p>And I'm getting this error when syncing the gradle, and of course is not integrating the framework, the error is</p>\n<pre><code>:shared:iosArm64Main: cinterop file: /Users/luis.garcia/Desktop/kmp-crash/shared/build/classes/kotlin/iosArm64/main/cinterop/shared-cinterop-luismafw.klib does not exist\n</code></pre>\n<pre><code>Exception in thread &quot;main&quot; java.lang.Error: /var/folders/h_/qb6wf4y90lz8c2blq8d3xbk80000gq/T/15310463132579371666.m:1:9: fatal error: module 'luismafw' not found\n at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:275)\n at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesASTFiles(ModuleSupport.kt:83)\n at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesInfo(ModuleSupport.kt:15)\n at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.buildNativeLibrary(main.kt:564)\n at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:307)\n at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLibSafe(main.kt:243)\n at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.access$processCLibSafe(main.kt:1)\n at org.jetbrains.kotlin.native.interop.gen.jvm.Interop.interop(main.kt:101)\n at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:47)\n at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:23)\n at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:45)\n</code></pre>\n<p>Here is how I got all setup</p>\n<p>File structure:</p>\n<p><a href="https://i.sstatic.net/z9o9Nr5n.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/z9o9Nr5n.png" alt="enter image description here" /></a></p>\n<p>the <code>build.gradle.kts</code> configuration:</p>\n<pre><code>listOf(\n iosX64(),\n iosArm64(),\n iosSimulatorArm64()\n).forEach {\n\n it.compilations.getByName(&quot;main&quot;) {\n val luismafw by cinterops.creating {\n defFile(&quot;src/nativeInterop/cinterop/luismafw.def&quot;)\n compilerOpts(\n &quot;-framework&quot;,\n &quot;luismafw&quot;,\n &quot;-F/Users/luis.garcia/Desktop/kmp-crash/iosApp/luismafw.framework&quot;\n )\n }\n }\n it.binaries.framework {\n baseName = &quot;shared&quot;\n isStatic = true\n }\n\n it.binaries.all {\n linkerOpts(\n &quot;-framework&quot;,\n &quot;luismafw&quot;,\n &quot;-F/Users/luis.garcia/Desktop/kmp-crash/iosApp/&quot;\n )\n }\n}\n</code></pre>\n<p>and the <code>.def</code> file content:</p>\n<p><a href="https://i.sstatic.net/0kMeDNlC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0kMeDNlC.png" alt="enter image description here" /></a></p>\n<p>I except to use the ios framewerk in iosMain in the KMM project</p>\n"^^ . . . "There's only 1 call stack per thread. After calling `someOtherFunction`, the activation record (or "frame") of `viewDidLoad` is still in the call stack, and the new record for `someOtherFrame` simply sits on top of it. In my example, the only way this is possible is that `runUntilDate` actually calls my completion block. Am I understanding it correct?"^^ . . "Thank you Rob. I'll check this out and when confirmed accept this outstanding answer."^^ . . . . "NSTableView Loses Focus After Calling editColumn"^^ . "<p><strong>Backgroud</strong></p>\n<p>Running python code using Beeware - Briefcase tool and call Python code from Flutter/Native MACOS application.</p>\n<p><strong>Issue</strong></p>\n<p>The code runs completely fine on MAC machines powered with Intel processors but breaks on Apple processors. (Crashing on M1 and M2 processors)</p>\n<p><strong>How it’s implemented and what Root cause has been analyzed so far for Apple processors?</strong><br />\nThe Python code is hosted by making use of Uvicorn and since Unicorn keeps a hold of a Thread and never returns. So the same is executed on a background thread from Xcode making use of dispatch_queue</p>\n<p><strong>MacOS Code</strong></p>\n<pre><code>- (void) trigger_python_main_init {\n dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\n [self python_main_init];\n });\n}\n</code></pre>\n<p><strong>The Python code further makes use of Pickle file which when loaded of a bigger size anything more than 1MB (for instance) creates this issue<br />\nNote: Smaller size files work fine.</strong></p>\n<pre><code>with open(self.vocab_path, &quot;rb&quot;) as handle:\n self.vocab = pickle.load(handle)\n self.vocab = {element: None for element in self.vocab}\n</code></pre>\n<p>When you run python code in man thread it works fine in M1 and M2 as well. Below code works fine</p>\n<pre><code>- (void) trigger_python_main_init {\n [self python_main_init];\n}\n</code></pre>\n<p>We want to run the python code in a background thread/process as its a heavy processing task (Python code is responsible of hosting local webserver)</p>\n"^^ . . "0"^^ . "wkwebview"^^ . . "0"^^ . . "uiviewcontroller"^^ . "2"^^ . . . "1"^^ . "0"^^ . "0"^^ . . . . "1"^^ . . . . . . . . . . . "Reading a few other answers it seems that you need to have a contact whose details match the `handle` for the call. The image from that contact will be used."^^ . "1"^^ . . "Use of Insecure iOS Coding Functions - React Native, MobSF"^^ . "1"^^ . . "0"^^ . . . . "what's a `DateTimePicker`? Do you mean a `DatePicker` with a `.datePickerStyle(.wheel)`?"^^ . . "0"^^ . . "0"^^ . . . . "0"^^ . "macos"^^ . . . . . . "Integrating OpenCV in a native macOS app leads to Linker Errors"^^ . . "<p>The Objective-C protocol is imported into Swift as a protocol that requires conformance to <a href="https://developer.apple.com/documentation/objectivec/nsobjectprotocol" rel="nofollow noreferrer"><code>NSObjectProtocol</code></a>. It does not require the conformer to inherit <code>NSObject</code>.</p>\n<p>If you declare the property like this:</p>\n<pre class="lang-swift prettyprint-override"><code>let conformsToObjCProtocol: MyObjCProtocol &amp; NSObject\n</code></pre>\n<p>then this can be observed using a <a href="https://developer.apple.com/documentation/objectivec/nsobject/keyvalueobservingpublisher" rel="nofollow noreferrer"><code>NSObject.KeyValueObservingPublisher</code></a>.</p>\n<pre class="lang-swift prettyprint-override"><code>NSObject.KeyValueObservingPublisher(\n object: conformsToObjCProtocol, keyPath: \\.myString, options: []\n).sink { ... }\n</code></pre>\n<p>The <code>publisher</code> method unfortunately cannot be used here because of <a href="https://stackoverflow.com/a/60381982/5133585">how it is declared</a>. The declaration requires that you call it on a <em>concrete</em> type.</p>\n"^^ . "Building a Swift XCFramework compatible with Objective-c"^^ . . . . . "It's cell based."^^ . . . "2"^^ . "0"^^ . "0"^^ . . "0"^^ . "<p>@Willeke pointed out in a comment above that there is a thread regarding this behavior – <a href="https://stackoverflow.com/questions/77822954/nsarraycontroller-add-function-now-causes-saved-nstableview-listed-entries-to">NSArrayController &#39;Add&#39; function now causes saved NSTableView listed entries to temporarily lose focus</a>. In that thread the accepted answer instructs you to sub-class a private method in NSTextFieldCell. However, I didn't need to do that because this only happens when the edited cell is empty. I simply added a string value of &quot;untitled&quot; to the property of the object that is bound to the cell and all works as expected.</p>\n<pre><code>-(IBAction)addAttribute:(id)sender\n {\n TKSpecialObject *theObject = [TKSpecialObject new];\n [TKSpecialObject setMyTitle:@&quot;untitled&quot;]; // added this line to fix\n [self.myArrayController insertObject:theObject atArrangedObjectIndex:self.myArrayController.count];\n [self.view.window makeFirstResponder:theTableView];\n [self.myTableView editColumn:0 row:[self.myTableView selectedRow] withEvent:nil select:YES]; \n }\n</code></pre>\n"^^ . . . . . . . . . . "Thank you a lot, looks like it worked! ✨ Was a hard catch!"^^ . . . . "2"^^ . . . "1"^^ . "0"^^ . . . . . . . . "0"^^ . . . . . . . . . "1"^^ . "0"^^ . . . "0"^^ . "datetimepicker"^^ . . . . "<p>I have this enum in Swift SDK, and need to print the <code>description</code> as a debug message.</p>\n<pre><code>@objc public enum ResultCode : UInt16 {\n case noError = 0x0000\n\n @objc public func description() -&gt; String {\n switch self {\n case .noError:\n return &quot;No Error&quot;\n }\n }\n}\n</code></pre>\n<p>The <code>description</code> can not be called in Objc like this:</p>\n<pre><code>[taskManager.sendRequest requestWithCompletion:^(ResultCode resultCode) {\n NSString *resultCodeDescription = [resultCode description];//Bad receiver type 'ResultCode' (aka 'enum ResultCode')\n NSLog(@&quot;Result code description: %@&quot;, resultCodeDescription);\n}];\n</code></pre>\n<p>I know that adding a ResultCode extension in Swift file and a <code>@objc</code> function is a solution, but I prefer to solve this in objc file, how can I approach this?</p>\n"^^ . . "enums"^^ . "Try `NSLog(@"%@", mainWindow.contentViewController);`."^^ . . . . . . "calendar"^^ . . "<p>I am having some trouble using Tuya Smart Life app SDK in my React Native application.</p>\n<p>I am using <a href="https://github.com/owowagency/react-native-tuya" rel="nofollow noreferrer">this</a> library to bridge between Tuya's native SDK and React Native.</p>\n<p>Using the SDK I successfully created a user, a home and then started the bluetooth scan,\nin the logs i can see that is discovers my device.\nAfter following <a href="https://developer.tuya.com/en/docs/app-development/ble?id=Ka5vcxzbglphd#title-6-Start%20scanning" rel="nofollow noreferrer">Tuya Docs</a> i see the discovered device should be returned from the &quot;didDiscoveryDeviceWithDeviceInfo&quot; but it doesn't happen for me.</p>\n<p>Not sure if its connected but in the logs i see this:</p>\n<pre><code>[ThingRequest] request: domain = a1-us.iotbing.com, url = https://\na1-us.iotbing.com/api.json, api =\nsmartlife.m.device.bind.status.get, commonParams = {\n &quot;lang&quot; : &quot;en&quot;,\n &quot;bizData&quot; : &quot;{\\&quot;nd\\&quot;:1,\\&quot;customDomainSupport\\&quot;:\\&quot;1\\&quot;}&quot;,\n &quot;deviceId&quot; : &quot;229A6B7E-D000-46B5-96F7-8FA1D39246F2&quot;,\n &quot;et&quot; : &quot;0.0.2&quot;,\n &quot;osSystem&quot; : &quot;17.4.1&quot;,\n &quot;bundleId&quot; : &quot;com.loopump.app&quot;,\n &quot;time&quot; : &quot;1715584371&quot;,\n &quot;lon&quot; : 0,\n &quot;channel&quot; : &quot;sdk&quot;,\n &quot;nd&quot; : 1,\n &quot;appVersion&quot; : &quot;1.0.0&quot;,\n &quot;ttid&quot; : &quot;appstore_d&quot;,\n&quot;os&quot; : &quot;IOS&quot;,\n &quot;v&quot; : &quot;1.1&quot;,\n &quot;sid&quot; :\n&quot;az171557r6264723dJPjtCF38dfad8b6ed4cd012febe985129302799&quot;,\n &quot;sign&quot; :\n&quot;e48995f2513ccefae9936cfe387f3cb100606a3e22bd7a02f07aa6c424dd6f32&quot;\n,\n &quot;platform&quot; : &quot;iPhone 13&quot;,\n &quot;requestId&quot; : &quot;326662BA-85AC-4C63-A94B-7D7E77D70E57&quot;,\n &quot;sdkVersion&quot; : &quot;5.2.0&quot;,\n &quot;timeZoneId&quot; : &quot;Asia\\/Manila&quot;,\n &quot;lat&quot; : 0,\n &quot;clientId&quot; : &quot;nwvrfnnvnd5kxvrss55x&quot;,\n &quot;deviceCoreVersion&quot; : &quot;5.7.0&quot;,\n &quot;a&quot; : &quot;smartlife.m.device.bind.status.get&quot;,\n &quot;cp&quot; : &quot;gzip&quot;\n}, businessParams = {\n &quot;encryptValue&quot; : &quot;4A536DA0ECEBAEE5&quot;,\n &lt;...&gt;\n\n[ThingRequest] response: api = smartlife.m.device.bind.status.get,\ndata = {\n &quot;success&quot; : false,\n &quot;errorCode&quot; : &quot;PERMISSION_DENIED&quot;,\n &quot;status&quot; : &quot;error&quot;,\n &quot;errorMsg&quot; : &quot;No access&quot;,\n &quot;t&quot; : 1715584370720\n}\n</code></pre>\n<p>The device id here is not of the bluetooth device i am trying to pair but its the actual Iphone that is scanning for devices.</p>\n<p>This is the Objective-C code that starts the scan and should return the discovered device:</p>\n<pre><code>static TuyaBLERNScannerModule * scannerInstance = nil;\n\n@interface TuyaBLERNScannerModule()&lt;ThingSmartBLEManagerDelegate&gt;\n\n@property(copy, nonatomic) RCTPromiseResolveBlock promiseResolveBlock;\n@property(copy, nonatomic) RCTPromiseRejectBlock promiseRejectBlock;\n\n@end\n\n@implementation TuyaBLERNScannerModule\n\nRCT_EXPORT_MODULE(TuyaBLEScannerModule)\n\nRCT_EXPORT_METHOD(startBluetoothScan:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter) {\n if (scannerInstance == nil) {\n scannerInstance = [TuyaBLERNScannerModule new];\n }\n NSLog(@&quot;DEBUG: startBluetoothScan&quot;);\n [ThingSmartBLEManager sharedInstance].delegate = scannerInstance;\n scannerInstance.promiseResolveBlock = resolver;\n scannerInstance.promiseRejectBlock = rejecter;\n\n [[ThingSmartBLEManager sharedInstance] startListening:YES];\n}\n\n- (void)didDiscoveryDeviceWithDeviceInfo:(ThingBLEAdvModel *)deviceInfo {\n // print device info\n NSLog(@&quot;DEBUG: %@&quot;, [deviceInfo yy_modelToJSONObject]);\n if (scannerInstance.promiseResolveBlock) {\n self.promiseResolveBlock([deviceInfo yy_modelToJSONObject]);\n }\n}\n\n@end\n</code></pre>\n<p>It never reaches the &quot;didDiscoveryDeviceWithDeviceInfo&quot;, the logs never logs.</p>\n"^^ . . . "0"^^ . . "1"^^ . "1"^^ . . . "No matter how fancy the GCD is, it's still built on top of threads tho. This means there can only be 1 call stack per thread. So in my example, if `runUntilDate` doesn't call my closure, then it would deadlock for sure."^^ . . . . . . . . "Watching the memory held by this process shows no indication of reduction. https://gist.github.com/kortschak/a3a12186f3b3a8f6f4c409e92fa3c6f0. Though its slow so I'd have to wait for days for it to crash."^^ . . . "1"^^ . . "<p>i am on macOS, objective-C. Not Swift, not ios.</p>\n<p>I have a programmatically created NSScrollView with a nested NSTableView.\nThe scrollbar shows some kind of square element. This element lies above the scrollbar, but is not visible in the view hierarchy debugger. I want it to not show up.</p>\n<p>Here is a video:</p>\n<p><a href="https://i.sstatic.net/npq2I5PN.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/npq2I5PN.gif" alt="Weird scroll Bar element" /></a></p>\n<p>Here is a screenshot from the view hierarchy:</p>\n<p><a href="https://i.sstatic.net/MO4SyIpB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/MO4SyIpB.png" alt="View hierarchy" /></a></p>\n<p>Here's the code creating the scrollView and and tableView:</p>\n<pre><code>// Create tableView\nNSTableView* tableView = [[NSTableView alloc] initWithFrame:NSZeroRect];\ntableView.selectionHighlightStyle = NSTableViewSelectionHighlightStyleNone;\ntableView.translatesAutoresizingMaskIntoConstraints = NO;\ntableView.backgroundColor = [NSColor clearColor];\ntableView.delegate = self.delegate ? self.delegate : weakSelf;\ntableView.dataSource = self.delegate ? self.delegate : weakSelf;\ntableView.rowHeight = height; // predefined\ntableView.intercellSpacing = NSMakeSize(2, 2);\ntableView.headerView = [[NSTableHeaderView alloc] initWithFrame:NSMakeRect(0, 0, 0, CGFLOAT_MIN)];\ntableView.columnAutoresizingStyle = NSTableViewUniformColumnAutoresizingStyle;\nif (@available(macOS 11.0, *)) {tableView.style = NSTableViewStylePlain;}\nself.tableView = tableView;\n\n\n \n// Create Scroll View\nNSScrollView* scrollView = [[NSScrollView alloc] initWithFrame:NSZeroRect];\n\nscrollView.verticalScrollElasticity = NSScrollElasticityAutomatic;\n\n// Setup scrollView\nscrollView.drawsBackground = NO;\nscrollView.hasVerticalScroller = YES;\nscrollView.hasHorizontalScroller = YES;\nscrollView.autohidesScrollers = YES;\nscrollView.translatesAutoresizingMaskIntoConstraints = NO;\nscrollView.documentView = tableView;\nscrollView.scrollerStyle = NSScrollerStyleLegacy; // Must be legacy (!)\nscrollView.automaticallyAdjustsContentInsets = NO;\nscrollView.contentInsets = insets;\nscrollView.scrollerInsets = NSEdgeInsetsMake(-(insets.top), -(insets.left), -(insets.bottom), -(insets.right)); // insets are predefined\nself.scrollView = scrollView;\n\n[self.view addSubview:scrollView];\n</code></pre>\n<p>Any help appreciated</p>\n"^^ . "0"^^ . . . "1"^^ . "<p>I have a class that receives an AVCaptureDevice object as a parameter and I'd like to test it. I found the swizzle method to create an instance of AVCaptureDevice</p>\n<pre><code>extension AVCaptureDevice { \n class func swizzle() {\n // Exchange class methods\n [\n (\n #selector(AVCaptureDevice.default(_:for:position:)),\n #selector(AVCaptureDevice.mockDefaultDevice(position:))\n ),\n (\n #selector(AVCaptureDevice.authorizationStatus(for:)),\n #selector(AVCaptureDevice.mockAuthorizationStatus)\n ),\n (\n #selector(AVCaptureDevice.requestAccess(for:completionHandler:)),\n #selector(AVCaptureDevice.mockRequestAccess)\n )\n ].forEach {\n if let original = class_getClassMethod(self, $0),\n let mock = class_getClassMethod(self, $1) {\n method_exchangeImplementations(original, mock)\n }\n }\n\n // Add NSObject.init implementation to init(mock:)\n [\n (\n #selector(AVCaptureDevice.init(mock:)),\n #selector(NSObject.init)\n )\n ].forEach {\n if let original = class_getInstanceMethod(self, $0),\n let mock = class_getInstanceMethod(self, $1) {\n print(&quot;Mock:::Init Exchange impl \\(original) &lt;-&gt; \\(mock)&quot;)\n method_setImplementation(original, method_getImplementation(mock))\n }\n }\n }\n\n @objc\n convenience init(mock: String) {\n fatalError(&quot;Fake method that should be replaced by NSObject.init&quot;)\n }\n\n @objc\n class func mockRequestAccess(completionHandler handler: @escaping (Bool) -&gt; Void) {\n handler(true)\n }\n\n @objc\n class func mockAuthorizationStatus() -&gt; AVAuthorizationStatus {\n return .authorized\n }\n}\n</code></pre>\n<p>It worked well to create an instance of <code>AVCaptureDevice</code> using <code>AVCaptureDevice.default(_:for:position:)</code>, but inside my class, this instance is used to create an <code>AVCaptureDeviceInput</code> object as follows:</p>\n<pre><code>let deviceInput = try AVCaptureDeviceInput(device: deviceCamera)\n</code></pre>\n<p>and passing the mocked instance of <code>deviceCamera</code> to <code>AVCaptureDeviceInput</code> is resulting in the error <code>&quot;Error Domain=AVFoundationErrorDomain Code=-11852 &quot;Não pode usar (null)&quot; UserInfo={NSLocalizedFailureReason=Este app não tem autorização para usar (null)., AVErrorDeviceKey=&lt;AVCaptureDevice: 0x600000cf49c0 [(null)][]&gt;, NSLocalizedDescription=Não pode usar (null)}&quot;</code></p>\n<p>I tried to use the swizzle method again to create an instance of <code>AVCaptureDeviceInput</code></p>\n<pre><code>extension AVCaptureDeviceInput {\n class func swizzle() {\n [\n (\n #selector(AVCaptureDeviceInput.init(device:)),\n #selector(NSObject.init)\n )\n ].forEach {\n if let original = class_getInstanceMethod(self, $0),\n let mock = class_getInstanceMethod(self, $1) {\n method_setImplementation(original, method_getImplementation(mock))\n }\n }\n }\n}\n</code></pre>\n<p>(and other variations of this code) but it did not work. When I activate this code calling <code>AVCaptureDeviceInput.swizzle()</code> my test freezes in <code>AVCaptureDeviceInput(device:) throws</code></p>\n<p>I found <a href="https://stackoverflow.com/questions/56027178/mock-avcapturedeviceinput-for-testing">another question about AVCaptureDeviceInput in unit tests</a>, but there is no solution either.</p>\n<p>Does anyone have any idea about what I can do to test my class mocking AVCaptureDevice and AVCaptureDeviceInput? Any idea is welcome!</p>\n"^^ . . . . . . . . "0"^^ . "<p>I’m a bit stumped, because we rarely use objective-c in our project (QT crossplatform,no X-Code at all, signing, entitlements, etc all done with commandline tools) and, up to now, no window stuff at all. (Except what gets triggered automatically, like Permission panes for Photokit, folders, etc.)</p>\n<p>I built the PaymentRequest and according to NSLog it works.</p>\n<pre><code> if ([PKPaymentAuthorizationViewController canMakePayments]) {\n NSLog(@&quot;Can Make Payments&quot;);\n }\n else {\n NSLog(@&quot;Cannot Make Payments&quot;);\n }\n \n</code></pre>\n<p>Removing or adding the supported card from the request also works.</p>\n<pre><code> if ([PKPaymentAuthorizationViewController\n canMakePaymentsUsingNetworks:paymentNetworks\n capabilities:(PKMerchantCapabilityDebit | PKMerchantCapabilityCredit)\n ])\n {\n NSLog(@&quot;Card Supported&quot;);\n } else {\n NSLog(@&quot;Card Not Supported&quot;);\n }\n</code></pre>\n<p>So I do get <code>Can Make Payments</code> and <code>Card Supported</code></p>\n<p>This also works in compile and execution,</p>\n<pre><code> PKPaymentAuthorizationViewController *paymentPane = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:request];\n</code></pre>\n<p>But I don’t manage to raise the request</p>\n<pre><code>NSWindow *mainWindow = [NSApplication sharedApplication].windows[0];\n[mainWindow.contentViewController presentViewControllerAsModalWindow:paymentPane];\n</code></pre>\n<p>My code is in</p>\n<pre><code> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification \n</code></pre>\n<p>I do get a window, as expected, but that’s all.</p>\n<p>The payment request is basically just the “supported cards” and the total, i.e. all we need is the authorisation token we would then send to the backend. The mobile team up has this up and running, but of course, they are all Swift these days and couldn’t help more than they already did.</p>\n"^^ . . . "0"^^ . . . "0"^^ . "1"^^ . . . . "<p>We created an iOS <em>.ipa</em> file to upload it on MobSF's <strong>Static Analysis</strong> to analyze the security of the app. However, we found that there are 2 High Severity issues.\n<a href="https://i.sstatic.net/4NGDoCLj.png" rel="nofollow noreferrer">Here</a> is the report that is generated by MobSF IPA Binary Code analysis report.</p>\n<p>We haven't used these APIs in our code.</p>\n<p>How do we fix this vulnerability in React Native?</p>\n"^^ . "0"^^ . "Is the table view cell-based or view-based?"^^ . "2"^^ . . "0"^^ . . . . . . . . . . "1"^^ . "1"^^ . . "`-[NSApplication terminate:]` catches this exception."^^ . "1"^^ . . . . "flutter"^^ . "0"^^ . "uncaughtExceptionHandler failed to catch exceptions in objective-c on Mac OS"^^ . "That works perfectly; solid as a rock under 700kb. Thanks."^^ . . . "0"^^ . "<p>Hi and I'm working on handling exceptions in an app.\nMy exception handler code is as below.\nIn AppDelegate.h</p>\n<pre><code>@interface AppDelegate : NSObject &lt;NSApplicationDelegate&gt;\nstatic void uncaughtExceptionhandler(NSException* exception);\n</code></pre>\n<p>In AppDelegate.m</p>\n<pre><code>@implementation AppDelegate\nstatic void uncaughtExceptionhandler(NSException* exception) {\n //log related information\n}\n\n-(void)applicationDidFinishLaunching:(NSNotification *)aNotification {\n NSSetUncaughtExceptionHandler(&amp;uncaughtExceptionhandler);\n}\n</code></pre>\n<p>In order to test this handler, I raised an expection in my code.\nIn MyWindowController.m</p>\n<pre><code>- (void)testHandler {\n @throw [NSException exceptionWithName:@&quot;TestException&quot; reason:@&quot;TestOnly&quot; userInfo:nil];\n}\n</code></pre>\n<p>But noting was logged and it seemed uncaughtExceptionhandler function was not triggered.</p>\n<p>I'm not sure if my exception handler code is right.</p>\n"^^ . "Thank you. That does what I want. So from what you are saying, we are depending on a system hook via a runloop to update in the approach that I posted above. Is that correct?"^^ . . "0"^^ . "Why not use a regexp? https://developer.apple.com/documentation/foundation/nsregularexpression"^^ . . "0"^^ . "0"^^ . . . . . . . . . . . . . "1"^^ . . "2"^^ . . . . . . . "How to set detents values to a viewcontroller in objective C"^^ . . . . "0"^^ . "cocoa"^^ . "0"^^ . . ""There's only 1 call stack per thread"; that's also not exactly true. The dispatch model in iOS is much more complex than simple threads. You have grand central dispatch queues that are mapped to threads and runloops which manage the work that is dispatched."^^ . . "2"^^ . "Replace `[NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]];` with `Thread.sleep(1)` and see what happens. That is the difference between blocking the thread and delaying the return of `viewDidLoad` but still running the RunLoop. Your current code has blocked UI updates and so is a bad idea, but the thread itself is not blocked because you have transferred execution back to the RunLoop."^^ . . "1"^^ . "2"^^ . . . "I have a follow up. `autoupdatingCurrentCalendar` does not appear to be doing what I expect; I expect it to provide the current, potentially updated, time zone ID. However, when I run a program that polls this value (for example here https://go.dev/play/p/3mNSP4mrZs9) and then change the time zone via settings, the returned value does not change."^^ . . "1"^^ . . . . "0"^^ . . "mobsf"^^ . "0"^^ . . . . . . "@Paulw11 Yes, I know the types are listed in the docs, which is where I got the several that I referenced in the original question (and I already included `UTTypeText` in my accepted types, but when I include `UTTypeText` it doesn't match against Word Docs). I couldn't find anything for document types in the list and that seemed like a weird oversight since there was a UTType for Spreadsheet and Presentation. That's why I was asking here, because maybe I missed something in the UTType documentation."^^ . "0"^^ . . . . . . . . . "1"^^ . . . "0"^^ . . . "Weird Scrollbar UI element in programmatically created NSScrollView (objective-c)"^^ . . "xcodebuild"^^ . "<p>I am having project in XCode version: 15.4 using Swift for iOS development -&gt; uiKit.\nI have added the c++ class to my project.</p>\n<p>MyStaticClass.h:</p>\n<pre><code>#ifndef MYSTATICCLASS_H\n#define MYSTATICCLASS_H\n\nclass MyStaticClass {\npublic:\nstatic bool isEven(int number);\n};\n\n#endif\n</code></pre>\n<p>MyStaticClass.cpp</p>\n<pre><code>#include &quot;MyStaticClass.h&quot;\n\n#include &lt;iostream&gt;\n\nbool MyStaticClass::isEven(int number) {return (number % 2 == 0);}\n</code></pre>\n<p>Then i created wrapper for this class in objective C as</p>\n<p>// MyStaticClass_Wrapper.h</p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n\n@interface MyStaticClassWrapper : NSObject\n\n+ (BOOL)isEven:(int)number;\n\n@end\n</code></pre>\n<p>// MyStaticClass_Wrapper.mm</p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n\n#import &quot;MyStaticClass_Wrapper.h&quot;\n#include &quot;MyStaticClass.h&quot;\n\n@implementation MyStaticClassWrapper\n\n+ (BOOL)isEven:(int)number {\n // Uncomment the line below to use the C++ implementation\n // return MyStaticClass::isEven(number);\n return true;\n }\n\n@end\n</code></pre>\n<p>**Note: ** The objective file is .mm not .m</p>\n<p>I added the bridging Header file as:</p>\n<pre><code>#import &quot;MyStaticClass_Wrapper.h&quot;\n</code></pre>\n<p>and i added its path in Build Setting -&gt; Objective-C Bridging Header</p>\n<p>Added PrefixHeader.pch:</p>\n<p>// PrefixHeader.pch</p>\n<pre><code>//#import &lt;Foundation/Foundation.h&gt;\n\n#ifndef PrefixHeader_pch\n#define PrefixHeader_pch\n\n#import &lt;Availability.h&gt;\n\n#ifdef __OBJC__\n#import &lt;UIKit/UIKit.h&gt;\n\n#import &lt;CoreData/CoreData.h&gt;\n\n#endif\n\ntypedef enum{\nbFileTypeDefault = 1,\nbFileTypePhoto,\nbFileTypeVideo,\nbFileTypeAudio,\nbFileTypeDocuments,\n} baseFileType;\n\nBOOL \\_isFakeAccount;\n\n#endif\n</code></pre>\n<p>then added the prefix header path to Build Setting -&gt; Prefix Header in setting.</p>\n<p>when i build it:</p>\n<p><strong>Error : Unnamed type used 'BOOL'</strong></p>\n<p>when i uncomment &quot;#import &lt;Foundation/Foundation.h&gt;&quot;</p>\n<p><strong>Error : Along with Unnamed type used 'BOOL' .... 'NSString' also encounters same error</strong></p>\n<p>How to resolve it, am stucked with this error.</p>\n<p>i tried commenting the BOOl, creating .m file to declare global variable seperately.\nDidn't worked.\n<strong>When i comment .pch file content it works fine.</strong></p>\n"^^ . . . . "nsstackview"^^ . "0"^^ . . . "0"^^ . . "<p>You said:</p>\n<blockquote>\n<p>My understanding is that, this code has a deadlock. Because the completion block is run on main thread, so in order for the completion block to run, <code>viewDidLoad</code> must return. And in order for <code>viewDidLoad</code> to return, completion block must be run to toggle the completed flag (hence circular wait).</p>\n</blockquote>\n<p>Yes and no.</p>\n<p>Technically, it is not a deadlock, as the run loop is still processing events. Your UI may appear to be responsive. But because <code>viewDidLoad</code> is not returning, some other events (like <code>viewDidAppear</code>) will not be called. There will be other consequences, too. This code interferes with the normal sequence of UI events, but is not technically a “deadlock”.</p>\n<p>Bottom line, you must allow <code>viewDidLoad</code> (and all UIKit events) to promptly return. So, either dispatch this asynchronously (but <a href="https://stackoverflow.com/a/78494378/1271826">avoid using the same serial queue</a> for both the <code>dispatch_async</code> and the <code>dispatch_after</code>), or better, lose this spinning on the run loop, altogether.</p>\n<p>Nowadays, spinning on the main run loop is almost always a mistake. GCD offers nice contemporary solutions. We would need more details regarding why you are spinning at all, though, to answer this broader question.</p>\n"^^ . . "Cannot discover a Tuya powered bluetooth device using Tuya Smart Life app SDK in a React Native environment"^^ . "0"^^ . . "swift-package-manager"^^ . . "ios"^^ . . "0"^^ . . "Core Data is doing that for you already, `NSManagedObjectID`. If you need a unique identifier that you control, add that property and set it in `awakeFromInsert()`. I'm wondering if you have a good understanding of the way Core Data works? One of the books by Donny Wals, Paul Hudson, or Florian Kugler/Daniel Eggert is probably worth working through (they're all going to be outdated though, see WWDC videos)."^^ . . "kotlin"^^ . . . "1"^^ . . . "0"^^ . . . . . . "1"^^ . "<p>I&quot;m developing an app on macOS.</p>\n<p>It's a tauri app which links to a custom library (written in objective-C so I can access some system functionality).</p>\n<p>The issue is, some of the functionality in the custom library, requires permissions in order to work.</p>\n<p>How do I give my tauri program permissions?</p>\n<p>Because this is a dev program and not an installed program, I can't give the program permissions via system <code>Privacy &amp; Security</code> in the <code>System Settings</code>.</p>\n<p>I've also tried to give the library permissions via <code>xcode</code> but because this is a library and not a app, I don't have the <code>Signing &amp; Capabilities</code> tab, so I can't give the library permissions through <code>xcode</code>.</p>\n"^^ . . . "0"^^ . . . "0"^^ . "In Swift DateTimePicker how can i set 12 or 24 hour time format? based on my app settings not Device setting"^^ . . . "Is run loop synchronous or asynchronous?"^^ . "1"^^ . . . . "combine"^^ . . . . . . . "Nope. NSLog(@"%@",mainWindow); says\n\n\n<NSWindow: 0x12c606490>\n\nor, next run, \n\n<NSWindow: 0x135f07dd0>\n\nWhich I interpret as “This is an NSWindow object starting at address 0x135f07dd0.”"^^ . "your code does not seem to be related to the pictures you show. Can you show the code you have that produces the pictures."^^ . . . . "<p>Loading a React production build directly through Bundle.main.url and WKWebView is causing my server requests Origin header to be set as &quot;file://&quot; due to which I get CORS Error.</p>\n<p>We are using Telegraph server as well in our app and according to their documentation:</p>\n<pre><code>// You can also serve custom urls, for example the Demo folder in your bundle\nlet demoBundleURL = Bundle.main.url(forResource: &quot;Demo&quot;, withExtension: nil)!\nserver.serveDirectory(demoBundleURL, &quot;/demo&quot;)\n</code></pre>\n<p>We want to know if it is possible to serve a React production build using the above syntax and if yes, how?</p>\n<p>Any guidance would be appreciated.</p>\n<p>Thanks.</p>\n<p>WHAT WE TRIED:-</p>\n<p>We tried loading our React production build directly through WKWebView but the Origin header of the requests get set to &quot;file://&quot; which leads to CORS issue.</p>\n<p>We tried serving our React production build using the syntax mentioned in Telegraph's GitHub repo but that leads to a white screen on my app. (My guess is that Telegraph is not capable of serving React production builds this way). We were expecting this method to serve our React production build so that we can workaround the WKWebView Origin Header &quot;file://&quot; issue.</p>\n<p>This is our code (not complete code, just relevant parts, for reference):</p>\n<pre><code>import Telegraph\n\npublic var server: Server!\npublic var webView: WKWebView!\n\n// other code\n\nlet buildURL = Bundle.main.url(forResource: &quot;build&quot;, withExtension: nil)!\nserver.serveDirectory(buildURL, &quot;/build&quot;)\nlet url = URL(string: &quot;https://**-MY IP HERE-**:9999/build&quot;)\nlet request = URLRequest(url: url!)\nwebView.load(request)\n</code></pre>\n"^^ . . . . "Problem of alignment with NSStackView in a custom table view"^^ . "kotlin-multiplatform"^^ . "1"^^ . "Look's like it's allowed when used as function argument, because compiler can automatically decide what to use `__bride` or `__bridge_retained`. `CFStringGetLength(static_cast<CFStringRef>([@"hello" mutableCopy]));` works without additional compiler settings."^^ . . . . . "0"^^ . "To be safer in my suggestion `containsWhere`, call you could do `if ([obj respondsToSelector:@selector(integerValue)]) { return [obj integerValue] == [@2 integerValue]; } else { NSLog(@"Element %@ from array to analyze doesn't responds to integerValue -> Skipped", obj); return FALSE; }` else you might get a `unrecognized selector sent to` crash error."^^ . "<p>I received a date string and a timezone from a web service and I am needing to convert into an <code>NSDate</code>. When setting the format and timezone, I get nil:</p>\n<pre><code>NSString *timeZoneString = @&quot;Europe/Paris&quot;;\nNSString *dateString = @&quot;2024-03-31T02:40:21.000&quot;;\n\nNSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];\n[dateFormat setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@&quot;en_US_POSIX&quot;]];\n[dateFormat setDateFormat:@&quot;yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'SS&quot;];\n\nNSTimeZone *timeZone = [NSTimeZone timeZoneWithName:timeZoneString];\n[dateFormat setTimeZone:timeZone];\n\nNSDate *date = [dateFormat dateFromString:dateString];// return nil\n</code></pre>\n<p>Is there a reason why this specific date string, and using <code>Europe/Paris</code> returns nil when trying to create my date?</p>\n"^^ . . "<p>I want to use the library <a href="https://github.com/philipturner/metal-float64" rel="nofollow noreferrer">https://github.com/philipturner/metal-float64</a>, and successfully built and ran tests, next copied the built MetalFloat64 folder into Xcode, but I do not know how to properly include it, the docs say to use #include &lt;metal_float64&gt; however the file cannot be found, any help would be appreciated</p>\n<p>tried pointing it at the file</p>\n<pre><code>#include &quot;MetalFloat64/usr/include/metal_float64&quot;\n</code></pre>\n<p>but that resulted in there being several errors I cannot find, making me think Im doing something wrong, the errors are:\n<a href="https://i.sstatic.net/9QGDfNfK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9QGDfNfK.png" alt="enter image description here" /></a></p>\n<p>there is also no atomic.h file I can find.</p>\n<p>Build phase settings:\n<a href="https://i.sstatic.net/JfNBRCP2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JfNBRCP2.png" alt="" /></a></p>\n<p>Build Settings search paths:\n<a href="https://i.sstatic.net/6fiGr9BM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6fiGr9BM.png" alt="enter image description here" /></a></p>\n"^^ . "0"^^ . "<p>Consider the code at the bottom. I am convinced it’s broken and should not compile. Line 224 has a <code>static_cast</code> from <code>NSURL*</code> to <code>CFURLRef</code> with no bridging which I believe will break the reference count. Line 42 even enforces the use of ARC which should statically detect such a cast and result in a hard compilation error.</p>\n<p>It certainly won’t compile for me which seems like the correct behaviour. (Side note, there’s an obvious fix by replacing the <code>static_cast</code> with a bridge cast, but this isn’t too relevant to the question).</p>\n<p>However, the code is taken from the public VST3 SDK code, a very popular audio programming framework with thousands of users worldwide and it’s been like this for the past 3 years which tells me it can’t be that broken after all. It seems impossible the VST3 SDK should have been unbuildable for such a long when the fix is obvious.</p>\n<p>My question is, under what set of circumstances will this code compile that I’m clearly missing? Other than conditionally compiling the code out which doesn’t seem to be the case?</p>\n<p><a href="https://github.com/steinbergmedia/vst3_public_sdk/blob/3f20bcbf36283b1e5c450e088571be6226cd4e64/source/vst/hosting/module_mac.mm#L224" rel="nofollow noreferrer">https://github.com/steinbergmedia/vst3_public_sdk/blob/3f20bcbf36283b1e5c450e088571be6226cd4e64/source/vst/hosting/module_mac.mm#L224</a></p>\n<pre><code>// line 42\n#if !__has_feature(objc_arc)\n#error this file needs to be compiled with automatic reference counting enabled\n#endif\n\n\n// line 219\n for (NSURL* url in enumerator)\n {\n if ([[[url lastPathComponent] pathExtension] isEqualToString:@&quot;vst3&quot;])\n {\n CFPtr&lt;CFArrayRef&gt; archs (\n CFBundleCopyExecutableArchitecturesForURL (static_cast&lt;CFURLRef&gt; (url)));\n if (archs)\n result.emplace_back ([url.path UTF8String]);\n }\n\n</code></pre>\n"^^ . . . "0"^^ . . "1"^^ . . . . . . "Class with name NsApplication could not be found.\nWill try the objc2 maybe this one is just abandonded as you suggested."^^ . "0"^^ . . "<p>I'm encountering an issue with SQLCipher in my iOS app after updating to a new version, which involves different workspaces of my app. The app uses SQLCipher(<strong>version: 3.1</strong>) to manage an encrypted SQLite database.The previous version (<strong>workspace2</strong>) had SQLCipher code that worked correctly. However, after updating to the new version (<strong>workspace1</strong>), I'm now receiving the error &quot;<em><strong>file is not a database</strong></em>&quot; when trying to access the database file.</p>\n<p><strong>Workspace Dependencies:</strong></p>\n<p><em><strong>Previous Version:</strong></em></p>\n<ul>\n<li>Workspace1: There is no db related code here</li>\n<li>Workspace2: Contains SQLCipher integration code and database operations.</li>\n<li>App: Dependent on Workspace1 &amp; 2 which includes additional app\nlogic and functionality.</li>\n</ul>\n<p><em><strong>New Version:</strong></em></p>\n<ul>\n<li><p>Workspace1: Contains SQLCipher integration code and database operations.</p>\n</li>\n<li><p>Workspace2: Depending on workspace1 and using few db operations.</p>\n</li>\n<li><p>App: Dependent on Workspace1 &amp; 2 which includes additional app\nlogic and functionality.</p>\n</li>\n</ul>\n<p><strong>Steps Taken:</strong></p>\n<p><em><strong>Checked Database Path:</strong></em></p>\n<ul>\n<li><p>Confirmed that the database file exists at the specified path in the\nDocuments directory.</p>\n</li>\n<li><p>Ensured that the path is correct and the file is not missing.</p>\n</li>\n</ul>\n<p><em><strong>Encryption Key:</strong></em></p>\n<ul>\n<li><p>Verified that the correct encryption key is used to open the\ndatabase.</p>\n</li>\n<li><p>The encryption key hasn't changed between app versions.</p>\n</li>\n</ul>\n<p><em><strong>Database File Integrity:</strong></em></p>\n<ul>\n<li><p>Considered the possibility of database file corruption after the\nupdate.</p>\n</li>\n<li><p>Not sure how to verify or fix any potential corruption.</p>\n</li>\n</ul>\n"^^ . "Note that `extern crate` is redundant in modern versions of Rust."^^ . . "markdown"^^ . . "0"^^ . . . . . "0"^^ . . "page-lifecycle"^^ . . "0"^^ . . . "0"^^ . . "1"^^ . . "1"^^ . "ios8-share-extension"^^ . "1"^^ . . . . . . . . . . . "nsobject"^^ . . . . "<p>Here is how i have configured the profile view,</p>\n<pre><code>-(void)addProfileView\n{\n if(!_profileView)\n {\n _profileView = [ProfileView new];\n _profileView.clipsToBounds = YES;\n _profileView.delegate=self;\n _profileView.alpha = 1.0;\n _profileView.opaque = YES;\n _profileView.translatesAutoresizingMaskIntoConstraints = false;\n [self.view addSubview:_profileView];\n NSLayoutConstraint *heightConstraint = [NSLayoutConstraint constraintWithItem:_profileView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:0 constant:160];\n NSLayoutConstraint *widthConstraint = [NSLayoutConstraint constraintWithItem:_profileView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeWidth multiplier:1 constant:0];\n NSLayoutConstraint *leftConstraint = [NSLayoutConstraint constraintWithItem:_profileView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1 constant:0];\n NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:_profileView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1 constant:-64];\n [NSLayoutConstraint activateConstraints:@[heightConstraint, widthConstraint, leftConstraint, topConstraint]];\n }\n}\n</code></pre>\n<p>Now, why is the profile view's height not changing after the animation? Should I add the constraints to the superview? What's the difference between adding constraints directly to the superview and using [NSLayoutConstraint activateConstraints:@[]] ?</p>\n<pre><code>-(void)animateProfileViewBasedOnOffset:(BOOL)isTop\n{\n__block NSLayoutConstraint *heightConstraint;\n \n for (NSLayoutConstraint * constraint in [_profileView constraints]) {\n if (constraint.firstAnchor == NSLayoutAttributeHeight) {\n heightConstraint = constraint;\n break;\n }\n }\n \n [UIView animateWithDuration:0.3 animations:^{\n if (isTop) {\n heightConstraint.constant = 64;\n }\n else {\n heightConstraint.constant = 160;\n }\n [_profileView layoutIfNeeded];\n [self.view layoutIfNeeded];\n }completion:^(BOOL completion)\n {\n NULL;\n }];\n}\n</code></pre>\n<p>The height of the profileView only changes when I add its constraint to the superview ([self.view addConstraints:@[]]). During the animation, I loop through all the constraints of the superview to find the specific constraint and update it.</p>\n"^^ . "Calling NSApplication from Rust using objc"^^ . "How does the NSWindow isReleasedWhenClosed property work when using ARC?"^^ . "2"^^ . . . . "0"^^ . "0"^^ . . . . . "xcode"^^ . . "0"^^ . . . "Use xml: it doesn't have numbers in strings problem"^^ . . . . "Xcode 15.4 always popup to click "Trust and Open" when open workspace"^^ . "One is String, one is number, and to be able to "fully compare" `NSNumber`, I'd use `integerValue` instead."^^ . "0"^^ . . "1"^^ . . "0"^^ . "storekit"^^ . "0"^^ . . "0"^^ . . "<p>I am working as iOS developer and now working to handle the Apple Push Notification Payload contains custom tag like this:</p>\n<pre><code>\n{\n&quot;aps&quot;: {\n &quot;alert&quot;: {\n &quot;title&quot;: &quot;Title of APN&quot;,\n &quot;body&quot;: &quot;Body of APN&quot;\n },\n &quot;badge&quot;: 32\n},\n&quot;context&quot;: {\n &quot;site_name&quot;: &quot;***&quot;,\n &quot;path&quot;: &quot;***&quot;,\n &quot;uid&quot;: &quot;***&quot;,\n &quot;site_id&quot;: &quot;example.com&quot;,\n &quot;type&quot;: &quot;***&quot;,\n &quot;entity_id&quot;: &quot;***&quot;\n }\n}\n</code></pre>\n<p>The notification with the above Payload format is send from the Drupal backend.\nThe problem is that while receiving the notification and Log the userInfo dictionary in delegate method:</p>\n<p>I see only this part:</p>\n<pre><code>\n&quot;aps&quot;: {\n &quot;alert&quot;: {\n &quot;title&quot;: &quot;Title of APN&quot;,\n &quot;body&quot;: &quot;Body of APN&quot;\n },\n &quot;badge&quot;: 32\n}\n</code></pre>\n<p>And the custom tags &quot;context&quot; part is missing.</p>\n<p>Is there any mechanism in Apple site to check the data received by the APNS from the Drupal backend?</p>\n<p>Thanks in advance!</p>\n"^^ . . . "0"^^ . "0"^^ . "0"^^ . . "`UIViewController` or `NSViewController`? Storyboard? How are the view controllers and views instantiated? Post a [mre] please."^^ . . "1"^^ . . "swift"^^ . . "signature"^^ . . . "2"^^ . . . "0"^^ . "<p>What logic is used to create <code>class</code> and <code>protocol</code> names when Kotlin code is exported to Objective-C? Additionally, where can I find detailed information about this process?</p>\n<p>Where code like:</p>\n<pre><code>package kotlinx.serialization.modules\n \npublic interface SerializersModuleCollector {...}\n</code></pre>\n<p>from: <a href="https://github.com/Kotlin/kotlinx.serialization/blob/master/core/commonMain/src/kotlinx/serialization/modules/SerializersModuleCollector.kt" rel="nofollow noreferrer">core/commonMain/src/kotlinx/serialization/modules/SerializersModuleCollector.kt</a></p>\n<p>Is transformed into:</p>\n<pre><code>Kotlinx_serialization_coreSerializersModuleCollector\nKotlinx_serialization_coreKSerializer\nKotlinx_serialization_coreSerializationStrategy\n...\n</code></pre>\n<p>Full Example:</p>\n<pre><code>public protocol Kotlinx_serialization_coreSerializersModuleCollector {\n\n func contextual(kClass: any KotlinKClass, provider: @escaping ([any Kotlinx_serialization_coreKSerializer]) -&gt; any Kotlinx_serialization_coreKSerializer)\n\n func contextual(kClass: any KotlinKClass, serializer: any Kotlinx_serialization_coreKSerializer)\n\n func polymorphic(baseClass: any KotlinKClass, actualClass: any KotlinKClass, actualSerializer: any Kotlinx_serialization_coreKSerializer)\n\n @available(*, deprecated, message: &quot;Deprecated in favor of function with more precise name: polymorphicDefaultDeserializer&quot;)\n func polymorphicDefault(baseClass: any KotlinKClass, defaultDeserializerProvider: @escaping (String?) -&gt; (any Kotlinx_serialization_coreDeserializationStrategy)?)\n\n func polymorphicDefaultDeserializer(baseClass: any KotlinKClass, defaultDeserializerProvider: @escaping (String?) -&gt; (any Kotlinx_serialization_coreDeserializationStrategy)?)\n\n func polymorphicDefaultSerializer(baseClass: any KotlinKClass, defaultSerializerProvider: @escaping (Any) -&gt; (any Kotlinx_serialization_coreSerializationStrategy)?)\n}\n</code></pre>\n"^^ . "0"^^ . . "There is missing comma after aps's closing brace. May be that's the reason, why APNS server is sending just part of JSON, because JSON is invalid."^^ . . "A viewcontroller(vca) and another vcb, I need to add vcb.view to vca.view as a subview"^^ . . "Github Markdown highlights text with @ in it"^^ . . . . . . . "@Cy-4AH I updated the question with the prints for the values. Apparently i do get an array of NSNumber from the server, still I don't understand why the containsObject returns 0 when the object is in fact present and the type of the array prints NSString.."^^ . . . . . "frameworks"^^ . . . . . . . . . "0"^^ . . "core-data"^^ . "2"^^ . . . . . . "1"^^ . . . "0"^^ . . . . . "0"^^ . . "0"^^ . "1"^^ . . . . . . . "The request signature we calculated does not match the signature you provided. Check your key and signing method in objective-c in iOS , Xcode 15"^^ . . . "0"^^ . "0"^^ . "0"^^ . "nullability"^^ . . "1"^^ . . "0"^^ . "0"^^ . "1"^^ . . . "0"^^ . . . . . . "0"^^ . . "Meanwhile I was just looking in to making an extension on NSArray to solve the problem as my for loop solution isn't the most elegant way to solve it, so once again thanks for the gigantic help"^^ . . . "0"^^ . . . "Your server is sending strings instead of numbers."^^ . . . . "linker-errors"^^ . . . . "Generating a signature for promotional offers in Objective-c"^^ . . . "0"^^ . "0"^^ . "1"^^ . . "0"^^ . "0"^^ . . "<p>I have an <code>NSManagedObject</code> class that stores, among other things, a JSON string that comes from a <code>WkWebView</code> form. The form in the web view allows the user to add images to the form; when the form is submitted, it is passed to the Cocoa layer via <code>userContentController:didReceiveScriptMessage</code> as a JSON string. The images are included as Base64 encoded data URLs.</p>\n<p>This works, but users add more images and larger images than anticipated, and it is rather uncool to store BLOBs in a database, IMHO. So I want to save the images into files in the app doc dir and patch the JSON string to refer to the images via file URL.</p>\n<p>The sandbox directory (and thus the documents directory) changes on every app launch, so I cannot store absolute URLs in the database. Instead, I use a placeholder, <code>[APP_DOC_DIR]</code>.</p>\n<p>So basically the JSON data images have 3 states:</p>\n<ul>\n<li>Base64 data URLs as created by JS code in WkWebView</li>\n<li>File URLs with <code>[APP_DOC_DIR]</code> placeholder</li>\n<li>File URLs with correct absolute path when displaying the data in WkWebView</li>\n</ul>\n<p>To make the changes at the appropriate locations and moments, I override the form data setter and getter of my <code>NSManagedObject</code> instance.</p>\n<pre><code>#define FORM_DATA_KEY @&quot;formData&quot;\n\n/// Form data setter\n- (void) setFormData:(NSString *)form_data\n{\n // abbreviated heavily, just showing the concept\n NSMutableString *data = form_data;\n for (;;) {\n // Find base64 data URL\n // Save resulting NSData in a file\n // Replace data URL with URL to the file, using [APP_DOC_DIR] placeholder\n }\n \n // Update the value Core Data sees\n [self willChangeValueForKey:FORM_DATA_KEY];\n [self setPrimitiveValue:data forKey:FORM_DATA_KEY];\n [self didChangeValueForKey:FORM_DATA_KEY];\n\n}\n\n/// Form data getter\n- (NSString*) formData\n{\n NSMutableString *data = [self primitiveValueForKey:FORM_DATA_KEY];\n NSString *docsUrl = [NSURL fileURLWithPath:thisApp.docDir].absoluteString;\n\n for (;;) {\n // Replace all occurrences of [APP_DOC_DIR] with docsUrl\n }\n\n return data;\n}\n</code></pre>\n<p>Basically, that's it. The replacement code is fast and works.</p>\n<p>But the form data stored in the database contains absolute URLs. Apparently, not the value set in the setter with <code>setPrimitiveValue</code> is being stored in the DB but the value returned from the getter.</p>\n<p>What am I doing wrong?</p>\n"^^ . "<p><code>addChildViewController</code> is not <em>strictly</em> necessary. You <em>can</em> simply instantiate a controller and add its view as a subview.</p>\n<p>However -- if you have any <strong>code</strong> in <code>vcb</code>, that code will be lost if you <strong>do not</strong> add the controller as a child.</p>\n"^^ . "<p>I'm having troubles checking if an array contains an object.\nThe <code>@property(nonatomic) NSArray&lt;NSNumber*&gt;* apiArray;</code> array is returned as a parameter from an API model while the object of which I want to check the presence in the array is returned from another API model <code>@property(nonatomic) NSNumber* localObject;</code>.</p>\n<p>When I check for it <code>[apiArray containsObject: localObject]</code> it outputs 0 even though the value is there..\nSo I checked the types and on <code>localObject</code> the type is effectively an NSNumber, while If i'm not mistaking the array results being an NSString array as by the prints below.</p>\n<pre><code> NSLog(@&quot;$$$$$$$$$$$ [apiArray containsObject: localObject]: %d&quot;, [apiArray containsObject: localObject] );\n NSLog(@&quot;apiArray types are: %@&quot;, [apiArray valueForKey:@&quot;class&quot;]);\n NSLog(@&quot;localObject type is: %@&quot;, [localObject valueForKey:@&quot;class&quot;]);\n NSLog(@&quot;apiArray is: %@&quot;, apiArray);\n NSLog(@&quot;localObject is: %@&quot;, localObject);\n\n\n\n$$$$$$$$$$$ [apiArray containsObject: localObject]: 0\napiArray types are: (\n &quot;__NSCFString&quot;\n)\nlocalObject type is: __NSCFNumber\napiArray is: (\n 5717271485874176\n)\nlocalObject is: 5717271485874176\nAPI NSNumber array types are: (\n &quot;__NSCFString&quot;\n)\n</code></pre>\n<p>The models are generated via swagger-codegen.jar but as the parameters are shown they both seem correct.</p>\n<p>As a test I did create an array myself and indeed the types are both NSNumber and containsObject actually works as expected</p>\n<pre><code>NSMutableArray&lt;NSNumber*&gt;* apiArray = [NSMutableArray&lt;NSNumber*&gt; array];\n NSNumber *localObject = [NSNumber numberWithInt: -1];\n [apiArray addObject: localObject];\n\n NSLog(@&quot;$$$$$$$$$$$ [apiArray containsObject: localObject]: %d&quot;, [apiArray containsObject: localObject] );\n NSLog(@&quot;apiArray types are: %@&quot;, [apiArray valueForKey:@&quot;class&quot;]);\n NSLog(@&quot;localObject type is: %@&quot;, [localObject valueForKey:@&quot;class&quot;]);\n NSLog(@&quot;apiArray is: %@&quot;, apiArray);\n NSLog(@&quot;localObject is: %@&quot;, localObject);\n\n$$$$$$$$$$$ [apiArray containsObject: localObject]: 1\napiArray types are: (\n &quot;__NSCFNumber&quot;\n)\nlocalObject type is: __NSCFNumber\napiArray is: (\n &quot;-1&quot;\n)\nlocalObject is: -1\nAPI NSNumber array types are: (\n &quot;__NSCFNumber&quot;\n)\n</code></pre>\n<p>Can you spot what the problem might be?</p>\n"^^ . . . . . . . . . . . . "kernel"^^ . . "automatic-ref-counting"^^ . . . "0"^^ . "Did you set `allowsPictureInPictureMediaPlayback = true`?"^^ . . . "0"^^ . . . . . . "Did you pull the encrypted database off the device and attempt to open it with DB Browser for SQLite using SQLCipher 3 default encryption settings? What was the result?"^^ . . "1"^^ . . . . . "sharing pdf to my ios react native app from gallery/files issue"^^ . . . "0"^^ . . . "0"^^ . . "0"^^ . . "2"^^ . . "@Larme I'm not sure I follow you. In my first code snippet I use the API model values, the print of the array doesn't show the value between `"`, its values type are NSString and containsObject returns 0. \nIn my second snippet I use an Array which I populate myself, and the value gets printed between `"`, its value types are indeed NSNumber and containsObject returns 1 correctly.\n\nwhere should I use `integerValue`? on the object I want to know if is presente in the array from the API or where?"^^ . . "0"^^ . . . . "<p>In Objective-C with ARC or Swift (which always uses ARC), what difference does it make whether <code>isReleasedWhenClosed</code> is <code>true</code> or not? Won't a window be kept alive as long as my code has strong references to it, and automatically destroyed when the last strong reference is gone? So why is this setting needed at all?</p>\n"^^ . . "0"^^ . "0"^^ . . . "0"^^ . "0"^^ . . . "0"^^ . . "0"^^ . . . . . . "0"^^ . "uibezierpath"^^ . . . "I tried and it compiled. I just had to add `@available(iOS 15.0, *)` above `@objcMembers public class Store:...`"^^ . "0"^^ . . . . . . . . "@Larme OOH I see.. thanks for the clarification on the array type I found myself having to make modifications to our Objective-c app, but I'm very new to it. So the problem then might reside in the API compilation with swagger I guess. The guys from the back-end told me they send longs, not strings, and checking the json we receive to compile the API the apiArray parameter is `"apiArray":{"type":"array","items":{"type":"integer","format":"int64"}}`."^^ . "microsoft.identitymode.tokens.audienceurivalidationfailedexception was thrown while trying to open One Drive document in WKWebView in iOS app"^^ . . "1"^^ . . "is anybody alive on stack overflow ????????????????????????????????????????????"^^ . . . "0"^^ . "How can I update running(activated) system extension in mac?"^^ . . "0"^^ . . "0"^^ . "0"^^ . "1"^^ . . . . . "1"^^ . . "0"^^ . . "0"^^ . "0"^^ . . . . . . . . "0"^^ . "apple-push-notifications"^^ . . . . "c++"^^ . . "swagger-codegen"^^ . . . . "1"^^ . . . . "1"^^ . . . . "2"^^ . . "cinterop"^^ . "0"^^ . . . . . . "If you use [the `class!()` macro](https://docs.rs/objc/latest/objc/macro.class.html), does it work?"^^ . "qt"^^ . "<p>I am trying to reference a variable in a Swift class from an Objective-C view controller.</p>\n<p>I can reference functions and variables in other Swift Classes from this Objective-C class. However, when I try to reference variables in this class in particular, which is a Store class containing Storekit2 when I try to build, it generates two errors:</p>\n<pre><code>Undefined symbol: _OBJC_CLASS_$__TtC5myapp5Store\nLinker command failed with exit code 1 (use -v to see invocation)\n \n</code></pre>\n<p>I believe the issue has something to do with Objective-C not being able to see every type of Swift Class. It can see classes with which it is familiar such as UIView Controllers but not new ones such as the Store.</p>\n<p>Here is the beginning of the Store file in Swift (which has all the Storekit functions. I think the Store_from_Objc was an unfinished effort to make the class observable from Swift but the documentation done by a previous programmer does not go into any detail.</p>\n<pre><code>//Store.swift\nimport StoreKit\n\n//CLASS STUB FOR TESTING ObjC\n@available(iOS 15.0, *)\n@objcMembers public class Store_from_Objc: NSObject,ObservableObject {\n static var shared = Store_from_Objc()\n @objc var teststring1 = &quot;hello from store_from_objc class&quot;\n public func initAndLoad () {\n Store.shared.initAndLoad()\n } \n}\n//FULL CLASS WITH METHODS FOR STORE\n @objcMembers public class Store: NSObject, ObservableObject { \n typealias Transaction = StoreKit.Transaction\n typealias RenewalInfo = StoreKit.Product.SubscriptionInfo.RenewalInfo\n typealias RenewalState = StoreKit.Product.SubscriptionInfo.RenewalState\n \n static var shared = Store()\n @objc var testing2 = &quot;hello from actual Store&quot;\n //LOTS MORE CODE\n}\n</code></pre>\n<p>Here is the Obj-c file from which I'm trying to reach Swift variable.</p>\n<pre><code>//import bridging header so that obj-c file knows about swift files\n\n #import &quot;myapp-Swift.h&quot;\n if (@available(iOS 15.0, *)) {\n NSString *test1 = [Store_from_Objc shared].teststring1;\n NSString *test2 = [Store shared].teststring2;\n NSLog(@&quot;%@&quot;,test1);\n NSLog(@&quot;%@&quot;,test2);\n} else {\n // Fallback on earlier versions\n}\n</code></pre>\n<p>The code does not generate an error when written but throws the two above errors when you try to build referencing the NSString in the Store class. The project builds ok if you just try to reference the Store_from_Objc variable.</p>\n<p>These errors go away if you comment out the attempt to reach the Store class variables.</p>\n<p>I did come across a line in <a href="https://www.revenuecat.com/blog/engineering/migrating-from-storekit-1-to-storekit-2/" rel="nofollow noreferrer">an article</a> that says &quot;Using StoreKit 2 is not possible with Objective-C&quot;. My storekit code is all in Swift but it would be nice to reach variables in the Store class.</p>\n<p>Thanks for any suggestions.</p>\n<p><strong>Edit</strong></p>\n<p>Playing around with this some more, I can reach a string variable if I put it in the Store_from_objc class but cannot reach the string if I put it in regular Store class even with the @available(iOS 15.0, *) as suggested by Larme. The Store_from_objc class inherits from the same objects but doesn't contain any substantive code....</p>\n<p>Could the Storekit2 methods be causing the errors? Thanks for any suggestions.</p>\n"^^ . . "0"^^ . . "1"^^ . "0"^^ . . "1"^^ . "You could create an extension on `NSArray`: `-(BOOL)containsWhere:(BOOL (^)(id obj))predicate { NSInteger index = [self indexOfObjectPassingTest:^BOOL(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { return predicate(obj); }]; return index != NSNotFound; }`, and then call it like that: `BOOL contains = [array containsWhere:^BOOL(id _Nonnull obj) { return [obj integerValue] == [localObject integerValue]; }];`"^^ . . "In both workspace 1 and workspace 2 implementations? My initial guess without seeing your code would be that it's some sort of issue with the way you've integrated SQLCipher. As mentioned in my previous comment, you should pull the database off the device, download DB Browser for SQLite and attempt to open it with that. Then if you're still stuck create a minimal project that reproduces the issue, upload it to GitHub and then post a link to it."^^ . . "0"^^ . . . "Override NSManagedObject getter/setter to modify data"^^ . . "0"^^ . . . "<p><strong>tl;dr?</strong> Scroll down all the way to the final summary. Yet if you want to know the history of that setting, how it really works and why it is even there, see below.</p>\n<hr />\n<p>The <code>isReleasedWhenClosed</code> property has been a major source of confusion for decades. Even in modern Swift code, people misunderstand this property and its purpose, or how it may or may not affect their code and application behavior. To understand why <code>isReleasedWhenClosed</code> even exists, we have to go back to a time when Swift didn't exist and Objective-C had no automatic memory management or garbage collection, it had no weak references and it didn't even have synthesized properties (<code>@propertry</code>), you had to write getter/setter methods yourself.</p>\n<p>Before ARC, you had to manage memory yourself in Obj-C. That is, if you created an object using a method starting with <code>new...</code> or <code>alloc...</code>, you had to release that object when you were done with it by calling <code>release</code> on it. Now, if you passed that object around and someone else wanted to keep a persistent reference to it, they had to <code>retain</code> the object, which would prevent it from being destroyed when its creator called <code>release</code>. But if you retained an object, you also had to offset that retention with another <code>release</code>, otherwise the object would never be destroyed.</p>\n<p>What happens if you keep a reference to an object without holding it? In this case, the object may be destroyed and your reference becomes a dangling pointer. A dangling pointer is a pointer to an address where an object used to be, but that object no longer exists, so there is either nothing or another object at that address, or the address points to the middle of some memory allocation. There's nothing wrong with having dangling object pointers, they're perfectly legal as long as you don't actually try to send them messages, because that will result in undefined behavior, meaning maybe it will cause your application to crash, maybe it will cause your application to behave in weird ways, just don't do it.</p>\n<p>So the rules for proper memory management were basically:</p>\n<ul>\n<li>You release any object you created.</li>\n<li>You retain any object you want to keep.</li>\n<li>You release any object you have retained.</li>\n<li>Assigning an object reference to a variable alone has no effect on the lifetime of the object.</li>\n<li>When your object is destroyed, make sure to deallocate any created/retained objects in instance variables.</li>\n</ul>\n<p>In modern Obj-C, this code is safe</p>\n<pre><code>@implementation SomeObject\n {\n id _ivar;\n }\n\n\n - (void)lookAtMyCoolObject:(id)object\n {\n _ivar = object;\n }\n@end\n</code></pre>\n<p>as <code>object</code> gets retained the moment you assign it to <code>_ivar</code> but in old school Obj-C that would be fatal. Instead you would have to write</p>\n<pre><code>_ivar = [object retain];\n</code></pre>\n<p>and to prevent the object from leaking, you had to add</p>\n<pre><code>- (void)dealloc\n{\n [_ivar release];\n [super dealloc];\n}\n</code></pre>\n<p>You can get the same behavior in modern Obj-C by declaring the variable as <code>__unsafe_unretain</code>. For synthesized properties you would use <code>assign</code> and in Swift you would use <code>unowned</code>. In general, however, there is no need for this construct anymore, as weak references now exist and you would just declare variables as <code>__weak</code> or use <code>weak</code> for properties and in Swift. The advantage of weak references is that they never become dangling pointers. When the object they reference is released, they become <code>nil</code> instead, and sending messages to <code>nil</code> is defined behavior.</p>\n<p>Now suppose you had a NIB file describing an NSWindow containing just a text label, named <code>&quot;MyWindow.nib&quot;</code>, and you wanted to load that window into your application, how would you have done that in old school Obj-C code?</p>\n<p>First, you would have created a class to manage that window. You could subclass <code>NSWindowController</code>, but you didn't have to, you could just as well do this</p>\n<pre><code>@interface MyWindowController : NSObject\n// ...\n@end\n\n\n@implementation MyWindowController\n {\n IBOutlet NSWindow * _window;\n IBOutlet NSTextField * _label;\n }\n\n\n - (instancetype)init \n {\n self = [super init];\n if (self) {\n [[NSBundle mainBundle] \n loadNibNamed:@&quot;MyWindow&quot; owner:self topLevelObjects:nil\n ];\n }\n return self;\n }\n@end\n</code></pre>\n<p>In the NIB file, set the <code>MyWindowController</code> class as the owner of the NIB file, and then use drag'n drop in the Interface Builder to assign the window to <code>_window</code> and the label to <code>_label</code>. Done.</p>\n<p>But wait, how does memory management work here? There are no <code>retain</code>/<code>release</code> calls anywhere in the code, and both instance variables do not retain anything just because a value is assigned to them. There is also no <code>dealloc</code> that would release anything.</p>\n<p>To make memory management for the UI easier, Apple decided that windows retain themselves on load, and a window retains everything found within the window. So <code>MyWindowController</code> in fact retains nothing in the above code. It has an unsafe reference to the window, which stays alive because it has self-retained, and another unsafe reference to the label inside the window, which stays alive because the window has retained it.</p>\n<p>What about freeing these objects? The code above is fine if the window exists as long as the application is running, because then there is no need to ever free anything, because when the application quits, all its resources are implicitly freed by the system anyway. However, sometimes an application has multiple windows that come and go, and then you also want to free the memory used by these UI objects at some point. And now we finally come to <code>isReleasedWhenClosed</code>!</p>\n<p>If set to <code>true</code>, the moment the window is closed, it will release itself once to balance the self-retention on load. This causes the window to be destroyed, which causes the label to be released and destroyed as well. As a result, both instance variables above are now dangling pointers and cannot be used anymore. So typically you would want to make sure that when the window is closed, <code>MyWindowController</code> is also destroyed, or at least no longer performs any operation that would access any UI objects. The typical way to do this is to tell the object that created and holds <code>MyWindowController</code> alive when the window has closed, and that object would then release <code>MyWindowController</code> and set its reference to <code>nil</code> or notify someone else and get destroy itself.</p>\n<p>However, if you set <code>isReleasedWhenClosed</code> to false, then closing the window will not cause the window to receive a <code>release</code> message and thus not balance the self-retaining. In this case, the window would leak unless you add this code to the controller</p>\n<pre><code>- (void)dealloc\n{\n [_window release];\n [super dealloc];\n}\n</code></pre>\n<p>This was a bit odd because it violated the rules I just stated above. You did not create the window (you loaded the NIB file, but never created a window object yourself), and you did not retain it, so according to the rules above, you should never have to release it. Therefore, the default behavior was that the window would retain and release itself, and you didn't have to worry about memory management at all.</p>\n<p>Note that you only need to release the window itself, the label will be freed as a direct result of this. Releasing both will most likely crash or cause strange behavior. Why would you want this behavior? There are two situations where you might want this behavior:</p>\n<ol>\n<li><p>You may want to access UI objects after the window has closed, e.g. you may not want to read values from input fields immediately after the input field has been changed or after the user has clicked a button, but only after the window has closed. This is only possible if these UI objects still exist when the window is closed.</p>\n</li>\n<li><p>You may want to bring the window back later without having to create a new controller and reload the window from the NIB file. All you need to do in the controller above is call <code>[_window makeKeyAndOrderFront:self]</code> and the window is back on the screen in exactly the state it was in when it was closed.</p>\n</li>\n</ol>\n<p>Now that you understand what this setting was originally good for and how it interacted with classical memory management, you might also understand why this setting is pretty much useless in modern Obj-C or Swift most of the time. With automatic reference counting in Obj-C and Swift, the window is automatically retained by your custom controller the moment it is assigned to an instance variable or property; and so is any other UI object within the window that you reference directly. Unless you manually set the references to <code>nil</code> or your controller object itself is destroyed, no window is ever destroyed when you set <code>isReleasedWhenClosed</code> to <code>true</code> and the window is closed.</p>\n<p>In fact, the self-retain itself would be useless in modern code, with one exception: A weak reference to a window. If your window reference is weak (<code>__weak NSWindow * _window</code>) and the window would not self-retain, it would be destroyed immediately after creation and the variable would immediately become <code>nil</code> again. So there is still self-retaining, and if <code>isReleasedWhenClosed</code> is <code>true</code>, a weak variable will become <code>nil</code> the moment the window is closed (assuming no one else has retained it), otherwise it will not and still refer to the window.</p>\n<p>Will a window leak in modern Obj-C and Swift if <code>isReleasedWhenClosed</code> is <code>false</code>? After all, you cannot explicitly release the window in ARC and in Swift, so how would you compensate for the self-retaining?</p>\n<p>The answer is: Not if the owner is also destroyed. If you go back to the NIB loading example code, you may notice that an argument there was called <code>owner</code> and I just passed a self-reference to it. In modern Obj-C and Swift, the self-retain is released the moment the owner is destroyed. If there are no more strong references to the window when that happens, the window is released as well. But be careful: By default, the owner of the main window is the application delegate, and the application delegate is never destroyed. So if you lose all strong references to the main window and the main window is not set to release on close, it will actually leak.</p>\n<p>Finally, there is one more thing that most people miss. The documentation says:</p>\n<blockquote>\n<p>Release when closed, however, is ignored for windows owned by window controllers.</p>\n</blockquote>\n<ul>\n<li><a href="https://developer.apple.com/documentation/appkit/nswindow/1419062-isreleasedwhenclosed" rel="nofollow noreferrer">https://developer.apple.com/documentation/appkit/nswindow/1419062-isreleasedwhenclosed</a></li>\n</ul>\n<p>So if you are using a window controller, or if your own window controller is a subclass of a window controller, this property has no effect anyway. That's because since MacOS 10.0, window controllers manage the lifecycles of their windows all by themselves and will prevent this setting from having any effect on the window retain count.</p>\n<hr />\n<h2>Summary</h2>\n<p>If you use a window controller or subclass of it, ignore that this setting even exists. Otherwise you almost certainly want <code>isReleasedWhenClosed</code> to be <code>true</code> in modern Obj-C and Swift code and manage the lifetime of the window yourself via strong references. The only reason to disable it is for the case that you (for whatever reason) have a weak reference only to the window and you don't want it to become <code>nil</code> when the window is getting closed; but then you must make sure that the owner of the NIB files will get destroyed at some point, otherwise the window will leak.</p>\n<p>Apple also confirms that the way set <code>isReleasedWhenClosed</code> is hardly ever the cause of a problem and if you must change that setting to fix an issue, something is broken about your memory management to begin with:</p>\n<blockquote>\n<p>In practical terms, isReleasedWhenClosed is almost never the cause of the problem. It's a self-retain of the window, and setting it true or false just changes an under-release problem into an over-release problem, or vice versa. :)</p>\n</blockquote>\n<ul>\n<li><a href="https://forums.developer.apple.com/forums/thread/735574" rel="nofollow noreferrer">https://forums.developer.apple.com/forums/thread/735574</a></li>\n</ul>\n<p>Note that DTS means &quot;Developer Technical Support&quot; and is Apple's paid developer support (yes, you must pay to get DTS tickets) and the replies from DTS are official replies from Apple by an Apple employee.</p>\n"^^ . . "0"^^ . "0"^^ . "popup"^^ . . . . . "0"^^ . . . . "Oh wow! Thank you very much for your answer, I really appreciate the in-depth\n explanation. I did check-out again with the back-end guys and indeed they're sending an array of strings..dough it shouldn't and they're looking into it because it shouldn't be the case looking at the OpenAPi yaml they're using to generate the endpoints"^^ . "nslayoutconstraint"^^ . . "<p>I've tested with the following structure (<code>shared</code> implements <code>shared-ui-models</code>):</p>\n<p><a href="https://i.sstatic.net/f5jrP5m6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/f5jrP5m6.png" alt="enter image description here" /></a><br />\n<a href="https://i.sstatic.net/TEYCrtJj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TEYCrtJj.png" alt="enter image description here" /></a> <a href="https://i.sstatic.net/cWVaoVZg.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/cWVaoVZg.png" alt="enter image description here" /></a></p>\n<p>And this <code>Model.kt</code> file:</p>\n<pre><code>package com.sample.models\n\nimport kotlin.experimental.ExperimentalObjCName\nimport kotlin.native.ObjCName\n\n@OptIn(ExperimentalObjCName::class)\n@ObjCName(swiftName = &quot;MyTestScreen&quot;)\ndata class Screen(val name: String)\n</code></pre>\n<p>The output is:</p>\n<pre><code>__attribute__((swift_name(&quot;Shared_ui_modelsMyTestScreen&quot;)))\n</code></pre>\n<p>Or just <code>Shared_ui_modelsScreen</code> if I remove the <code>@ObjCName</code>.</p>\n<p>I'm inclined to assume that the logic is:<br />\nModule name capitalised + &quot;-&quot; replaced by &quot;_&quot; + <code>class</code>/<code>protocol</code> name.</p>\n<p>I would like to get some confirmation on this because when applying this logic to the <code>SerializersModuleCollector.kt</code> file in the OP, we see that its module is simply <strong>core</strong>. However, the result is Kotlinx_serialization_coreSerializersModuleCollector, which leads me to wonder where the Kotlinx_serialization part comes from.</p>\n"^^ . "0"^^ . . . . "0"^^ . . . . "This sounds like: an issue with the way you've integrated SQLCipher or mismatched SQLCipher major versions (you won't be able to open SQLCipher 3.x databases with SQLCipher 4.x by default as the encryption settings are different -- you'll need to use cipher_migrate or open it with compatibility settings: https://discuss.zetetic.net/t/upgrading-to-sqlcipher-4/3283). I'd recommend pulling the database off the device and attempting to open it with DB Browser for SQLite: https://sqlitebrowser.org If you're still stuck, create an simple example project on GitHub and post a link to it."^^ . "0"^^ . "0"^^ . "0"^^ . . "I was able to access a variable in Store_from_Objc from is just a stub of.a class but not in the full class Store. The code included above is just the beginning of the Store class. The actual one has hundreds of lines of code...It could be that some of the StoreKit2 methods may be the problem although that doesn't make that much sense since both the long version and the short version inherit from (NSObject, ObservableObject)"^^ . . . . "That I am aware of. Wanted to know the difference technically as if using String functions will be better than using NSString functions in which sense ?"^^ . . . "It would also be useful to know _when_ all this is happening. I could incorporate your code pretty much as is into a demo project where I tap a button in the interface and alternate with animation between a 64 height and a 160 height, and your code pretty much as is would _work_. Therefore in order to know why your code is _not_ working we might need to know more about other aspects of the environment in which all this is happening."^^ . "0"^^ . . "Did you tried : « @import metal_float64 » . To import the module and its interface in Objective-C code ?"^^ . . . "<ol>\n<li>I’m trying to generate Xcode project file of some libraries with CMake.</li>\n<li>I want to generate dSYM file in all build config type.</li>\n<li>I set values in all my CMakelists.txt as below:\n<code> set(CMAKE_CXX_FLAGS &quot;${CMAKE_CXX_FLAGS} -g&quot;) set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT &quot;dwarf-with-dsym&quot;)</code></li>\n<li>After CMake generate my xcodeproj file, I find out “Generate Debug Symbols” is set to true in Debug but set to false in Release build type\n<a href="https://i.sstatic.net/22sf05M6.png" rel="nofollow noreferrer">enter image description here</a></li>\n<li>I only find it happened in one library, and other libraries worked perfectly.</li>\n<li>Does anyone have a clue?</li>\n<li>I found relevant question and tried, but not valid:\n<a href="https://stackoverflow.com/questions/49695234/cmake-with-xcode-target-generate-debug-symbols-setting-ignored-for-release-conf">cmake-with-xcode-target-generate-debug-symbols-setting-ignored-for-release-conf</a></li>\n</ol>\n<p>What I expect is as below image. Actually cmake works good with other library.\n<a href="https://i.sstatic.net/gDr1MkIz.png" rel="nofollow noreferrer">enter image description here</a></p>\n"^^ . . "1"^^ . . . . . . . . . . "0"^^ . "javascript"^^ . "1"^^ . "Did not know that , thanks!"^^ . . . . . "0"^^ . "The Objective C runtime was not linked, which leaded to failure to find the class. It is weird, even a bug, that `objc` didn't forced linking it."^^ . "0"^^ . . . . "0"^^ . "sharepoint"^^ . . . . . "You receive numbers in double quotes from server?"^^ . "Duplicate of https://stackoverflow.com/a/23839955/341994"^^ . . . . . . "uisplitviewcontroller"^^ . . . "0"^^ . . . . "<p>I am working in iOS app needs to be opened One Drive attachments in WKWebView.</p>\n<p>Sample One Drive document is</p>\n<pre><code>https://\\*\\*\\*.sharepoint.com/personal/\\*\\*\\*\\*\\*\\_onmicrosoft_com/\\_layouts/15/Doc.aspx?sourcedoc=%7B756B3139-9729-49D2-A325-9D3B150C6A78%7D&amp;file=export.csv&amp;action=default&amp;mobileredirect=true\n</code></pre>\n<p>I got the this error</p>\n<p><code>&quot;microsoft.identitymode.tokens.audienceurivalidationfailedexception was thrown&quot; inside the loaded WKWebView</code></p>\n<p>Please suggest me to fix the issue.</p>\n<p>Thanks in Advance</p>\n<p>To load the document in the WKWebView, here is the code snippet:</p>\n<pre><code>WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];\n if([[NSUserDefaults standardUserDefaults] objectForKey:[TMEUserDefaultKeys cdnSetCookie]]) {\n WKUserContentController *userContentController = WKUserContentController.new;\n WKUserScript *cookieScript = [[WKUserScript alloc]\n initWithSource:[NSString\n stringWithFormat:@&quot;document.cookie = '%@';&quot;,\n [[NSUserDefaults standardUserDefaults] objectForKey:[TMEUserDefaultKeys cdnSetCookie]]]\n injectionTime:WKUserScriptInjectionTimeAtDocumentStart\n forMainFrameOnly:NO];\n [userContentController addUserScript:cookieScript];\n [configuration setUserContentController:userContentController];\n }\n WKPreferences *preferences = [[WKPreferences alloc] init];\n preferences.javaScriptEnabled = YES;\n configuration.preferences = preferences;\n configuration.allowsInlineMediaPlayback = YES;\n configuration.allowsPictureInPictureMediaPlayback = YES;\n configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAll;\n NSArray&lt;NSHTTPCookie *&gt; *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];\n for(NSHTTPCookie *cookie in cookies) {\n [configuration.websiteDataStore.httpCookieStore setCookie:cookie completionHandler:nil];\n }\n\n self.webView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:configuration];\n self.webView.UIDelegate = self;\n self.webView.navigationDelegate = self;\n self.webView.translatesAutoresizingMaskIntoConstraints = false;\n self.webView.scrollView.bounces = NO;\n self.webView.scrollView.showsVerticalScrollIndicator = NO;\n self.webView.allowsBackForwardNavigationGestures = YES;\n [self.view addSubview:self.webView];\n \n NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:self.documentURL\n cachePolicy:NSURLRequestUseProtocolCachePolicy\n timeoutInterval:60.0];\n\n [request addValue:[NSString stringWithFormat:@&quot;Bearer %@&quot;, self.oneDriveToken] forHTTPHeaderField:@&quot;Authorization&quot;];\n [request addValue:@&quot;https://***.sharepoint.com/.default&quot; forHTTPHeaderField:@&quot;scope&quot;];\n [self.webView loadRequest:request];\n</code></pre>\n"^^ . . "Yes. Basically, I am trying to scan a QR code with the camera and load the URL obtained from the scan in an app that is running in the background. However, I am unable to load the new URL."^^ . . . . . . . "0"^^ . "0"^^ . . "Sounds like a SQLCipher integration issue or conflicting dependencies with standard SQLite. Try to make a simple test project to reproduce the problem and narrow down what could be causing it. You can add dependencies one at a time to determine if one of them is causing the issue."^^ . "0"^^ . . "0"^^ . "<p>resident expert phil dennis-jordan and another person named 'krackers' have gotten to the bottom of the issue.</p>\n<p>for others: be careful with lld. it is used by default for compiling firefox, and this issue will arise when linking with the -fuse-ld=lld flag.</p>\n<p>when i set the linker to ld64. the problem went away.</p>\n"^^ . "UIBezierPath stroke with alpha issue / artifact"^^ . . . . . . "1"^^ . . . . . . . . "0"^^ . "0"^^ . "How to Reactivate the Last Focused Window After My Qt App Closes on macOS"^^ . "github"^^ . . "0"^^ . . "0"^^ . "objective-c-runtime"^^ . . "Sandboxed macOS app not able to launch the PiP window via Javascript, why?"^^ . . "Sorry, it was late, but I still don't know how I missed it. I will delete my comment as it's irrelevant."^^ . . . "1"^^ . . . . "metal"^^ . . . . "appkit"^^ . . . "0"^^ . . . . . . . . . . . "notifications"^^ . . . "0"^^ . "cgcontext"^^ . . "<p>We are using AWS-IOS-SDK to upload images and text.</p>\n<p>error occurred in Xcode 15 but working good in Xcode 14 ,we used the same source code for both versions.</p>\n<p>Please check the error message</p>\n<p>AWSiOSSDKv2 [Verbose] AWSURLResponseSerialization.m line:263 | -[AWSXMLResponseSerializer responseObjectForResponse:originalRequest:currentRequest:data:error:] | Response body: [\n<Code>SignatureDoesNotMatch</Code>The request signature we calculated does not match the signature you provided. Check your key and signing method.AWERFJUIOLPRTBDUTYAWS4-HMAC-SHA256\n20240702T113658Z\n20240702/us-east-1/s3/aws4_request\n5526a3fb62da4bea59eeb780deef64e9d943168388e7bfed6e2f47335fb6a1878d45a2e2d81869e6b734bc4cf9a95717df7286c41fb84e842d79d0e5be3ca7a641 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 0a 32 30 32 34 30 37 30 32 54 31 31 33 36 35 38 5a 0a 32 30 32 34 30 37 30 32 2f 75 73 2d 65 61 73 74 2d 31 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 35 35 32 36 61 33 66 62 36 32 64 61 34 62 65 61 35 39 65 65 62 37 38 30 64 65 65 66 36 34 65 39 64 39 34 33 31 36 38 33 38 38 65 37 62 66 65 64 36 65 32 66 34 37 33 33 35 66 62 36 61 31 38 37PUT</p>\n<p>Thank you for your help support.</p>\n"^^ . "osx-lion"^^ . "Issue with nullability specifiers in Xcode when developing Flutter app"^^ . . . . . "0"^^ . . "1"^^ . . "NSNumber array containsObject fails as types are different but they should be the same"^^ . . . . "0"^^ . "0"^^ . . . "0"^^ . . "1"^^ . "subscription"^^ . . . . . "In both workspaces used 3.4 version only."^^ . "I'm using .p8 file, I need help asper."^^ . "1"^^ . . "0"^^ . . . . . . "Does [this](https://stackoverflow.com/a/73731707/13944750) help you ?"^^ . . . "<p>I'm developing a screenshot-taker application using Qt and need some assistance with macOS-specific behavior.</p>\n<p>Here’s the scenario:</p>\n<ul>\n<li>When I take a screenshot, my application becomes focused to allow the user to draw over the screenshot.</li>\n<li>After editing, the user can copy the edited screenshot.</li>\n<li>The problem is that the previously focused window (for example, a Chrome window) loses focus and remains unfocused even after my application closes.</li>\n</ul>\n<p>What I want to achieve:</p>\n<ul>\n<li>Programmatically refocus the last focused window that was active before my application became active.</li>\n</ul>\n<p>Is there any way to achieve this using macOS APIs? Specifically, I’m looking for a method to track and reactivate the previously focused window from my application. Any guidance, suggestions, or code snippets would be greatly appreciated!</p>\n"^^ . "xcode15"^^ . "1"^^ . . . . "0"^^ . . "0"^^ . . . . . "I would always suggest using NSISO8601DateFormatter when dealing with things that look like ISO8601 - It is simpler than having to define a custom format."^^ . "1"^^ . "cmake"^^ . . . . . . . . . . . "NSDateFormatter returns nil for date string from server"^^ . "0"^^ . . "@AlanBirtles I finally solved it. The reason is the library includes *.c file, and I should add `set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")` :("^^ . . "2"^^ . "<p>Now we are trying to update our security solution. The solution is built with endpoint security extension, and it's already distributed for all clients, and we want to update them.</p>\n<p>But it seems like updating the existing system extension is a hard work.</p>\n<p>Below are the tasks that we did.</p>\n<ol>\n<li>Modify Extension Manager class</li>\n</ol>\n<pre><code>- (OSSystemExtensionReplacementAction)request:(OSSystemExtensionRequest OS_UNUSED *)request actionForReplacingExtension:(OSSystemExtensionProperties *)existing withExtension:(OSSystemExtensionProperties *)extension\n{\n NSLog(@&quot;Got the upgrade request (%@ -&gt; %@); answering replace.&quot;, existing.bundleVersion, extension.bundleVersion);\n os_log(OS_LOG_DEFAULT, &quot;Got the upgrade request (%@ -&gt; %@); answering replace&quot;, existing.bundleVersion, extension.bundleVersion);\n\n return OSSystemExtensionReplacementActionReplace;\n}\n</code></pre>\n<p>We modified OSSystemExtensionReplacementAction to replace current extension program.</p>\n<ol start="2">\n<li>Modify CFBundleVersion / CFBundleShortVersionString</li>\n</ol>\n<pre><code>&lt;key&gt;CFBundleShortVersionString&lt;/key&gt;\n&lt;string&gt;1.3&lt;/string&gt;\n&lt;key&gt;CFBundleVersion&lt;/key&gt;\n&lt;string&gt;2&lt;/string&gt;\n</code></pre>\n<p>we modified version codes in the info.plist file to get updated</p>\n<ol start="3">\n<li>Checked System settings</li>\n</ol>\n<p>We also checked for system settings. Becuase there could be &quot;Allow extension&quot; alike buttons enabled. But there were none buttons enabled related to system extensions.</p>\n<p>We tried all of them, but existed activated extension is still running, and version is not updated</p>\n<p><a href="https://i.sstatic.net/82C8Sy5T.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/82C8Sy5T.png" alt="enter image description here" /></a></p>\n<p>What could be the reason?</p>\n"^^ . . "<p>i've read the great question here</p>\n<p><a href="https://stackoverflow.com/q/15456974">Is NSObject class a part of the Objective-C runtime library today (instead of being a Foundation component)?</a></p>\n<p>about how NSObject was moved from runtime into its own class between 10.7 and 10.8.</p>\n<p>i was hoping to get assistance on how i can use an NSObject with &gt;=10.8 SDKs and a 10.7 build target.</p>\n<p>if i try to use a 10.7 target with the modern SDK, it will complain about NSObject being an undefined symbol:</p>\n<pre><code>ld64.lld: error: undefined symbol: OBJC_CLASS_$_NSObject\n&gt;&gt;&gt; referenced by /Users/Gagan/Downloads/mozilla-unified/toolkit/mozapps/update/updater/launchchild_osx.mm\n&gt;&gt;&gt; launchchild_osx.o:(symbol OBJC_CLASS_$_ElevatedUpdateServer+0x8)\n&gt;&gt;&gt; referenced by /Users/Gagan/Downloads/mozilla-unified/toolkit/mozapps/update/updater/progressui_osx.mm\n&gt;&gt;&gt; progressui_osx.o:(symbol OBJC_CLASS_$_UpdaterUI+0x8)\n\nld64.lld: error: undefined symbol: OBJC_METACLASS_$_NSObject\n&gt;&gt;&gt; referenced by /Users/Gagan/Downloads/mozilla-unified/toolkit/mozapps/update/updater/launchchild_osx.mm\n&gt;&gt;&gt; launchchild_osx.o:(symbol OBJC_METACLASS_$_ElevatedUpdateServer+0x8)\n&gt;&gt;&gt; referenced by /Users/Gagan/Downloads/mozilla-unified/toolkit/mozapps/update/updater/launchchild_osx.mm\n&gt;&gt;&gt; launchchild_osx.o:(symbol OBJC_METACLASS_$_ElevatedUpdateServer+0x0)\n&gt;&gt;&gt; referenced by /Users/Gagan/Downloads/mozilla-unified/toolkit/mozapps/update/updater/progressui_osx.mm\n&gt;&gt;&gt; progressui_osx.o:(symbol OBJC_METACLASS_$_UpdaterUI+0x8)\n</code></pre>\n<p>i understand why this is the case (because it was in the runtime), but i really want a 10.7 target and not 10.8 (where this error goes away).</p>\n<p>how would i link an objective c files that use NSObject for a 10.7 target and a modern SDK?</p>\n<p>i tried -framework Foundation and -framework CoreFoundation to no avail.</p>\n<p>there must be some way to handle this.</p>\n"^^ . . . . "<p>No prior knowledge for using external library in Swift.</p>\n<p>I was trying to include <a href="https://github.com/ngageoint/simple-features-proj-ios" rel="nofollow noreferrer">sf-proj-ios</a> in my empty project named &quot;Test&quot;. I followed instruction on the library GitHub, used commands on MacOS terminal.app:</p>\n<p>(installed CocoaPods)</p>\n<ol>\n<li><p><code>brew install automake</code></p>\n</li>\n<li><p><code>brew install libtool</code></p>\n</li>\n<li><p><code>cd /Users/MYNAME/Documents/Test</code></p>\n</li>\n<li><p><code>pod init</code></p>\n</li>\n</ol>\n<p>Podfile in project folder:</p>\n<pre><code>platform :ios, '15.0'\ntarget 'Test' do\n\npod 'sf-proj-ios', '~&gt; 6.0.3'\n use_frameworks!\n target 'TestTests' do\n inherit! :search_paths\n end\n target 'TestUITests' do\n end\nend\n</code></pre>\n<ol start="5">\n<li><code>pod install</code></li>\n</ol>\n<p>Notes: I did not make any changes to the bridging header build settings as I don't really understand where to import it as stated in the GitHub guide. i.e. where to put the line:</p>\n<pre><code>#import &quot;sf-proj-ios-Bridging-Header.h&quot;\n</code></pre>\n<p>Tried to add <code>sf-proj-ios-Bridging-Header.h</code> in <code>Objective-C Bridging Header</code> in project Build Settings but error prevailed.</p>\n<ol start="6">\n<li>Opened Test.xcworkspace with Xcode and added <code>test()</code> function to ViewController</li>\n</ol>\n<pre><code>import UIKit\nimport proj_ios\n\nclass ViewController: UIViewController {\n \n override func viewDidLoad() {\n super.viewDidLoad()\n test()\n }\n \n func test(){\n let projection1: PROJProjection = PROJProjectionFactory.projection(withAuthority: PROJ_AUTHORITY_EPSG, andIntCode: PROJ_EPSG_WEB_MERCATOR)\n }\n}\n</code></pre>\n<ol start="7">\n<li>Built and ran Test, resulted in error <code>Use of undeclared identifier 'nullptr'</code> and <code>'crs.hpp' file not found with &lt;angled&gt; include; use &quot;quotes&quot; instead</code> occurred at library file <code>optargpm.h</code> and <code>proj.cpp</code> .</li>\n</ol>\n<p><a href="https://i.sstatic.net/82KYId0T.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/82KYId0T.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/Jp9OKKi2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Jp9OKKi2.png" alt="enter image description here" /></a></p>\n<ul>\n<li><p>Tried to fix the &quot;angled&quot; with &quot;quotes&quot; as suggested by the compiler but it did not help.</p>\n</li>\n<li><p>Tried comment and uncomment <code>use_frameworks!</code> in the podfile then re-install pod but also not helping.</p>\n</li>\n<li><p>Searched online and found out that <code>nullptr</code> is available after C++11. Checked Build Settings of the project but all Clang dialects are 17 or above.</p>\n</li>\n</ul>\n<p>Suspected that the problem was due to improper installation of the library. Please advice how should it be done correctly.</p>\n<p>Project environment:</p>\n<pre><code>Mac Mini with M2 Chip\nmacOS: 14.0 (23A344)\nXcode: Version 15.4 (15F31d)\n</code></pre>\n<p>Attached project\n<a href="https://drive.google.com/file/d/1fLmQLhgLITaDjtLFu3n0xWVbXWOjjbVF/view?usp=sharing" rel="nofollow noreferrer">Test.zip</a></p>\n"^^ . "@Larme Just started learning. The line was there at the 3rd row in the podfile. Or am I missing some more?"^^ . . . "1"^^ . "0"^^ . "0"^^ . . "Post a [mre] in the question please. How/where did you add the MultitouchSupport framework? When do you get the `Undefined symbol: _MTDeviceCreateList` error?"^^ . . "0"^^ . "<p>What is the actual difference between String in Swift and NSString in Foundation(Objective C).</p>\n<p>I have seen all functions of NSString can be applied to String in swift. For example componentsSeparatedBy is function of NSString but works with String also.</p>\n<p>So what exactly is difference between them?</p>\n<p>Tried running NSString functions on Strings.</p>\n"^^ . . . . . . . . . . . . . . "0"^^ . . . . . . . "If the problem is solved, either delete the question or add an Answer to it."^^ . . . . . . . "Stick to `activateConstraints`: it knows better than you do what to add each constraint to. Instead of hunting for the height constraint at animation time, just keep a reference to it at the time you create it."^^ . . . . . . . . . "How do I replace detail view controller navigation stack when presenting"^^ . "<p>Curious...</p>\n<p>From experience, <code>UIBezierPath</code> can be rather <em><strong>quirky</strong></em>. In this case, I'm guessing this particular quirk is caused by internal optimizations.</p>\n<p>The reason I believe that to be the case is because if we generate a path with 256 points -- 1 moveTo + 255 addLineTo commands -- we don't see the problem:</p>\n<p><a href="https://i.sstatic.net/pmrmdefg.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/pmrmdefg.png" alt="enter image description here" /></a></p>\n<p>However, as soon as we use 1 moveTo + 256 addLineTo commands -- for a total of <strong>257</strong> points, we get this:</p>\n<p><a href="https://i.sstatic.net/3aIeHxlD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3aIeHxlD.png" alt="enter image description here" /></a></p>\n<p>One option to get around that would be to render a temporary image with clear background and 100% opaque stroke, and then render <em>that</em> image with 50% alpha:</p>\n<pre><code>// create image with solid stroke\nUIImage * tmpImage = [ renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext)\n{\n [ [ UIColor clearColor ] setFill ];\n [ [ UIColor colorWithWhite:0.0 alpha:1.0 ] setStroke ];\n [ bezierPath stroke ];\n} ];\n\n// create image2 by rendering tmpImage at 50% alpha\nUIImage * image2 = [ renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext)\n{\n [tmpImage drawAtPoint:CGPointZero blendMode:kCGBlendModeNormal alpha:0.5];\n} ];\n</code></pre>\n<hr />\n<p>Here's a complete, runnable example -- starts with 250 addLineTo commands... each tap anywhere increments that by 1:</p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\n@interface AlphaPathVC : UIViewController\n\n@end\n\n@interface AlphaPathVC ()\n{\n NSInteger nPoints;\n UIImageView *imgView1;\n UIImageView *imgView2;\n UILabel *infoLabel;\n}\n@end\n\n@implementation AlphaPathVC\n\n- (void)viewDidLoad {\n \n [super viewDidLoad];\n self.view.backgroundColor = UIColor.systemYellowColor;\n \n imgView1 = [UIImageView new];\n imgView2 = [UIImageView new];\n \n imgView1.backgroundColor = UIColor.whiteColor;\n imgView2.backgroundColor = UIColor.whiteColor;\n\n infoLabel = [UILabel new];\n infoLabel.backgroundColor = UIColor.whiteColor;\n infoLabel.numberOfLines = 0;\n infoLabel.text = @&quot;Tap anywhere to increase number of points and re-generate images...&quot;;\n \n [self.view addSubview:imgView1];\n [self.view addSubview:imgView2];\n [self.view addSubview:infoLabel];\n \n nPoints = 250;\n}\n\n- (void)viewDidLayoutSubviews {\n [super viewDidLayoutSubviews];\n \n UIEdgeInsets i = self.view.safeAreaInsets;\n imgView1.frame = CGRectMake(i.left + 20.0, i.top + 20.0 , 1000.0, 100.0);\n imgView2.frame = CGRectMake(i.left + 20.0, i.top + 20.0 + 120.0, 1000.0, 100.0);\n \n infoLabel.frame = CGRectMake(i.left + 20.0, i.top + 20.0 + 240.0, 200.0, 80.0);\n}\n\n- (void)touchesBegan:(NSSet&lt;UITouch *&gt; *)touches withEvent:(UIEvent *)event {\n \n UIBezierPath * bezierPath = [ UIBezierPath new ];\n bezierPath.lineCapStyle = kCGLineCapRound;\n bezierPath.lineJoinStyle = kCGLineJoinRound;\n bezierPath.lineWidth = 80.0;\n \n [ bezierPath moveToPoint:CGPointMake(50.0, 50.0) ];\n\n infoLabel.text = [NSString stringWithFormat:@&quot; moveTo plus\\n %ld addLineTo&quot;, (long)nPoints];\n \n for (int i = 0; i &lt; nPoints; i++)\n {\n [ bezierPath addLineToPoint:CGPointMake(50.0 + i, 50.0) ];\n }\n \n UIGraphicsImageRendererFormat * format = [ UIGraphicsImageRendererFormat defaultFormat ];\n format.scale = 1.0;\n format.opaque = NO;\n format.preferredRange = UIGraphicsImageRendererFormatRangeStandard;\n CGSize size = CGSizeMake(1000.0, 100.0);\n UIGraphicsImageRenderer * renderer = [ [ UIGraphicsImageRenderer alloc ] initWithSize:size format:format ];\n \n // create image with alpha stroke\n UIImage * image1 = [ renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext)\n {\n [ [ UIColor clearColor ] setFill ];\n [ [ UIColor colorWithWhite:0.0 alpha:0.5 ] setStroke ];\n [ bezierPath stroke ];\n } ];\n\n // create image with solid stroke\n UIImage * tmpImage = [ renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext)\n {\n [ [ UIColor clearColor ] setFill ];\n [ [ UIColor colorWithWhite:0.0 alpha:1.0 ] setStroke ];\n [ bezierPath stroke ];\n } ];\n \n // create image2 by rendering tmpImage at 50% alpha\n UIImage * image2 = [ renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext)\n {\n [tmpImage drawAtPoint:CGPointZero blendMode:kCGBlendModeNormal alpha:0.5];\n } ];\n \n imgView1.image = image1;\n imgView2.image = image2;\n\n ++nPoints;\n \n}\n\n@end\n</code></pre>\n<p>Looks like this after 7 taps:</p>\n<p><a href="https://i.sstatic.net/pB0RMbdf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/pB0RMbdf.png" alt="enter image description here" /></a></p>\n"^^ . "<p>I am using react native for an app.Just added NotificationService Extension for rich notifications and trying building my project</p>\n<p>Getting these unnecessary log in console when hit to run on simulator.</p>\n<p>1)tried cleaning the derived data.</p>\n<p>2)pod deintegrate and integrate.</p>\n<p>3)closing xcode and reopening again.</p>\n<p>These types of logs getting</p>\n<p>export HEADER_SEARCH_PATHS=/Users/manish.kumar/Library/Developer/Xcode/DerivedData/Medikabazaar-dplnuuermlmktvaimqgotsinmaoj/Build/Products/Debug-iphonesimulator/include\\ \\ /Users/manish.kumar/Library/Developer/Xcode/DerivedData/Medikabazaar-dplnuuermlmktvaimqgotsinmaoj/Build/Products/Debug-iphonesimulator/ReactCommon-Samples/ReactCommon_Samples.framework/Headers\\ /Users/manish.kumar/Library/Developer/Xcode/DerivedData/Medikabazaar-dplnuuermlmktvaimqgotsinmaoj/Build/Products/Debug-iphonesimulator/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\\ /Users/manish.kumar/Library/Developer/Xcode/DerivedData/Medikabazaar-dplnuuermlmktvaimqgotsinmaoj/Build/Products/Debug-iphonesimulator/ReactCommon-Samples/ReactCommon_Samples.framework/Headers/platform/ios\\ /Users/manish.kumar/Library/Developer/Xcode/DerivedData/Medikabazaar-dplnuuermlmktvaimqgotsinmaoj/Build/Products/Debug-iphonesimulator/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\\ /Users/manish.kumar/Library/Developer/Xcode/DerivedData/Medikabazaar-dplnuuermlmktvaimqgotsinmaoj/Build/Products/Debug-iphonesimulator/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\\ &quot;/Users/manish.kumar/Library/Developer/Xcode/DerivedData/Medikabazaar-dplnuuermlmktvaimqgotsinmaoj/Build/Products/Debug-iphonesimulator/AppAuth/AppAuth.framework/Headers&quot;\\ &quot;/Users/manish.kumar/Library/Developer/Xcode/DerivedData/Medikabazaar-dplnuuermlmktvaimqgotsinmaoj/Build/Products/Debug-iphonesimulator/BVLinearGradient/BVLinearGradient.framework/Headers&quot;\\ &quot;/Users/manish.kumar/Library/Developer/Xcode/DerivedData/Medikabazaar-dplnuuermlmktvaimqgotsinmaoj/Build/Products/Debug-iphonesimulator/Base64/Base64.framework/Headers&quot;\\ &quot;/Users/manish.kumar/Library/Developer/Xcode/DerivedData/Medikabazaar-dplnuuermlmktvaimqgotsinmaoj/Build/Products/Debug-iphonesimulator/CleverTap-iOS-SDK/CleverTapSDK.framework/Headers&quot;\\\n..................................................................................\n...................................\n........</p>\n"^^ . . "2"^^ . "@Paulw11: 31st of March"^^ . "1"^^ . "0"^^ . "onedrive"^^ . "0"^^ . . . . . "using NSObject with modern OS X SDK (14.4) and 10.7 MACOSX_DEPLOYMENT_TARGET"^^ . . "0"^^ . . . "vst"^^ . . . . "1"^^ . . "1"^^ . "Maybe you can clarify if the anonymous edit was done by you or someone else. If not please roll back."^^ . . "Unrelated but all single quotes except the ones around the `T` are redundant."^^ . . "0"^^ . . "but here I am using 3.4 version only."^^ . . . "rust"^^ . . . "objective-c"^^ . "Kotlin Multiplatform objective-c export file name convention"^^ . . . "0"^^ . . "1"^^ . . . "2"^^ . "please show a [mre]"^^ . "SQLCipher "file is not a database" Error After Updating iOS App"^^ . . "Getting unnecessary log while adding NotificationService Extension in IOS"^^ . "Broken `static_cast` from `NSURL*` to `CFURLRef`"^^ . . "How? `allowsPictureInPictureMediaPlayback` is [unavailable on native macOS](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/allowspictureinpicturemediaplayback). Is says "iOS 9.0+\niPadOS 9.0+\nMac Catalyst 13.1+\nvisionOS 1.0+"."^^ . . "nsdate"^^ . "Why can I not include metal_float64 library in Xcode"^^ . . "yes it would appear so"^^ . "Does this answer your question? [Swift - which types to use? NSString or String](https://stackoverflow.com/questions/24038629/swift-which-types-to-use-nsstring-or-string)"^^ . . "<p>You can add the following code in your <code>.cargo/config.toml</code> :</p>\n<pre><code>[build]\nrustflags = [&quot;-Clink-arg=-lobjc&quot;, &quot;-Clink-arg=-framework&quot;, &quot;-Clink-arg=AppKit&quot;]\n</code></pre>\n<p>With this you don't have to pass arguments every time and can just do <code>cargo run --release</code></p>\n"^^ . . . . . "0"^^ . . . . "0"^^ . "0"^^ . . "3"^^ . . . "0"^^ . . . "How can I initiate a new URL request using an already loaded WKWebView?"^^ . "-3"^^ . . "0"^^ . "<p>Apple provides <a href="http://www.idownloadblog.com/2017/04/20/fix-application-from-internet-gatekeeper/" rel="nofollow noreferrer">Gatekeeper</a>, if the app wasn't properly signed, the warning would be different - &quot;[ExampleApp] is from an unidentified developer&quot; or &quot;[ExampleApp] is damaged and cannot be opened.&quot;</p>\n<p>Thus, the fact that you're seeing &quot;[ExampleApp] is an application downloaded from the Internet&quot; is typical and indicates that your app is correctly signed.</p>\n<p>This warning is the same one users will encounter when downloading any application from the internet. For instance, if you download Google Chrome, you'll see the identical message.</p>\n<p>If you want to remove this warning still you can check <a href="http://www.idownloadblog.com/2017/04/20/fix-application-from-internet-gatekeeper/" rel="nofollow noreferrer">this post</a></p>\n"^^ . . . "0"^^ . . . "You can do that in a build script too."^^ . . "The difference is that String is a Swift native type and NSString is bridged from Objc-c"^^ . . "Thank you! In this case, should I still use `NSISO8601DateFormatter` has you previously suggested? It strips the time, which is what I would want here."^^ . . . "3"^^ . . . "1"^^ . . "0"^^ . . . . . "<p>I just upgrade my macOS from Monterey to Sonoma. And then I also downloaded and installed the new XCode version 15.4. I'm also git clone my project from my BitBucket repo after upgraded to macOS Sonoma.</p>\n<p>The issue started when I opened my project workspace after clone the repo. I always popup &quot;&quot; is a workspace downloaded from the Internet. Are you sure you want to open it? Opening, building, or running a project containing malicious code can harm your Mac or compromise your privacy. Be sure you trust the source of the project before opening it.&quot;\n<a href="https://i.sstatic.net/v8VNvUeo.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/v8VNvUeo.png" alt="enter image description here" /></a></p>\n<p>Once I click &quot;Trust and Open&quot; btn, it open the workspace file normally. However, after close the XCode and open the project workspace again, it displayed the same popup.</p>\n<p>Does anyone have any idea how to remove this popup.\nThank you ^_^</p>\n"^^ . "viewcontroller"^^ . . . . "1"^^ . . . . . . "getter-setter"^^ . . "<p>You should check and confirm that you are, in fact, finding the Height constraint:</p>\n<pre><code>for (NSLayoutConstraint * constraint in [_profileView constraints]) {\n if (constraint.firstAnchor == NSLayoutAttributeHeight) {\n heightConstraint = constraint;\n break;\n }\n}\nif (heightConstraint) {\n NSLog(@&quot;Found Height Constraint: %@&quot;, heightConstraint);\n} else {\n NSLog(@&quot;Did NOT find Height Constraint!&quot;);\n}\n</code></pre>\n<p>That code (in my quick test) does <strong>NOT</strong> find the Height constraint, so of course, no animation.</p>\n<p>This code:</p>\n<pre><code>for (NSLayoutConstraint *constraint in _profileView.constraints) {\n // Check if the constraint is a height constraint\n if (constraint.firstAttribute == NSLayoutAttributeHeight &amp;&amp; constraint.firstItem == _profileView) {\n // Found the height constraint\n heightConstraint = constraint;\n break;\n }\n}\nif (heightConstraint) {\n NSLog(@&quot;Found Height Constraint: %@&quot;, heightConstraint);\n} else {\n NSLog(@&quot;Did NOT find Height Constraint!&quot;);\n}\n</code></pre>\n<p><strong>Does</strong> find the Height constraint, and the animation happens as expected.</p>\n<hr />\n<p>As a side note, you might want to look at the more modern way of setting up constraints. This matches your constraints, but I think you'd agree it is much more readable (and much easier to edit when needed):</p>\n<pre><code>[NSLayoutConstraint activateConstraints:@[\n [_profileView.heightAnchor constraintEqualToConstant:160.0],\n [_profileView.widthAnchor constraintEqualToAnchor:self.view.widthAnchor],\n [_profileView.leftAnchor constraintEqualToAnchor:self.view.leftAnchor],\n [_profileView.topAnchor constraintEqualToAnchor:self.view.topAnchor constant:-64.0],\n]];\n</code></pre>\n<hr />\n<p><strong>Edit</strong></p>\n<p>As mentioned in comments by Matt, you are (almost always) better off adding a constraint property that you can update when desired.</p>\n<p>Here's an example of that approach:</p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\n@interface AnimSubViewController : UIViewController\n@end\n\n@interface AnimSubViewController ()\n@property (strong, nonatomic) UIView *profileView;\n@property (strong, nonatomic) NSLayoutConstraint *heightConstraint;\n@end\n\n@implementation AnimSubViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n self.view.backgroundColor = UIColor.systemBackgroundColor;\n \n [self addProfileView];\n}\n\n-(void)addProfileView\n{\n if(!_profileView)\n {\n //_profileView = [ProfileView new];\n _profileView = [UIView new];\n _profileView.backgroundColor = UIColor.redColor;\n _profileView.clipsToBounds = YES;\n //_profileView.delegate=self;\n _profileView.alpha = 1.0;\n _profileView.opaque = YES;\n _profileView.translatesAutoresizingMaskIntoConstraints = false;\n [self.view addSubview:_profileView];\n\n // set the _heightConstraint property, so we can modify its .constant later\n _heightConstraint = [_profileView.heightAnchor constraintEqualToConstant:160.0];\n \n [NSLayoutConstraint activateConstraints:@[\n //[_profileView.heightAnchor constraintEqualToConstant:160.0],\n _heightConstraint,\n [_profileView.widthAnchor constraintEqualToAnchor:self.view.widthAnchor],\n [_profileView.leftAnchor constraintEqualToAnchor:self.view.leftAnchor],\n [_profileView.topAnchor constraintEqualToAnchor:self.view.topAnchor constant:-64.0],\n ]];\n\n }\n}\n\n-(void)animateProfileViewBasedOnOffset:(BOOL)isTop\n{\n\n [UIView animateWithDuration:0.3 animations:^{\n if (isTop) {\n self-&gt;_heightConstraint.constant = 64;\n }\n else {\n self-&gt;_heightConstraint.constant = 160;\n }\n // not needed\n //[self-&gt;_profileView layoutIfNeeded];\n \n [self.view layoutIfNeeded];\n \n } completion:^(BOOL completion) {\n NULL;\n }];\n \n}\n\n- (void)touchesBegan:(NSSet&lt;UITouch *&gt; *)touches withEvent:(UIEvent *)event {\n // hide/show _profileView on tap anywhere\n [self animateProfileViewBasedOnOffset:_heightConstraint.constant == 160.0];\n}\n\n@end\n</code></pre>\n"^^ . . "<p>Here is a viewcontroller(vca) and another vcb, I need to add vcb.view to vca as a subview.</p>\n<p>but I did not use addChildViewController, instead, I directly calls [vca.view addSubview:vcb.view], and vcb's viewWillAppear, viewDidAppear just get called automatically.</p>\n<p>really want to know why.</p>\n<p>Is addChildViewController necessarily while adding another vc's view as subview?</p>\n<p>`ViewControllerA.m</p>\n<ul>\n<li>(void)showVCBView {\nViewControllerB *vcb = [[ViewControllerB alloc] init];\n[self.view addSubview:vcb.view];\n}`</li>\n</ul>\n"^^ . "Does this answer your question? [Force Header Files to Compile as C++ in Xcode](https://stackoverflow.com/questions/32827389/force-header-files-to-compile-as-c-in-xcode)"^^ . . . . . . . "react-native"^^ . . . "0"^^ . "How can I use a private-framework's function in Xcode?"^^ . . "1"^^ . "0"^^ . "2"^^ . . . "@Vincenzo How is really retrieved `apiArray`? In Objective-C, it's not because it's `NSArray<NSNumber*>*` that all element of the array will be `NSNumber`, it's more of a suggestion/reminder, there is in fact NO check."^^ . . . . . . . . . . . . . . . . "0"^^ . . . "I am able to open db file by using DB Browser. It has old data as well."^^ . . . . . . . . . . "0"^^ . . . . . . . . . . "0"^^ . "<p>My requirements are to generate a signature for a promotional offer in the iOS app code (Objective-C), but I'm getting nil every time with the error: 'The operation couldn’t be completed. (OSStatus error -50 - EC private key creation from data failed).' Please refer to my code below and suggest how I can get the signature. The <em>privateKeyPath</em> is a <em><strong>.p8</strong></em> file saved in the Xcode project's main folder:</p>\n<pre><code> + (NSString *)generateSignatureWithKeyId:(NSString *)keyId\n bundleId:(NSString *)bundleId\n productId:(NSString *)productId\n offerId:(NSString *)offerId\n nonce:(NSUUID *)nonce\n timestamp:(NSTimeInterval)timestamp\n privateKeyPath:(NSString *)privateKeyPath {\n \n // Load the private key\n NSString *privateKeyString = [NSString stringWithContentsOfFile:privateKeyPath encoding:NSUTF8StringEncoding error:nil];\n \n if (!privateKeyString) {\n NSLog(@&quot;Failed to load private key&quot;);\n return nil;\n }\n \n // Remove the header and footer\n privateKeyString = [privateKeyString stringByReplacingOccurrencesOfString:@&quot;-----BEGIN PRIVATE KEY-----&quot; withString:@&quot;&quot;];\n privateKeyString = [privateKeyString stringByReplacingOccurrencesOfString:@&quot;\\n&quot; withString:@&quot;&quot;];\n privateKeyString = [privateKeyString stringByReplacingOccurrencesOfString:@&quot;\\r&quot; withString:@&quot;&quot;];\n privateKeyString = [privateKeyString stringByReplacingOccurrencesOfString:@&quot;-----END PRIVATE KEY-----&quot; withString:@&quot;&quot;];\n \n // Convert to NSData\n NSData *privateKeyData = [[NSData alloc] initWithBase64EncodedString:privateKeyString options:NSDataBase64DecodingIgnoreUnknownCharacters];\n \n NSLog(@&quot;NSDATA private key: %@&quot;, [privateKeyData base64EncodedStringWithOptions:0]);\n \n if (!privateKeyData) {\n \n NSLog(@&quot;Failed to decode private key&quot;);\n \n return nil;\n \n }\n \n // Create the payload string\n NSString *payloadString = [NSString stringWithFormat:@&quot;%@\\u2063%@\\u2063%@\\u2063%@\\u2063%@\\u2063%@\\u2063%.0f&quot;,\n bundleId,\n keyId,\n productId,\n offerId,\n @&quot;&quot;, // appAccountToken is optional, leave empty if not used\n [nonce UUIDString],\n timestamp];\n \n NSData *payloadData = [payloadString dataUsingEncoding:NSUTF8StringEncoding];\n \n // Sign the payload\n NSData *signature = [self signData:payloadData withPrivateKey:privateKeyData];\n \n if (!signature) {\n NSLog(@&quot;Failed to sign data&quot;);\n return nil;\n }\n \n // Base64 encode the signature\n NSString *signatureBase64 = [self base64UrlEncode:signature];\n \n return signatureBase64;\n}\n\n+ (NSData *)signData:(NSData *)data withPrivateKey:(NSData *)privateKey {\n \n SecKeyRef keyRef = [self createSecKeyRefFromPrivateKeyData:privateKey];\n \n if (!keyRef) {\n NSLog(@&quot;Failed to create private key reference.&quot;);\n return nil;\n }\n\n size_t sigLen = SecKeyGetBlockSize(keyRef);\n uint8_t *sig = malloc(sigLen);\n if (sig == NULL) {\n NSLog(@&quot;Failed to allocate memory for signature.&quot;);\n return nil;\n }\n\n OSStatus status = SecKeyRawSign(keyRef, kSecPaddingPKCS1, data.bytes, data.length, sig, &amp;sigLen);\n if (status != errSecSuccess) {\n NSLog(@&quot;Failed to sign data: %d&quot;, (int)status);\n free(sig);\n return nil;\n }\n\n return [NSData dataWithBytes:sig length:sigLen];\n}\n\n+ (SecKeyRef)createSecKeyRefFromPrivateKeyData:(NSData *)privateKeyData {\n \n NSString *base64EncodedString = [privateKeyData base64EncodedStringWithOptions:0];\n \n SecKeyRef privateKeyRef = NULL;\n \n NSDictionary *privateKeyAttr = @{\n \n (id)kSecAttrKeyType: (id)kSecAttrKeyTypeECSECPrimeRandom,\n (id)kSecAttrKeyClass: (id)kSecAttrKeyClassPrivate,\n (id)kSecAttrKeySizeInBits: @256,\n (id)kSecAttrIsPermanent: @NO\n \n };\n\n CFErrorRef error = NULL;\n privateKeyRef = SecKeyCreateWithData((__bridge CFDataRef)privateKeyData,\n (__bridge CFDictionaryRef)privateKeyAttr,\n &amp;error);\n\n if (error != NULL) {\n \n NSString *errorDescription = CFBridgingRelease(CFErrorCopyDescription(error));\n NSLog(@&quot;Error creating private key reference: %@&quot;, errorDescription);\n\n CFRelease(error);\n privateKeyRef = NULL;\n \n }\n\n return privateKeyRef;\n}\n\n \n</code></pre>\n"^^ . "1"^^ . . "1"^^ . . "<p>I dont have the full knowledge to explain as to why the below solution was correct , if anyone could explain it better you are more then welcome.\nSeems like running it using the following command helps it succesfully find the AppKit classes using the objc2 crate.</p>\n<pre><code>RUSTFLAGS=&quot;-C link-arg=-lobjc -C link-arg=-framework -C link-arg=AppKit&quot; cargo run --release\n</code></pre>\n"^^ . "0"^^ . "uigraphicsimagerenderer"^^ . . "0"^^ . . . . . "1"^^ . "0"^^ . . "<p>In Objective-C, it's not because it's declared as such <code>NSArray&lt;NSNumber*&gt;* apiArray</code> that <code>apiArray</code> will contains only <code>NSNumber</code>:</p>\n<pre><code>NSArray&lt;NSNumber*&gt;* apiArray;\nNSArray *t = @[@[], @&quot;&quot;, @2];\napiArray = t;`\n</code></pre>\n<p>This will compile just fine, and the elements of <code>apiArray</code> are an array, a string and a number.\nIt's a common cause of <code>unrecognized selector sent to instance</code> crash error.</p>\n<p><code>NSArray&lt;NSNumber*&gt;* apiArray</code> is just a small helper:\nIt tells you that <code>apiArray</code> SHOULD only have <code>NSNumber</code> elements (even if it's not the case), so when you populate it, populate it accordingly, and when retrieving elements from it, it would expect them to be <code>NSNumber</code>.\nSo <code>NSArray *first = [apiArray firstObject];</code> will produce a warning <code>Incompatible pointer types initializing 'NSArray *' with an expression of type 'NSNumber * _Nullable'</code>, but that's it, just a warning. And in my case, the first element is really a <code>NSArray</code>, not a <code>NSNumber</code>.</p>\n<p>After a few feedbacks on your end, it seems that the back-end send <code>NSString</code> instead of <code>NSNumber</code>.\nIt's up to you to change it in your JSON parsing or not, or change your local model for <code>localObject</code> be a <code>NSString</code>.</p>\n<p>If you want to keep both API/local as such, since you have <code>NSString</code> and <code>NSNumber</code> to compare, a possible way is to use <code>integerValue</code>.</p>\n<p>It's a little more verbose, but this should do the trick:</p>\n<pre><code>NSInteger index = [self indexOfObjectPassingTest:^BOOL(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n return [obj integerValue] == [localObject integerValue];\n}];\nBOOL contains = index != NSNotFound;\n</code></pre>\n<p>If you want to create a <code>contains(where:)</code> (in a more &quot;Swift&quot; code) you can create a category on NSArray:</p>\n<p>NSArray+Custom.h</p>\n<pre><code>@interface NSArray&lt;ObjectType&gt; (Addon)\n-(BOOL)containsWhere:(BOOL (^)(id obj))predicate;\n@end\n</code></pre>\n<p>NSArray+Custom.m</p>\n<pre><code>@implementation NSArray (Addon)\n\n-(BOOL)containsWhere:(BOOL (^)(id obj))predicate\n{\n NSInteger index = [self indexOfObjectPassingTest:^BOOL(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n return predicate(obj);\n }];\n return index != NSNotFound;\n}\n@end\n</code></pre>\n<p>Then, in use:</p>\n<pre><code>NSNumber *localObject = @2;\nBOOL contains = [array containsWhere:^BOOL(id _Nonnull obj) {\n if ([obj respondsToSelector:@selector(integerValue)]) {\n return [obj integerValue] == [localObject integerValue];\n } else {\n NSLog(@&quot;Element %@ from array to analyze doesn't respond to integerValue -&gt; Skipped&quot;, obj);\n return FALSE;\n }\n}];\nNSLog(@&quot;%@ contains localObject: %d&quot;, array, localObject, contains);\n</code></pre>\n"^^ . "objective-c++"^^ . "@Cy-4AH Yes, I did set it to true."^^ . . . . "wkwebview"^^ . . . . . "CMake sets “Generate Debug Symbols” - a Xcode build setting to wrong value"^^ . . . . "0"^^ . . "1"^^ . "0"^^ . . . . . "0"^^ . . "Reference variable in Store.swift class from Objective-C file using singleton pattern giving Linker command failed error"^^ . . "in-app-purchase"^^ . . . . "nsdateformatter"^^ . "singleton"^^ . "0"^^ . . . . . "<p>By default GitHub uses Jekyll to build github.io pages and this renders Markdown differently than on the github.com page.</p>\n<p>To overcome another such difference (Jekyll does not allow HTML markup like <code>&lt;li&gt;</code> inside Markdown table cells), I switched the page builder workflow from Jekyll to pandoc on the GitHub repo (see <a href="https://github.com/oasis-tcs/odata-vocabularies/blob/main/.github/workflows/gh-pages.yml" rel="nofollow noreferrer">https://github.com/oasis-tcs/odata-vocabularies/blob/main/.github/workflows/gh-pages.yml</a>). Perhaps you can do something similar.</p>\n<p>Both github.com and pandoc 3.1.13 highlight your code properly, but only when I enclose it in <code>```objectivec</code> instead of <code>```objc</code>.</p>\n"^^ . . "macos-system-extension"^^ . . . . . "0"^^ . . "macos"^^ . . . . . . "0"^^ . . . . . "<p>I'm developing a Flutter application and encountering an issue with nullability specifiers in Xcode. Specifically, I have methods in my Objective-C files where Xcode is reporting conflicts with existing specifiers like 'nullable' and 'nonnull'.</p>\n<p>Here's an example of the code causing the issue:</p>\n<pre><code>- (instancetype)init {\n return [self initWithPresentingViewController:nil];\n}\n\n- (instancetype)initWithPresentingViewController:(UIViewController *)presentingViewController {\n NSAssert(presentingViewController != nil, @&quot;presentingViewController cannot be nil on iOS 13&quot;);\n\n self = [super init];\n if (self) {\n _presentingViewController = presentingViewController;\n }\n return self;\n}\n\n- (instancetype)initWithPresentingViewController:(UIViewController *)presentingViewController\n prefersEphemeralSession:(BOOL)prefersEphemeralSession {\n NSAssert(presentingViewController != nil, @&quot;presentingViewController cannot be nil on iOS 13&quot;);\n\n self = [super init];\n if (self) {\n _presentingViewController = presentingViewController;\n _prefersEphemeralSession = prefersEphemeralSession;\n }\n return self;\n}\n</code></pre>\n<p>Xcode highlights these lines and shows errors like:</p>\n<p>Nullability specifier 'nonnull' conflicts with existing specifier 'nullable'.<br />\nand Flutter Terminal:</p>\n<p>Nullability Issue (Xcode): Nullability specifier 'null_unspecified' conflicts</p>\n<p>with existing specifier 'nullable'<br />\nCould not build the application for the simulator.</p>\n<p>Error launching application on iPhone 14.</p>\n<p>I've tried correcting the nullability specifiers, but the error persists. How can I resolve this issue?</p>\n<p><strong>Additional Information:</strong></p>\n<ul>\n<li><p>Developing a Flutter application.</p>\n</li>\n<li><p>Running into nullability specifier conflicts specifically in Objective-C files.</p>\n</li>\n</ul>\n"^^ . "0"^^ . . "0"^^ . "<p>I am trying to learn by doing a project of allowing AppKit certain functions , related with App and Window creation to be called from Rust using objc.</p>\n<pre><code>extern crate objc;\nuse objc::runtime::{Class,Object};\nuse objc::{msg_send, sel, sel_impl};\n\npub fn create_app(){\n unsafe {\n let app_class =Class::get(&quot;NSApplication&quot;).unwrap();\n let app:&amp;Object = msg_send![app_class,sharedApplication];\n let _:&amp;Object = msg_send![app_class,run];\n }\n}\n\n</code></pre>\n<p>However if i try to run this an main.rs I get the following:</p>\n<pre><code>thread 'main' panicked at src/lib.rs:7:52:\ncalled `Option::unwrap()` on a `None` value\n</code></pre>\n<p>I guess the objective-c is unable to find the NSApplication Class of AppKit but why and how can i resolve such an issue?</p>\n<p>I am running all of this from a M3 MacOs just to give insight on my machine.</p>\n"^^ . "<p>I have a macOS app which has a WKWebView which can load sites and if they have a video player, it can show the native PiP video window which the app invokes via a Javascript action to the WKWebView. This app is sandboxed for submitted to the Mac app store. The launch of native PiP window works well in the debug version while running from Xcode but not the release version. I want to upload to the Mac App Store, so it has to be sandboxed.</p>\n<p>Does the sandboxed app not able to launch the PiP Agent? Or what is missing and why does it works well when running from Xcode in Debug version but not in Release mode as a direct app?</p>\n<p>Any help is appreciated.</p>\n"^^ . . . . . . . . . . "<p>I am trying to understand how to use private frameworks in Xcode. Specifically I want to call the <code>MTDeviceCreateList()</code> from the MultitouchSupport-Framework to create a minimal working example. I created this <a href="https://github.com/dawCreator/Private-Framework-Test" rel="nofollow noreferrer">Github-Repo</a> to share what I have tried.\nThe <strong>workingButUglyMain.m</strong> uses dynamic linking and successfully calls the function, but I saw many people write custom headers to make a private-framework's functions accessible without that complicated linking. I fail to understand and replicate it though. I tried creating such a header with <strong>MultitouchSupport.h</strong> and linking the framework by adding it to the frameworks and setting the <strong>Other Linker Flags</strong> in <em>build-settings</em>. I also tried dynamic loading using NSBundle's <code>bundleWithPath()</code>. I always get <strong>Undefined symbol: _MTDeviceCreateList</strong> error. The framework should be stored in <strong>/System/Library/PrivateFrameworks/MultitouchSupport</strong>.</p>\n<p>Here are some of the sources I used:</p>\n<ol>\n<li><a href="https://www.jviotti.com/2023/11/20/exploring-macos-private-frameworks.html#approach-3-hopper-disassembler" rel="nofollow noreferrer">https://www.jviotti.com/2023/11/20/exploring-macos-private-frameworks.html#approach-3-hopper-disassembler</a></li>\n<li><a href="https://github.com/NilStack/HelloPF/tree/master" rel="nofollow noreferrer">https://github.com/NilStack/HelloPF/tree/master</a></li>\n<li><a href="https://medium.com/swiftworld/swift-world-how-to-use-private-framework-in-swift-b369209e25be" rel="nofollow noreferrer">https://medium.com/swiftworld/swift-world-how-to-use-private-framework-in-swift-b369209e25be</a></li>\n</ol>\n"^^ . . "<p>There was no 2:40 in the morning on the 31st of March in Paris - Daylight savings/summer time started at 02:00 on the 31st of March, meaning the clocks jumped forward to 03:00 at that time.</p>\n<p><code>nil</code> is the correct result</p>\n"^^ . . . . . "0"^^ . . . . . . . . . . "0"^^ . . . "0"^^ . "I would urge the OP not to listen to this, but rather to do what I suggested in my comment, "Instead of hunting for the height constraint at animation time, just keep a reference to it at the time you create it." Constraint-hunting is a bad technique, even if you can get it to work. It's an anti-pattern. We know in advance that we're going to want to modify the constraint on this one constraint; therefore the correct pattern is to maintain a reference to it."^^ . . . . . . . . "0"^^ . "I was trying to update the height constraint of my view during an animation. Its not getting updated why..?"^^ . . . . . . . . "Difference between String in Swift and NSString in Foundation(Objective C)"^^ . . . . . "<p>I solved it. My first mistake was to not properly add the framework-dependency. You need to add the whole folder so in my case: /System/Library/PrivateFrameworks/MultitouchSupport.framework. The second problem was that it does not work if the project is in SANDBOX-mode. Might be use-case-specific though.</p>\n"^^ . . . . . "<p>For general advice on which to use and why, see <a href="https://stackoverflow.com/questions/24038629/swift-which-types-to-use-nsstring-or-string">Swift - which types to use? NSString or String</a>. However, I believe you are aware of that, and this is a different question. What actually are the differences?</p>\n<p>The biggest difference that has the most impact is that <code>NSString</code> is uses UTF-16 as its preferred internal encoding and <code>String</code> prefers UTF-8. Both can encode things other ways, but that's their defaults, and this has a big impact on them. Since almost all modern work is done in UTF-8, <code>String</code> is more natural for this.</p>\n<p>While it's obvious that <code>NSString</code> is a class and String is a struct, it is less obvious that <code>String</code> has a <a href="https://github.com/swiftlang/swift/blob/main/stdlib/public/core/SmallString.swift#L30" rel="nofollow noreferrer"><code>SmallString</code></a> storage which can store <a href="https://github.com/swiftlang/swift/blob/fb0a1b96ae38fd9251ef16c6e4b59582685f13bc/stdlib/public/core/SmallString.swift#L81-L87" rel="nofollow noreferrer">very short strings</a> directly in two Ints avoiding heap memory allocations and reference counting entirely. This is the kind of optimization that is difficult to achieve with the design of <code>NSString</code>.</p>\n<p><code>NSString</code> is fundamentally composed of UTF-16 code points. <code>String</code> is fundamentally composed of &quot;extended grapheme clusters&quot; (<code>Character</code>). This has major implications in how it works with Unicode. <code>String</code> is a much more &quot;Unicode-aware&quot; type than <code>NSString</code>. Alternately you can say it is a very &quot;Unicode-pedantic&quot; type. Between the use of UTF-8, which is variable width, and <code>Character</code> rather than code point as the element, finding the &quot;nth&quot; element of a <code>String</code> is a O(n) process. It's O(1) in <code>NSString</code>, but you then must do extra work to be sure you're not in the middle of a combined character.</p>\n<p>Ultimately while there is very handy bridging between the two types, they are very different, and <code>String</code> is much more powerful, especially when dealing with complex Unicode such as emoji.</p>\n"^^ . "How to check what data is received by APNS sent from backend?"^^ . . . . . "<p>I am writing documentation using Github Markdown for Objective-C, and everytime I write <code>@weakify(self)</code> or <code>strongify(self)</code> and publish my documentation, these two writings appear in highlighted red and the text is white.</p>\n<p>In Github preview everything seems fine, yet when I publish it and go to the documentation website, I see that red highlight.\n<a href="https://i.sstatic.net/V03LVoPt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/V03LVoPt.png" alt="enter image description here" /></a>\nThis is how I am writing my documentation (I found on the internet that <code>objc</code> is how I should mark that the code is in Objective-C, I tried using <code>objective-c</code>, but then the code is just plain grey):</p>\n<pre><code>```objc\n@weakify(self);\n[self.bannerAdUnit fetchDemandWithAdObject:gamRequest completion:^(enum ResultCode resultCode) { \n @strongify(self);\n}];\n</code></pre>\n"^^ . . "In the Drupal code the Payload like this:\n{\n"aps": {\n "alert": {\n "title": "Title of APN",\n "body": "Body of APN"\n },\n "badge": 32\n},\n"context": {\n "site_name": "***",\n "path": "***",\n "uid": "***",\n "site_id": "example.com",\n "type": "***",\n "entity_id": "***"\n }\n}\n\nI left the comma to type here."^^ . "0"^^ . . . . . . . . . . . "0"^^ . "flutter"^^ . "0"^^ . . . . . "The other API model value ( the one I want to find out if is present in the array) does compile as an SNNumber dough"^^ . "sqlcipher"^^ . . . . . "1"^^ . "1"^^ . . . "0"^^ . . . . . "<p>Recently I implemented ShareExtension in my <strong>ios app built using react-native</strong>.<br />\ncoming straight to the point.</p>\n<p>added below code to info.plist of ShareExtension app to support sharing of any kind of file/attachments available</p>\n<pre><code>&lt;dict&gt;\n &lt;key&gt;NSExtensionActivationRule&lt;/key&gt;\n &lt;dict&gt;\n &lt;key&gt;NSExtensionActivationSupportsText&lt;/key&gt;\n &lt;true/&gt;\n &lt;key&gt;NSExtensionActivationSupportsWebURLWithMaxCount&lt;/key&gt;\n &lt;integer&gt;1&lt;/integer&gt;\n &lt;key&gt;NSExtensionActivationSupportsImageWithMaxCount&lt;/key&gt;\n &lt;integer&gt;10&lt;/integer&gt;\n &lt;key&gt;NSExtensionActivationSupportsMovieWithMaxCount&lt;/key&gt;\n &lt;integer&gt;10&lt;/integer&gt;\n &lt;key&gt;NSExtensionActivationSupportsFileWithMaxCount&lt;/key&gt;\n &lt;integer&gt;10&lt;/integer&gt;\n &lt;key&gt;NSExtensionActivationSupportsAttachmentsWithMaxCount&lt;/key&gt;\n &lt;integer&gt;10&lt;/integer&gt;\n &lt;/dict&gt;\n&lt;/dict&gt;\n</code></pre>\n<p>and now I</p>\n<ul>\n<li><p>opened Photos</p>\n</li>\n<li><p>selected an image to share</p>\n</li>\n<li><p>from list of apps shown to share, I chose my app</p>\n<p>from the below code I got the url details but <strong>could not repeat the same while sharing PDFs</strong></p>\n</li>\n</ul>\n<pre><code>NSExtensionItem *inputItem = self.extensionContext.inputItems.firstObject;\n NSItemProvider *itemProvider = inputItem.attachments.firstObject;\n\n if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeImage]) {\n [itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeImage options:nil completionHandler:^(NSURL *url, NSError *error) {\n if (url) {\n NSLog(@&quot;Shared file URL: %@&quot;, url);\n [self uploadFileWithURL:url];\n } else {\n NSLog(@&quot;Error loading shared file: %@&quot;, error);\n }\n }];\n }\n</code></pre>\n<p><strong>My trials -</strong> for sharing PDFs in the same manner,</p>\n<pre><code>if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeFileURL]) {\n [itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeFileURL options:nil completionHandler:^(NSURL *url, NSError *error) {\n if (error) {\n NSLog(@&quot;Error loading PDF: %@&quot;, error.localizedDescription);\n } else if (url) {\n NSLog(@&quot;Shared PDF URL: %@&quot;, url);\n }\n }];\n }\n</code></pre>\n<p>just changed <strong>kUTTypeImage --&gt; kUTTypeFileURL</strong></p>\n<p>but everytime its throwing error saying</p>\n<pre><code>Failed to resolve item of class `NSURL` for type `public.file-url` with error: Error Domain=NSPOSIXErrorDomain Code=3 &quot;No such process&quot; UserInfo={NSLocalizedDescription=Cannot issue a sandbox extension for file &quot;/Users/demouser/Library/Developer/CoreSimulator/Devices/{ID}/data/Containers/Data/Application/{SOME_ID}/Documents/PDF_NAME.pdf&quot;: No such process}\n</code></pre>\n<p>and also logging<br />\n<code>Error loading PDF: Could not coerce an item to class NSURL</code></p>\n<p>what I want ------&gt; I just want to share the pdf file just like the image(which is working fine)</p>\n<p><strong>IF anybody have any prior experience, do kindly share, it will be very helpful.</strong></p>\n"^^ . . . "0"^^ . . . "cocoa"^^ . "-1"^^ . "0"^^ . "Also note that `objc` appears abandoned, last commit 4 years ago. Maybe the author just considers it complete, but consider switching to a different crate, probably [`objc2`](https://lib.rs/crates/objc2)."^^ . . "0"^^ . . . . . "`nullptr` is from C++. you need import it's headers inside `#ifdef _cplusplus #endif` block"^^ . "During an animation you should use the `presentationLayer`. See https://stackoverflow.com/questions/21953459/get-current-frame-of-uiview-while-animated but I don't suggest to keep a reference to the constraint instead..."^^ . "0"^^ . . "1"^^ . "Seems like i found the issue. It seems to work if i run it this way : \n```RUSTFLAGS="-C link-arg=-lobjc -C link-arg=-framework -C link-arg=AppKit" cargo run --release```"^^ . . . . . . . "1"^^ . "<p>I have opened a WKWebView with &quot;https://www.google.com&quot;, for example. After that, I put my app in the background. When I try to open a new URL request in the same web view with a new link, like &quot;https://www.youtube.com&quot;, by redirecting the app, it doesn't work. I've put a listener function to detect the new URL and called &quot;webView.load(newURLRequest)&quot;. However, the web view never loads the new URL request.</p>\n<p>I have tried to solve this issue by adding a delay through DispatchQueue. Adding a delay sometimes works and sometimes doesn't. I also tried using NavigationDelegate, but it still didn't help. Below is my code:</p>\n<pre><code>override func viewDidLoad() {\n super.viewDidLoad()\n NotificationCenter.default.addObserver(self, selector: #selector(self.refreshData), name: NSNotification.Name(&quot;refreshweb&quot;), object: nil)\n}\n\n@objc func refreshData() {\n let url = URL (string: &quot;https://www.youtube.com&quot;)\n let requestObj = URLRequest(url: url!)\n webview.load(requestObj)\n}\n</code></pre>\n"^^ . . . . "audio"^^ . "1"^^ . . . . . . . . . "1"^^ . . "ios"^^ . . "<p>Answering my own question...</p>\n<p>I have not found why it failed overriding getter and setter. What finally solved it for me was to create dedicated getters and setters and leave the Core Data generated property with its getter and setter alone. I don't use it anymore at all, nowhere.</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (void) setFormDataWithBlobs:(NSString*) data\n{\n // Store BLOBs as files\n // Replace BLOB base64 strings with file URLs using [APP_DOC_DIR] placeholder\n\n // Then save the whole thing in Core Data:\n [self willChangeValueForKey:FORM_DATA_KEY];\n [self setPrimitiveValue:data forKey:FORM_DATA_KEY];\n [self didChangeValueForKey:FORM_DATA_KEY];\n}\n\n- (NSString*) getPatchedFormData\n{\n // Get form data with placeholders from Core Data\n NSString *s = [self primitiveValueForKey:FORM_DATA_KEY];\n NSMutableString *data = [s mutableCopy];\n\n // Replace [APP_DOC_DIR] with actual application docs dir\n // ...\n\n return data;\n}\n</code></pre>\n"^^ . . "Undeclared identifier 'nullptr' and Obj-C error while using Obj-C library in Swift"^^ . "kotlin"^^ . . "1"^^ . "@matt - I agree, "hunting for constraints" is a bad technique... although I wanted to explain the OP's error. Added an **Edit** to my answer with the "maintain a reference" approach."^^ . . . . "You mean you are trying to open a new URL *while your app is in the background*?"^^ . . "Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/258066/discussion-between-bathi-and-r4n)."^^ . . . "@Larme ok.. I did sort it out thanks to your suggestion.\nI started with a `BOOL containsObject` set to false.\nThen I loop on the array values and only when `containsObject` is false (not to override an eventual match ) I compare their `.integerValue` against the localObject `.integerValue` and assign the resulting BOOL value to `containsObject` itself.\nIt works and suits my purpose but still I can't get why the types of the array's values returned from the server are NSString when both the model and the json we receive to compile it aren't."^^ . . . "2"^^ . "3"^^ . . . . "1"^^ . . . "1"^^ . . . . . . . . "<p>I need to draw a curve with a translucent color. But if the curve contains many points, then you can get a strange effect. How to get rid of it?</p>\n<p><a href="https://i.sstatic.net/bZafWoOU.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bZafWoOU.png" alt="" /></a></p>\n<pre><code>UIBezierPath * bezierPath = [ UIBezierPath bezierPath ];\nbezierPath.lineCapStyle = kCGLineCapRound;\nbezierPath.lineJoinStyle = kCGLineJoinRound;\nbezierPath.lineWidth = 80.0;\n[ bezierPath moveToPoint:CGPointMake(50.0, 50.0) ];\nfor (int i = 0; i &lt; 900; i++)\n{\n [ bezierPath addLineToPoint:CGPointMake(50.0 + i, 50.0) ];\n}\n\nUIGraphicsImageRendererFormat * format = [ UIGraphicsImageRendererFormat defaultFormat ];\nformat.scale = 1.0;\nformat.opaque = NO;\nformat.preferredRange = UIGraphicsImageRendererFormatRangeStandard;\nCGSize size = CGSizeMake(1000.0, 100.0);\nUIGraphicsImageRenderer * renderer = [ [ UIGraphicsImageRenderer alloc ] initWithSize:size format:format ];\nUIImage * image = [ renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext)\n{\n [ [ UIColor clearColor ] setFill ];\n [ [ UIColor colorWithWhite:0.0 alpha:0.5 ] setStroke ];\n [ bezierPath stroke ];\n} ];\n</code></pre>\n<p><a href="https://i.sstatic.net/kZhZ3fvb.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/kZhZ3fvb.png" alt="" /></a></p>\n"^^ . . . "<p>I'm working with a UISplitViewController that's using some storyboards but now moving to programmatic presentation (which is what I'm familiar with). I have a VC that's currently presenting as a push, but I'm trying to move out to presenting as a detail view on a split view controller.</p>\n<p>The problem is that it's presented correctly in the detail side, but the back button unravels to the most previous detail view controller. This messes up the navigation, especially when in the collapsed view.</p>\n<p>How can I present the detail view controller as the only VC on the detail stack? The rest of the app detail view controllers behave as though they are replacing the detail view controller stack.</p>\n<p>I'm currently trying:</p>\n<pre><code>UIViewController *vc = [UIViewController new];\n[self.splitViewController showDetailViewController:vc sender:self];\n</code></pre>\n"^^ . . "core-image"^^ . . . . . "1"^^ . "0"^^ . . "0"^^ . . . "I want to share on my app. Like share WhatsApp message in my app."^^ . . . . . . . . "Follow this [SO](https://stackoverflow.com/questions/45997841/how-to-get-a-secidentityref-from-a-seccertificateref-and-a-seckeyref) for for SecIdentity"^^ . "0"^^ . . . "avfoundation"^^ . "0"^^ . "0"^^ . . "(More philosophically, C and by extension ObjC don’t work like more modern languages. In eg Python, if your code runs without errors then ipso facto it’s valid Python. C is more like a bunch of rusty ancient power tools in a box, and ObjC is a set of rules around how to use them. You can break the rules if you want, but there’s no one to complain to if you accidentally cut off your foot.)"^^ . . . . . . . . . . . . . . "0"^^ . . . . "Documentation: [NSUndoManager](https://developer.apple.com/documentation/foundation/nsundomanager) and [Undo Architecture](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/UndoArchitecture/UndoArchitecture.html#//apple_ref/doc/uid/10000010-SW1)."^^ . "facebook"^^ . . . "0"^^ . . . "nstextfield"^^ . "ios8-share-extension"^^ . . "0"^^ . . . . . "<p>An app can only contain a single share extension. While you could use &quot;File-&gt;New-&gt;Target&quot; multiple times to add multiple share extensions to your app, only one of these share extensions will be visible in the system &quot;Share&quot; dialog. Which one would appear is undefined.</p>\n"^^ . . . . "1"^^ . "nsobject"^^ . . . "Thank you a lot! It does indeed work. And is compatible with the velocity that android passes to `GestureDetector.OnGestureListener.onFling`!"^^ . "<p>Here's a small example to get you started.</p>\n<ol>\n<li>Start with the Xcode macOS App template.</li>\n<li>Add the code below to AppDelegate.m.</li>\n<li>Add some controls (<code>NSTextField</code> or another subclass of <code>NSControl</code>) to the window.</li>\n<li>Connect the action of the controls to <code>controlAction:</code>.</li>\n</ol>\n<pre><code>@interface AppDelegate ()\n\n@property (strong) IBOutlet NSWindow *window;\n\n// values before editing, the key is the identifier of the control\n@property (strong) NSMutableDictionary *data;\n\n@end\n\n\n@implementation AppDelegate\n\n- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {\n self.data = [[NSMutableDictionary alloc] init];\n}\n\n- (void)undoControl:(NSControl *)control oldValue:(id)oldValue newValue:(id)newValue {\n // undo\n NSString *controlID = control.identifier;\n [control setObjectValue:oldValue];\n self.data[controlID] = oldValue;\n if (control.acceptsFirstResponder)\n [self.window makeFirstResponder: control];\n // register redo\n NSLog(@&quot;register redo %@ old:'%@' new:'%@'&quot;, controlID, oldValue, newValue);\n [[self.window.undoManager prepareWithInvocationTarget:self] undoControl:control\n oldValue:newValue newValue:oldValue];\n}\n\n- (IBAction)controlAction:(NSControl *)control {\n NSString *controlID = control.identifier;\n id oldValue = self.data[controlID];\n id newValue = control.objectValue;\n if (oldValue != newValue &amp;&amp; ![oldValue isEqual:newValue]) {\n // register undo\n NSLog(@&quot;register undo %@ old:'%@' new:'%@'&quot;, controlID, oldValue, newValue);\n [[self.window.undoManager prepareWithInvocationTarget:self] undoControl:control\n oldValue:oldValue newValue:newValue];\n self.data[controlID] = newValue;\n }\n}\n\n@end\n</code></pre>\n"^^ . "<p>I'm trying to add accessibility support for my iOS mobile app.</p>\n<p>for a table view when the user clicks on the cell, we are showing tick icon at the end of the cell as shown below.</p>\n<p>the voice should announce the selected state of the cell.</p>\n<p><a href="https://i.sstatic.net/VUPIkHth.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/VUPIkHth.png" alt="enter image description here" /></a></p>\n<p>Also, I tried with below code since we are reusing the same cell the same selected state is applied for all the rows.</p>\n<pre><code>if(cell.selected){\n cell.accessibilityHint = @&quot;Hidden&quot;;\n } else {\n cell.accessibilityHint = @&quot;Visible&quot;;\n }\n</code></pre>\n<p>the value is getting change but it's getting applied for both the cells.</p>\n<p>I'm using iOS Objective C</p>\n<p>Any solution for this issue? Kindly help.</p>\n"^^ . "1"^^ . . . "opengl-es"^^ . . . . . . . . . "0"^^ . "memory-management"^^ . . "audioqueue"^^ . "For SPM with Objective-C file you need to put all header (.h) files in the same folder (eg: include). Look [here](https://stackoverflow.com/questions/70850794/how-to-create-an-spm-package-based-on-objc-code)"^^ . . "module"^^ . . . "xcode"^^ . "0"^^ . . . . "You need use `publicHeadersPath` and don't need use modulemap"^^ . . . "Must you use an instance of `Car`? Can you subclass it and use that instead?"^^ . "storekit"^^ . . . "0"^^ . . "swiftui"^^ . . . "-1"^^ . "0"^^ . . "The 'data' property is not initialized correctly and all old values ​​are 'nil'. It should be filled with the initial values ​​of the controls. Most controls can have a delegate and/or send notifications, for example `NSControlTextDidBeginEditingNotification` and `NSPopUpButtonWillPopUpNotification`. Check the documentation of the class and delegate methods with a notification argument. Also check the superclass."^^ . . . . "1"^^ . . . . . "@CPlus Maybe! Try it and see what happens. I'm resisting answering directly because I don't actually know and more to the point, I guess, it's possible to make a C compiler (or your own code) do nearly any unnatural acts if you really want it to. But then, if you break the language rules, are you still writing in ObjC? Not really, right?"^^ . "ckrecord"^^ . . "swift"^^ . . "0"^^ . . . . "@GeraldTheGerm - curious... I ran it first on Ventura, but I now see the problem when running on Sonoma. See the **Edit** to my answer."^^ . "0"^^ . . "Core data inappropriately turns managed objects into faults"^^ . . . "0"^^ . . . "@ShilaiZhang As per your code snippet which you have added in the question, you have assigned "textField.textContentType = .password" due to which when textfield becomes first responder you are getting a suggestion of autofill password above numberpad keyboard."^^ . . . . . . . . . . "0"^^ . . . "<p>I have an iOS app that I used CocoaPods to install Parse. My Podfile is:</p>\n<pre><code># Uncomment the next line to define a global platform for your project\n# platform :ios, '9.0'\n\ntarget 'EYC' do\n # Comment the next line if you don't want to use dynamic frameworks\n use_frameworks!\n\n # Pods for EYC\npod 'Parse'\npod 'SquareInAppPaymentsSDK'\n\nend\n</code></pre>\n<p>On my code I have imported both Parse and Bolts. I run some code that uses Parse, and even autocomplete suggestions works fine for me, so I know it can see the Parse code. However, when I try to build, I get four errors.</p>\n<pre><code>Undefined symbol: _OBJC_CLASS_$_PFCloud\n\nUndefined symbol: _OBJC_CLASS_$_PFObject\n\nUndefined symbol: _OBJC_CLASS_$_PFUser\n\nLinker command failed with exit code 1 (use -v to see invocation)\n</code></pre>\n<p>I've tried deleting the Podfile, doing a pod deintegrate and pod install again, but nothing seems to work.</p>\n<p>If I comment out the code that references anything with Parse, it builds fine, even with the <code>@import Parse;</code> and <code>@import Bolts;</code> still there.</p>\n"^^ . . . "Setting aside your question (whether it's possible to trick the compiler), the reason the compiler errors on a local allocation of an object is that the ObjC object lifecycle model going all the way back rests on reference counting, which can't be done reliably when stuff could be unexpectedly "deallocated" by stack unwinding. So it's not just unsupported (thought it is that too) it's a guarantee of disaster. :)"^^ . . . . "frameworks"^^ . "1"^^ . . . "ScreenCaptureKit example in Go/C"^^ . . "0"^^ . . . . . . "core-data"^^ . "0"^^ . . . . "0"^^ . "Ok I think I have a solution which would work, would have preferred something a bit more automated that storing each fields value - but I can do it with an array with the field Identifier and the field value."^^ . . "0"^^ . "Is there the equivalent of "fling" detection (Android) with UIGestureRecognizer on iOS?"^^ . . . "0"^^ . "0"^^ . . . . . . . . . . . . "0"^^ . "0"^^ . . "I see one issue in your code. The CGImage is not retained. You must retain it. Look at the comment: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/ui/snapshot/snapshot_mac.mm"^^ . . . "0"^^ . . . . . . . . . . . . "IMO it's much better to write a new dict proxy in swift and for swift using generics, and then if needs be, make an extension that conforms to `DictionaryProxy` for backward compatibility. When you fully migrate from ObjC, you ditch that old wrapper, and keep the new one."^^ . "nsimage"^^ . . "<p>That code you're wondering about doesn't actually use the time returned by <code>AudioQueueGetCurrentTime()</code>, although it does sometimes overwrite and then log the result.</p>\n<p>I interpret <a href="https://developer.apple.com/documentation/audiotoolbox/1502244-audioqueuegetcurrenttime" rel="nofollow noreferrer">this doco</a> as meaning that <code>AudioQueueGetCurrentTime</code> should return the number of samples that the <code>AudioQueue</code> has output (or captured if you're using the input variant) or if that amount is negative, the number of samples in the future that the queue is scheduled to start in (and indeed <code>AudioQueueStart()</code> does have an optional start time, so that's reassuringly consistent).</p>\n<p>The negative timestamp shenanigans lead me to believe that this is not the number of your samples actually consumed by the <code>AudioQueue</code>, but that's ok, because you already know how many samples you've supplied it (probably <code>dts-aqStartDts</code> in your code).</p>\n"^^ . "@Sweeper I've updated the question to list how I was able to achieve it using Combine."^^ . "1"^^ . . . . . . . . . "@Cy-4AH I am curious if this can be done and how. How does setting the pointer to `[NSWindow class]` to the beginning of the buffer work?"^^ . "1"^^ . . . . "What's the point of `ObservableCar`? Why not just use `Car` directly?"^^ . . "Can you please try to crop the image to some fixed size before assigning it to the view? `[outputImage imageByCroppingToRect: CGRectMake(0, 0, img.size.width, img.size.height)]`"^^ . . "0"^^ . . "0"^^ . . . "<p>I have an <code>NSView</code> with <code>NSImage</code> instances as subviews that all show up correctly on the screen. I want to save them to a PDF file but the subviews are not included.</p>\n<p>The routine works well and also saves to PDF. The resulting PDF file contains all that I draw on the <code>NSView</code>, but the NSImage-subviews are only visible on screen but not in the PDF file.\nAny suggestions?</p>\n<pre><code>NSString* savePath = [self getSavePath];\n\nif (savePath != nil) {\n \n NSData *pdfData = [_myCtDistView dataWithPDFInsideRect:_myCtDistView.bounds];\n\n if ([pdfData writeToFile:savePath atomically:YES]) { \n NSLog(@&quot;Saved PDF successfully&quot;); \n } else { \n NSLog(@&quot;Saved PDF failed&quot;);\n }\n}\n</code></pre>\n<p>View drawing code:</p>\n<pre><code>- (void)drawRect:(NSRect)dirtyRect {\n [super drawRect:dirtyRect];\n \n [[NSColor whiteColor] set];\n NSRectFill(self.bounds);\n\n [self drawBgImage];\n\n}//end of drawRect \n\n- (void)drawBgImage {\n \n NSImageView *backgroundImageView = [[NSImageView alloc] initWithFrame:self.bounds];\n backgroundImageView.image = _bgImage;\n backgroundImageView.imageScaling = NSImageScaleProportionallyUpOrDown;\n\n [self addSubview:backgroundImageView];\n\n}// end of drawBgImage\n</code></pre>\n"^^ . "0"^^ . . . "1"^^ . . "0"^^ . "1"^^ . . . "0"^^ . . "1"^^ . . . . . "<p>I've been trying to write an application for older versions of Mac OS X that mounts an NFS network share and ran into an interesting quirk when trying to use the <code>mount(2)</code> function. According to the documentation it should has the following prototype:</p>\n<pre class="lang-c prettyprint-override"><code>int mount(const char *type, const char *dir, int flags, void *data);\n</code></pre>\n<p>As the documentation is vague on the value of <code>type</code>, I've assumed that it was the network location, in the form of <code>server.name:/some/location</code>. So I've written the following test code:</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (BOOL)mount:(NSString *)serverAddress mountPoint:(NSString *)path\n{\n int ret = mount([serverAddress UTF8String], [path UTF8String], 0, NULL);\n NSLog(@&quot;mount = %d&quot;, ret);\n \n // Handle mounting errors.\n if (ret != 0) {\n NSString *errorMessage = [NSString stringWithUTF8String:strerror(errno)];\n NSLog(@&quot;errno = %d (%@)&quot;, errno, errorMessage);\n }\n \n return ret == 0;\n}\n</code></pre>\n<p>When I run this example method under OS X Mavericks I get the following output from the console:</p>\n<pre><code>mount = -1\nerrno = 3 (No such process)\nFailed to mount network share: No such process\n</code></pre>\n<p>Most interestingly is that if I run the same example under OS X Leopard on a Power Mac G5 I get the following output:</p>\n<pre><code>mount = -1\nerrno = 63 (File name too long)\nFailed to mount network share: File name too long\n</code></pre>\n<p>On both machines I'm able to mount the network share using the <code>mount(8)</code> command supplying the same parameters as I did with the example method. By the way, the <code>type</code> location is 46 characters long and the <code>dir</code> path is located under the user's home folder.</p>\n<p>In order to try to replicate the issue on modern versions of macOS I've written the following test code:</p>\n<pre class="lang-c prettyprint-override"><code>#include &lt;stdlib.h&gt;\n#include &lt;stdio.h&gt;\n#include &lt;string.h&gt;\n#include &lt;errno.h&gt;\n#include &lt;sys/param.h&gt;\n#include &lt;sys/mount.h&gt;\n\nint main(int argc, char **argv) {\n const char *type = &quot;nfsserver.lan:/some/path&quot;;\n const char *mntp = &quot;/Users/localuser/tmpmount&quot;;\n\n int ret = mount(type, mntp, 0, NULL);\n printf(&quot;ret = %d\\n&quot;, ret);\n printf(&quot;errno = %d (%s)\\n&quot;, errno, strerror(errno));\n\n return 0;\n}\n</code></pre>\n<p>Upon running this code on the Mavericks machine and on a Mac Pro running macOS 12.7.4 I got the following output:</p>\n<pre><code>ret = -1\nerrno = 63 (File name too long)\n</code></pre>\n<p>This shows that there is clearly something wrong with my call to <code>mount(2)</code>, which parameters are wrong and how can they be fixed?</p>\n"^^ . "0"^^ . . . . "Theoretically it's possible, but no one guaranty stable behaviour. You need set at least pointer to `[NSWindow class]` at the beginning of yours buffer. Also I suggest to turn off ARC. What you are trying to achieve with static `NSObject`?"^^ . "0"^^ . "0"^^ . . "`drawRect` should draw, nothing else. Don't add subviews from `drawRect`. Add the image view first and then call `dataWithPDFInsideRect`. Or draw the image without a `NSImageView` in `drawRect`."^^ . "0"^^ . . . "0"^^ . . . . . . . . . . "That is the expected output. The completion handler executes asynchronously, but the print of `555` is outside of the completion handler, so it executes first. Some time later the completion handler executes and you get `111`. You need to pass a completion handler to this method which you can invoke to provider the value back to the caller."^^ . . . "square"^^ . . "Library not loaded: CorePaymentCard SquareInApp"^^ . . "0"^^ . . "<p>Resolved: Application Support storage class was created exactly for these no man's land cases when data does not need to be purged and yet it is not important enough to be backed up in its entirety (not a document created by this user and unavailable anywhere else).</p>\n"^^ . . . . . . "sockets"^^ . "push-notification"^^ . "That is what I am doing - I am using a linear gradient I have tried reducing the size of the image to 1 pixel and even 20 or 30px previously however I notice a stepping on the gradient - so it's not a smooth gradient. So right no i'm using 850px which probably isn't helping with performance. \n\nI also wonder if drawinrect is the most efficient way as when I move the sliders in the color panel from my nscolorwell it's really lagging."^^ . "1"^^ . . "c99"^^ . . . "`NSData` is the object that can hold arbitrary data loaded from a file."^^ . . . . . "Thank you I will try that when back at my Mac thank you"^^ . . "0"^^ . "1"^^ . . . . . . "Can you tell me how to manage both posts and chats with one share extension?"^^ . . . "Another solution is getting the initial values in `viewDidLoad` or `awakeFromNib`."^^ . . "Do you call fetch or reload methods? Do you override any `NSManagedObject` methods? How do you keep the data and the outline view in sync? When do you call save? When/where/how do you see the faults?"^^ . . "0"^^ . "1"^^ . "1"^^ . "0"^^ . . . "0"^^ . . "0"^^ . . . "1"^^ . "1"^^ . "0"^^ . . "0"^^ . "0"^^ . "cloudkit"^^ . . . . "1"^^ . . "I have marked your answer as top and upvoted - this was unbelievbly useful, anything I searched online seemed very complicated and daughnting but your code snippet helped me see everything needed and is very easy to understand. \n\nI am noticing one thing, when I modify a field for the first time the old value is coming up as NULL - so for things like dropdown menus when you do the final undo it takes you to a non existing blank option on the dropdown.\n\nregister undo _NS:454 old:'(null)' new:'4'\n\nAny idea why it is coming up as null?"^^ . . . "0"^^ . . "0"^^ . "1"^^ . . . . . "0"^^ . . "0"^^ . "1"^^ . "That is how it exports for me: https://imgur.com/a/SAF6oQU"^^ . . . . . . . . . "0"^^ . . . . . . . "Parse Undefined Symbols PFCloud"^^ . . "nsdocumentdirectory"^^ . . . . . "0"^^ . . "c"^^ . "Creating a xcframework with both Debug and Release libs?"^^ . . . . . . "Have you seen [Objective C: Memory Allocation on stack vs. heap](https://stackoverflow.com/questions/4326965/objective-c-memory-allocation-on-stack-vs-heap)?"^^ . . . . . . . . . . . . "<p>I'm building a library, and my goal is to provide a way for users to automatically get the right version depending on their configuration (Debug or Release).</p>\n<p>I used to do that with <code>.a</code> files, where, in their project, I'd set <em>Linker Flags</em> to <code>-lMyLib1 -lMyLib2 ...</code> and then set the <em>Library Search Path</em> to a different value for Debug and Release (two directories with the .a files compiled for Debug and Release respectively).</p>\n<p>Now I am switching to <code>xcframework</code>s, but I find no way to do that. Should I bundle my release and debug libs together in the <code>xcframework</code>? Is that even possible? If not, how can I make xcode pick a different <code>xcframework</code> depending on the configuration, in my app? Am I missing something obvious here?</p>\n"^^ . . "1"^^ . "0"^^ . . . . "0"^^ . . . "0"^^ . . . . . . . "0"^^ . . . . . . . . "0"^^ . "0"^^ . . . "@BenZotto Howver, if you disable ARC, and refrain from sending `release` to objects that were... questionably allocated, could that work? So the reference count in the objects are just ignored?"^^ . "nsview"^^ . "<p>I have a <code>Dictionary&lt;ObjcType, SwiftType&gt;</code> that I have to serialize to and deserialize from JSON. <code>SwiftType</code> conforms to <code>Codable</code>. <code>ObjcType</code> is a class written in Objective-C (used by one of the libraries I heavily depend on, so cannot change it to be in Swift). All properties of <code>ObjcType</code> are either <code>NSString</code> or <code>BOOL</code>.</p>\n<p>I did some search and added these functions to <code>ObjcType</code>, to give it some semblance of serialization:</p>\n<pre class="lang-objectivec prettyprint-override"><code>-(NSString*)GetJSON{\n NSError *writeError = nil;\n\n NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:&amp;writeError];\n\n NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];\n\n return jsonString;\n}\n\n- (instancetype)initWithObject:(NSString *)jsonString {\n self = [super init];\n if (self != nil)\n {\n NSData* jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];\n \n NSError *error = nil;\n NSDictionary *object = [NSJSONSerialization\n JSONObjectWithData:jsonData\n options:0\n error:&amp;error];\n for (NSString *dictionaryKey in object) {\n self.field1 = [[object valueForKey:dictionaryKey] objectForKey:@&quot;field1&quot;];\n self.field2 = [[object valueForKey:dictionaryKey] objectForKey:@&quot;field2&quot;];\n self.field3 = [[object valueForKey:dictionaryKey] objectForKey:@&quot;field3&quot;];\n }\n }\n return self;\n}\n</code></pre>\n<p>So now my <code>ObjcType</code> can create its own text to put into that JSON.\nBut I cannot figure out how to make a wrapper that will encode\\decode this dictionary. Any help?</p>\n<p>P.S. even better is it could work with <code>OrderedDictionary</code> from <code>OrderedCollections</code> module instead of normal <code>Dictionary</code>.</p>\n"^^ . . "0"^^ . "0"^^ . . . . "0"^^ . "Tableview cell selected state is not correctly announced by voice over accessibility - iOS Objective C"^^ . . . . . . . . . "0"^^ . . . . . "0"^^ . . . "0"^^ . "<p><strong>Solution</strong></p>\n<p>Apparently the GLKView is already a UIView. Not good at explaining things but this solved the problem.</p>\n<pre><code>#import &quot;FUCameraPlatformView.h&quot;\n#import &quot;OverlayView.h&quot;\n#import &quot;GLView.h&quot; \n#import &lt;GLKit/GLKit.h&gt;\n\n@interface FUCameraPlatformView()\n@property (nonatomic, strong) EAGLContext *glContext;\n@property (nonatomic, strong) GLKView *glView;\n@property (nonatomic, strong) CIContext *ciContext;\n@property (nonatomic, strong) FUCamera *camera;\n@property (nonatomic, strong) MHBeautyManager *beautyManager;\n@property (nonatomic , strong) OverlayView *overlay;\n@property (nonatomic, assign) GLuint framebuffer;\n@property (nonatomic, assign) GLuint colorRenderbuffer;\n@property (nonatomic, strong) dispatch_queue_t captureQueue;\n@end\n\n@implementation FUCameraPlatformView\n\n- (instancetype)initWithFrame:(CGRect)frame\n viewIdentifier:(int64_t)viewId\n arguments:(id)args\n binaryMessenger:(NSObject&lt;FlutterBinaryMessenger&gt; *)messenger\n beautyManager:(MHBeautyManager *)manager \n cameraInstance:(FUCamera *)camera{\n self = [super init];\n if (self) {\n _containerView = [[UIView alloc] initWithFrame:frame];\n // Initialize the OpenGL context\n _glContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];\n if (!_glContext) {\n NSLog(@&quot;Failed to create ES context&quot;);\n return nil;\n }\n if (![EAGLContext setCurrentContext:_glContext]) {\n NSLog(@&quot;Failed to set current OpenGL context.&quot;);\n return nil;\n }\n\n // Initialize the GLKView\n _glView = [[GLKView alloc] initWithFrame:frame context:_glContext];\n _glView.context = _glContext;\n // _glView.drawableDepthFormat = GLKViewDrawableDepthFormat24;\n // _glView.drawableColorFormat = GLKViewDrawableColorFormatRGBA8888; \n\n // Initialize the CIContext\n _ciContext = [CIContext contextWithEAGLContext:_glContext];\n\n\n // Add overlay view\n _overlay = [[OverlayView alloc] initWithFrame:_glView.bounds];\n _overlay.backgroundColor = [UIColor clearColor];\n [_glView addSubview:_overlay];\n\n // Setup the camera and beauty manager\n _camera = camera;\n _camera.delegate = self;\n _beautyManager = manager;\n _captureQueue = dispatch_queue_create(&quot;com.faceunity.videoCaptureQueue&quot;, DISPATCH_QUEUE_SERIAL);\n // Start the camera\n [self setupCamera];\n\n }\n return self;\n}\n\n- (void)showFaceLandmarksAndFaceRectWithPersonsArray:(NSMutableArray *)arrPersons {\n if (_overlay.hidden) {\n _overlay.hidden = NO;\n }\n _overlay.arrPersons = arrPersons;\n [_overlay setNeedsDisplay];\n [_overlay layoutIfNeeded];\n}\n\n- (void)setupCamera {\n [_camera startCapture];\n}\n\n\n- (void)didOutputVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer {\n CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);\n OSType formatType = CVPixelBufferGetPixelFormatType(imageBuffer);\n CVPixelBufferLockBaseAddress(imageBuffer, 0);\n [self.beautyManager processWithPixelBuffer:imageBuffer formatType:formatType];\n CIImage *image = [CIImage imageWithCVPixelBuffer:imageBuffer];\n CIFilter *filter = [CIFilter filterWithName:@&quot;CIPhotoEffectChrome&quot; keysAndValues:kCIInputImageKey, image, nil];\n [filter setValue:image forKey:kCIInputImageKey];\n [_glView bindDrawable];\n CGFloat width = _glView.drawableHeight/640.f*480.f;\n CGFloat height = _glView.drawableHeight;\n CGFloat x = (_glView.drawableWidth - width) /2;\n [_ciContext drawImage:filter.outputImage inRect:CGRectMake(x, 0, width, height) fromRect:CGRectMake(0, 0, 480, 640)];\n [_glView display];\n\n}\n\n- (UIView *)view {\n return _glView;\n}\n\n- (void)dealloc {\n [self disposeAll];\n}\n\n- (void)disposeAll {\n [_camera stopCapture];\n _camera.delegate = nil;\n _camera = nil;\n [_beautyManager releaseSession];\n _beautyManager = nil;\n\n [EAGLContext setCurrentContext:_glContext];\n glDeleteFramebuffers(1, &amp;_framebuffer);\n glDeleteRenderbuffers(1, &amp;_colorRenderbuffer);\n [EAGLContext setCurrentContext:nil];\n _glContext = nil;\n}\n\n@end\n</code></pre>\n"^^ . . . "0"^^ . . . "0"^^ . "<p>Adding a X.509 certificate and private key to a Swift application involves reading the certificate and key from files, creating <code>SecCertificate</code> and <code>SecKey</code> objects. Creating a <code>SecIdentity</code> from these objects and you'll need to configure <code>URLSession</code> to use these credentials for the request.</p>\n<p><strong>Paths to your certificate and key files :</strong></p>\n<pre class="lang-c prettyprint-override"><code>\nlet certPath = &quot;/path/to/device-cert.pem&quot; \nlet keyPath = &quot;/path/to/device-key.pem&quot;\n</code></pre>\n<p><img src="https://i.imgur.com/FVQ8qXq.png" alt="enter image description here" /></p>\n<blockquote>\n<p>I have used this <a href="https://github.com/henrinormak/Heimdall" rel="nofollow noreferrer">links</a> for handling <a href="https://www.swift.org/blog/swift-certificates-and-asn1/" rel="nofollow noreferrer">Certificates</a> and <a href="https://cryptography.io/en/latest/x509/tutorial/" rel="nofollow noreferrer">Cryptography</a> operations in <a href="https://github.com/TakeScoop/SwiftyRSA" rel="nofollow noreferrer">Swift</a> .</p>\n</blockquote>\n<p>I have used below code to register a device with Azure Device Provisioning Service (DPS) using x.509 certificates in Swift.</p>\n<pre class="lang-c prettyprint-override"><code>\nimport Foundation\nimport Security\n\nfunc loadIdentity(certPath: String, keyPath: String) -&gt; SecIdentity? {\n guard let certData = try? Data(contentsOf: URL(fileURLWithPath: certPath)) else {\n print(&quot;Unable to load certificate&quot;)\n return nil\n }\n\n guard let cert = SecCertificateCreateWithData(nil, certData as CFData) else {\n print(&quot;Unable to create certificate&quot;)\n return nil\n }\n\n guard let keyData = try? Data(contentsOf: URL(fileURLWithPath: keyPath)) else {\n print(&quot;Unable to load private key&quot;)\n return nil\n }\n\n let keyDict: [NSString: Any] = [\n kSecAttrKeyType: kSecAttrKeyTypeRSA,\n kSecAttrKeyClass: kSecAttrKeyClassPrivate,\n kSecAttrKeySizeInBits: 2048,\n kSecReturnPersistentRef: true\n ]\n\n var error: Unmanaged&lt;CFError&gt;?\n guard let privateKey = SecKeyCreateWithData(keyData as CFData, keyDict as CFDictionary, &amp;error) else {\n print(&quot;Unable to create private key: \\(error?.takeRetainedValue() ?? &quot;Unknown error&quot; as CFError)&quot;)\n return nil\n }\n\n var identity: SecIdentity?\n let status = SecIdentityCreateWithCertificate(cert, privateKey, &amp;identity)\n guard status == errSecSuccess else {\n print(&quot;Unable to create identity&quot;)\n return nil\n }\n\n return identity\n}\n\nclass URLSessionPinningDelegate: NSObject, URLSessionDelegate {\n var identity: SecIdentity\n\n init(identity: SecIdentity) {\n self.identity = identity\n }\n\n func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -&gt; Void) {\n let credential = URLCredential(identity: self.identity, certificates: nil, persistence: .forSession)\n completionHandler(.useCredential, credential)\n }\n}\n\nfunc performRequest() {\n let certPath = &quot;/path/to/your/device-cert.pem&quot;\n let keyPath = &quot;/path/to/your/device-key.pem&quot;\n \n guard let identity = loadIdentity(certPath: certPath, keyPath: keyPath) else {\n print(&quot;Unable to load identity&quot;)\n return\n }\n \n let session = URLSession(configuration: .default, delegate: URLSessionPinningDelegate(identity: identity), delegateQueue: nil)\n \n guard let url = URL(string: &quot;https://global.azure-devices-provisioning.net/[ID_Scope]/registrations/[registration_id]/register?api-version=2021-06-01&quot;) else {\n print(&quot;Invalid URL&quot;)\n return\n }\n \n var request = URLRequest(url: url)\n request.httpMethod = &quot;PUT&quot;\n request.setValue(&quot;application/json&quot;, forHTTPHeaderField: &quot;Content-Type&quot;)\n request.setValue(&quot;utf-8&quot;, forHTTPHeaderField: &quot;Content-Encoding&quot;)\n \n let body = [&quot;registrationId&quot;: &quot;registrationId&quot;]\n request.httpBody = try? JSONSerialization.data(withJSONObject: body, options: [])\n\n let task = session.dataTask(with: request) { data, response, error in\n if let error = error {\n print(&quot;Request failed: \\(error)&quot;)\n } else if let data = data, let responseString = String(data: data, encoding: .utf8) {\n print(&quot;Response: \\(responseString)&quot;)\n }\n }\n \n task.resume()\n}\n\n\nperformRequest()\n\n</code></pre>\n<p><img src="https://i.imgur.com/pBs6wLF.png" alt="enter image description here" />\n<img src="https://i.imgur.com/DzLKmDO.png" alt="enter image description here" /></p>\n"^^ . . "I did a test: folders are turned into fault even if the outline view isn't populated (by specifying no datasource for the outline view). So the issue is not related to the outline view."^^ . . "1"^^ . . "0"^^ . . . . "Thank you Wileke, I will look through the code and unstand how it all works, I appeciate your time."^^ . "<p>Hello I have an application, it's very basic but has some fields for an address, so city, zip code, state etc...</p>\n<p>I want it so the user can undo the content across multiple fields, currently the default undo only works on the field you are using. I am using NSTextFields for my fields.</p>\n<p>I assume I need to use UndoManager but I am not sure how to implement it on my fields, my fields have ID's. Is there any documentation on how to do this, none of the fields have any functions - I just grab the data from all of the fields on one of my button events.</p>\n<p>I don't know swift so please responsd in Obj-c so I can undertstand what needs to be done.</p>\n"^^ . . . . . "1"^^ . "iOS: How to show an introductory offer with promotional offer(if there is introductory offer not need to show promotional offer)"^^ . . . "1"^^ . . . . . . "1"^^ . . "core-audio"^^ . . "1"^^ . "<p>Basically, fling designates the &quot;energy&quot; to apply after the finger is released from the screen after having swiped around (i.e. a panning event such as <code>UIPanGestureRecognizer</code>). It's like you swipe and then &quot;throw&quot; the object you have moved around: you get the force at which it has been thrown in the direction.</p>\n<p>It is useful for me to apply inertia after a panning event on a scroll view (from my own custom framework, not using UIScrollView). Is there any way to get the equivalent on iOS? I don't really understand how it is calculated. It is not giving good results to use the last translation from the <code>UIPanGestureRecognizer</code> as a value for inertia.</p>\n"^^ . . . . "- Currently, there is a future working of a post in Share Extension. Now I also want to share the chat in the share extension outside the app.\n\n- So now I want to run both post and chat futures in the share extension.\n- So how is that possible?\n\n- Both posts and chats should run from one share extension."^^ . . . "1"^^ . . . . "@Willeke That basically is just to show that yes, Objective-C allocates everything on the heap, with a select few exceptions."^^ . . . . . "nsgradient"^^ . . "Unable to create framework in Xcode 15 with Objective-C throwing error "Command PhaseScriptExecution failed with a nonzero exit code""^^ . "<p>When i try to save <em>CKRecord</em> with <em>CKShare</em> using <em>setModifyRecordsCompletionBlock</em></p>\n<pre><code>NSOperationQueue * quwuw = [[NSOperationQueue alloc] init];\n [quwuw setMaxConcurrentOperationCount:1];\n \n [self createOrFetchZone:^(CKRecordZone *rzone, NSError *error) {\n CKRecordID *recordID = [[CKRecordID alloc] initWithRecordName:recordId zoneID:custZone.zoneID];\n [[self privateCloudDatabase] fetchRecordWithID:recordID completionHandler:^(CKRecord *record, NSError *error) {\n \n if (error) {\n dispatch_async(dispatch_get_main_queue(), ^{\n prephandler(nil, nil,error);\n });\n return;\n }\n \n CKShare * share = [[CKShare alloc] initWithRootRecord:record];\n \n share[CKShareTitleKey] = @&quot;example&quot;;\n [share setPublicPermission:CKShareParticipantPermissionReadWrite];\n CKModifyRecordsOperation * op = [[CKModifyRecordsOperation alloc] initWithRecordsToSave:@[share, record] recordIDsToDelete:nil];\n [op setModifyRecordsCompletionBlock:^(NSArray&lt;CKRecord *&gt; * _Nullable savedRecords, NSArray&lt;CKRecordID *&gt; * _Nullable deletedRecordIDs, NSError * _Nullable operationError) {\n if (operationError == nil) {\n dispatch_async(dispatch_get_main_queue(), ^{\n prephandler(share, [CKContainer defaultContainer],operationError);\n });\n \n }\n else {\n dispatch_async(dispatch_get_main_queue(), ^{\n prephandler(share, [CKContainer defaultContainer],operationError);\n });\n }\n }];\n [op setDatabase:[self privateCloudDatabase]];\n [quwuw addOperation:op];\n }];\n }];\n</code></pre>\n<p>I got error with userinfo :</p>\n<pre><code>CKErrorDescription = &quot;Failed to modify some records&quot;;\n CKPartialErrors = {\n &quot;&lt;CKRecordID: 0x282af5da0; recordName=Share-76902C70-A6CD-4A12-B6DD-6371A1578FBD, zoneID=someCustomZoneName:__defaultOwner__&gt;&quot; = &quot;&lt;CKError 0x28242a670: \\&quot;Batch Request Failed\\&quot; (22/2024); server message = \\&quot;Atomic failure\\&quot;; op = 80E158204C153900; uuid = 81B2BAEB-5ADE-447C-A29C-F8D8D174107D; container ID = \\&quot;iCloud.com.xxxx.cloudkit-objC\\&quot;&gt;&quot;;\n &quot;&lt;CKRecordID: 0x282af5b20; recordName=0CA7AA50-FCD0-4964-984D-237031BB7106, zoneID=someCustomZoneName:__defaultOwner__&gt;&quot; = &quot;&lt;CKError 0x28242a490: \\&quot;Invalid Arguments\\&quot; (12/2006); server message = \\&quot;Chaining supported for hierarchical sharing only\\&quot;; op = 80E158204C153900; uuid = 81B2BAEB-5ADE-447C-A29C-F8D8D174107D; container ID = \\&quot;iCloud.com.xxxx.cloudkit-objC\\&quot;&gt;&quot;;\n };\n ContainerID = &quot;iCloud.com.xxxx.cloudkit-objC&quot;;\n NSDebugDescription = &quot;CKInternalErrorDomain: 1011&quot;;\n NSLocalizedDescription = &quot;Failed to modify some records&quot;;\n NSUnderlyingError = &quot;&lt;CKError 0x28242a2e0: \\&quot;Partial Failure\\&quot; (1011); \\&quot;Failed to modify some records\\&quot;; partial errors: {\\n\\t0CA7AA50-FCD0-4964-984D-237031BB7106:(someCustomZoneName:__defaultOwner__) = &lt;CKError 0x28242a490: \\&quot;Invalid Arguments\\&quot; (12/2006); server message = \\&quot;Chaining supported for hierarchical sharing only\\&quot;; op = 80E158204C153900; uuid = 81B2BAEB-5ADE-447C-A29C-F8D8D174107D&gt;\\n\\t... 1 \\&quot;Batch Request Failed\\&quot; CKError's omited ...\\n}&gt;&quot;;\n RequestUUID = &quot;81B2BAEB-5ADE-447C-A29C-F8D8D174107D&quot;;\n</code></pre>\n<p>My record has no parent. Is it possible to share only one CKRecord without set parent reference?</p>\n"^^ . "How to share CKRecord with CKShare properly"^^ . . "0"^^ . . . "1"^^ . . . . "0"^^ . "skproduct"^^ . "<p>This is a method to check if the file input is mp3 format.</p>\n<pre><code>#import &lt;UniformTypeIdentifiers/UniformTypeIdentifiers.h&gt;\n\n- (BOOL)isMP3FileAtURL:(NSURL *)url {\n NSError *error = nil;\n NSDictionary *resourceValues = [url resourceValuesForKeys:@[NSURLContentTypeKey] error:&amp;error];\n \n if (error) {\n NSLog(@&quot;Error retrieving file resource values: %@&quot;, error);\n return NO;\n }\n \n UTType *contentType = resourceValues[NSURLContentTypeKey];\n return [contentType conformsToType:UTTypeMP3];\n}\n</code></pre>\n<p>Integrate it into your code, it will be like</p>\n<pre><code>-(id)getAudioFileNamed: (NSString*) name {\n {\n NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,\n NSUserDomainMask, YES);\n NSString *documentsDirectory = [paths objectAtIndex:0];\n NSString* path = [documentsDirectory stringByAppendingPathComponent:\n [NSString stringWithString: name] ];\n NSURL *url = [NSURL fileURLWithPath:path];\n if ([self isMP3FileAtURL: url]) {\n AVPlayerItem* item = [AVPlayerItem playerItemWithURL:url];\n return item;\n } else {\n return nil;\n }\n }\n return nil;\n}\n</code></pre>\n<p>I adjust a bit, making it more readable, so finally it should be like.</p>\n<pre><code>- (nullable AVPlayerItem *)getAudioFileNamed:(NSString *)name {\n NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,\n NSUserDomainMask, YES);\n NSString *documentsDirectory = [paths objectAtIndex:0];\n NSString *path = [documentsDirectory stringByAppendingPathComponent: [NSString stringWithString: name]];\n NSURL *url = [NSURL fileURLWithPath:path];\n if ([self isMP3FileAtURL: url]) {\n return [AVPlayerItem playerItemWithURL:url];\n } else {\n return nil;\n }\n}\n</code></pre>\n"^^ . . "<p>I'm working on improving open source library to capture screenshots: <a href="https://github.com/kbinani/screenshot" rel="nofollow noreferrer">https://github.com/kbinani/screenshot</a> - it is somewhat popular and it uses legacy approach, and MacOS 15 (beta as of time of writing) already complains that &quot;CGDisplayCreateImageForRect' is unavailable: obsoleted in macOS 15.0&quot;. So you can't use it on macOS 15.0 - will not compile.</p>\n<p>I spent a couple of days trying to use ScreenCaptureKit from Apple. Which is a new way of doing things. And it works, but not in Go with C bindings.</p>\n<p>How do I implement <code>SCScreenshotManager_captureImage</code> in C99?</p>\n<p>I have working code in swift (works absolutely fine):</p>\n<pre><code>import Foundation\nimport ScreenCaptureKit\nimport CoreGraphics\nimport AppKit\n\n// This program captures a screenshot using Apple's ScreenCaptureKit framework.\n// It detects multiple monitors and allows capturing from a specific display or the main display.\n\n// To run this program:\n// 1. Make sure you have Xcode and Swift installed on your Mac.\n// 2. Save this code in a file named 'demo.swift'.\n// 3. Open Terminal, navigate to the directory containing the file.\n// 4. Run: swift demo.swift\n\n// Function to capture screenshot\nfunc captureScreenshot(display: SCDisplay?, completion: @escaping (NSImage?) -&gt; Void) {\n let filter: SCContentFilter\n if let display = display {\n filter = SCContentFilter(display: display, excludingApplications: [], exceptingWindows: [])\n } else {\n filter = SCContentFilter()\n }\n \n let configuration = SCStreamConfiguration()\n configuration.width = 1920 // You can adjust this\n configuration.height = 1080 // You can adjust this\n configuration.showsCursor = true\n configuration.scalesToFit = false\n \n SCScreenshotManager.captureImage(contentFilter: filter, configuration: configuration) { image, error in\n if let error = error {\n print(&quot;Error capturing screenshot: \\(error.localizedDescription)&quot;)\n completion(nil)\n } else if let image = image {\n completion(NSImage(cgImage: image, size: NSSize(width: image.width, height: image.height)))\n } else {\n print(&quot;No image captured&quot;)\n completion(nil)\n }\n }\n}\n\n// Main execution\nfunc main() {\n let semaphore = DispatchSemaphore(value: 0)\n \n Task {\n do {\n let content = try await SCShareableContent.current\n \n guard !content.displays.isEmpty else {\n print(&quot;No displays found&quot;)\n semaphore.signal()\n return\n }\n \n print(&quot;Available displays:&quot;)\n for (index, display) in content.displays.enumerated() {\n print(&quot;\\(index + 1). \\(display.displayID) - \\(display.width)x\\(display.height)&quot;)\n }\n \n print(&quot;Enter the number of the display to capture (or press Enter for main display):&quot;)\n let input = readLine()?.trimmingCharacters(in: .whitespacesAndNewlines)\n \n let selectedDisplay: SCDisplay?\n if let index = Int(input ?? &quot;&quot;), (1...content.displays.count).contains(index) {\n selectedDisplay = content.displays[index - 1]\n } else {\n selectedDisplay = content.displays.first\n }\n \n captureScreenshot(display: selectedDisplay) { image in\n if let image = image {\n let currentDirectoryURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath)\n let fileURL = currentDirectoryURL.appendingPathComponent(&quot;screenshot.png&quot;)\n \n if let tiffData = image.tiffRepresentation,\n let bitmapImage = NSBitmapImageRep(data: tiffData),\n let pngData = bitmapImage.representation(using: .png, properties: [:]) {\n do {\n try pngData.write(to: fileURL)\n print(&quot;Screenshot saved to: \\(fileURL.path)&quot;)\n } catch {\n print(&quot;Error saving screenshot: \\(error.localizedDescription)&quot;)\n }\n } else {\n print(&quot;Error converting image to PNG data&quot;)\n }\n } else {\n print(&quot;Failed to capture screenshot&quot;)\n }\n semaphore.signal()\n }\n } catch {\n print(&quot;Error getting shareable content: \\(error.localizedDescription)&quot;)\n semaphore.signal()\n }\n }\n \n semaphore.wait()\n}\n\nmain()\n\n</code></pre>\n<p>But when it comes to making a Go package that just works - nothing works. I've spent hours trying to make it work. For Stackoverflow I created GitHub repo to demonstrate the problem with instructions: <a href="https://github.com/ro31337/screenshot_macos" rel="nofollow noreferrer">https://github.com/ro31337/screenshot_macos</a></p>\n<p>The <code>main_screencapturekit.go</code> has the method that is not implemented (well, I tried to implement it , but ended up with solution that just sits there and does nothing, I don't provide these extra few lines so you're not derailed):</p>\n<pre><code>CGImageRef SCScreenshotManager_captureImage(SCContentFilter* filter, SCStreamConfiguration* config) {\n __block CGImageRef capturedImage = NULL;\n dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);\n\n NSLog(@&quot;Initializing SCStream...&quot;);\n SCStream* stream = [[SCStream alloc] initWithFilter:filter configuration:config delegate:nil];\n\n NSLog(@&quot;Starting capture...&quot;);\n [stream startCaptureWithCompletionHandler:^(NSError * _Nullable error) {\n if (error) {\n NSLog(@&quot;Error starting capture: %@&quot;, error.localizedDescription);\n NSLog(@&quot;Error domain: %@&quot;, error.domain);\n NSLog(@&quot;Error code: %ld&quot;, (long)error.code);\n NSLog(@&quot;Error user info: %@&quot;, error.userInfo);\n dispatch_semaphore_signal(semaphore);\n } else {\n NSLog(@&quot;Capture started successfully, attempting to capture screenshot...&quot;);\n [stream stopCaptureWithCompletionHandler:^(NSError * _Nullable error) {\n if (error) {\n NSLog(@&quot;Error stopping capture: %@&quot;, error.localizedDescription);\n NSLog(@&quot;Error domain: %@&quot;, error.domain);\n NSLog(@&quot;Error code: %ld&quot;, (long)error.code);\n NSLog(@&quot;Error user info: %@&quot;, error.userInfo);\n } else {\n NSLog(@&quot;Capture stopped successfully&quot;);\n }\n dispatch_semaphore_signal(semaphore);\n }];\n }\n }];\n\n dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);\n [stream release];\n return capturedImage;\n}\n</code></pre>\n<p>It's currently producing good output and new ScreenCaptureKit bindings do work (with whole bunch of warnings I wasn't able to get rid of):</p>\n<pre><code>2024-08-07 19:16:31.094 main_screencapturekit[10934:95763] Number of displays: 1\n2024-08-07 19:16:31.152 main_screencapturekit[10934:95763] Display info - Index: 0, Width: 1440, Height: 900, X: 0, Y: 0, ID: 69734272\n2024-08-07 19:16:31.206 main_screencapturekit[10934:95763] Display info - Index: 0, Width: 1440, Height: 900, X: 0, Y: 0, ID: 69734272\n2024-08-07 19:16:31.259 main_screencapturekit[10934:95763] SCContentFilter created successfully for display ID: 69734272\n2024-08-07 19:16:31.259 main_screencapturekit[10934:95759] SCStreamConfiguration initialized with width: 1920, height: 1080\n2024-08-07 19:16:31.259 main_screencapturekit[10934:95759] SCStreamConfiguration width set to: 1440\n2024-08-07 19:16:31.259 main_screencapturekit[10934:95759] SCStreamConfiguration height set to: 900\n2024-08-07 19:16:31.259 main_screencapturekit[10934:95759] SCStreamConfiguration showsCursor set to: 0\n2024-08-07 19:16:31.259 main_screencapturekit[10934:95759] Initializing SCStream...\n2024-08-07 19:16:31.371 main_screencapturekit[10934:95759] Starting capture...\n2024-08-07 19:16:31.421 main_screencapturekit[10934:95764] Capture started successfully, attempting to capture screenshot...\n2024-08-07 19:16:31.424 main_screencapturekit[10934:95825] Capture stopped successfully\n#0 : (0,0)-(1440,900) &quot;0_1440x900.png&quot;\n(0,0)-(1440,900)\n2024-08-07 19:16:31.510 main_screencapturekit[10934:95825] Display info - Index: 0, Width: 1440, Height: 900, X: 0, Y: 0, ID: 69734272\n2024-08-07 19:16:31.566 main_screencapturekit[10934:95825] SCContentFilter created successfully for display ID: 69734272\n2024-08-07 19:16:31.566 main_screencapturekit[10934:95759] SCStreamConfiguration initialized with width: 1920, height: 1080\n2024-08-07 19:16:31.566 main_screencapturekit[10934:95759] SCStreamConfiguration width set to: 1440\n2024-08-07 19:16:31.566 main_screencapturekit[10934:95759] SCStreamConfiguration height set to: 900\n2024-08-07 19:16:31.566 main_screencapturekit[10934:95759] SCStreamConfiguration showsCursor set to: 0\n2024-08-07 19:16:31.566 main_screencapturekit[10934:95759] Initializing SCStream...\n2024-08-07 19:16:31.567 main_screencapturekit[10934:95759] Starting capture...\n2024-08-07 19:16:31.610 main_screencapturekit[10934:95764] Capture started successfully, attempting to capture screenshot...\n2024-08-07 19:16:31.612 main_screencapturekit[10934:95824] Capture stopped successfully\n</code></pre>\n<p>So we definitely have progress. Bindings do work. But now we have to capture the stream I guess? But how? I don't even know where to look.</p>\n<p>I hope somebody out there can help me out, so we can improve the cross-platform screenshot making library for newest MacOS.</p>\n"^^ . . . "0"^^ . "2"^^ . "0"^^ . . . "drawing"^^ . "0"^^ . . . "All objects have pointer to the class object at the beginning of theirs buffer, to know whom to ask for function pointers."^^ . . "0"^^ . . . . . . "<p>I have an Objective-C class that is a proxy to an NSDictionary.</p>\n<pre class="lang-objectivec prettyprint-override"><code>@interface DictionaryProxy : NSProxy\n-(id)objectForKey:(id)key;\n-(void)setObject:(id)obj forKey:(id&lt;NSCopying&gt;)key;\n@end\n</code></pre>\n<p>I have not genericized the class because I do not want the type parameters class-constrained in Swift.</p>\n<p>Swift imports the class as follows:</p>\n<pre class="lang-swift prettyprint-override"><code>class DictionaryProxy : NSProxy {\n func object(forKey key: any NSCopying) -&gt; Any\n func setObject(_ obj: Any, forKey key: any NSCopying)\n}\n</code></pre>\n<p>Is there a way for me to customize how the return type for <code>objectForKey:</code> and the key parameter in <code>setObject:forKey:</code> are imported in Swift? After Swift changed to import <code>id</code> as <code>Any</code>, can I selectively import an <code>id</code> type as an <code>AnyHashable</code> or <code>AnyObject</code>?</p>\n"^^ . "1"^^ . "<p>If you were able to get a list of all apps installed on an iOS device, that would be a really huge security leak.</p>\n<p>Not going to happen.</p>\n"^^ . "0"^^ . "0"^^ . "Is there somekind of notification available which can obtain a field or other control's value when it is selected? I am struggling to find anything online."^^ . "0"^^ . . . . "0"^^ . . "Cropping the image as suggested will also produce output which may be placed in an NSImageView after conversion from a CIImage to an NSImage."^^ . . "0"^^ . . "How can I mock an Objective-C class from Swift code for unit testing?"^^ . . . . . . . . . . "Best way to draw a gradient is to attach image with gradient. If gradient linear you can use resizable image with 1 pixel width."^^ . . . "0"^^ . . "Retrieve an audio file such as an mp3 from the documents directory in Objective-C or Swift"^^ . "Is there a way to force an NSObject to be allocated in stack or static memory?"^^ . . . . . . . "parse-platform"^^ . . "Paulw11, I am doing a fair amount with the audio that originally comes from a remote url. I would like to be able to save it locally, upload it to a server and share it using an activityViewController. I gather for playing it, you can just use the url--either to a lcoal or remote resource. For sharing it using activity view controller you can also use the url although this is not working very well for me... Are there any advantages to working with an AVPlayer item or AVAsset such as compression? The NSData itself of these files is around 4 megs so they add up."^^ . "0"^^ . "1"^^ . . . . . "jailbreak"^^ . . . "UPD same issue with or without modulemap"^^ . . "Still you can build framework with SPM and use it directly"^^ . . "1"^^ . "1"^^ . . "@Sweeper My situation was simplified here. Originally, I have a 1) parent framework that provides interfaces. This framework also have an Objective-C layer that consumes these interfaces for some business logic; 2) A client layer that implement the interfaces in (1) (as macOS and iOS behaves bit differently); 3) A UI layer that should somehow get work with the interfaces, agnostic to the platform (as we use SwiftUI), extend them with Observables; 4) The actual app (iOS/macOS) which instantiate the correct platform interface and send it to the UI."^^ . . "I only fetch the "root" folder (which contains all folders) at the start of the app, and call `subflolders` in the datasource methods. When the user adds, deletes or moves a folder (via buttons, menus or drag&drop), the outline view delegate modifies the underlying model with `insertObject:inSubfoldersAtIndex:` for instance, and it then inserts/deletes/moves rows with NSOutlineView dedicated methods, to allow animation. I usually don't reload the table as it breaks animations. But I do reload rows after the managed object context is saved, to fire faults as mentioned in my post."^^ . . . "If you were in Swift you could potentially use async/await to make your code linear, but it is still going to be an asynchronous operation."^^ . "0"^^ . "0"^^ . . . "<p>Library not loaded: @rpath/CorePaymentCard.framework/CorePaymentCard is the error that keeps popping up on me. I have used CocoaPods to install SquareInAppPaymentsSDK, and it builds, but as soon as it launches it crashes.</p>\n<p>I have done all that needs to be done according to Square's documentation, including the Run Script Phase:</p>\n<pre><code>SETUP_SCRIPT=${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}&quot;/SquareInAppPaymentsSDK.framework/setup&quot;\nif [ -f &quot;$SETUP_SCRIPT&quot; ]; then\n &quot;$SETUP_SCRIPT&quot;\nfi\n</code></pre>\n<p>Any ideas why I'm STILL getting this?</p>\n"^^ . . . . "1"^^ . . . "1"^^ . . . "observable"^^ . . . . "0"^^ . "AutoFill password into UITextField"^^ . . . "Cocoapod integration Issue in Framework as target"^^ . . "0"^^ . "0"^^ . . . "0"^^ . "0"^^ . . . . . . "xcode15"^^ . . . . . . . . . . . "<p>I am asking this out of curiosity, because even if this can technically be done, this is almost certainly unsupported by Apple.</p>\n<p>As far as I can tell, only <code>NSString</code> literals, and possibly <code>NSDictionary</code> literals can be allocated in <code>static</code> memory, because they can be used to initialize global/static <code>NSString *</code> objects, making them compile-time constants, whereas any behind-the-scenes dynamic allocation would be unsuitable for a compile-time constant initializer. For any other <code>NSObject</code>, the only supported way to have one is by using the <code>alloc</code> method.</p>\n<p>If you try to declare a non-pointer to an <code>NSObject</code>, as you would a normal C <code>struct</code> if you wanted one allocated on the stack, such as <code>NSWindow my_window;</code> rather than <code>NSWindow *my_window;</code> a compile-time error results.</p>\n<p>My question is, is there theoretically a way to have an <code>NSObject</code> allocated in stack or static memory? For example, to declare a stack or static buffer, and then 'trick' the Objective-C runtime into using that space for an <code>NSObject</code>? Something along the lines of:</p>\n<pre><code>unsigned char buffer[sizeof(NSWindow)]; // sizeof(NSWindow) is a compile-time error but you get the idea\nNSWindow *window = buffer;\n[window init];\n</code></pre>\n"^^ . "Unable to mount NFS share using mount(2) on macOS"^^ . . . . . . . . . "Tried to use it as a view model, as in the future I'd like to have a ViewModel with few published properties."^^ . "glkit"^^ . . "0"^^ . . "Meaning of Timestamp Retrieved by AudioQueueGetCurrentTime() in AudioQueue Callback"^^ . "0"^^ . . . . . . . . "-2"^^ . "1"^^ . . . "<p>By extending the Car class to conform to ObservableObject, we can update the car's color from both SwiftUI and Objective-C. The UI automatically reflects changes using Combine’s objectWillChange, keeping everything in sync.</p>\n<pre><code>import SwiftUI\nimport Combine\n\nextension Car: ObservableObject {\n public var objectWillChange: ObservableObjectPublisher {\n let willChange = ObservableObjectPublisher()\n let originalChangeColor = self.changeColor\n self.changeColor = {\n willChange.send()\n originalChangeColor()\n }\n return willChange\n }\n \n public static func randomCar() -&gt; Car {\n let colors = [&quot;Red&quot;, &quot;Blue&quot;, &quot;Green&quot;, &quot;Yellow&quot;, &quot;Purple&quot;, &quot;Orange&quot;]\n return Car(color: colors.randomElement() ?? &quot;Red&quot;)\n }\n}\n\n@Observable\nclass ObservableCar&lt;CarT&gt;: ObservableObject where CarT: CarProtocol {\n @Published public var car: CarT\n \n public init(_ car: CarT) {\n self.car = car\n }\n}\n\nstruct SwiftObservableView&lt;CarT&gt;: View where CarT: CarProtocol &amp; ObservableObject {\n @StateObject var car: ObservableCar&lt;CarT&gt;\n \n public init(car: CarT) {\n _car = StateObject(wrappedValue: ObservableCar(car))\n }\n \n var body: some View {\n NavigationStack {\n Form {\n Section(header: Text(&quot;Modification Form&quot;)) {\n VStack {\n TextField(&quot;Color&quot;, text: Binding(get: { car.car.color }, set: { car.car.color = $0 }))\n }\n }\n Section(header: Text(&quot;Results&quot;)) {\n VStack {\n HStack() {\n Text(&quot;Color&quot;)\n Spacer()\n Text(car.car.color)\n }\n }\n }\n Section(header: Text(&quot;Actions&quot;)) {\n Button(&quot;Random Car&quot;) {\n self.car = ObservableCar(Car.randomCar() as! CarT)\n }\n Button(&quot;Assign from Objective-C&quot;) {\n self.car.car.changeColor()\n }\n }\n }\n .navigationTitle(&quot;Car Data (Swift)&quot;)\n }\n }\n}\n\n#Preview {\n SwiftObservableView(car: Car(color: &quot;Green&quot;))\n}\n</code></pre>\n"^^ . . "1"^^ . . . "Thank you, I will look through the code when i'm at my Mac, appeciate the help - i'm always looking to learn!"^^ . "0"^^ . . . . . . "0"^^ . . . "0"^^ . . "xcframework"^^ . "Fun fact: when I copy all the necessary code to a newly created project, errors disappear."^^ . . . "0"^^ . "1"^^ . "0"^^ . . . . . "1"^^ . . "1"^^ . . . . "0"^^ . "0"^^ . "0"^^ . . "JSON only supports strings for keys and doesn't support ordering, so using a `OrderedDictionary` wouldn't help anything. People could probably answer this question, but you can help them by giving them a short/simple snippet they can copy/paste and edit easily, showing the kind of dictionary you're looking to serialize"^^ . . "0"^^ . . . "1"^^ . . . . "Why do you want multiple share extensions? Even if it were supported, it would be a confusing experience for the user, seeing your app more than once in the share sheet."^^ . "CGContextDrawImage: invalid context 0x0. Failed to bind EAGLDrawable to GL_RENDERBUFFER 2"^^ . "0"^^ . . . "I don't have any experience with mocking but did you see [OCMock](https://ocmock.org)?"^^ . "<p>I would just declare ObjcClass conformance in an Swift extension:</p>\n<pre><code>extension ObjcClass: ObjcClassProtocol {\n func doStuff() {\n \n }\n}\n</code></pre>\n<p>Note : do not forget to add ObjcClass.h in Bridging Header file so it can be seen by Swift</p>\n"^^ . . "osx-mavericks"^^ . "<p>in swift ios share extension possible multiple share extension in one project. if yes then how ?\nand how to access swift file in share extension inside used ?\nplease tell me?</p>\n<p>I try to file &gt; new file &gt; target &gt; create share extension multiple but not work only one share extension show in gallery inside share option</p>\n"^^ . "0"^^ . "How to add x509 certificate and private key in http request in swift?"^^ . "foundation"^^ . "mount"^^ . "0"^^ . . "1"^^ . . "Error com.facebook.sdk.core - code: 8 When Switching to FBSDKLoginTrackingLimited"^^ . "<p>I have an promotional offer for a 1 week trial for the app users who is subscribing for the very first time. Here I need to show an additional offer only for the users who are subscribing on certain days. So I am going with the introductory offer.</p>\n<p>For ex) If I am giving the offer for the app for 1 week or one month who are subscribing the app with a special offer for a certain day alone. Here I need to show this offer for few days and revert back the app to an original promotional offer after this special offer.</p>\n<p>Is there any way to make this using the SKProductsRequest using the StoreKit.</p>\n"^^ . . "cocoapods"^^ . "<p>I'm trying to use an Objective-C model via a SwiftUI code. This is a simple demo I made:</p>\n<pre class="lang-objectivec prettyprint-override"><code>@protocol CarProtocol &lt;NSObject&gt;\n@property (strong, readwrite) NSString * color;\n- (void)changeColor;\n@end\n\n@protocol PersonProtocol &lt;NSObject&gt;\n@property (strong, readwrite) NSString * name;\n- (void)changeName;\n@end\n\n@interface Car : NSObject &lt;CarProtocol&gt;\n\n@property (strong, readwrite) NSString * color;\n\n- (instancetype)initWithColor:(NSString *)color;\n- (void)changeColor;\n\n@end\n\n\n@implementation Car\n\n- (instancetype)init {\n if ((self = [super init])) {\n self.color = @&quot;&quot;;\n }\n return self;\n}\n\n\n- (instancetype)initWithColor:(NSString *)color {\n if ((self = [super init])) {\n self.color = color;\n }\n return self;\n}\n\n- (void)changeColor {\n NSArray *colors = @[@&quot;Red&quot;, @&quot;Blue&quot;, @&quot;Green&quot;, @&quot;Yellow&quot;, @&quot;Black&quot;, @&quot;White&quot;];\n NSString *newColor = self.color;\n \n while (self.color == nil || [newColor isEqualToString:self.color]) {\n newColor = colors[arc4random_uniform((uint32_t)colors.count)];\n }\n \n self.color = newColor;\n NSLog(@&quot;The car color has been changed to %@&quot;, self.color);\n}\n\n@end\n</code></pre>\n<p>Then, I'm trying to access the <code>Car</code> object via the <code>CarProtocol</code> from Objective-C. My goal is to be able to modify the <code>Car</code> instance properties from both Swift (say, from a Text Field) and from the ObjC code (say, by calling <code>car.changeColor()</code>).</p>\n<p>I've tried the following:</p>\n<pre class="lang-swift prettyprint-override"><code>import SwiftUI\nimport Combine\n\nextension Car: ObservableObject {\n public var objectWillChange: AnyPublisher&lt;Void, Never&gt; {\n publisher(for: \\.color, options: .prior)\n .map { _ in }\n .eraseToAnyPublisher()\n }\n \n public static func randomCar() -&gt; Car {\n let colors = [&quot;Red&quot;, &quot;Blue&quot;, &quot;Green&quot;, &quot;Yellow&quot;, &quot;Purple&quot;, &quot;Orange&quot;]\n return Car(color: colors.randomElement() ?? &quot;Red&quot;)\n }\n}\n\n\n@Observable\nclass ObservableCar&lt;CarT&gt;\n where CarT: CarProtocol {\n public var car: CarT\n \n public init(_ car: CarT) {\n self.car = car\n }\n}\n\nstruct SwiftObservableView&lt;CarT&gt;: View\n where CarT: CarProtocol &amp; ObservableObject {\n @State var car: ObservableCar&lt;CarT&gt;\n \n public init(car: CarT) {\n self.car = ObservableCar(car)\n }\n \n var body: some View {\n NavigationStack {\n Form {\n Section(header: Text(&quot;Modification Form&quot;)) {\n VStack {\n TextField(&quot;Color&quot;, text: $car.car.color)\n }\n }\n Section(header: Text(&quot;Results&quot;)) {\n VStack {\n HStack() {\n Text(&quot;Color&quot;)\n Spacer()\n Text(car.car.color)\n }\n }\n }\n Section(header: Text(&quot;Actions&quot;)) {\n Button(&quot;Random Car&quot;) {\n self.car = ObservableCar&lt;CarT&gt;(Car.randomCar() as! CarT)\n }\n Button(&quot;Assign from Objective-C&quot;) {\n self.car.car.changeColor()\n }\n }\n }\n .navigationTitle(&quot;Car Data (Swift)&quot;)\n }\n }\n}\n\n#Preview {\n SwiftObservableView(car: Car(color: &quot;Green&quot;))\n}\n</code></pre>\n<p>I can see swift modifications reflects, but not the call to <code>changeColor</code>. Do you have an idea on how to achieve the desired behavior using the new <code>#Observable</code> macros introduced in WWDC23? I could achieve it with plain Combine, <strong>without the usage of protocols</strong>. However, as my code is protocol oriented, I need to rely on protocols.\n<a href="https://i.sstatic.net/pzc5ucZf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/pzc5ucZf.png" alt="screenshot of the created UI" /></a></p>\n<p><strong>Edit:</strong> I've added here the way that I was able to achieve it using Combine</p>\n<pre class="lang-swift prettyprint-override"><code>import SwiftUI\nimport Combine\n\nextension PersonCombine: ObservableObject {\n public var objectWillChange: AnyPublisher&lt;Void, Never&gt; {\n publisher(for: \\.name, options: .prior)\n .map { _ in }\n .eraseToAnyPublisher()\n }\n}\n\nextension CarCombine: ObservableObject {\n public var objectWillChange: AnyPublisher&lt;Void, Never&gt; {\n Publishers.Merge3(\n owner.objectWillChange,\n publisher(for: \\.owner, options: .prior).map { _ in },\n publisher(for: \\.color, options: .prior).map { _ in }\n )\n .eraseToAnyPublisher()\n }\n \n public static func randomCar() -&gt; CarCombine {\n let colors = [&quot;Red&quot;, &quot;Blue&quot;, &quot;Green&quot;, &quot;Yellow&quot;, &quot;Purple&quot;, &quot;Orange&quot;]\n return CarCombine(color: colors.randomElement() ?? &quot;Red&quot;)\n }\n}\n\nstruct CombineView: View {\n @StateObject var car: CarCombine\n \n var body: some View {\n NavigationStack {\n Form {\n Section(header: Text(&quot;Modification Form&quot;)) {\n VStack {\n TextField(&quot;Color&quot;, text: $car.color)\n }\n VStack {\n TextField(&quot;Owner Name&quot;, text: $car.owner.name)\n }\n }\n Section(header: Text(&quot;Results&quot;)) {\n VStack {\n HStack {\n Text(&quot;Color&quot;)\n Spacer()\n Text(car.color)\n }\n }\n VStack {\n HStack {\n Text(&quot;Owner&quot;)\n Spacer()\n Text(car.owner.name)\n }\n }\n }\n Section(header: Text(&quot;Actions&quot;)) {\n Button(&quot;Random Car&quot;) {\n let randomCar = CarCombine.randomCar()\n car.color = randomCar.color\n }\n Button(&quot;Assign Car.Color from Objective-C&quot;) {\n car.changeColor()\n }\n Button(&quot;Assign Person.Name from Objective-C&quot;) {\n car.owner.changeName()\n }\n }\n Section(header: Text(&quot;Owner Details&quot;)) {\n NavigationLink(destination: PersonDetailCombineView(person: car.owner)) {\n HStack {\n Text(&quot;Owner&quot;)\n Spacer()\n Text(car.owner.name)\n }\n }\n }\n }\n .navigationTitle(&quot;Car Data (Combine)&quot;)\n }\n }\n}\n\n#Preview {\n CombineView(car: CarCombine())\n}\n</code></pre>\n"^^ . . . "osx-leopard"^^ . . . . . . "0"^^ . . "bridging-header"^^ . . . "2"^^ . . "0"^^ . . . . "If you just want to share via email, a `URL` and a `UIActivityViewController` is all you need. Is that what you are looking for?"^^ . "cifilter"^^ . . . "1"^^ . "objective-c"^^ . . "0"^^ . . "1"^^ . . . . . . . . . . . . "<p>I'm working on a custom UIView subclass in my iOS project that involves using GLKView and CAEAGLLayer for camera rendering and applying beauty filters. The main goal is to capture video from the camera, process it with beauty filters, and render the output in a custom view. However, I'm encountering several issues related to setting the drawable properties of CAEAGLLayer and rendering the video frames correctly.</p>\n<p>Below is the code:</p>\n<pre><code>#import &quot;FUCameraPlatformView.h&quot;\n#import &quot;OverlayView.h&quot;\n#import &quot;GLView.h&quot; \n#import &lt;GLKit/GLKit.h&gt;\n\n@interface FUCameraPlatformView() &lt;FUCameraDelegate&gt;\n@property (nonatomic, strong) EAGLContext *glContext;\n@property (nonatomic, strong) GLKView *glView;\n@property (nonatomic, strong) CIContext *ciContext;\n@property (nonatomic, strong) GLView *view; \n@property (nonatomic, strong) FUCamera *camera;\n@property (nonatomic, strong) MHBeautyManager *beautyManager;\n@property (nonatomic , strong) OverlayView *overlay;\n@end\n\n@implementation FUCameraPlatformView\n\n- (instancetype)initWithFrame:(CGRect)frame\n viewIdentifier:(int64_t)viewId\n arguments:(id)args\n cameraInstance:(FUCamera *)camera\n binaryMessenger:(NSObject&lt;FlutterBinaryMessenger&gt; *)messenger\n beautyManager:(MHBeautyManager *)manager {\n self = [super init];\n if (self) {\n _beautyManager = manager;\n _beautyManager.delegate = self;\n _camera = camera;\n _camera.delegate = self;\n _view = [[GLView alloc] initWithFrame:frame];\n [self setupGL];\n [self setupCamera];\n }\n return self;\n}\n\n- (void)setupGL {\n _glContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];\n _glView = [[GLKView alloc] initWithFrame:_view.bounds context:self.glContext];\n _glView.enableSetNeedsDisplay = NO;\n _glView.context = self.glContext;\n _glView.drawableDepthFormat = GLKViewDrawableDepthFormat24;\n _ciContext = [CIContext contextWithEAGLContext:_glContext];\n\n // Ensure the drawable properties are set correctly\n CAEAGLLayer *eaglLayer = (CAEAGLLayer *)_view.layer;\n eaglLayer.opaque = YES;\n eaglLayer.contentsScale = [UIScreen mainScreen].scale;\n eaglLayer.drawableProperties = @{\n kEAGLDrawablePropertyRetainedBacking: [NSNumber numberWithBool:NO],\n kEAGLDrawablePropertyColorFormat: kEAGLColorFormatRGBA8\n };\n\n GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);\n if (status != GL_FRAMEBUFFER_COMPLETE) {\n NSLog(@&quot;Failed to make complete framebuffer object %x&quot;, status);\n }\n\n if (![EAGLContext setCurrentContext:self.glContext]) {\n NSLog(@&quot;Failed to set current OpenGL context.&quot;);\n return;\n }\n \n [_view addSubview:_glView];\n\n _overlay = [[OverlayView alloc] initWithFrame:_view.bounds];\n _overlay.backgroundColor = [UIColor clearColor];\n [_view addSubview:_overlay];\n}\n\n\n- (void)showFaceLandmarksAndFaceRectWithPersonsArray:(NSMutableArray *)arrPersons {\n if (_overlay.hidden) {\n _overlay.hidden = NO;\n }\n _overlay.arrPersons = arrPersons;\n [_overlay setNeedsDisplay];\n [_overlay layoutIfNeeded];\n}\n\n- (void)setupCamera {\n [self.camera startCapture];\n}\n\n- (void)didOutputVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer {\n // Check for null sample buffer\n if (!sampleBuffer) {\n return;\n }\n\n CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);\n if (!imageBuffer) {\n return;\n }\n\n OSType formatType = CVPixelBufferGetPixelFormatType(imageBuffer);\n CVPixelBufferLockBaseAddress(imageBuffer, 0);\n\n\n\n CIImage *image = [CIImage imageWithCVPixelBuffer:imageBuffer];\n if (!image) {\n CVPixelBufferUnlockBaseAddress(imageBuffer, 0);\n return;\n }\n\n CIFilter *filter = [CIFilter filterWithName:@&quot;CIPhotoEffectChrome&quot; keysAndValues:kCIInputImageKey, image, nil];\n if (!filter) {\n CVPixelBufferUnlockBaseAddress(imageBuffer, 0);\n return;\n }\n [filter setValue:image forKey:kCIInputImageKey];\n [_glView bindDrawable];\n\n CGFloat width = _glView.drawableHeight / 640.f * 480.f;\n CGFloat height = _glView.drawableHeight;\n CGFloat x = (_glView.drawableWidth - width) / 2;\n\n if (_ciContext) {\n [_ciContext drawImage:filter.outputImage inRect:CGRectMake(x, 0, width, height) fromRect:CGRectMake(0, 0, 480, 640)];\n }\n\n if (self.beautyManager) {\n [self.beautyManager processWithPixelBuffer:imageBuffer formatType:formatType];\n }\n [_glView display];\n\n \n // CVPixelBufferUnlockBaseAddress(imageBuffer, 0);\n}\n\n\n// - (void)didOutputVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer {\n// CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);\n// OSType formatType = CVPixelBufferGetPixelFormatType(imageBuffer);\n// CVPixelBufferLockBaseAddress(imageBuffer, 0);\n// CIImage *image = [CIImage imageWithCVPixelBuffer:imageBuffer];\n// CIFilter *filter = [CIFilter filterWithName:@&quot;CIPhotoEffectChrome&quot; keysAndValues:kCIInputImageKey, image, nil];\n// [filter setValue:image forKey:kCIInputImageKey];\n// [_glView bindDrawable];\n// CGFloat width = _glView.drawableHeight/640.f*480.f;\n// CGFloat height = _glView.drawableHeight;\n// CGFloat x = (_glView.drawableWidth - width) /2;\n// [_ciContext drawImage:filter.outputImage inRect:CGRectMake(x, 0, width, height) fromRect:CGRectMake(0, 0, 480, 640)];\n// [self.beautyManager processWithPixelBuffer:imageBuffer formatType:formatType];\n// [_glView display];\n\n// }\n\n- (UIView *)view {\n return _view;\n}\n\n@end\n</code></pre>\n"^^ . "0"^^ . . "1"^^ . . . . . . "azure"^^ . . . . "ckshare"^^ . . . . . . "0"^^ . . "0"^^ . "pdf"^^ . . "0"^^ . "Hey Willeke, I took a look at NSControlTextDidBeginEditingNotification previously for text fields but I could only get it to fire after I had made a change so I couldn't get it to get the initial value but only the first changed value\n\nHow do I initialise data correctly to get the initial values"^^ . . . "0"^^ . . . . . "1"^^ . . . "Order is not actually important for saving this, only for other operations. That is why I asked about a normal Dictionary."^^ . . . "Even if I don‘t set any associated domain, autofilling password still appears when `textField.isSecureTextEntry = true` and `textField.keyboardType = .default`."^^ . . . "0"^^ . "0"^^ . . . "0"^^ . . . . . . . . . "1"^^ . . . . "0"^^ . "0"^^ . . "Your swift protocol/class are not compatible to objective-c . Missing the @objc and eventually the NSObject dependency."^^ . "I suggest to use SPM for framework creation, even if it's written in `Objective-C`"^^ . . "How can I encode/decode a Swift dictionary with Obj-C objects as keys to and from JSON?"^^ . "1"^^ . "0"^^ . "in swift ios share extension possible multiple share extension in one project. if yes then how?"^^ . . . . . "1"^^ . . . . "<p>You can write a wrapper like this:</p>\n<pre><code>@propertyWrapper\nstruct Wrapper: Codable {\n struct StringCodingKey: CodingKey {\n var intValue: Int? { nil }\n let stringValue: String\n \n init?(intValue: Int) { return nil }\n init(stringValue value: String) { stringValue = value }\n }\n \n var wrappedValue: [ObjcType: SwiftType]\n \n func encode(to encoder: any Encoder) throws {\n var container = encoder.container(keyedBy: StringCodingKey.self)\n for (key, value) in wrappedValue {\n // assuming there is property called 'jsonString'\n let keyString = key.jsonString\n try container.encode(value, forKey: StringCodingKey(stringValue: keyString))\n }\n }\n \n init(wrappedValue: [ObjcType : SwiftType]) {\n self.wrappedValue = wrappedValue\n }\n \n init(from decoder: any Decoder) throws {\n var wrapped = [ObjcType: SwiftType]()\n let container = try decoder.container(keyedBy: StringCodingKey.self)\n for key in container.allKeys {\n // assuming such an initialiser exists\n let objcKey = ObjcType(json: key.stringValue)\n wrapped[objcKey] = try container.decode(SwiftType.self, forKey: key)\n }\n self.wrappedValue = wrapped\n }\n}\n</code></pre>\n<p>Usage:</p>\n<pre><code>// decoding\nJSONDecoder().decode(Wrapper.self, from: someJson).wrappedValue\n\n// encoding\nJSONEncoder().encode(Wrapper(wrapped: yourActualDictionary))\n</code></pre>\n<p>You can also use it as a property wrapper in other <code>Codable</code> types:</p>\n<pre><code>struct SomeOtherCodableType: Codable {\n @Wrapper var dict: [ObjcType: SwiftType]\n}\n</code></pre>\n"^^ . "0"^^ . . . "0"^^ . "uikit"^^ . . "-1"^^ . "0"^^ . . . "0"^^ . . . . . . "share-extension"^^ . . "0"^^ . . . . . "1"^^ . . "Don’t worry. `@Observable` is never meant as a *replacement* for `ObservableObject`."^^ . . . . . . . . . "I did think this but there are a good 30-40 fields, I mean I could save these in a plist or something - however in the controlAction function how would I reference the control to the correct initial value? I appeciate your help :)\n\nI'm surprised there is no notification for like field focus - that would have been easier as I could have just grabbed the value on field focus - and then saved that as oldValue."^^ . "<p>My app maintains <code>Folder</code> objects (an <code>NSManagedObject</code> subclass). Each folder may have <code>subfolders</code> of the same class (an ordered to-many relationship, the reciprocal relationship is called <code>parent</code>). Folders also have a <code>name</code> attribute (<code>NSString</code>).</p>\n<p>Problem: when a subfolder is added/removed to/from a parent folder, for instance via <code>insertObject:inSubfoldersAtIndex:</code> sent to the parent folder, the other subfolders are often turned into faults when the parent folder is saved (which happens when the context is saved). This has detrimental effect as their names disappear from the UI (folders show in an outline view, but this isn't related to the issue, which occurs even if the outline view is removed).</p>\n<p>I have no idea why code data sees fit to turn these subfolders into faults in this situation. It doesn't do it consistently and never does it when the <em>names</em> of folders are changed (which also requires a save). Note: the folder that was inserted into a parent is never turned into a fault. Only other subfolders of the same parent are.</p>\n<p>How can I prevent folders from being turned into faults?</p>\n<p>EDIT: Since the folders that turn into faults are those that are <em>not</em> saved (i.e., that have no pending changes), making changes to these folders prevents them for turning into faults during the next save. So I just make dummy changes to all subfolders (replacing their <code>name</code> with the same values) whenever one of them is inserted or removed. Not the best solution.</p>\n"^^ . . "0"^^ . "But I dont have modulemap in the project"^^ . . . . . "0"^^ . . . . . . . . . . . "0"^^ . . . . . . "I have downloaded your example project and run it and the exported PDF has a black background too - at least in Sonomo 14.3.1 is it exporting with the gradient for you?"^^ . . . . "most efficient way to draw a gradient Objective-C (currently NSColorWell is lagging when moving color sliders)"^^ . . "go"^^ . . "screencapturekit"^^ . "Undo manager with multiple fields"^^ . "Thanks Shim, that was very helpful! I love learning."^^ . . . . "0"^^ . . . . "The problem arises because SecKeyRef and SecCertificateRef objects exist either in memory or in keychain storage. Only keychain-backed objects have the necessary metadata to form an identity. The public key hash, which is required to match private keys to their certificates, is stored within the metadata, which is only available when the key is stored in a keychain.The solution involves exporting the key from memory, then re-importing it into the keychain, which ensures that the necessary metadata, including the public key hash, is correctly populated."^^ . . . . "voiceover"^^ . "0"^^ . "Was there a particular reason why you are adding the background image in `drawRect`?"^^ . "Creating a gradient with CILinearGradient"^^ . . "<p>I have objc project <a href="https://github.com/facebookincubator/SocketRocket" rel="nofollow noreferrer">https://github.com/facebookincubator/SocketRocket</a> which I forked and adding SPM support. I create Package.swift:</p>\n<pre><code>let package = Package(\n name: &quot;SocketRocket&quot;,\n platforms: [\n .iOS(.v12)\n ],\n products: [\n .library(\n name: &quot;SocketRocket&quot;,\n targets: [&quot;SocketRocket&quot;]\n )\n ],\n targets: [\n .target(\n name: &quot;SocketRocket&quot;,\n path: &quot;SocketRocket&quot;,\n publicHeadersPath: &quot;.&quot;\n ),\n .testTarget(\n name: &quot;SocketRocketTests&quot;,\n dependencies: [&quot;SocketRocket&quot;],\n path: &quot;Tests&quot;\n )\n ]\n)\n</code></pre>\n<p>There is an umbrella header file inside of project SocketRocket.h:</p>\n<pre><code>#import &lt;SocketRocket/NSRunLoop+SRWebSocket.h&gt;\n#import &lt;SocketRocket/NSURLRequest+SRWebSocket.h&gt;\n#import &lt;SocketRocket/SRSecurityPolicy.h&gt;\n#import &lt;SocketRocket/SRWebSocket.h&gt;\n</code></pre>\n<p>I created a modulemap:</p>\n<pre><code>module SocketRocket {\n header &quot;SocketRocket.h&quot;\n export *\n}\n</code></pre>\n<p>But there is issue in building package:\nBuilding for debugging...\nfatal error: 'SRDelegateController.h' file not found\n#import &quot;SRDelegateController.h&quot;\n^~~~~~~~~~~~~~~~~~~~~~~~\n1 error generated.</p>\n<p>I think imports is not applying, every time I run again and again there is different number of compiled files(0, 3, 4, 19):</p>\n<p>[0/19] Compiling SRIOConsumerPool.m</p>\n<p>I'm expecting to solve my problem.</p>\n<p><a href="https://i.sstatic.net/65b47seB.png" rel="nofollow noreferrer">Project Structure</a></p>\n"^^ . . "0"^^ . "-1"^^ . . . . "1"^^ . . "Thank you for your suggestion but the client needs framework directly. Hence I am stuck. I am able to build other framework using Xcode 12.3 on different machine. but not with the described specification."^^ . "Hi @Sampath thank you for answer, I am getting one error i.e. `Cannot find 'SecIdentityCreateWithCertificate' in scope` I am using macOS `Sonoma 14.5` with Xcode `15.3`"^^ . . "0"^^ . "How to corroct get notification permission in Objc?"^^ . . . "0"^^ . . . . . . . "nsundomanager"^^ . . "accessibility"^^ . "0"^^ . "0"^^ . "By the way, how did you "achieve it with plain Combine"?"^^ . . . . . "Can we customize how parameters and return types are imported from Objective-C into Swift?"^^ . "That's a bad idea. SwiftUI `View`s are *already* view models. Just write whatever "published properties" you want in your view directly, as `@State`s."^^ . "<p>I have a way to get push permissions.<br>\nBut what I get every time is not the correct value.<br>\nHow can I rewrite this method?<br>\nMy push permission has been enabled, but it still prints out 555 first and then 111.<br>\nBut when I call this method outside, I have already obtained False first.<br>\nHow can I make the whole method normal?<br></p>\n<pre><code>- (BOOL)getNotificationPermission\n{\n __block BOOL hasPermission;\n\n UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];\n [center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings *settings){\n\n switch (settings.authorizationStatus) {\n case UNAuthorizationStatusAuthorized:\n hasPermission = YES;\n NSLog(@&quot;111&quot;);\n break;\n case UNAuthorizationStatusDenied:\n hasPermission = NO;\n NSLog(@&quot;222&quot;);\n break;\n case UNAuthorizationStatusNotDetermined:\n hasPermission = NO;\n NSLog(@&quot;333&quot;);\n break;\n default:\n hasPermission = NO;\n NSLog(@&quot;444&quot;);\n break;\n }\n }];\n\n NSLog(@&quot;555&quot;);\n\n return hasPermission;\n}\n</code></pre>\n<p>Log</p>\n<pre><code>555\n111\n</code></pre>\n"^^ . . "1"^^ . . . . "azure-iot-hub"^^ . . . . . "0"^^ . . . "1"^^ . . . "<p><a href="https://github.com/Lessica/TrollFools" rel="nofollow noreferrer">https://github.com/Lessica/TrollFools</a></p>\n<p>I was reading through this repository and found a code snippet about getting all installed apps on an ios device:</p>\n<pre><code>let allAppList: [LSApplicationProxy] = LSApplicationWorkspace.default().allApplications();\n</code></pre>\n<p>When I download and install tipa from the repository's distribution (TrollStore), I can get the list of all installed apps. But when I compile the install using xcode I can't get the list of apps.</p>\n<p>I don't understand why this is happening?</p>\n"^^ . . . "`NSTreeController` or data source? Post a [mre] please."^^ . "1"^^ . . "<p>I am trying to create objective C Network framework using Xcode 15 with minimum supported iOS version 14.0.</p>\n<p>Here are the steps I am following:</p>\n<ol>\n<li><p>I created New&gt; Project&gt; framework&gt; Objective C&gt; storyboard&gt; Create.</p>\n</li>\n<li><p>Made <code>NetworkManager.h</code> file created by project to public.</p>\n</li>\n<li><p>Added two files <code>MyNetworkRequest.h</code> and <code>MyNetworkRequest.m.</code></p>\n</li>\n<li><p>Made <code>MyNetworkRequest.h</code> &gt; <code>Public</code> from inspector.</p>\n</li>\n<li><p>Added <code>#import &lt; NetworkManager/MyNetworkRequest.h&gt;</code> in the <code>NetworkManager.h</code></p>\n</li>\n<li><p>From Project &gt; Target &gt; Build Setting &gt; set <code>SKIP_INSTALL = NO</code> and <code>Build Libraries for distribution = YES</code></p>\n</li>\n<li><p>Added script for making framework : select target from top bar&gt; Edit scheme&gt; Archive&gt; Post action&gt; Add run script&gt; copy pasted following script:</p>\n<pre><code>UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-Universal\n\n# Build Device and Simulator versions\nxcodebuild -target &quot;${PROJECT_NAME}&quot; -configuration ${CONFIGURATION} -sdk \n\niphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR=&quot;${BUILD_DIR}&quot; BUILD_ROOT=&quot;${BUILD_ROOT}&quot; clean build\n xcodebuild -target &quot;${PROJECT_NAME}&quot; ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR=&quot;${BUILD_DIR}&quot; BUILD_ROOT=&quot;${BUILD_ROOT}&quot; clean build\n # Copy the framework structure (from iphoneos build) to the universal folder\n cp -R &quot;${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework&quot; &quot;${UNIVERSAL_OUTPUTFOLDER}/&quot;\n\n# iOS - Copy the framework structure to the universal folder (clean it first)\nrm -rf &quot;${UNIVERSAL_OUTPUTFOLDER}&quot;\n# Make sure the output directory exists\nmkdir -p &quot;${UNIVERSAL_OUTPUTFOLDER}&quot;\n\n# Copy Swift modules from iphonesimulator build (if it exists) to the copied framework directory\nBUILD_PRODUCTS=&quot;${SYMROOT}/../../../../Products&quot;\ncp -R &quot;${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework&quot; &quot;${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework&quot;\n\n# Create universal binary file using lipo and place the combined executable in the copied framework directory\nlipo -create -output \n\n&quot;${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}&quot; &quot;${BUILD_PRODUCTS}/Debug-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}&quot; &quot;${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}&quot;\n\n# Copy the framework to the project directory\ncp -R &quot;${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework&quot; &quot;${PROJECT_DIR}&quot;\n\n# Open the project directory in Finder\n#open &quot;${PROJECT_DIR}&quot;\nfi\n</code></pre>\n</li>\n<li><p>build and make archive.</p>\n</li>\n<li><p>Open the archive by right clicking and show file content&gt; does not contain framework in any enclosing folder.</p>\n</li>\n</ol>\n"^^ . . . . . . . "core-graphics"^^ . "0"^^ . . . . . . . "0"^^ . . "0"^^ . . "1"^^ . "<p>I want to exclude a directory in documents storage class from backup.</p>\n<p>Setting exclusion attribute like so</p>\n<pre><code>+ (BOOL)kit_addSkipBackupAttributeForItemAtURL:(NSURL *)url\n{\n if (![[NSFileManager defaultManager] fileExistsAtPath:url.path]) {\n return NO;\n }\n NSError *error = nil;\n NSNumber *value = nil;\n BOOL success = [url getResourceValue:&amp;value forKey:NSURLIsExcludedFromBackupKey error:&amp;error];\n if (value.boolValue == YES) {\n NSLog(@&quot;ALREADY Excluded %@ from backup&quot;, [url absoluteString]);\n return YES;\n }\n success = [url setResourceValue:@(YES)\n forKey:NSURLIsExcludedFromBackupKey\n error:&amp;error];\n if (!success){\n NSLog(@&quot;Error excluding %@ from backup: %@&quot;, [url lastPathComponent], error);\n }\n success = [url getResourceValue:&amp;value\n forKey:NSURLIsExcludedFromBackupKey\n error:&amp;error];\n NSAssert(success, @&quot;The backup exclusion attribute is missing&quot;);\n NSLog(@&quot;Excluding %@ from backup&quot;, [url absoluteString]);\n NSAssert(value.boolValue, @&quot;The backup exclusion attribute is false&quot;);\n return success;\n}\n</code></pre>\n<p>does trip: value.boolValue is NO and listing the directory later on using ls -la@ {directoryname} does not show that attribute. Somehow it does not stick for some items in the filesystem (within the same storage class!).</p>\n"^^ . "Exclusion of a directory from backup : NSURLIsExcludedFromBackupKey does not always stick even though setResourceValue has reported success"^^ . "ffmpeg"^^ . "Are you sharing *from* your app or *to* your app? Since you are talking about a share extension, I presume you are sharing *to* your app, in which case your Share Extension is responsible for presenting an appropriate UI that asks the user if they want to share to a Post or to a Chat."^^ . "<p>I want to add x509 certificate and private key in https request in swift. I am new in swift so I need help. I am not sure what should I use to achieve this. I want to call this <a href="https://learn.microsoft.com/en-us/azure/iot-dps/how-to-control-access#certificate-based-authentication" rel="nofollow noreferrer">API</a></p>\n<p>I have tried this till now.</p>\n<pre><code>import UIKit\nimport Foundation\nimport Security\n@objc(AzureProvisionWithCertificate)\nclass AzureProvisionWithCertificate: NSObject {\n @objc(provisionAndUploadFile:withRegistrationId:withKey:withCertificate:withProvisionHost:withFileNameWithFolder:withModelId:withResolver:withRejecter:)\n func provisionAndUploadFile(scopeId:String, registrationId:String, key:String, certificate:String, provisionHost:String, fileNameWithFolder:String, modelId:String, resolve:@escaping RCTPromiseResolveBlock, reject:@escaping RCTPromiseRejectBlock) -&gt; Void {\n\n let url = URL(string: &quot;https://global.azure-devices-provisioning.net/\\(scopeId)/registrations/\\(registrationId)/register?api-version=2021-06-01&quot;)!\n\n var request = URLRequest(url: url)\n request.httpMethod = &quot;PUT&quot;\n request.setValue(&quot;application/json&quot;, forHTTPHeaderField: &quot;Content-Type&quot;)\n request.setValue(&quot;utf-8&quot;, forHTTPHeaderField: &quot;Content-Encoding&quot;)\n let bodyData = [&quot;registrationId&quot;: registrationId]\n let jsonData = try? JSONSerialization.data(withJSONObject: bodyData)\n request.httpBody = jsonData\n let sessionConfig = URLSessionConfiguration.default\n let session = URLSession(configuration: sessionConfig)\n let task = session.dataTask(with: request) { (data, response, error) in\n if let error = error {\n reject(&quot;Error&quot;, error.localizedDescription, error)\n } else if let data = data {\n let responseString = String(data: data, encoding: .utf8)\n resolve(&quot;Response data: \\(responseString)&quot;)\n } else {\n reject(&quot;Error&quot;, &quot;No data received&quot;, nil)\n }\n }\n\n task.resume()\n }\n}\n</code></pre>\n"^^ . . . . . . . . . "A minimal example would already require posting header and m files for the entity, as well as the core data model. To summarise I don't use an `NSTreeController`. I use standard datasource methods. `numberOfChildrenOfItem: returns `subfolders.count`, `childOfItem:AtIndex` returns the folder at the index in the `subfolders` relationship and `objectValueForTableColumn:byItem` returns the item (a folder). There is a single column, and the text field of a cell is bound to the `name` attribute of the cell's `objectValue` (which is a folder)."^^ . "0"^^ . "@PtitXav my bad, forgot to add the \\@objc to the question. The original code does have it. Thanks for pointing it out!"^^ . . . . . . . . "<p>You are looking for <a href="https://developer.apple.com/documentation/uikit/uipangesturerecognizer/1621209-velocity" rel="nofollow noreferrer"><code>velocity(in:)</code></a>, which gives you points per second at the moment of measurement (which should be the moment of the gesture's <code>.ended</code>). What I do is convert this &quot;momentum&quot; into a spring animation's <code>initialVelocity</code> to bring the motion gently to a halt.</p>\n<p>Alternatively, depending on what you're trying to do here, you might find UIKit Dynamics a better fit for your use case.</p>\n"^^ . . "0"^^ . . "Error while building SPM package with ObjC code"^^ . "flutter"^^ . . . . "Create a file url from your string and then use https://developer.apple.com/documentation/avfoundation/avasset/1389943-init and then use that to create an `AVPlayerItem` ?"^^ . "archive"^^ . . . "<p>One way to visualize the output is to draw the CIImage into an NSView. A CIContext derived from the NSView's NSGraphicsContext is used with this technique. You may run the following source code in Xcode by copy/pasting into the 'main' after deleting pre-existing code and also deleting the pre-supplied AppDelegate files.\nNote that I changed the 'vectorWithX:' from zero to 400 on point1 of the first filter.</p>\n<pre><code>#import &lt;Cocoa/Cocoa.h&gt;\n#import &lt;CoreImage/CIImage.h&gt;\n#import &lt;CoreImage/CIFilter.h&gt;\n#import &lt;CoreImage/CIContext.h&gt;\n\n@interface CustomView : NSView\n@end\n\n@implementation CustomView\n\n- (id)initWithFrame:(NSRect)frameRect {\n if ((self = [super initWithFrame:frameRect]) != nil) {\n // Add initialization code here\n }\n return self;\n}\n\n-(CIImage *) drawLinearGradient: (CGContextRef) context frame: (CGRect) viewBounds {\n \n CIFilter *gradientfilter = [CIFilter filterWithName:@&quot;CILinearGradient&quot;];\n [gradientfilter setValue:[CIVector vectorWithX:0 Y:0.75*400] forKey:@&quot;inputPoint0&quot;];\n [gradientfilter setValue:[CIColor colorWithRed:0 green:1 blue:0 alpha:1] forKey:@&quot;inputColor0&quot;];\n [gradientfilter setValue:[CIVector vectorWithX:400 Y:0.5*400] forKey:@&quot;inputPoint1&quot;];\n [gradientfilter setValue:[CIColor colorWithRed:0 green:1 blue:0 alpha:0] forKey:@&quot;inputColor1&quot;];\n \n CIFilter *gradientfilter2 = [CIFilter filterWithName:@&quot;CILinearGradient&quot;];\n [gradientfilter2 setValue:[CIVector vectorWithX:0 Y:0.25*400] forKey:@&quot;inputPoint0&quot;];\n [gradientfilter2 setValue:[CIColor colorWithRed:0 green:1 blue:0 alpha:1] forKey:@&quot;inputColor0&quot;];\n [gradientfilter2 setValue:[CIVector vectorWithX:0 Y:0.5 *400] forKey:@&quot;inputPoint1&quot;];\n [gradientfilter2 setValue:[CIColor colorWithRed:0 green:1 blue:0 alpha:0] forKey:@&quot;inputColor1&quot;];\n \n CIFilter *compositingFilter = [CIFilter filterWithName:@&quot;CIAdditionCompositing&quot;];\n [compositingFilter setValue:gradientfilter.outputImage forKey:kCIInputImageKey];\n [compositingFilter setValue:gradientfilter2.outputImage forKey:kCIInputBackgroundImageKey];\n \n CIImage *outImage = compositingFilter.outputImage;\n NSLog(@&quot;CIImage = %@&quot;,outImage);\n CIContext *outputCIContext = [CIContext contextWithCGContext:context options:NULL];\n NSLog (@&quot;outputCIContext = %@&quot;,outputCIContext);\n [outputCIContext drawImage:outImage inRect:viewBounds fromRect:CGRectMake(0,0,400,400)];\n return outImage;\n}\n\n- (void)drawRect:(NSRect)rect {\n CGContextRef ctx = [[NSGraphicsContext currentContext] CGContext];\n [self drawLinearGradient:ctx frame:NSRectToCGRect(rect)];\n}\n\n-(BOOL)isFlipped {\n return YES;\n}\n@end\n\n\n@interface AppDelegate : NSObject &lt;NSApplicationDelegate&gt; {\n NSWindow *window;\n}\n\n-(void) buildMenu;\n-(void) buildWindow;\n\n@end\n\n@implementation AppDelegate\n\n- (void) buildMenu {\n NSMenu *menubar = [NSMenu new];\n NSMenuItem *menuBarItem = [NSMenuItem new];\n [menubar addItem:menuBarItem];\n [NSApp setMainMenu:menubar];\n NSMenu *appMenu = [NSMenu new];\n NSMenuItem *quitMenuItem = [[NSMenuItem alloc] initWithTitle:@&quot;Quit&quot;\n action:@selector(terminate:) keyEquivalent:@&quot;q&quot;];\n [appMenu addItem:quitMenuItem];\n [menuBarItem setSubmenu:appMenu];\n}\n\n- (void) buildWindow {\n#define _wndW 700\n#define _wndH 650\n \n window = [[NSWindow alloc] initWithContentRect: NSMakeRect( 0, 0, _wndW, _wndH )\n styleMask: NSWindowStyleMaskTitled | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable\n backing: NSBackingStoreBuffered defer: NO];\n \n [window center];\n [window setTitle: @&quot;Test window&quot;];\n [window makeKeyAndOrderFront: nil];\n \n // **** Custom View **** //\n CustomView *view = [[CustomView alloc]initWithFrame:NSMakeRect( 20, 80, _wndW - 40, _wndH - 100 )];\n [[window contentView] addSubview:view];\n \n // ***** Quit btn ***** //\n NSButton *quitBtn = [[NSButton alloc]initWithFrame:NSMakeRect( _wndW - 50, 5, 40, 40 )];\n [quitBtn setBezelStyle:NSBezelStyleCircular ];\n [quitBtn setTitle: @&quot;Q&quot; ];\n [quitBtn setAutoresizingMask: NSViewMinXMargin];\n [quitBtn setAction:@selector(terminate:)];\n [[window contentView] addSubview: quitBtn];\n}\n\n- (void) applicationWillFinishLaunching: (NSNotification *)notification {\n [self buildMenu];\n [self buildWindow];\n}\n\n- (void) applicationDidFinishLaunching: (NSNotification *)notification {\n}\n@end\n\nint main (){\n NSApplication *application = [NSApplication sharedApplication];\n AppDelegate *appDelegate = [[AppDelegate alloc] init];\n [application setDelegate:appDelegate];\n [NSApp activateIgnoringOtherApps:YES];\n [application run];\n return 0;\n}\n\n</code></pre>\n<p><strong>Alternate technique using NSImageView:</strong></p>\n<ol>\n<li>Crop the CIImage with the code in the first comment; it's infinite in size initially.</li>\n<li>Convert CIImage to NSImage with the following code and insert into NSImageView:</li>\n</ol>\n<pre><code>NSCIImageRep *imageRep = [NSCIImageRep imageRepWithCIImage:ciImage];\nNSImage *image = [[NSImage alloc] initWithSize:[imageRep size]];\n[image addRepresentation:imageRep];\n[imageView setImage:image];\n\n</code></pre>\n"^^ . . "the private key has no place in the http request. certificate authentication occurs at the transport layer (TLS). to make the communication, you need to add the certificate (and its private key) to the repository that your application uses. the rest is up to the operating system."^^ . "<p>I'm trying to unit test a Swift class that depends on an Objective-C class. Call these <code>SwiftClass</code> and <code>ObjcClass</code>.</p>\n<p>I created a protocol that contains the methods/properties of <code>ObjcClass</code> that <code>SwiftClass</code> needs. I created a stub (call it <code>ObjcClassMock</code>) that implements those methods and properties. So I tried to do this:</p>\n<pre><code>// ObjcClass is in its own .m and .h files somewhere...\n\n// In Swift:\n\n@objc protocol ObjcClassProtocol {\n func doStuff()\n}\n\nclass ObjcClassMock: ObjcClassProtocol {\n func doStuff() { /* sike, actually do nothing */ }\n}\n\nclass SwiftClass {\n let objcClass: ObjcClassProtocol\n // default to ObjcClass's singleton for compatibility with older code\n init(objcClass: ObjcClassProtocol = ObjcClass.shared()) { ... }\n}\n\n// In tests:\n\nfunc testSwiftClass() {\n let swiftClass = SwiftClass(objcClass: ObjcClassMock())\n}\n</code></pre>\n<p>Now the issue here is that <code>ObjcClass</code> does not implicitly conform to this new protocol, even though it does contain all methods and properties that the protocol requires, which I guess makes sense. Force casting it to <code>any ObjcClassProtocol</code> crashes at runtime (<code>Could not cast value of type ObjcClass to ObjcClassProtocol</code> - I guess that also makes sense).</p>\n<p>From what I see, I have a couple of options:</p>\n<ul>\n<li>Make <code>ObjcClass</code> conform to <code>ObjcClassProtocol</code> explicitly. I'm not that familiar with Objective-C, so I may be missing something here, but this seems nontrivial. In particular it seems like it would require segregating the protocol methods into their own block. <code>ObjcClass</code> is also used in other places, and there is nothing that groups these particular methods together other than the fact that they are what <code>SwiftClass</code> happens to need, so I do not want to do that. (The project structure is a mess but it is what it is.) If this was Swift I could just add <code>class ObjcClass: ObjcClassProtocol</code> to <code>ObjcClass</code>'s declaration and not change anything else. Can I do something similar in Objective-C?</li>\n<li>Giving up Swift's type safety somehow and using Objective-C dynamic dispatch. Haven't really figured out how this might work yet. I assume it is possible but I don't like the idea of giving up type safety.</li>\n<li>Perhaps other, more esoteric stuff, like type erasure</li>\n</ul>\n<p>It feels like I'm barking up the wrong tree. I'm quite new to interoping between Swift and Objective-C so it feels like there is something obvious I'm missing. Surely there is an easier way to do what I want?</p>\n"^^ . . . . . . "<p>Have you set your associated domains? According to the <a href="https://developer.apple.com/documentation/security/password_autofill/about_the_password_autofill_workflow#3001197" rel="nofollow noreferrer">Apple Developer Documentation</a> You have to have some domains associated with your app to have the AutoFill functionality.</p>\n<blockquote>\n<p>When your app installs on an iOS device, the system attempts to\nassociate the app with all the domains listed in the app’s Associated\nDomains Entitlement:</p>\n<p>The system takes each domain from the Associated Domains Entitlement.</p>\n<p>It tries to download the Apple App Site Association file\n(apple-app-site-association) for that domain.</p>\n<p>If all the steps succeed, the system associates the app with that\ndomain, and enables Password AutoFill for that domain’s credentials.</p>\n</blockquote>\n"^^ . "<p>Hello I have an NSGradient which I had hoped to drawin to the rect using the following code:</p>\n<pre><code> [g drawInRect:[self bounds] angle:90];\n</code></pre>\n<p>However the issue is to get the PDF data using the below produces a black color rather than the gradient.</p>\n<pre><code>[myView dataWithPDFInsideRect:myView.bounds];\n</code></pre>\n<p>My solution currently is to create an NSImage from the gradient drawn on a rect - and draw the image - but obviously the performance of drawing this is bad - especially when changing colours.</p>\n<p>I am trying to use the gradient as a background which you can change the colors with objects drawn on top.</p>\n<p>Is there a better way to draw a gradient which works with dataWithPDFInsideRect, that's efficient so the NSColorWell sliders don't lag?</p>\n<p>I'm sure there musy be an efficient way but i'm obviously looking in the wrong direction!</p>\n"^^ . "TrollStore IOS swift Get Installed Apps about LSApplicationWorkspace.default().allApplications()"^^ . . "0"^^ . "Have you tried adding `< ObjcClassProtocol >` to `ObjcClass`? See [Conforming to Protocols](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithProtocols/WorkingwithProtocols.html#//apple_ref/doc/uid/TP40011210-CH11-SW3). You can try to do something similar as `class ObjcClass: ObjcClassProtocol` in Objective-C. It's called a Category."^^ . . "0"^^ . . . "<p>Hello i've been doing some with with CIFilters and I have a basic understanding of many of the basic ones such as hue, brightness etc..</p>\n<p>What i'm trying to understand is how to create a linear gradient using CIFilter, below is my attempt but when I put the outImage into an imageview nothing is displaying, what am I doing wrong?</p>\n<pre><code>\n CIFilter *gradientfilter = [CIFilter filterWithName:@&quot;CILinearGradient&quot;];\n [gradientfilter setValue:[CIVector vectorWithX:0 Y:0.75*img.size.height] forKey:@&quot;inputPoint0&quot;];\n [gradientfilter setValue:[CIColor colorWithRed:0 green:1 blue:0 alpha:1] forKey:@&quot;inputColor0&quot;];\n [gradientfilter setValue:[CIVector vectorWithX:0 Y:0.5 *img.size.height] forKey:@&quot;inputPoint1&quot;];\n [gradientfilter setValue:[CIColor colorWithRed:0 green:1 blue:0 alpha:0] forKey:@&quot;inputColor1&quot;];\n \n CIFilter *gradientfilter2 = [CIFilter filterWithName:@&quot;CILinearGradient&quot;];\n [gradientfilter2 setValue:[CIVector vectorWithX:0 Y:0.25*img.size.height] forKey:@&quot;inputPoint0&quot;];\n [gradientfilter2 setValue:[CIColor colorWithRed:0 green:1 blue:0 alpha:1] forKey:@&quot;inputColor0&quot;];\n [gradientfilter2 setValue:[CIVector vectorWithX:0 Y:0.5 *img.size.height] forKey:@&quot;inputPoint1&quot;];\n [gradientfilter2 setValue:[CIColor colorWithRed:0 green:1 blue:0 alpha:0] forKey:@&quot;inputColor1&quot;];\n \n CIFilter *compositingFilter = [CIFilter filterWithName:@&quot;CIAdditionCompositing&quot;];\n [compositingFilter setValue:gradientfilter.outputImage forKey:kCIInputImageKey];\n [compositingFilter setValue:gradientfilter2.outputImage forKey:kCIInputBackgroundImageKey];\n \n outImage = compositingFilter.outputImage;\n\n</code></pre>\n"^^ . . "1"^^ . "@Sweeper I'm just worried that Combine will be deprecated soon due to the introduction of Observables, and then my code won't work anymore."^^ . . . . "0"^^ . "2"^^ . . "0"^^ . "<p>Facebook asked us to switch the tracking mode from enable to limited some time ago. I made this change, but I am getting the error &quot;com.facebook.sdk.core - code: 8&quot;. I have been researching for a while, but I couldn't find any information to solve my problem.</p>\n<p>My objective-c code</p>\n<pre><code>-(void) createLoginPopup\n{\n FBSDKLoginManager *login = [FBSDKLoginManager new];\n FBSDKLoginConfiguration *configuration =\n [[FBSDKLoginConfiguration alloc] initWithPermissions:@[@&quot;public_profile&quot;,@&quot;user_friends&quot;]\n tracking:FBSDKLoginTrackingLimited];\n \n [login\n logInFromViewController:(UIViewController*)(((AppController *)[[UIApplication sharedApplication] delegate]).viewController)\n configuration:configuration\n completion:^(FBSDKLoginManagerLoginResult *result, NSError *error)\n {\n if (error || result.isCancelled)\n {\n NSLog(@&quot;FacebookManagerIOS - Cancelled&quot;);\n \n [self connectionToFacebookCompleted:NO];\n }\n else\n {\n NSLog(@&quot;FacebookManagerIOS - Logged in&quot;);\n \n [self updateFacebookDefaults\n :[[FBSDKAccessToken currentAccessToken] tokenString]\n :[[FBSDKAccessToken currentAccessToken] expirationDate]\n :[[FBSDKAccessToken currentAccessToken] userID]];\n \n [self connectionToFacebookCompleted:YES];\n }\n }];\n}\n</code></pre>\n<p>If I change FBSDKLoginTrackingLimited to FBSDKLoginTrackingEnabled in this code, everything works correctly.</p>\n<p><a href="https://i.sstatic.net/9nx1wNLK.png" rel="nofollow noreferrer">error</a></p>\n<p>I tried the changes mentioned in the documentation, but I couldn't reach a solution. I looked at posts from other people experiencing the same problem, but I couldn't find a solution.</p>\n"^^ . . . "<p>Tough to say, without seeing more of your code, but, here is a quick example...</p>\n<p>Start a new MacOS app project</p>\n<p>Add a new <code>NSView</code> class named &quot;SimpleGradientView`:</p>\n<p><strong>SimpleGradientView.h</strong></p>\n<pre><code>#import &lt;Cocoa/Cocoa.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n@interface SimpleGradientView : NSView\n@end\nNS_ASSUME_NONNULL_END\n</code></pre>\n<hr />\n<p><strong>SimpleGradientView.m</strong></p>\n<pre><code>#import &quot;SimpleGradientView.h&quot;\n\n@implementation SimpleGradientView\n\n- (void)drawRect:(NSRect)dirtyRect {\n [super drawRect:dirtyRect];\n NSGradient *bg = [[NSGradient alloc] initWithColors:@[NSColor.redColor, NSColor.yellowColor]];\n [bg drawInRect:self.bounds angle:90.0];\n}\n\n@end\n</code></pre>\n<hr />\n<p><strong>ViewController.h</strong></p>\n<pre><code>#import &lt;Cocoa/Cocoa.h&gt;\n\n@interface ViewController : NSViewController\n@end\n</code></pre>\n<hr />\n<p><strong>ViewController.m</strong></p>\n<pre><code>#import &quot;ViewController.h&quot;\n#import &quot;SimpleGradientView.h&quot;\n\n@interface ViewController ()\n{\n SimpleGradientView *gradView;\n}\n\n@end\n\n@implementation ViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n \n self.preferredContentSize = NSMakeSize(600.0, 480.0);\n \n gradView = [SimpleGradientView new];\n \n // Create a button\n NSButton *button = [[NSButton alloc] initWithFrame:NSMakeRect(150, 125, 100, 50)];\n [button setTitle:@&quot;Save as PDF&quot;];\n [button setButtonType:NSButtonTypeMomentaryPushIn];\n [button setBezelStyle:NSBezelStyleRounded];\n [button setTarget:self];\n [button setAction:@selector(saveAsPDF:)];\n \n // Create a label\n NSTextField *label = [[NSTextField alloc] initWithFrame:NSMakeRect(40, 20, 200, 45)];\n [label setStringValue:@&quot;Hello, PDF!&quot;];\n [label setBezeled:NO];\n [label setDrawsBackground:NO];\n [label setEditable:NO];\n [label setSelectable:NO];\n \n NSFontManager *fontManager = [NSFontManager sharedFontManager];\n NSFont *boldItalic = [fontManager fontWithFamily:@&quot;Verdana&quot;\n traits:NSBoldFontMask|NSItalicFontMask\n weight:0 size:48];\n \n // create an image view with image\n NSImage *img = [NSImage imageWithSystemSymbolName:@&quot;apple.logo&quot; accessibilityDescription:@&quot;&quot;];\n NSImageView *iv = [NSImageView new];\n iv.image = img;\n iv.imageScaling = NSImageScaleProportionallyUpOrDown;\n iv.contentTintColor = NSColor.cyanColor;\n \n [label setFont:boldItalic];\n [label setTextColor:NSColor.blueColor];\n \n button.translatesAutoresizingMaskIntoConstraints = NO;\n [self.view addSubview:button];\n \n gradView.translatesAutoresizingMaskIntoConstraints = NO;\n [self.view addSubview:gradView];\n \n label.translatesAutoresizingMaskIntoConstraints = NO;\n [gradView addSubview:label];\n \n iv.translatesAutoresizingMaskIntoConstraints = NO;\n [gradView addSubview:iv];\n \n [NSLayoutConstraint activateConstraints:@[\n \n [button.topAnchor constraintEqualToAnchor:self.view.topAnchor constant:20.0],\n [button.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor],\n \n [gradView.topAnchor constraintEqualToAnchor:button.bottomAnchor constant:20.0],\n [gradView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor constant:40.0],\n [gradView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor constant:-40.0],\n [gradView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor constant:-40.0],\n \n [label.topAnchor constraintEqualToAnchor:gradView.topAnchor constant:20.0],\n [label.centerXAnchor constraintEqualToAnchor:gradView.centerXAnchor],\n \n [iv.topAnchor constraintEqualToAnchor:label.bottomAnchor constant:20.0],\n [iv.centerXAnchor constraintEqualToAnchor:gradView.centerXAnchor],\n [iv.bottomAnchor constraintEqualToAnchor:gradView.bottomAnchor constant:-20.0],\n [iv.widthAnchor constraintEqualToAnchor:iv.heightAnchor],\n \n ]];\n \n}\n\n- (void)saveAsPDF:(id)sender {\n NSData *pdfData = [gradView dataWithPDFInsideRect:[gradView bounds]];\n NSSavePanel *savePanel = [NSSavePanel savePanel];\n [savePanel setAllowedFileTypes:@[@&quot;pdf&quot;]];\n [savePanel setNameFieldStringValue:@&quot;MyView.pdf&quot;];\n \n [savePanel beginWithCompletionHandler:^(NSModalResponse result) {\n if (result == NSModalResponseOK) {\n NSURL *fileURL = [savePanel URL];\n [pdfData writeToURL:fileURL atomically:YES];\n NSLog(@&quot;PDF saved to %@&quot;, fileURL);\n }\n }];\n}\n\n- (void)setRepresentedObject:(id)representedObject {\n [super setRepresentedObject:representedObject];\n}\n\n@end\n</code></pre>\n<p>When run, it should look like this:</p>\n<p><a href="https://i.sstatic.net/AJCht7X8.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AJCht7X8.png" alt="enter image description here" /></a></p>\n<p>Clicking the button will save the gradient view - along with its subviews - as a PDF file. Example: <a href="https://github.com/DonMag/SavePDFMacApp/blob/main/MyView.pdf" rel="nofollow noreferrer">https://github.com/DonMag/SavePDFMacApp/blob/main/MyView.pdf</a></p>\n<p>I posted the complete project here: <a href="https://github.com/DonMag/SavePDFMacApp" rel="nofollow noreferrer">https://github.com/DonMag/SavePDFMacApp</a></p>\n<hr />\n<p><strong>Edit</strong></p>\n<p>Curious... this is either a Bug, or there was a change that I can't find between Ventura and Sonoma</p>\n<p>Using <code>dataWithPDFInsideRect</code> does not appear to render the gradient -- either using <code>drawRect</code> <em><strong>or</strong></em> using a <code>CAGradientLayer</code>.</p>\n<p>Generating a gradient image looks to be a reliable approach.</p>\n<p>I updated my GitHub repo with an example.</p>\n"^^ . "-1"^^ . . "0"^^ . . "0"^^ . "0"^^ . . . . "0"^^ . . "Problems in saving NSView with subviews to PDF"^^ . . "<p>I'm working on an audio project and have a question regarding the meaning of the timestamp retrieved by AudioQueueGetCurrentTime().</p>\n<p>According to the Apple Developer Documentation, the following calculation gives the audio time being played (since AudioQueueStart):</p>\n<pre><code>- (Float64) GetCurrentTime {\n AudioTimeStamp c; \n AudioQueueGetCurrentTime(playState.queue, NULL, &amp;c, NULL); \n return c.mSampleTime / _av-&gt;audio.sample_rate;\n}\n</code></pre>\n<p>However, in a project I'm working on, I noticed the following code inside the fillAudioBuffer callback function of AudioQueue:</p>\n<pre><code>\nstatic void fillAudioBuffer(AudioQueueRef queue, AudioQueueBufferRef buffer){\n \n int lengthCopied = INT32_MAX;\n int dts= 0;\n int isDone = 0;\n\n buffer-&gt;mAudioDataByteSize = 0;\n buffer-&gt;mPacketDescriptionCount = 0;\n \n OSStatus err = 0;\n AudioTimeStamp bufferStartTime;\n\n AudioQueueGetCurrentTime(queue, NULL, &amp;bufferStartTime, NULL);\n \n\n \n while(buffer-&gt;mPacketDescriptionCount &lt; numPacketsToRead &amp;&amp; lengthCopied &gt; 0){\n if (buffer-&gt;mAudioDataByteSize) {\n break;\n }\n \n lengthCopied = getNextAudio(_av,buffer-&gt;mAudioDataBytesCapacity-buffer-&gt;mAudioDataByteSize, (uint8_t*)buffer-&gt;mAudioData+buffer-&gt;mAudioDataByteSize,&amp;dts,&amp;isDone);\n if(!lengthCopied || isDone) break;\n \n if(aqStartDts &lt; 0) aqStartDts = dts;\n if (dts&gt;0) currentDts = dts;\n if(buffer-&gt;mPacketDescriptionCount ==0){\n bufferStartTime.mFlags = kAudioTimeStampSampleTimeValid;\n bufferStartTime.mSampleTime = (Float64)(dts-aqStartDts) * _av-&gt;audio.frame_size;\n \n if (bufferStartTime.mSampleTime &lt;0 ) bufferStartTime.mSampleTime = 0;\n PMSG2(&quot;AQHandler.m fillAudioBuffer: DTS for %x: %lf time base: %lf StartDTS: %d\\n&quot;, (unsigned int)buffer, bufferStartTime.mSampleTime, _av-&gt;audio.time_base, aqStartDts);\n \n }\n buffer-&gt;mPacketDescriptions[buffer-&gt;mPacketDescriptionCount].mStartOffset = buffer-&gt;mAudioDataByteSize;\n buffer-&gt;mPacketDescriptions[buffer-&gt;mPacketDescriptionCount].mDataByteSize = lengthCopied;\n buffer-&gt;mPacketDescriptions[buffer-&gt;mPacketDescriptionCount].mVariableFramesInPacket = _av-&gt;audio.frame_size;\n \n buffer-&gt;mPacketDescriptionCount++;\n buffer-&gt;mAudioDataByteSize += lengthCopied;\n \n }\n \n#ifdef DEBUG\n int audioBufferCount, audioBufferTotal, videoBufferCount, videoBufferTotal;\n bufferCheck(_av,&amp;videoBufferCount, &amp;videoBufferTotal, &amp;audioBufferCount, &amp;audioBufferTotal);\n \n PMSG2(&quot;AQHandler.m fillAudioBuffer: Video Buffer: %d/%d Audio Buffer: %d/%d\\n&quot;, videoBufferCount, videoBufferTotal, audioBufferCount, audioBufferTotal);\n \n PMSG2(&quot;AQHandler.m fillAudioBuffer: Bytes copied for buffer 0x%x: %d\\n&quot;,(unsigned int)buffer, (int)buffer-&gt;mAudioDataByteSize );\n#endif \n if(buffer-&gt;mAudioDataByteSize){\n \n if(err=AudioQueueEnqueueBufferWithParameters(queue, buffer, 0, NULL, 0, 0, 0, NULL, &amp;bufferStartTime, NULL))\n {\n#ifdef DEBUG\n char sErr[10];\n\n PMSG2(@&quot;AQHandler.m fillAudioBuffer: Could not enqueue buffer 0x%x: %d %s.&quot;, buffer, err, FormatError(sErr, err));\n#endif\n }\n }\n\n}\n</code></pre>\n<p>Based on the documentation for <code>AudioQueueEnqueueBufferWithParameters</code> and the variable naming used by the author, <code>bufferStartTime</code> seems to represent the time when the newly filled audio buffer will start playing, i.e., the time when all current audio in the queue has finished playing and the new audio starts. This interpretation suggests <code>bufferStartTime</code> is not the same as the time of the audio currently being played.</p>\n<p>I have browsed through many related questions, but I still have some doubts.. I'm currently fixing an audio-video synchronization issue in my project, and there isn't much detailed information in the Apple Developer Documentation (or maybe my search skills are lacking).</p>\n<p>Can someone clarify the exact meaning of the timestamp returned by AudioQueueGetCurrentTime() in this context? Is it the time when the current audio will finish playing, or is it the time when the new audio will start playing? Any additional resources or documentation that explain this in detail would also be appreciated.</p>\n"^^ . . "0"^^ . . . . "<p>I would like to store and retrieve audio files such as MP3s in the user's documents directory. When I do this with images I can simply fetch the file as a UIImage. However, I'm struggling with what format to use to retrieve the audio.</p>\n<p>For images I could do:</p>\n<pre><code>-(UIImage*)getImageNamed: (NSString*) name {\n {\n NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,\n NSUserDomainMask, YES);\n NSString *documentsDirectory = [paths objectAtIndex:0];\n NSString* path = [documentsDirectory stringByAppendingPathComponent:\n [NSString stringWithString: name] ];\n UIImage *img = [UIImage imageWithContentsOfFile:path];\n return img;\n }\n return nil;\n}\n</code></pre>\n<p>I'm trying a similar approach for audios but it does not compile as there is no such method as objectWithContentsOfFile. Also I'm not sure that an AVPlayerItem is the right way to return the audio file. (I don't want to just play it from its location in the documents directory, but rather get the actual .mp3 file to share via email etc.)</p>\n<p>How would I edit the following code to retrieve an audio file such as an mp3 instead of an image from the documents directory?</p>\n<pre><code>-(id)getAudioFileNamed: (NSString*) name {\n {\n NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,\n NSUserDomainMask, YES);\n NSString *documentsDirectory = [paths objectAtIndex:0];\n NSString* path = [documentsDirectory stringByAppendingPathComponent:\n [NSString stringWithString: name] ];\n AVPlayerItem* item = [AVPlayerItem objectWithContentsOfFile:path];//pseudo method\n return item;\n }\n return nil;\n}\n</code></pre>\n<p>Thanks for any suggestions</p>\n"^^ . . . . . . . . . "1"^^ . . . . . "ios"^^ . "swift-package-manager"^^ . . . "0"^^ . . . "Once this is done, you can successfully create an identity."^^ . . . . . "2"^^ . "Use Swift `#Observable` with Objective-C model"^^ . "1"^^ . . . . . . . "0"^^ . . "<p>I want to implement such a function: a password UITextField, using the system Jiugongge numeric keypad(textField.keyboardType = .numberPad), and enable to automatically fill the password. like this:\n<a href="https://i.sstatic.net/zO3jCb95.jpg" rel="nofollow noreferrer">enter image description here</a></p>\n<p>There's my code:</p>\n<pre class="lang-swift prettyprint-override"><code> let passwordTextField: UITextField = {\n let textField = UITextField()\n textField.placeholder = &quot;password&quot;\n textField.textContentType = .password\n textField.isSecureTextEntry = true\n textField.keyboardType = .numberPad.\n return textField\n }()\n</code></pre>\n<p>When I set <code>textField.isSecureTextEntry = true</code>, the button of autofilling password disappears, and if <code>textField.isSecureTextEntry = false</code>, the button of autofilling password appears.<p>\nWhen I set <code>textField.keyboardType</code> to other type like <code>.default</code>, and <code>textField.isSecureTextEntry = true</code>, the button of autofilling password also appears.<p>\nI wonder if that's Apple's feature? Is any way to make both <code>textField.isSecureTextEntry = true</code>, <code>textField.keyboardType = .numberPad</code> and the button of autofilling password appears?</p>\n"^^ . "But it's happened, and that's TrollStore"^^ . "<p><a href="https://i.sstatic.net/9ANhhCKN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9ANhhCKN.png" alt="enter image description here" /></a>I have created an Application in which we have framework as target. I am using SendbirdChatSDK and Sendbirdcalls Cocoapod as dependency for framework.
While compiling it is showing error in swift generated header as Module not found for Sendbirdcalls and SendbirdChatSDK.</p>\n<p>Note: Our Project has mixed Objective C and Swift</p>\n<p>Please find screenshot and Project link for reference:
\nGithub link :(<a href="https://github.com/shikha110225/POCAPP" rel="nofollow noreferrer">https://github.com/shikha110225/POCAPP</a>)</p>\n<p>I have tried adding Cocoapod for the framework. Added the .h file in bridging header.\nAlso tried deleting derived data.</p>\n<p>Expectation : Code should compile after this</p>\n"^^ . "0"^^ . "0"^^ . . . . . "1"^^ . "0"^^ . . "0"^^ . . . . "Okay, why couldn't the same approach be used with protocols? Instead of `@Observable`, you can still create an `ObservableObject` that wraps something conforming to `CarProtocol`, and merge the publishers as you do here."^^ . "kotlin-multiplatform"^^ . . "You don't need `import MainApp-Swift.h`. You need just import modules that have protocol."^^ . "instance"^^ . . "1"^^ . . . . . . "0"^^ . . "2"^^ . . . . . "<p>IMO, I think <code>NSAssert</code> is appropriate because it is only in Development (by default). You do not want an unexpected crash in Production if the <code>block of code</code> changes in the near future somehow, do you?</p>\n<p>However, you can take a look at <a href="https://developer.apple.com/documentation/foundation/nsexception/1569524-raise" rel="nofollow noreferrer">NSException raise</a> here:</p>\n<pre class="lang-objectivec prettyprint-override"><code>[NSException raise: @&quot;InvalidBlock&quot; fromat: @&quot;This should never happen&quot;];\n</code></pre>\n"^^ . "3"^^ . "This question is similar to: [In Objective-C MRR, if foo is a retain property, then self.foo = \\[\\[Foo alloc\\] init\\] will need to be released immediately?](https://stackoverflow.com/questions/12354230/in-objective-c-mrr-if-foo-is-a-retain-property-then-self-foo-foo-alloc-in). If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem."^^ . . . . . . "I've already deleted the comment because it was a duplicate of @Gerhardh's comment, but: no. Objective-C is said to be superset to C so `sizeof()` should be as wrong here as it is in puce C. Just use `strlen()` if you have a nul terminated string. Btw. my `main()` is basically `uint16_t wCrc = crc16(argv[1], strlen(argv[1]);`"^^ . . . . . "0"^^ . "0"^^ . "0"^^ . . "I'd love to try it"^^ . . "<p>I have a <code>UItextView</code> within a <code>UIViewController</code> created in storyboard. The <code>UITextView</code> has an outlet property myTextView and constraints that keep it at a fixed size. One wrinkle: The vertical constraints are initially inactive and set to active if the length of the text exceeds a certain amount.</p>\n<p>I can set the text without issue, however, when the text is long it bleeds outside the <code>UITextView</code> at the top and bottom. It doesn't always do this... If the text is just a little bit long, it scrolls okay within the <code>UITextView</code>. However if it is significantly longer than what fits in the textViewwindow a good portion of it (not all) displays outside. It scrolls but bleeds above and below the top and bottom depending on whether you scroll up or down. I can see the outlines of the textView from a border.</p>\n<p>Here is my code:</p>\n<pre><code>in .h file\n@property (weak, nonatomic) IBOutlet UITextView *myTextView;\n@property (weak, nonatomic) IBOutlet NSLayoutConstraint *myViewHeight;\n</code></pre>\n<p>In view didLoad:</p>\n<pre><code>[self styleAndAddBorderTo: self.myTextView];\nif (descript.length&gt;=32) {\nself.myTextView.text = descript;\nself.myTextView.translatesAutoresizingMaskIntoConstraints = FALSE;\nself.myViewHeight.constant = 240;\nself.myViewHeight.active = YES;\n}\nelse {\n//display in a UILabel\n}\n\n-(UITextView*) styleAndAddBorderTo: (UITextView*) myTextView {\n [myTextView.layer setBackgroundColor: [[UIColor whiteColor] CGColor]];\n [myTextView.layer setBorderWidth: 2.0];\n [myTextView.layer setCornerRadius:8.0f];\n [myTextView.layer setMasksToBounds:YES];\n [myTextView setClipsToBounds: YES];\n myTextView.translatesAutoresizingMaskIntoConstraints = NO;\n [myTextView.layer setBorderColor:[[[UIColor grayColor] colorWithAlphaComponent:0.5] CGColor]];\n return myTextView;\n}\n</code></pre>\n<p>How can I prevent the text from bleeding outside the textView?</p>\n<h2>Edit</h2>\n<p>Screenshots</p>\n<p><a href="https://i.sstatic.net/CbsXTJcr.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/CbsXTJcr.png" alt="enter image description here" /></a></p>\n<p>With myViewHeight set to 100 and 320 respectively</p>\n<p><a href="https://i.sstatic.net/ymPNc60w.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ymPNc60w.png" alt="height 100" /></a></p>\n<p><a href="https://i.sstatic.net/GsCiYHPQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/GsCiYHPQ.png" alt="height 320" /></a></p>\n<h2>Edit</h2>\n<p>with colors:</p>\n<p><a href="https://i.sstatic.net/65EIzcXB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/65EIzcXB.png" alt="enter image description here" /></a></p>\n<p>Comment out setting text</p>\n<pre><code>//textView.text = descript;\n</code></pre>\n<p><a href="https://i.sstatic.net/cn5SdHgY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/cn5SdHgY.png" alt="enter image description here" /></a></p>\n<p>with <code>textView.hidden = YES;</code></p>\n<p><a href="https://i.sstatic.net/4ibK3ULj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4ibK3ULj.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/mLZKXZZD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mLZKXZZD.png" alt="enter image description here" /></a></p>\n"^^ . . . . . "0"^^ . "AppAuth-iOS-ObjC: failing at archive/unarchive of OIDAuthState"^^ . . . . . . "THANK YOU so much! This was it. My project was configured to use openSSL for receipt validation. I ended up moving to Revenuecat but never removed the dependency."^^ . . "0"^^ . . "uislider"^^ . . . . . . . "0"^^ . "crashlytics"^^ . . . . . . . "grand-central-dispatch"^^ . "How to Open the Default Phone App Scene from CarPlay Scene on iOS (Including Devices Without Multiple Scene Support)?"^^ . . . . "0"^^ . "0"^^ . . "Xcode 16 error - Use of undeclared identifier '_CTYPE_A'"^^ . "2"^^ . . . "0"^^ . . "0"^^ . . "Thank you so much @MoonKid . It solved the error."^^ . . "1"^^ . "Import Swift protocol from SubModule into Objective-C Class"^^ . "1"^^ . . "0"^^ . . . . . . . "1"^^ . "<p>Hello I have the below c function which I believe to be in the correct specification for CRC-16 CCITT False:</p>\n<pre><code>uint16_t crc16(const char* pData, int length)\n{\n uint8_t i;\n uint16_t wCrc = 0xffff;\n while (length--) {\n wCrc ^= *(unsigned char *)pData++ &lt;&lt; 8;\n for (i=0; i &lt; 8; i++)\n wCrc = wCrc &amp; 0x8000 ? (wCrc &lt;&lt; 1) ^ 0x1021 : wCrc &lt;&lt; 1;\n }\n return wCrc &amp; 0xffff;\n}\n</code></pre>\n<p>I am using Objective C for my application and have the following:</p>\n<pre><code>- (IBAction)mycrc16function:(id)sender\n{\nNSString * stringexample = @&quot;Example&quot;;\n\nconst char * stringAsChar = [stringexample cStringUsingEncoding:[NSString defaultCStringEncoding]]; //encode string into c string encoding\n\nunsigned long CrcTest = crc16(stringAsChar,sizeof(stringAsChar)); // put encoded string date and size of string into the crc16 function.\n\nNSLog(@&quot;crctext %04lX\\n&quot;,CrcTest); // print outcome to log\n \n}\n\n</code></pre>\n<p>The output is always incorrect, the string I am testing with for example is giving a result of 6B20</p>\n<p>However the result should be E272</p>\n<p>I am using this site which I know to be correct to compare my results:\n<a href="http://www.sunshine2k.de/coding/javascript/crc/crc_js.html" rel="nofollow noreferrer">http://www.sunshine2k.de/coding/javascript/crc/crc_js.html</a></p>\n<p>Any idea where I am going wrong?</p>\n"^^ . "<p>I’m developing an iOS app with CarPlay support, and I’m trying to open the default phone app scene from the CarPlay scene. This needs to work on all iOS devices, including those that do not support multiple scenes (e.g., older iOS versions or devices that do not have multiple windows).</p>\n<p>Scenario:</p>\n<pre><code>• The default configuration scene is the phone app, and the CarPlay scene is a separate one.\n• When interacting with the CarPlay interface, I want to programmatically switch or launch the phone app scene.\n</code></pre>\n<p>I’ve found resources on managing multiple scenes on devices that support it, but not much about how to handle this scenario for devices that only support a single scene.</p>\n<p>Could someone guide me on the correct approach to achieve this behavior in Objective-C?\nI’d appreciate code examples that work on all iOS devices, including handling cases where multiple scenes aren’t available.</p>\n<p>Here’s a rough version of what I’m trying, but I’m unsure how to make this compatible across all devices:</p>\n<pre><code>- (void)switchToPhoneAppScene {\n if (@available(iOS 13.0, *)) {\n NSSet&lt;UIScene *&gt; *connectedScenes = [UIApplication sharedApplication].connectedScenes;\n \n for (UIScene *scene in connectedScenes) {\n if ([scene.session.role isEqualToString:UIWindowSceneSessionRoleApplication]) {\n // Trying to activate the phone app scene\n [UIApplication.sharedApplication requestSceneSessionActivation:scene.session\n userActivity:nil\n options:nil\n errorHandler:nil];\n return;\n }\n }\n } else {\n // For iOS versions below 13 that do not support multiple scenes\n // What should be done here to ensure compatibility?\n }\n}\n</code></pre>\n<p>What would be the best way to handle scene activation or app switching across all iOS devices, regardless of whether they support multiple scenes?</p>\n<p>Thanks in advance!</p>\n"^^ . . . . "KMP Library to interact with AdMob API"^^ . "0"^^ . . "1"^^ . "1"^^ . "0"^^ . "0"^^ . "0"^^ . . . . . . "module"^^ . "0"^^ . . "0"^^ . "1"^^ . "0"^^ . . . "xcode"^^ . . . "2"^^ . "0"^^ . "0"^^ . . "1"^^ . . "AppCheckCore 'GoogleUtilities/GULKeychainStorage.h' file not found in my objective-c project"^^ . . "0"^^ . . . . . "<blockquote>\n<p>which isn't directly supported by Google yet</p>\n</blockquote>\n<p><a href="https://android-developers.googleblog.com/2024/05/android-support-for-kotlin-multiplatform-to-share-business-logic-across-mobile-web-server-desktop.html" rel="nofollow noreferrer">Well, that depends what you mean by &quot;Google&quot; and &quot;support&quot;.</a></p>\n<blockquote>\n<p>Are there any instructions or walkthroughs for how to create an iosMain / iosApp implementation of AdMob in a Kotlin Multiplatform (KMP) project?</p>\n</blockquote>\n<p>Probably nothing specific to AdMob. If what you're calling in common code is relatively limited, I'd create an interface in common with those calls, then implement Android in <code>androidMain</code>, and implement the iOS side in Swift.</p>\n<p>Interface, not expect/actual. Generally speaking, you won't use expect/actual much for classes/objects. If ever.</p>\n<p>Create an implementation of the Kotlin interface in Swift, and pass it in on app start.</p>\n<p>I gave a talk about bridging native apis a couple years ago: <a href="https://www.droidcon.com/2022/06/28/sdk-design-and-publishing-for-kotlin-multiplatform-mobile/" rel="nofollow noreferrer">https://www.droidcon.com/2022/06/28/sdk-design-and-publishing-for-kotlin-multiplatform-mobile/</a></p>\n"^^ . . . . . "0"^^ . "1"^^ . . . . "0"^^ . "0"^^ . "swiftui"^^ . "<p><code>If screen is ideal for 5mins I set AutoLogout it works perfectly but when the UIAlert dialogue shows it logged out but the alert remains showed in the login screen. so below are the code to dismiss my alert dialogue before logout</code></p>\n<pre><code>- (void)dismissAnyAlertControllerIfPresent {\n UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;\n UIViewController *topVC = keyWindow.rootViewController.presentedViewController;\n\n while (topVC.presentedViewController != nil) {\n topVC = topVC.presentedViewController;\n }\n\n if ([topVC isKindOfClass:[UIAlertController class]]) {\n [topVC dismissViewControllerAnimated:NO completion:nil];\n }\n}\n\n- (void)didLogout {\n [self dismissAnyAlertControllerIfPresent];\n \n NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];\n [prefs removeObjectForKey:@&quot;userName&quot;];\n \n [prefs synchronize];\n\n // Redirect to login page\n [self redirectToLoginPage];\n}\n\n- (void)redirectToLoginPage {\n if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)\n {\n UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@&quot;Main_iPhone&quot; bundle:nil];\n BmobileViewController * login = [storyboard instantiateViewControllerWithIdentifier:@&quot;login&quot;] ;\n login.hideBackbtn = YES;\n login.hideAutoLogoutMsg = YES;\n login.modalPresentationStyle = UIModalPresentationFullScreen;\n [self presentViewController:login animated:YES completion:nil];\n }\n else\n {\n UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@&quot;Main_iPad&quot; bundle:nil];\n BmobileViewController * login = [storyboard instantiateViewControllerWithIdentifier:@&quot;login&quot;] ;\n login.hideBackbtn = YES;\n login.hideAutoLogoutMsg = YES;\n login.modalPresentationStyle = UIModalPresentationFullScreen;\n [self presentViewController:login animated:YES completion:nil];\n }\n}\n</code></pre>\n<p><code>the code above which one diss miss the alert dialogue runs, then the screen becomes unresponsive</code></p>\n<pre><code>if ([topVC isKindOfClass:[UIAlertController class]]) {\n [topVC dismissViewControllerAnimated:NO completion:nil];\n }\n</code></pre>\n<p>`if there is no alert dialogue on ideal state and logged out login screen is working I can click textfields etc.. if I checked with alert on ideal state then logged out screen is not working\nI can't able to click textfields in the login screen</p>\n<p>for my doubts, I commented the code which goes for login screen and just check the alert dismiss. alert dismissed in the current page and also the current page becomes unresponsive</p>\n<p>I am new to IOS development so just give me a advise to handle this error and thanks in advance`</p>\n"^^ . "May be just turn on `ARC`?"^^ . . "0"^^ . . . . . . "<p>First, apology if my English is not quite good.<br/>\nWe have developed an iOS app in objective-C and added integrations for shortcuts app - more specific the &quot;automation&quot; part of the app.<br/>\nBasically, user opens shortcuts app, select automation and when scanning NFC tag, user can select an action and our app shows 3 different actions. User select action, opens the app and action is executed. That all done in Obj-C and was working very well with no complaints till users start to update to iOS18. <br/>\nNow, when user starts to add automation, only thing they can do is select &quot;open app&quot;. Our app actions are not showing any more. Is there something new in iOS 18 we have to update our app.<br/>\nI know Obje-C is considered &quot;old&quot;, but the cost of upgrading an existing app and time is not available at the moment.\n<br/>Here's a code snippet of out shortcutIntent:</p>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;\n&lt;plist version=&quot;1.0&quot;&gt;\n&lt;dict&gt;\n &lt;key&gt;com.apple.security.application-groups&lt;/key&gt;\n &lt;array&gt;\n &lt;string&gt;group.lw.grp1&lt;/string&gt;\n &lt;string&gt;group.lw.grp2&lt;/string&gt;\n &lt;/array&gt;\n&lt;/dict&gt;\n&lt;/plist&gt;\n</code></pre>\n<p><strong>Info-plist</strong></p>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;\n&lt;plist version=&quot;1.0&quot;&gt;\n&lt;dict&gt;\n &lt;key&gt;NSExtension&lt;/key&gt;\n &lt;dict&gt;\n &lt;key&gt;NSExtensionAttributes&lt;/key&gt;\n &lt;dict&gt;\n &lt;key&gt;IntentsRestrictedWhileLocked&lt;/key&gt;\n &lt;array/&gt;\n &lt;key&gt;IntentsRestrictedWhileProtectedDataUnavailable&lt;/key&gt;\n &lt;array/&gt;\n &lt;key&gt;IntentsSupported&lt;/key&gt;\n &lt;array&gt;\n &lt;string&gt;LockIntent&lt;/string&gt;\n &lt;string&gt;TrunkIntent&lt;/string&gt;\n &lt;string&gt;UnlockIntent&lt;/string&gt;\n &lt;/array&gt;\n &lt;/dict&gt;\n &lt;key&gt;NSExtensionPointIdentifier&lt;/key&gt;\n &lt;string&gt;com.apple.intents-service&lt;/string&gt;\n &lt;key&gt;NSExtensionPrincipalClass&lt;/key&gt;\n &lt;string&gt;IntentHandler&lt;/string&gt;\n &lt;/dict&gt;\n&lt;/dict&gt;\n&lt;/plist&gt;\n</code></pre>\n<p><strong>IntentHandler</strong></p>\n<pre><code>@implementation IntentHandler\n\n-(id)init{\n self = [super init];\n self.started = false;\n self.handler = [[AppIntentHandler alloc] init];\n self.handler.userInfo = [[NSMutableDictionary alloc] init];\n return self;\n}\n- (id)handlerForIntent:(INIntent *)intent {\n // This is the default implementation. If you want different objects to handle different intents,\n // you can override this and return the handler you want for that particular intent.\n \n \n if(!self.started){\n self.started = YES;\n if([intent isKindOfClass:[LockIntent class]]){\n NSLog(@&quot;*intent lock selected*&quot;);\n self.handler.userInfo = [self assignUserInfo:@&quot;lock&quot;];\n }else if([intent isKindOfClass:[UnlockIntent class]]){\n NSLog(@&quot;*intent unlock selected*&quot;);\n self.handler.userInfo = [self assignUserInfo:@&quot;unlock&quot;];\n }else if([intent isKindOfClass:[TrunkIntent class]]){\n NSLog(@&quot;*intent trunk selected*&quot;);\n self.handler.userInfo = [self assignUserInfo:@&quot;trunk&quot;];\n }\n }else{\n self.started = NO;\n }\n \n \n return self.handler;\n}\n</code></pre>\n<p><strong>A custom class to handle each intent</strong></p>\n<pre><code>@interface AppIntentHandler : NSObject&lt;LockIntentHandling, UnlockIntentHandling, TrunkIntentHandling&gt;\n@implementation AppIntentHandler\n\n#pragma mark - response handlers\n- (void)handleLock:(nonnull LockIntent *)intent completion:(nonnull void (^)(LockIntentResponse * _Nonnull))completion {\n LockIntentResponse *response = [[LockIntentResponse alloc] initWithCode:LockIntentResponseCodeContinueInApp userActivity:[self lockUserActivity]];\n completion(response);\n}\n\n- (void)handleUnlock:(nonnull UnlockIntent *)intent completion:(nonnull void (^)(UnlockIntentResponse * _Nonnull))completion {\n UnlockIntentResponse *response = [[UnlockIntentResponse alloc] initWithCode:UnlockIntentResponseCodeContinueInApp userActivity:[self unlockUserActivity]];\n completion(response);\n}\n\n- (void)handleTrunk:(nonnull TrunkIntent *)intent completion:(nonnull void (^)(TrunkIntentResponse * _Nonnull))completion {\n TrunkIntentResponse *response = [[TrunkIntentResponse alloc] initWithCode:TrunkIntentResponseCodeContinueInApp userActivity:[self trunkUserActivity]];\n completion(response);\n}\n</code></pre>\n<p>What needs to be done to make our app's actions show in shortcuts app again.\nThanks in advance</p>\n"^^ . "xcode16"^^ . . "0"^^ . . . . "swift"^^ . . . . . . "Could you explain, please, why does the reference become strong with `AdHook**`? What actually changes with this? We create additional C++ pointer, right? So it is C++ pointer to Objective-C pointer, right?"^^ . . . "I can imagine some Javascript ping/pong where you call iOS on field activation, show the picker natively and sends picker results to the WebView, but I'm not sure this is the best way to do it. What about web-side validation with the field just turning red in case of wrong input, or just implement custom picker, easiest option - 2 separate option pickers for month and year and refilter of available month options on year pick"^^ . . "How to prevent a root object from being deleted in C++/Objective-C"^^ . . . . . . "The protocol is still invisible to the objc class tho"^^ . . . . "0"^^ . . . "0"^^ . . . . . . "<p>You can add an <code>-ld64</code> flag to other linker flags (More info <a href="https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking" rel="nofollow noreferrer">https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking</a>)</p>\n<p><a href="https://i.sstatic.net/EDYBMOLZ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EDYBMOLZ.png" alt="Build Settings" /></a></p>\n"^^ . "Yes you are correct it was meant to have pointers I was playing around with it and I must have forgot to put it back to its original state. I have simplified the CRC16-CCITT FALSE function with one I have found online instead (now replaced in my question), which seems a bit better put together than my attempt!\n\nIt's the Obj-C function which feeds the data and outputs the result (NSLog).\n\nStill getting a wrong result with the new crc16 function B415 instead of E272 now."^^ . . "ubuntu"^^ . . . . . . "0"^^ . "Please trim your code to make it easier to find your problem. Follow these guidelines to create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example)."^^ . . "1"^^ . "frameworks"^^ . . . . . "From here you download the sample project. \n\nhttps://drive.google.com/file/d/1HRJ9Cdnj4vymbZojpU9OI-80L2mGuQ1s/view?usp=sharing\n\nYou need to try it on your device. Once you run it you will see a button. When you tap on it, it will show you an action sheet with two options (Camera/Library) you need to select Camera and the rest is given in the question. I'll be waiting to hear from you soon."^^ . . "0"^^ . . . . "@Cy-4AH yes, it is `-fno-objc-arc` compiler flag (https://stackoverflow.com/a/18883995/2394762)"^^ . . "core-data"^^ . . . . . "0"^^ . . . "The same issue can be found here: https://forums.developer.apple.com/forums/thread/764530"^^ . "1"^^ . . "capacitor"^^ . . . "mac-catalyst"^^ . "0"^^ . . . . . . "1"^^ . . "1"^^ . . . . . . "<p>Given this source code:</p>\n<pre><code>#include &lt;Cocoa/Cocoa.h&gt;\nint main()\n{\n printf(&quot;%ld\\n%ld\\n&quot;,\n [@&quot;A 2&quot; localizedStandardCompare:@&quot;a 10&quot;],\n [@&quot;A 2&quot; localizedStandardCompare:@&quot;a 10&quot;]);\n}\n</code></pre>\n<p>It produces two different results (presumably the first correct, the second incorrect):</p>\n<pre><code>$ clang++ ./cmp.m -o cmp -ObjC -framework Foundation &amp;&amp; ./cmp\n-1\n1\n</code></pre>\n<p>This behaviour is consistent on two different machines (both MacOS 14), running two different versions of Xcode: 15 and 16. It doesn't make any sense, but is consistent - after the first invocation of <code>localizedStandardCompare</code> something breaks and then this methods always says that &quot;A 2&quot; is greater than &quot;a 10&quot; in natural ordering.</p>\n<p>Addendum: on MacOS 10.15 / Xcode 12 it produces an expected result &quot;-1 -1&quot;.</p>\n<p>Addendum2: this small repo runs this snippet on GitHub Actions: <a href="https://github.com/mikekazakov/localizedStandardCompare" rel="nofollow noreferrer">https://github.com/mikekazakov/localizedStandardCompare</a>. It confirms the issue in MacOS14:</p>\n<pre><code>macos-12, xcode-14.2: -1 -1\nmacos-13, xcode-14.2: -1 -1\nmacos-12, xcode-13.1: -1 -1\nmacos-13, xcode-14.3.1: -1 -1\nmacos-14, xcode-16b6: -1 1\nmacos-14, xcode-15.4: -1 1\nmacos-14, xcode-14.3.1: -1 1\n</code></pre>\n"^^ . . "0"^^ . "<p>I'd like to use AppAuth's <code>performActionWithFreshTokens</code> method. This requires using the OIDAuthState returned by the <code>authStateByPresentingAuthorizationRequest</code> when generating access and refresh tokens. I want to save that OIDAuthState in the Keychain for security reasons, then use it at a later time when a token refresh is necessary. What I can't seem to do is properly archive and unarchive the saved value from the Keychain.</p>\n<p>I have two methods: (1) used to convert the OIDAuthState to an NSString to store to the Keychain and (2) used to convert the NSString from the Keychain to an OIDAuthState. Here is the first:</p>\n<pre><code>NSData *checkEncoding;\n- (NSString *)authStateToString:(OIDAuthState *)authState {\n NSError *errRet;\n //NSData *authStateData = [NSKeyedArchiver archivedDataWithRootObject:authState];\n NSData *authStateData = [NSKeyedArchiver archivedDataWithRootObject:authState\n requiringSecureCoding:NO error:&amp;errRet];\n checkEncoding = authStateData;\n NSString *authString = [[NSString alloc] initWithData:authStateData\n encoding:NSUnicodeStringEncoding];\n NSLog(@&quot;ToString length = %ld, authStateData length = %ld&quot;,\n (unsigned long)authString.length, (unsigned long)authStateData.length);\n return authString;\n}\n</code></pre>\n<p>And here is the second:</p>\n<pre><code>- (OIDAuthState *)stringToAuthState:(NSString *)authString {\n NSError *errRet;\n NSData *authStateData = [authString dataUsingEncoding:NSUnicodeStringEncoding allowLossyConversion:NO];\n NSLog(@&quot;ToAuthState length = %ld, authStateData length = %ld, checkEncoding = %d&quot;,\n (unsigned long)authString.length, (unsigned long)authStateData.length, [authStateData isEqualToData:checkEncoding]);\n OIDAuthState *authState = [NSKeyedUnarchiver unarchivedObjectOfClass:[OIDAuthState class]\n fromData:authStateData error:&amp;errRet];\n //OIDAuthState *authState = [NSKeyedUnarchiver unarchiveTopLevelObjectWithData:authStateData error:&amp;errRet];\n //OIDAuthState *authState = [NSKeyedUnarchiver unarchiveObjectWithData:authStateData];\n /* NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:authStateData];\n OIDAuthState *authState = [unarchiver decodeObject];\n [unarchiver finishDecoding]; */\n return authState;\n}\n</code></pre>\n<p>(The multiple tries at unarchiving don't come into play since they all fail and the uncommented version is probably the right/undeprecated one.)</p>\n<p>Note the NSLog statements in each, which seem to point out the problem. For the <code>authStateToString</code> NSLog, the output is &quot;ToString length = 7930, authStateData length = 15860&quot;. For the <code>stringToAuthState</code> NSLog, the output is &quot;ToAuthState length = 7930, authStateData length = 15862, checkEncoding = 0&quot;. The NSStrings in both methods are equal according to <code>isEqualToString</code>.</p>\n<p>So, I'm guessing that the OIDAuthState can't be regenerated because the conversion for the NSString versions is occuring but isn't regenerated the same NSData representation; the encoded version is 15860 bytes while the decoded version is 15862 bytes and the <code>isEqualToData</code> returns false.</p>\n<p>I do note that the OIDAuthState class NSKeyedArchiver method <code>encodeWithCoder</code> is called as expected when encoding the state. The corresponding NSKeyedUnarchiver method <code>initWithCoder</code> is <em>not</em> called but that's not surprising since the NSData being passed is probably not valid.</p>\n<p>I've tried multiple <code>dataUsingEncoding</code> encoding types with most failing (the resulting NSData is zero-length). <code>NSUnicodeStringEncoding</code> is the only one that seemed to produce appropriate length NSData instances. I've tried setting 'requiringSecureCoding' to both YES and NO. I've tried setting 'allowLossyConversion' to both YES and NO.</p>\n<p>I am open to other methods of persisting the OIDAuthState but it seems what I've done should be valid. Can someone suggest why I can't seem to correctly unarchive?</p>\n"^^ . . "Thank you! Setting colors as you suggest it appears there are two instances of the text. One in thee round green textView looks ok. Behind it however is another instance. However the text is set only once with textView.text = descript; and when I comment out the single setting of the text no text appears at all. When I hide the textview with textView.hidden = YES; both sets of text disappear. Therefore the second instance of text seems to be in the same textview."^^ . "Did you try on real device ?"^^ . . . "security"^^ . "@user6631314 - `UITextContainerView` and `UITextLayoutView` are *parts* of `UITextView`. I fear the only way we're going to be able to help is for you to put together a [mre] and share the project."^^ . "firebase"^^ . "1"^^ . . . "1"^^ . . . . "appauth"^^ . . . . "It didn't work for me too"^^ . "Prevent text in UITextView from bleeding outside of textView"^^ . "0"^^ . . . . . "0"^^ . . . "0"^^ . . "Yes I tried on a real device and I am getting this error everytime. I have a sample app created if you want to try it."^^ . . . . . "*In general* you should not mess with the cell's `contentView`."^^ . . . . "<p>a bit related to <a href="https://stackoverflow.com/questions/12354230/in-objective-c-mrr-if-foo-is-a-retain-property-then-self-foo-foo-alloc-in">In Objective-C MRR, if foo is a retain property, then self.foo = [[Foo alloc] init] will need to be released immediately?</a></p>\n<p>suppose you have</p>\n<pre><code>@property (nonatomic, readwrite, retain) NSObject *foo;\n</code></pre>\n<p>In this case</p>\n<pre><code>- (instancetype)initWithSomeObject:(NSObject)foo\n{\n self = [super init];\n if (self != nil) {\n _foo = foo;\n }\n}\n</code></pre>\n<p>would foo correctly get autoincremented as retain property attribute suggests it should?\nI initially wrote this as self.foo = foo; but for some reason folks on the team use the compact syntax that seemed more fitting in MRC times to avoid superfluous release for a n object newly created in the init context.</p>\n"^^ . . . . "1"^^ . . . "0"^^ . . "linker-errors"^^ . "1"^^ . "0"^^ . "0"^^ . . . . "1"^^ . . "<p>When I run my iOS app on Apple Silicon Mac (ARM) in &quot;Designed for iPad&quot; mode, I'm not able to use a <code>UISlider</code> contained in a reorderable tableview cell. Dragging the slider triggers a reorder of the cell rather than sliding the slider.</p>\n<p><a href="https://i.sstatic.net/iV6r70ej.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/iV6r70ej.gif" alt="Example" /></a></p>\n<p>This behaves correctly on iOS devices: when I drag the slider, no reorder is triggered.\nI tried a Swift version which yields the same result.</p>\n<p>Here's how the <code>UITableView</code> is setup:</p>\n<pre><code>[self.tableView setEditing:YES animated:YES];\n[self.tableView setAllowsSelectionDuringEditing:YES];\n</code></pre>\n<p>Here's the <code>cellForRowAtIndexPath</code> implementation:</p>\n<pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath\n {\n UITableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:@&quot;AddRow&quot;];\n \n if (cell == nil)\n cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@&quot;AddRow&quot;] autorelease];\n \n UISlider *slider = [[UISlider new] autorelease];\n [cell.contentView addSubview:slider];\n \n return cell;\n }\n</code></pre>\n"^^ . . . . . "1"^^ . . . . "0"^^ . "2"^^ . "0"^^ . . . "0"^^ . . "<p>in my application that I developed with Objective-C, I have a web view structure in which I select a photo from the photo gallery and upload it while testing it on my device with Xcode 16 and iOS 18 installed, but when I try to select and upload a photo from the photo gallery, I receive the following error in the log [ERROR] Could not create a bookmark: NSError: Cocoa 4097 &quot;connection to service named com.apple.FileProvider&quot;. Has anyone encountered this error before? Thank you in advance.</p>\n<p>I changed the product name based on an article stating that this error would be resolved by changing the product name. it didn't work again</p>\n"^^ . "0"^^ . "<p>I have upgraded to Xcode 16.0 recently. I encountered the following error when building my project in iOS physical devices.</p>\n<p>I am not sure how to resolve this issue and would appreciate any help.</p>\n<p>Here is the error message</p>\n<pre><code>Assertion failed: ((ct == Atom::ContentType::objcConst) || (ct == Atom::ContentType::objcData) || (ct == Atom::ContentType::constData) || (ct == Atom::ContentType::constText)), function ObjCClassReadOnlyDataRef, file Atom.cpp, line 3022.\n\n\nLinker command failed with exit code 1 (use -v to see invocation)\n</code></pre>\n<p>Note : Same codebase is building successfully in XCode 15.</p>\n<p>I tried to debug and find more information about this error. But I couldn't find much information about it.</p>\n"^^ . "<p>My app often fails to access the network (other apps on the device can access the network normally), and restarting the app is also ineffective. I need to open and close the flight mode to restore the app's network</p>\n<p>I used to suspect the background refresh was the cause, but removing the background refresh still occasionally causes this problem.</p>\n"^^ . . . "https://github.com/parse-community/Parse-SDK-iOS-OSX/issues/1792"^^ . "0"^^ . "Using the visual debugger and clicking on UITextView, something called UITextContainerView is the larger view that bleeds over and the UITextLayoutView is the smaller view respecting the border."^^ . . . . "0"^^ . "<p>I am facing an issue with <code>QLThumbnailGenerationRequest</code>, it is not creating thumbnail from the image captured from the iPhone camera. I am doing the following:</p>\n<ol>\n<li>I get the captured image and convert it into <code>NSData</code> like this:</li>\n</ol>\n<pre><code>UIImage *source = info[UIImagePickerControllerOriginalImage];\nNSData *imageData = UIImageJPEGRepresentation(source, 1.0);\n</code></pre>\n<ol start="2">\n<li>Then I save the <code>imageData</code> to a temporary directory like this:</li>\n</ol>\n<pre><code>NSString *directoryPath = NSTemporaryDirectory();\nNSString *filePath = [directoryPath stringByAppendingPathComponent:@&quot;CapturedImageFromCamera.jpg&quot;];\n \nNSError *error = nil;\nBOOL success = [imageData writeToFile:filePath options:NSDataWritingAtomic error:&amp;error];\n</code></pre>\n<p>I am getting <code>success</code> as <code>true</code> which means that the image is saved at the given path.</p>\n<ol start="3">\n<li>I am creating <code>QLThumbnailGenerationRequest</code> like this:</li>\n</ol>\n<pre><code>CGSize thumbnailSize = CGSizeMake(720, 720);\nQLThumbnailGenerator *generator = [[QLThumbnailGenerator alloc] init];\nQLThumbnailGenerationRequest *request = [[QLThumbnailGenerationRequest alloc] initWithFileAtURL: [NSURL fileURLWithPath:filePath] size:thumbnailSize scale:[UIScreen mainScreen].scale representationTypes:QLThumbnailGenerationRequestRepresentationTypeThumbnail];\n\n [generator generateBestRepresentationForRequest:request completionHandler:^(QLThumbnailRepresentation * _Nullable thumbnail, NSError * _Nullable error) {\n \n if (error) {\n NSLog(@&quot;ERROR = %@&quot;, error.localizedDescription);\n } else {\n NSLog(@&quot;SUCCESS&quot;);\n }\n \n }];\n</code></pre>\n<p>I am getting the following error everytime:</p>\n<pre><code>Thumbnail generation failed with error: The operation couldn’t be completed. (QLThumbnailErrorDomain error 0.)\nError code: 0\nError domain: QLThumbnailErrorDomain\nError user info: {\n NSUnderlyingError = &quot;Error Domain=QLThumbnailErrorDomain Code=102 \\&quot;(null)\\&quot;&quot;;\n</code></pre>\n<p>Let me know if you need any further details reagarding this issue.\nAny help regarding this would be appreciated. Thanks</p>\n"^^ . . "I've compiled xour `crc16()` in pure c and have compared some results like 1234567890 with the online calculator you've linked to and I get the same results"^^ . . . . . . "Found some examples: https://developernote.com/2024/09/examples-of-c-objective-c-interop/. Can they help?"^^ . "0"^^ . . "automatic-ref-counting"^^ . "1"^^ . . "Trying to use GTMAppAuth in objectiveC project using cocoapods throws errors"^^ . "0"^^ . . . . "digital-signature"^^ . . "<blockquote>\n<pre><code>[self.tableView setEditing:YES animated:YES];\n</code></pre>\n</blockquote>\n<p>Well, there's your problem. Being able to edit, meaning that the user can <em>rearrange</em> or <em>delete</em> cells, is incompatible with the notion of being able to do things <em>in</em> the cell. Just the opposite: the slider should be <em>disabled</em> when the cell/table is in edit mode.</p>\n"^^ . . . . . "<p>My team creates an xcframework, let's call it MyFramework. The framework uses just one class as an API, also called MyFramework. Until now, this framework has only contained ObjC code. However, we want to add a Swift file to support some SwiftUI stuff. In this Swift file, I want to add an extension to the MyFramework class.</p>\n<p>In my Swift file, I have something simple, like</p>\n<pre><code>import SwiftUI\nimport UIKit\n\npublic extension MyFramework {\n func doStuff() { /// }\n}\n</code></pre>\n<p>However, this doesn't build because the swift file can't find MyFramework. I experimented with adding a bridging header, which allows the framework to build. However, this doesn't seem to generate a .swiftinterface file, which means a test app can't find the <code>doStuff()</code> function. In further investigation, it seems that bridging headers aren't permitted in frameworks? I attempted to manually construct a .swiftinterface file, with no success.</p>\n<p>I then enabled <strong>Build Libraries for Distribution</strong>, which seems to be recommended for this situation. However, this requires that the bridging header be removed, which means that the swift file can't find MyFramework again. Online reading suggests that a modulemap is supposed to fix this, but I already have a modulemap, which looks like</p>\n<pre><code>framework module MyFramework {\n umbrella header &quot;MyFramework.h&quot;\n\n export *\n}\n</code></pre>\n<p>But this doesn't seem to affect the build at all. My understanding of modulemaps may be flawed, but I thought they were intended to expose ObjC code to Swift APPS, not necessarily when building the framework in the first place.</p>\n<p>Does anyone have any advice on how I can do this? I could resort to creating a separate framework for the swift portion, but I'd really rather not do that if at all possible.</p>\n"^^ . . . . "2"^^ . "0"^^ . "push-notification"^^ . "1"^^ . "0"^^ . "0"^^ . . . . . . . . . . . . . . "1"^^ . "1"^^ . "0"^^ . "0"^^ . . . "0"^^ . . . . . "<p>need some light here!</p>\n<p>Been working on a app where some submodules (.xcproject) are written in swift, and some inner modules of the main target are written in ObjC.</p>\n<p>Until then all good.</p>\n<p>We want to implement a feature from one of the swift submodule into an ObjC class.\nOur way for the rest of the project is to import every dependencies to a Parent class through an extension conforming to the protocol.</p>\n<p>Example.</p>\n<pre><code>// In Swift\n\n@obc public protocol MyProtocol { }\n\nclass ParentClass: MyProtocol { } // this way all the children gets access to the parent conformance\n\nclass ChildClass: ParentClass { }\n</code></pre>\n<p>In my bridging header, (which is already found, and works correctly by the way), I added:</p>\n<pre><code>#import &lt;MySubModule/MySubModule.h&gt;\n</code></pre>\n<p>In my ObjC class, I import <strong>MainApp-Swift.h</strong></p>\n<p>Now when importing the same protocol, I get this error:\n<strong>Cannot find protocol declaration for MyProtocolFromSubModule</strong></p>\n<p>Although the submodule is added and the protocol is found in the <strong>MainApp-Swift.h</strong></p>\n<pre><code>@interface SomeClassIExtend (SWIFT_EXTENSION(MainApp)) &lt;MyProtocolFromSubModule&gt;\n@end\n</code></pre>\n<p>Ideas ?</p>\n<p><strong>EDIT SOLUTION FOUND</strong></p>\n<p>It might have been obvious but still want to share it.\nSince swift is ObjectiveC c friendly, and my protocol holds object that be identified by ObjectiveC, turning the protocol into a an ObjectiveC one resolved my issue.</p>\n<p>Still have to make it public in my submodule and export it, but once its done, can reach by #importing my module.</p>\n<p>Yeah !</p>\n"^^ . "0"^^ . "0"^^ . . "<p>I have the following code in my C++/Objective-C app:</p>\n<pre><code>#import &lt;YandexMobileAds/YandexMobileAds-Swift.h&gt;\n\n@class AdHook;\n\nnamespace MyApp\n{\n class AdHolder\n {\n public:\n\n AdHolder(IosInterstitialAd* cpp_ad);\n\n AdHook* m_hook;\n };\n}\n\nusing namespace MyApp;\n\n@interface AdHook : NSObject &lt;YMAInterstitialAdLoaderDelegate, YMAInterstitialAdDelegate&gt;\n{\n @public IosInterstitialAd* m_cppAd;\n\n @public YMAInterstitialAdLoader* m_loader;\n @public YMAInterstitialAd* m_interstitialAd;\n}\n@end\n\n@implementation AdHook \n\n- (id)initFromCpp:(IosInterstitialAd *)cpp_ad\n{\n if (self = [super init])\n {\n m_cppAd = cpp_ad;\n m_interstitialAd = nil;\n\n m_loader = [[YMAInterstitialAdLoader alloc]init];\n m_loader.delegate = self;\n }\n return self;\n}\n\nAdHolder::AdHolder(IosInterstitialAd* cpp_ad)\n{\n [YMAMobileAds enableLogging];\n\n m_hook = [[AdHook alloc]initFromCpp:cpp_ad];\n}\n\nvoid SomeOtherClass::load()\n{\n NSLog(@&quot;IosInterstitialAd::load()&quot;);\n\n YMAAdRequestConfiguration* configuration = [[YMAAdRequestConfiguration alloc]initWithAdUnitID:@&quot;demo-interstitial-yandex&quot;];\n\n [m_holder-&gt;m_hook-&gt;m_loader loadAdWithRequestConfiguration:configuration];\n}\n</code></pre>\n<p>I create an instance of <code>AdHolder</code> class in C++ code and <code>AdHolder</code>'s constructor creates an instance of Objective-C class <code>AdHook</code> that in its turn crates its internal Objective-C objects.</p>\n<p>But I do not understand well enough what is the lifetime of <code>m_hook</code>? And I suspect that it is deleted at some point, because when I try to access <code>m_hook-&gt;m_interstitialAd</code> from <code>YMAInterstitialAdLoaderDelegate</code> callback I get a wrong value and the app crashes.</p>\n<p>Is m_hook a strong reference? If it is not how to make it strong?</p>\n<p><strong>EDIT1</strong></p>\n<p>Tried to randomly add <code>retain</code> call to various objects in my app and made the app work by adding <code>retain</code> call to <code>AdHook::m_interstitialAd</code>:</p>\n<pre><code>- (void)interstitialAdLoader:(YMAInterstitialAdLoader * _Nonnull)adLoader didLoad:(YMAInterstitialAd * _Nonnull)interstitialAd\n{\n NSLog(@&quot;IosInterstitialAd::YMAInterstitialAdLoader::didLoad, %@&quot;, interstitialAd);\n\n m_interstitialAd = [interstitialAd retain];\n m_interstitialAd.delegate = self;\n}\n</code></pre>\n<p>at least my app stopped crashing when I access <code>m_interstitialAd</code>.</p>\n<p>So the question probably is if <code>AdHook::m_interstitialAd</code> a strong reference?</p>\n"^^ . . . . . . . "0"^^ . "0"^^ . . "1"^^ . . . . . "1"^^ . "What calls `didLogout`?"^^ . "0"^^ . . . . "ScreenCaptureKit: SCShareableContent getShareableContentExcludingDesktopWindows never calls completion handler"^^ . "0"^^ . . . . . . "0"^^ . . "0"^^ . . "0"^^ . . . . . . . . . "crc16"^^ . "I don't know Objective C, but this looks wrong: `const char * stringAsChar` used as argument for a function that expects a `unsigned long`. Also `sizeof(stringAsChar)` is rather strange as it does not depend on the length of that string."^^ . . "<p>I finally solved this. My app had three Objective-C breakpoints. I don't remember what they're for and probably don't need them since I rewrote the app in Swift. I did find <a href="https://stackoverflow.com/questions/10003962/breakpoint-pointing-out-objc-autoreleasenopool">this old SO post</a> that I had upvoted, so that's probably what prompted me to add the objc_autoreaseNoPool breakpoint.</p>\n<p>Anyway, when I removed that breakpoint, the problem immediately disappeared. Now I can finally debug on iOS 18 and macOS 15.</p>\n"^^ . . . "1"^^ . . "iphone"^^ . "1"^^ . "On stackoverflow, you are welcome to answer your own questions, see https://stackoverflow.com/help/self-answer. However, the answer should be posted as a reply to your question. That way, you can accept your own answer after 48 hours and it will be marked with a green tick."^^ . "Added pics with height set to 240, 100 and 320 rspectively. The text in the textview always seems to be about four lines too long. Could it be a timing issue, the border of the textview is set before the text is set and the text is responding to some other layout constraints affected by the amount of text? There is a textview constraint at the bottom that goes to the next element down--an image that is not being used in this scenario. As of now, I am not touching that constraint. i do set the height of the image to zero elsewhere"^^ . . "0"^^ . "-1"^^ . "<p>You'll need to expose the UIView (in this case, the backgroundUIView) to your CustomHostingController. This can be done by passing a callback to the CustomButton, which lets the hosting controller know when a new UIView is created.</p>\n<p>try this:</p>\n<pre><code>public struct BackgroundUIView: UIViewRepresentable {\n var onUIViewCreated: ((UIView) -&gt; Void)?\n\n func makeUIView(context: Context) -&gt; UIView {\n let view = UIView()\n view.backgroundColor = .blue\n onUIViewCreated?(view)\n return view\n }\n\n func updateUIView(_ uiView: UIView, context: Context) {}\n}\n\npublic struct CustomButton: View {\n public var viewModel: ButtonViewModel\n public var index: Int\n public var onUIViewCreated: ((Int, UIView) -&gt; Void)?\n\n public var body: some View {\n Button(action: viewModel.tapEvent) {\n ZStack {\n BackgroundUIView(onUIViewCreated: { view in\n onUIViewCreated?(index, view)\n })\n Text(viewModel.title)\n }\n }\n }\n}\n\npublic struct ContainerView: View {\n @ObservedObject var viewModel: ContainerViewModel\n var onUIViewCreated: ((Int, UIView) -&gt; Void)?\n\n public var body: some View {\n LazyVStack {\n ForEach(viewModel.buttonViewModels.indices, id: \\.self) { index in\n CustomButton(viewModel: viewModel.buttonViewModels[index],\n index: index,\n onUIViewCreated: onUIViewCreated)\n }\n }\n }\n}\n\npublic class CustomHostingController: UIHostingController&lt;ContainerView&gt; {\n public var containerViewModel: ContainerViewModel\n private var buttonUIViews: [Int: UIView] = [:]\n\n public init(containerViewModel: ContainerViewModel) {\n self.containerViewModel = containerViewModel\n super.init(rootView: ContainerView(viewModel: containerViewModel, onUIViewCreated: { [weak self] index, uiView in\n self?.buttonUIViews[index] = uiView\n }))\n }\n\n @objc required dynamic init?(coder aDecoder: NSCoder) {\n fatalError(&quot;init(coder:) has not been implemented&quot;)\n }\n\n public func getButtonAtIndex(index: Int) -&gt; UIView? {\n return buttonUIViews[index]\n }\n}\n</code></pre>\n<p>and use like below:</p>\n<pre><code>let hostingController = CustomHostingController(containerViewModel: yourViewModel)\nif let buttonView = hostingController.getButtonAtIndex(index: 2) {\n let popover = ThirdPartyPopoverController(description: &quot;Test&quot;, fromSourceView: buttonView)\n // Present your popover\n}\n</code></pre>\n"^^ . "0"^^ . . "Objective C ARC: _foo in constructor autoincrements or not?"^^ . . . . "I tried it. It's just like you wrote, but I don't get the error, I took a photo then selected the photo and got “success” in the log (Without any changes in code, just change deployment target to 16.6)\n\nMaybe the problem is in the read accesses from the specified directory ?\n\nSystem Info: \niOS 17.6.1 \nDeveloper mode on"^^ . . "0"^^ . "<p>I have a UI object (a subclass of <code>NSObject</code> called <code>Label</code>) that observes a property called <code>region</code> (subclass of <code>NSManagedObject</code> called <code>Region</code>) for three core data attributes:</p>\n<ul>\n<li><code>start</code> (float)</li>\n<li><code>end</code> (float)</li>\n<li><code>name</code> (<code>NSString</code>)</li>\n</ul>\n<p><code>Label.m</code>, contains:</p>\n<pre><code>-(void) setRegion:(Region *)region {\n _region = region;\n [region addObserver:self forKeyPath:@&quot;start&quot;\n options:NSKeyValueObservingOptionNew\n context:nil];\n\n [region addObserver:self forKeyPath:@&quot;end&quot;\n options:NSKeyValueObservingOptionNew\n context:nil];\n\n [region addObserver:self forKeyPath:@&quot;name&quot;\n options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial\n context:nil]; // problematic\n}\n\n- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {\n NSLog(@&quot;%@&quot;, keyPath);\n}\n</code></pre>\n<p>(I also remove observation as required, in another method)</p>\n<p>All this seems pretty standard.\nThe problem is that when the instruction that is commented with <code>//problematic</code> is executed, <code>observeValueForKeyPath:</code> is called <strong>3 times</strong>, one for each observed key (<code>start</code>, <code>end</code>, <code>name</code>), even though the problematic instruction only observes the <code>name</code> key (and should send the notification only once for this key).</p>\n<p>Using a specific pointer for the context of each observation does not change this.</p>\n<p>This issue doesn't not occur if the problematic instruction is placed at the start of the method, nor when <code>NSKeyValueObservingOptionInitial</code> is added as an option for the observation of <code>start</code> and <code>end</code>.</p>\n<p>Of note: <code>Region</code> is a subclass of an abstract class that defines the <code>start</code>, <code>end</code> and <code>name</code> attributes, and the issue does not occur if the observed object is from another concrete subclass, even though neither subclass do anything special with these attributes (they use default accessors, they don't implement custom setters or whatnot).</p>\n"^^ . . . . . "1"^^ . . . . . "<p>I gets the error:</p>\n<blockquote>\n<p>'GoogleUtilities/GULKeychainStorage.h' file not found\nin file - Pods/AppCheckCore/GACAppCheckStorage.h</p>\n</blockquote>\n<p>The error occurred when i installed a new pod in an old objective-c project.</p>\n<p>I have tried deleting derived data, clean build, deleting workspace, pod deintegrate and install etc...</p>\n<p>Below is my podfile</p>\n<pre><code># Uncomment this line to define a global platform for your project\n# platform :ios, '10.0'\n# Uncomment this line if you are using Swift\n# use_frameworks!\n\ntarget ‘PurposeColor’ do\n \n pod 'FirebaseMessaging'\n pod 'GooglePlaces'\n pod 'GoogleMaps'\n pod 'FirebaseAuth'\n pod 'GoogleSignIn'\n \n source 'https://github.com/CocoaPods/Specs.git'\n pod 'AFNetworking', '~&gt; 2.7.0'\n pod 'SDWebImage', '~&gt;3.8.3'\n pod 'Fabric'\n pod 'Crashlytics'\n pod 'MobileVLCKit', '~&gt;3.3.0'\n pod 'EMEmojiableBtn'\n pod 'FirebaseCore'\n pod 'FirebaseFirestore'\n pod 'algorithmia', '~&gt;0.1.1'\n \n pod 'FBSDKCoreKit'\n pod 'FBSDKLoginKit'\n pod 'FBSDKShareKit'\n \n \n pod 'SVProgressHUD'\n pod 'Alamofire'\n pod 'Kingfisher', '~&gt;5.7.1'\n pod 'SwiftGifOrigin'\n pod 'MarqueeLabel'\n pod 'NXPlacePicker'\n pod 'SVPullToRefresh'\n \n pod 'MKDropdownMenu'\nend\n\ntarget ‘Share’ do\n \n source 'https://github.com/CocoaPods/Specs.git'\n pod 'AFNetworking', '~&gt; 2.7.0'\n \n pod 'SDWebImage', '~&gt;3.8.3'\n \n \n \n \n source 'https://github.com/CocoaPods/Specs.git'\n #pod 'GooglePlacePicker'\n pod 'GooglePlaces'\n pod 'GoogleMaps'\n \n \nend\n\n\ntarget 'PurposeColorTests' do\n \nend\n\ntarget 'PurposeColorUITests' do\n \nend\n</code></pre>\n"^^ . . "<p>I can independently build projects for iOS (using Swift) or Android (using Kotlin or Java) with Google AdMob. Unfortunately, my company switched to Kotlin Multiplatform (KMP), which isn't directly supported by Google yet.</p>\n<p>Here's a typical KMP project structure for me in case you're wondering:</p>\n<pre class="lang-yaml prettyprint-override"><code>- composeApp\n - src\n + androidMain # Android implementation\n + commonMain # Shared implementation\n + iosMain # iOS implementation\n- iosApp # Swift / iOS-specific frameworks\n - iosApp # target iOS app\n</code></pre>\n<p>In my KMP project, I have built a <code>commonMain</code> class with functions that call <code>androidMain</code> and <code>iosMain</code> implementations. <code>androidMain</code> is working well displaying ads, but I'm struggling to get AdMob working on the iOS side.</p>\n<p>Are there any <strong>instructions or walkthroughs</strong> for how to create an <code>iosMain</code> / <code>iosApp</code> implementation of <strong>AdMob</strong> in a Kotlin Multiplatform (<strong>KMP</strong>) project?</p>\n"^^ . "1"^^ . . "0"^^ . . "0"^^ . . "Is `self.textView` a strong property and retaining the text view? What happens when you do `self.textView = nil;`?"^^ . "0"^^ . . "c"^^ . . . . . . . . . "How do you use UIKit to watch for clipboard changes in a Mac Catalyst console app in Objective-C?"^^ . "c++"^^ . . "0"^^ . . "Unless you mean the actual border line *appearing* to "bleed"? https://i.sstatic.net/oTl2ZUHA.png"^^ . "1"^^ . . . . . . . . . "<p>The issue is not from not from iOS code. The issue you are facing is because the JAVASCRIPT. if don't know then let me tell you that javascript does not run in the background because of JavaScript thread is tied to the UI thread.</p>\n<p>The second thing, iOS will pause your app in background.</p>\n<p>Try the library that provides support to run react-native (javascript) in the background.</p>\n<p>Try <a href="https://github.com/ocetnik/react-native-background-timer" rel="nofollow noreferrer">BackgroundTimer</a></p>\n<p>or</p>\n<p><a href="https://github.com/jamesisaac/react-native-background-task" rel="nofollow noreferrer">Background-Task</a></p>\n<p>Hope this will help you.</p>\n"^^ . . "`+keyPathsForValuesAffecting...` is not implemented. I can try to code a minimal example, but I'm afraid the issue will not manifest itself as it only occurs when the observed object is of a particular subclass, and not when it is of another subclass with the same attributes."^^ . . . "`NSAssert(NO,...)` is the traditional way to write this."^^ . "uitextview"^^ . . "Is `+keyPathsForValuesAffecting…` implemented? Have you tried reproducing the issue in a [mre]?"^^ . . "<p>I am learning to create a Cocoa application on Mac OS and have run into an issue with memory I don't quite understand. From what I've read with non-ARC is that you should be releasing anything you've allocated manually.</p>\n<p>However, I am running into issues with some classes not deallocating after being allocated and initialized. For example, <code>NSTextView</code>, if I manually try to release it, it will not deallocate. I am testing this by using my own implementation and overriding the <code>dealloc</code> function. As far as why, I plan to have my application be able to open and close Windows for debug and test suite runs; so I want to be able to destroy and remake the <code>NSTextView</code> with the Window if needed. However, I don't want to be leaking things when Windows are remade.</p>\n<pre><code>@implementation MyCustomTextView\n\n- (void)dealloc {\n NSLog(@&quot;MyCustomTextView deallocated&quot;);\n [super dealloc];\n}\n\n@end\n</code></pre>\n<p>With my code being something like this:</p>\n<pre><code> @autoreleasepool { \n self.textView = [[MyCustomTextView alloc] init];\n }\n</code></pre>\n<p>Then after callinge <code>[self.textView release];</code> to release it my <code>dealloc</code> function does not get called. However, if I call <code>[self.textView release];</code> twice, then it will trigger the deallocation. Why is that?</p>\n<p>It doesn't seem to do it with many classes, just a few, but most classes seem to call <code>dealloc</code> after one release call. Shouldn't it be 1:1 release for each allocation to get a deallocation? I know refcounts can increase due to internal behavior, but that they should be freed when the original allocation is released. It doesn't seem like the solution should be to trace the internals of a class to determine how to release it.</p>\n<p>It seems like either I'm doing something wrong or I am missing something, any help is appreciated!</p>\n"^^ . "0"^^ . "<p>Is there a way to know when Crashlytics has finished sending report? There is a method <code>sendUnsentReports</code>, which can be used together with <code>checkAndUpdateUnsentReportsWithCompletion</code> method, but it just &quot;Enqueues any unsent reports on the device to upload to Crashlytics&quot;, but how do I know when upload is finished?</p>\n"^^ . . "key-value-observing"^^ . "1"^^ . . "0"^^ . . . . "1"^^ . . . "1"^^ . . . . . . . . . . . "I tried on iOS 18 works without problem"^^ . . . "0"^^ . "0"^^ . "iOS Keychain data for SDKs"^^ . "1"^^ . . "You need a specific commit for the swift package. It’s in the issues."^^ . "0"^^ . . . "Please provide enough code so others can better understand or reproduce the problem."^^ . . . "What is the string encoding and what does `defaultCStringEncoding` use? "You might sometimes need to use this encoding when interpreting user documents with unknown encodings, in the absence of other hints, but in general this encoding should be used rarely, if at all.""^^ . "<p>I have a QT app with CMake. CMake generates <code>.xcodeproj</code> and <a href="https://developernote.com/2024/09/the-right-way-to-build-yandex-mobile-ads-example-for-ios/" rel="nofollow noreferrer">CocoaPods generates</a> <code>.xcworkspace</code> from the following <code>Podfile</code>:</p>\n<pre><code>source 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, :deployment_target =&gt; '14.0'\n\ntarget 'MyApp' do\n pod 'YandexMobileAdsAdMobAdapters'\n pod 'YandexMobileAdsIronSourceAdapters'\n pod 'YandexMobileAdsMediation'\n pod 'YandexMobileAdsInstream'\nend\n\npost_install do |installer|\n installer.pods_project.targets.each do |target|\n target.build_configurations.each do |config|\n config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'\n end\n end\nend\n</code></pre>\n<p><code>pod install</code> command generates the following headers:</p>\n<pre><code>./Pods/YandexMobileAdsIronSourceAdapters/YandexMobileAdsIronSourceAdapters.xcframework/ios-arm64_x86_64-simulator/YandexMobileAdsIronSourceAdapters.framework/Headers/YandexMobileAdsIronSourceAdapters-umbrella.h\n./Pods/YandexMobileAdsIronSourceAdapters/YandexMobileAdsIronSourceAdapters.xcframework/ios-arm64_x86_64-simulator/YandexMobileAdsIronSourceAdapters.framework/Headers/YandexMobileAdsIronSourceAdapters-Swift.h\n./Pods/YandexMobileAdsIronSourceAdapters/YandexMobileAdsIronSourceAdapters.xcframework/ios-arm64/YandexMobileAdsIronSourceAdapters.framework/Headers/YandexMobileAdsIronSourceAdapters-umbrella.h\n./Pods/YandexMobileAdsIronSourceAdapters/YandexMobileAdsIronSourceAdapters.xcframework/ios-arm64/YandexMobileAdsIronSourceAdapters.framework/Headers/YandexMobileAdsIronSourceAdapters-Swift.h\n./Pods/YandexMobileAds/static/YandexMobileAds.xcframework/ios-arm64_x86_64-simulator/YandexMobileAds.framework/Headers/YandexMobileAds-umbrella.h\n./Pods/YandexMobileAds/static/YandexMobileAds.xcframework/ios-arm64_x86_64-simulator/YandexMobileAds.framework/Headers/YandexMobileAds-Swift.h\n./Pods/YandexMobileAds/static/YandexMobileAds.xcframework/ios-arm64_x86_64-simulator/YandexMobileAds.framework/Headers/YandexMobileAds.h\n./Pods/YandexMobileAds/static/YandexMobileAds.xcframework/ios-arm64/YandexMobileAds.framework/Headers/YandexMobileAds-umbrella.h\n./Pods/YandexMobileAds/static/YandexMobileAds.xcframework/ios-arm64/YandexMobileAds.framework/Headers/YandexMobileAds-Swift.h\n./Pods/YandexMobileAds/static/YandexMobileAds.xcframework/ios-arm64/YandexMobileAds.framework/Headers/YandexMobileAds.h\n./Pods/YandexMobileAdsInstream/YandexMobileAdsInstream.xcframework/ios-arm64_x86_64-simulator/YandexMobileAdsInstream.framework/Headers/YandexMobileAdsInstreamVersion.h\n./Pods/YandexMobileAdsInstream/YandexMobileAdsInstream.xcframework/ios-arm64_x86_64-simulator/YandexMobileAdsInstream.framework/Headers/YandexMobileAdsInstream-Swift.h\n./Pods/YandexMobileAdsInstream/YandexMobileAdsInstream.xcframework/ios-arm64/YandexMobileAdsInstream.framework/Headers/YandexMobileAdsInstreamVersion.h\n./Pods/YandexMobileAdsInstream/YandexMobileAdsInstream.xcframework/ios-arm64/YandexMobileAdsInstream.framework/Headers/YandexMobileAdsInstream-Swift.h\n./Pods/YandexMobileAdsAdMobAdapters/YandexMobileAdsAdMobAdapters.xcframework/ios-arm64_x86_64-simulator/YandexMobileAdsAdMobAdapters.framework/Headers/YandexMobileAdsAdMobAdapters-Swift.h\n./Pods/YandexMobileAdsAdMobAdapters/YandexMobileAdsAdMobAdapters.xcframework/ios-arm64_x86_64-simulator/YandexMobileAdsAdMobAdapters.framework/Headers/YandexMobileAdsAdMobAdapters-umbrella.h\n./Pods/YandexMobileAdsAdMobAdapters/YandexMobileAdsAdMobAdapters.xcframework/ios-arm64/YandexMobileAdsAdMobAdapters.framework/Headers/YandexMobileAdsAdMobAdapters-Swift.h\n./Pods/YandexMobileAdsAdMobAdapters/YandexMobileAdsAdMobAdapters.xcframework/ios-arm64/YandexMobileAdsAdMobAdapters.framework/Headers/YandexMobileAdsAdMobAdapters-umbrella.h\n</code></pre>\n<p>but I can't include them into <code>.mm</code> file in my project. I tried various paths like</p>\n<pre><code>#import &lt;YandexMobileAds.h&gt;\n#import &lt;YandexMobileAds/YandexMobileAds-Swift.h&gt;\n#import &lt;YandexMobileAds/YandexMobileAds.h&gt;\n</code></pre>\n<p>but without a success:</p>\n<p><a href="https://i.sstatic.net/pBB6AsPf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/pBB6AsPf.png" alt="enter image description here" /></a></p>\n<ol>\n<li>Why aren't they found?</li>\n</ol>\n<p>My first Idea was to <a href="https://stackoverflow.com/a/33865771/2394762">make them public somehow</a>, but I did not find <code>Header</code> section on <code>Build Phases</code> page:</p>\n<p><a href="https://i.sstatic.net/0kFBdE1C.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0kFBdE1C.png" alt="enter image description here" /></a></p>\n<p>(there are a lot of tasks like <code>Generate .rcc/qmlcache .. </code>, but not <code>Headers</code>).</p>\n<p><a href="https://i.sstatic.net/fzZVN9Y6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/fzZVN9Y6.png" alt="enter image description here" /></a></p>\n<p>XCode shows the following Pods among others:</p>\n<p><a href="https://i.sstatic.net/zOwaaGt5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zOwaaGt5.png" alt="enter image description here" /></a></p>\n<ol start="2">\n<li>Another question is why <code>YandexMobileAdsMediation</code> header is not generated? (but only YandexMobileAds)</li>\n</ol>\n<p>See <a href="https://ads.yandex.com/helpcenter/en/easy/integration/ios" rel="nofollow noreferrer">Yandex docs</a> on how to use their packages from a Swift project.</p>\n<ol start="3">\n<li>Is it possible to add Swift packages to a project with CMake? (It is possible to <a href="https://github.com/apple/swift-cmake-examples" rel="nofollow noreferrer">link against a Swift library</a>, but what about a Swift package?)</li>\n</ol>\n<p><strong>EDIT1:</strong></p>\n<p>I do not understand Objective-C syntax well enough, but at least I was able to find required class name <code>InterstitialAdLoader</code> in generated <code>YandexMobileAds-Swift.h</code> header and I can assume that it is defined here:</p>\n<pre><code>grep -ri &quot;InterstitialAdLoader&quot; . --include=\\*.h\n\n./YandexMobileAds-Swift.h:@protocol YMAInterstitialAdLoaderDelegate;\n./YandexMobileAds-Swift.h:SWIFT_CLASS_NAMED(&quot;InterstitialAdLoader&quot;)\n./YandexMobileAds-Swift.h:@interface YMAInterstitialAdLoader : NSObject\n./YandexMobileAds-Swift.h:@property (nonatomic, weak) id &lt;YMAInterstitialAdLoaderDelegate&gt; _Nullable delegate;\n./YandexMobileAds-Swift.h:SWIFT_PROTOCOL_NAMED(&quot;InterstitialAdLoaderDelegate&quot;)\n./YandexMobileAds-Swift.h:@protocol YMAInterstitialAdLoaderDelegate &lt;NSObject&gt;\n./YandexMobileAds-Swift.h:/// \\param adLoader A reference to an object of the &lt;code&gt;InterstitialAdLoader&lt;/code&gt; class that invoked the method.\n./YandexMobileAds-Swift.h:- (void)interstitialAdLoader:(YMAInterstitialAdLoader * _Nonnull)adLoader didLoad:(YMAInterstitialAd * _Nonnull)interstitialAd;\n./YandexMobileAds-Swift.h:/// \\param adLoader A reference to an object of the &lt;code&gt;InterstitialAdLoader&lt;/code&gt; class that invoked the method.\n./YandexMobileAds-Swift.h:- (void)interstitialAdLoader:(YMAInterstitialAdLoader * _Nonnull)adLoader didFailToLoadWithError:(YMAAdRequestError * _Nonnull)error;\n</code></pre>\n<p>so theoretically including <code>YandexMobileAds-Swift.h</code> to my <code>.mm</code> file can be step to a right direction.</p>\n"^^ . . "Yes, possibly. But on iOS, one can only reorder the cells by dragging the burger icon, and thus the slider is usable even when the table is editing. In my view, that is the correct behavior. Whichever way is correct, it doesn't behave the same between iOS and Mac, which is a shame."^^ . . . . "0"^^ . . "connection to service named com.apple.FileProvider""^^ . . . "1"^^ . "This definitely looks like a bug. -1 (ascending) is correct given how Finder orders these filenames. I've reproduced this many ways, including in Swift, and the second and subsequent calls are all incorrect. I would open a Feedback about it. Especially since only the first call is correct, I don't see a way to work around this (you can't "prime" the system by just making a comparison and throw it away)."^^ . . "If you turned off `ARC` then you need implement smart pointer functionality in your holders: retain new objects on assign and release old objects. And release objects in destructor. But I don't know reasons to not use `ARC`."^^ . . . . "0"^^ . "1"^^ . . . "accelerate-framework"^^ . "javascript"^^ . "0"^^ . . "<p>I ended up implementing a different Keychain approach, using the Apple-provided <a href="https://gist.github.com/dhoerl/1170641" rel="nofollow noreferrer">KeychainItemWrapper</a> to simplify Keychain operations.</p>\n<pre><code>- (void)storeAuthState:(OIDAuthState *)authState {\n NSError *errRet;\n NSData *authStateData = [NSKeyedArchiver archivedDataWithRootObject:authState\n requiringSecureCoding:NO error:&amp;errRet];\n KeychainItemWrapper *keychainItem =\n [[KeychainItemWrapper alloc] initWithIdentifier:@&quot;&lt;your ID here&gt;&quot; accessGroup:nil];\n [keychainItem setObject:authStateData forKey:(id)kSecAttrAccount];\n}\n- (OIDAuthState *)retrieveAuthState {\n NSError *errRet;\n KeychainItemWrapper *keychainItem =\n [[KeychainItemWrapper alloc] initWithIdentifier:@&quot;&lt;your ID here&gt;&quot; accessGroup:nil];\n NSData *data = [keychainItem objectForKey:(id)kSecAttrAccount];\n OIDAuthState *authState = [NSKeyedUnarchiver unarchivedObjectOfClass:[OIDAuthState class]\n fromData:data error:&amp;errRet];\n return authState;\n}\n</code></pre>\n"^^ . . . . . "When I scroll the text up and dowm it moves above and below the green so it appears there is only one instance of the text. It just is not respecting the boundaries or border layer of the text view."^^ . "0"^^ . "1"^^ . . "0"^^ . . . . "1"^^ . . "0"^^ . "<p>I'm trying to use GTMAppAuth in my ObjectiveC project.</p>\n<p>In my podfile I use <code>pod 'GTMAppAuth'</code> <code>platform: ios, '12.0'</code> and <code>use_frameworks!</code></p>\n<p>The Podfile seems to be installed and I can see the GTMAppAuth in my Pods, too.</p>\n<p>But when I try <code>#import &lt;GTMAppAuth/GTMAppAuth.h&gt;</code> I'm getting an error saying <code>#import &lt;GTMAppAuth/GTMAppAuth.h&gt; file not found</code>.</p>\n<p>Same goes for <code>#import &lt;GTMAppAuth/GTMAppAuthFetcherAuthorization.h&gt;</code>.</p>\n<p>What am I doing wrong?</p>\n"^^ . . "clipstobounds"^^ . . . . . "0"^^ . . . "0"^^ . . . "Thanks for your suggestion, but it still doesn't work ."^^ . "If it's any comfort, you're not alone: https://developer.apple.com/forums/thread/681946"^^ . "0"^^ . "Thanks, that sort of works. Seems like there are lots of deprecations in newser versions of GoogleSignIn. I get weird errors (handleUrl not working, for example). Do you have an idea where I find the latest examples for GIDSignIn?"^^ . . "0"^^ . . . . . . . "<p>I have the following function to process audio data in Obj-C (and then deeper in C++):</p>\n<pre><code>- (void) audioProcess: (int) numChannels\n numSamples: (int) numSamples\n stride: (int) stride\n data: (float * const *) data;\n</code></pre>\n<p>This signature is classic for processing audio buffer data stored in contiguous memory. It could be interleaved or not, depending on the buffer.</p>\n<p>Then in Swift, I want to process an audio buffer like so:</p>\n<pre><code>let buffer = ... // get AVAudioPCMBuffer from somewhere\n\nif let floatChannelData = buffer.floatChannelData {\n\n audioProcess(Int32(buffer.format.channelCount),\n numSamples: Int32(buffer.frameLength),\n stride: Int32(buffer.stride),\n data: floatChannelData)\n}\n</code></pre>\n<p>I get the following compilation error:</p>\n<ul>\n<li>Cannot convert value of type <code>'UnsafePointer&lt;UnsafeMutablePointer&lt;Float&gt;&gt;'</code> to expected argument type <code>'UnsafePointer&lt;UnsafeMutablePointer&lt;Float&gt;?&gt;'</code></li>\n</ul>\n<p>Notice the difference in optionality of the <code>UnsafeMutablePointer&lt;Float&gt;</code>.</p>\n<p>How can I pass the floatChannelData from Swift to Obj-C (C++)?</p>\n<p>Edit: typos</p>\n"^^ . "1"^^ . . . . . "<p>The issue with me was that my project included openSSL static libs and among the include headers was a file &quot;ctype.h&quot;, that has the same name as the one of the files in macOS SDK /usr/include folder.</p>\n<p>So, yeah, it has to do with &quot;search and discovery&quot; phase of the compiler.</p>\n<p>I packed openSSL as a framework and added it to the project, solved this mix-up.</p>\n"^^ . "How did I solve the Could not build Objective-C module 'Firebase' error at flutter?"^^ . . . "onesignal"^^ . . . "Why could [NSString localizedStandardCompare:] produce different results?"^^ . . "0"^^ . . . . "Please include at least the openssl commands you used for verifying."^^ . "0"^^ . . . . . . "Importing Swift into Objective-C with CMake"^^ . . . . . . "1"^^ . . . "OneSignal Push notification works in iPhone 14 but not iPhone SE and iPhone 11"^^ . . "BTW: There is a code generator for CRC calculation with selectable algorithms and CRC models. see https://pycrc.org/"^^ . . . . . . "1"^^ . . . . "0"^^ . . . "What does the error say? You need to have a bridging header "MyFramework-Bridge.h" and import "MyFramework.h" in it (don't forget to declare bridging header in target settings). No modulemap/umbrella needed, just bridging header"^^ . "<p>How did I solve the Could not build Objective-C module 'Firebase' error at flutter ?</p>\n<p><a href="https://i.sstatic.net/QS4QhUhn.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/QS4QhUhn.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/zJFoSD5n.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zJFoSD5n.png" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/XtSULXcg.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XtSULXcg.png" alt="enter image description here" /></a></p>\n<p>I opened edit schemes in xcode and set the build configuration in debug mode and the problem was solved.</p>\n<p>Make sure that debug mode is selected in the window that opens by selecting the edit scheme option under the runner in Xcode.</p>\n"^^ . . . "2"^^ . "use more modern syntax for importing modules `@import GTMAppAuth;`"^^ . "<p>I am making my own custom swipeable cells where user can swipe a cell to show options. Currently all my subviews are added to the <code>contentView</code> of the cell. And I have added my options to the <code>backgroundView</code> of the cell.</p>\n<p><a href="https://i.sstatic.net/BHUAsa2z.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/BHUAsa2z.png" alt="enter image description here" /></a></p>\n<ol>\n<li><p>Is it okay for me to add my custom content to the <code>backgroundView</code>?</p>\n</li>\n<li><p>Is it okay for me to manually change the position of the frame of the <code>contentView</code> when doing my swipe on the cell? And then I will reset it back to its original position after it's completed. Or should I use another view as a container?</p>\n</li>\n</ol>\n"^^ . . . "1"^^ . . . "`AdHolder` itself is a C++ controlled memory that stores the Objective-C pointer, right?"^^ . . "ios18"^^ . . . . . "0"^^ . . . . "1"^^ . "0"^^ . "2"^^ . "Is is legal to change the position of the frame of the contentView in a UITableViewCell or should I use another container view?"^^ . . . "I would drop support for < iOS 13. You can probably reasonably drop support for < iOS 15"^^ . . . "1"^^ . . . . . . . . . "0"^^ . . . . . "0"^^ . . . . . "0"^^ . "1"^^ . . . "0"^^ . "0"^^ . "parse-platform"^^ . "The app will crash on IOS 18 when send a network request"^^ . . . . "We need some more information. Using your code, I set the text to **2400 characters** and don't get any "bleed." As a side note, the way your code is written, there is no reason to return a `UITextField` from your `styleAndAddBorderTo` method."^^ . "0"^^ . "0"^^ . . . . . . . . "0"^^ . "you just need `@property (nonatomic) NSObject *foo;`"^^ . "0"^^ . "Does Apple BNNS copy weight data internally? Can I safely free my weight buffer afterward?"^^ . "autolayout"^^ . . "1"^^ . . . . . . . . . . . . . "2"^^ . "Crashlytics notification that crash report sending is finished"^^ . . . . . . "0"^^ . . "<p>I'm working with Apple's BNNS framework to implement neural networks. I'm using the <code>BNNSFilterCreateLayerFullyConnected</code> function to create fully connected layers. I have a few questions regarding weight data handling:</p>\n<ol>\n<li>Does BNNS Filter factory methods like <code>BNNSFilterCreateLayerFullyConnected</code> internally copy the weight data I provide into its own buffer? Or does it simply reference my original weight buffer?</li>\n<li>If it does copy the data, can I safely free my original weight buffer after the layer is created? I want to ensure proper memory management and avoid potential issues.</li>\n</ol>\n<p>I haven't been able to find definitive information in Apple's documentation. Any insights or clarifications on this would be greatly appreciated.</p>\n"^^ . . . . . . . . "0"^^ . "Unable Run/Build/Archive iOS app in Xcode 16"^^ . . . "0"^^ . . . . . "<p>I just upgraded to Xcode 16.0 and Sequoia 15.0. I have a large, mostly Objective-C project that's giving me the following error. Does anybody know how I can track down this error? I'd love to create a sample project to reproduce it, but I have no idea which part of my project is taking the compiler down this path. Other projects build fine.</p>\n<pre><code>/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/usr/include/wchar.h:67:10: note: while building module '\\_wchar' imported from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/usr/include/wchar.h:67:\n#include \\&lt;\\_wchar.h\\&gt;\n^\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/usr/include/\\_wchar.h:76:10: note: while building module '\\__wctype' imported from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/usr/include/\\_wchar.h:76:\n#include \\&lt;sys/\\_types/\\_mbstate_t.h\\&gt;\n^\n\\&lt;module-includes\\&gt;:1:9: note: in file included from \\&lt;module-includes\\&gt;:1:\n#import &quot;\\___wctype.h&quot;\n^\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/usr/include/\\___wctype.h:83:24: error: use of undeclared identifier '\\_CTYPE_A'\nreturn (\\__istype(\\_wc, \\_CTYPE_A|\\_CTYPE_D));\n^\n</code></pre>\n<p>There are 100+ lines of similar errors referencing _CTYPE_A, _CTYPE_C, _CTYPE_D, _CTYPE_G, etc.</p>\n<pre><code></code></pre>\n<p>I've tested this on another Mac that's still running Sonoma. The project compiles on that computer with Xcode 15.4, but gives the same errors with Xcode 16.</p>\n<p>UPDATE: This project is for a macOS application (not sure if that matters).</p>\n"^^ . "My app often fails to access the network (iOS,Objective-c)"^^ . "1"^^ . . . "0"^^ . "0"^^ . . . . "0"^^ . . . . . . "Swift extension to an ObjC class inside the same framework"^^ . . . . "May be someone is setting `contentView` too?"^^ . . . "1"^^ . . . "0"^^ . . "Please [edit] your question and add a C `main` function that feeds your test data into your function `crc16` and prints the result. It would be best to embed the data in the main function. Otherwise, if it needs an input file, provide the input file as well. `unsigned long ptr` and `(uint16_t )ptr++ << 8` look wrong. It looks like you wanted to use a pointer."^^ . . "1"^^ . "0"^^ . "clang++"^^ . . . . . . "1"^^ . "0"^^ . . "2"^^ . . . "<p>I'm developing a React Native app with CarPlay support using the react-native-carplay library. The CarPlay interface works correctly when the phone app is open, but it fails to load the JavaScript when the phone app is closed. Currently, the CarPlay does not load the JS when the app is open either, although that is something easier to fix.</p>\n<p>I already tried adhering to this <a href="https://github.com/birkir/react-native-carplay/pull/158/files#diff-7acbeaeeab36010e6193c0a86a31c4000ef49f57d90aa94eac35b08ca32a2e3f" rel="nofollow noreferrer">README</a>, although to little avail.</p>\n<pre><code>// AppDelegate.mm (redacted and consolidated)\n@implementation AppDelegate\n\n- (BOOL)initAppFromScene:(UISceneConnectionOptions *)connectionOptions {\n if (self.rootView == nil) {\n self.rootViewFactory = [self createRCTRootViewFactory];\n NSDictionary *initProps = [self prepareInitialProps];\n self.rootView = [self.rootViewFactory viewWithModuleName:self.moduleName \n initialProperties:initProps \n launchOptions:[self connectionOptionsToLaunchOptions:connectionOptions]];\n return YES;\n }\n return NO;\n}\n\n// Other necessary methods...\n\n@end\n\n\n// CarSceneDelegate.mm (redacted and consolidated)\n@implementation CarSceneDelegate\n\n- (void)templateApplicationScene:(CPTemplateApplicationScene *)templateApplicationScene\n didConnectInterfaceController:(CPInterfaceController *)interfaceController {\n AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];\n \n [appDelegate initAppFromScene:nil];\n UIView *carPlayRootView = [appDelegate.rootViewFactory viewWithModuleName:@&quot;CarPlayApp&quot;\n initialProperties:nil\n launchOptions:nil];\n \n UIViewController *rootViewController = appDelegate.createRootViewController;\n [appDelegate setRootView:appDelegate.rootView toRootViewController:rootViewController];\n \n CPWindow *carWindow = templateApplicationScene.carWindow;\n carWindow.rootViewController = rootViewController;\n \n [carPlayRootView setFrame:carWindow.bounds];\n [carWindow addSubview:carPlayRootView];\n \n [RNCarPlay connectWithInterfaceController:interfaceController window:carWindow];\n}\n\n// Other necessary methods...\n\n@end\n\n// SceneDelegate.mm (redacted and consolidated)\n@implementation SceneDelegate\n\n- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions\n{\n if ([scene isKindOfClass:[UIWindowScene class]])\n {\n AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];\n BOOL hasCreatedBridge = [appDelegate initAppFromScene:connectionOptions];\n \n UIViewController *rootViewController = appDelegate.createRootViewController;\n [appDelegate setRootView:appDelegate.rootView toRootViewController:rootViewController];\n\n UIWindow *window = [[UIWindow alloc] initWithWindowScene:scene];\n window.rootViewController = rootViewController;\n self.window = window;\n appDelegate.window = window;\n [self.window makeKeyAndVisible];\n\n // Handle splash screen...\n }\n}\n\n// Other necessary methods...\n\n@end\n\n// JavaScript\nimport { AppRegistry } from &quot;react-native&quot;;\nimport CarCode from &quot;./carplay/CarCode&quot;;\n\nAppRegistry.registerComponent(&quot;CarPlayApp&quot;, () =&gt; CarCode);\n</code></pre>\n<p>I've tried various approaches, including:</p>\n<ul>\n<li>Initializing the React Native bridge in the CarPlay scene delegate.</li>\n<li>Creating a separate root view for CarPlay.</li>\n<li>Ensuring that the JavaScript bundle is loaded and executed.</li>\n</ul>\n<p>Despite these attempts, the CarPlay interface remains blank when the phone app is not running. The native iOS code seems to be working, but the JavaScript is not being loaded or executed.\nWhat am I missing to ensure that the React Native JavaScript code runs in CarPlay even when the phone app is closed?\nAdditional information:</p>\n<p>React Native version: 75.0\nreact-native-carplay version: 2.4.1-beta.0\niOS version: 16.6</p>\n<p>Any help or insights would be greatly appreciated!</p>\n"^^ . . "0"^^ . . . . . . "<p>I'm trying to share my UIView between some class for decode frame. For this, i've add <code>sharedInstance</code> method for get the instance from other class.</p>\n<p>This method same not work and return an new instance, not the current.</p>\n<p>My UIView class :</p>\n<pre><code>using namespace facebook::react;\n\n@interface RTNViewStreamView () &lt;RCTRTNViewStreamViewViewProtocol&gt;\n\n@end\n\n@implementation RTNViewStreamView {\n UIView * _view;\n}\n\n+ (ComponentDescriptorProvider)componentDescriptorProvider\n{\n return concreteComponentDescriptorProvider&lt;RTNViewStreamViewComponentDescriptor&gt;();\n}\n\n- (instancetype)initWithFrame:(CGRect)frame\n{\n if (self = [super initWithFrame:frame]) {\n static const auto defaultProps = std::make_shared&lt;const RTNViewStreamViewProps&gt;();\n _props = defaultProps;\n\n _view = [[UIView alloc] init];\n NSLog(@&quot;initWithFrame: %p&quot;, _view);\n\n self.contentView = _view;\n }\n\n return self;\n}\n\n+ (id)sharedInstance\n{\n static RTNViewStreamView *sharedClassA = nil;\n static dispatch_once_t onceToken;\n dispatch_once(&amp;onceToken, ^{\n sharedClassA = [[self alloc] init];\n });\n return sharedClassA;\n}\n\n- (UIView *)getContentView {\n return self.contentView;\n}\n\n- (void)updateProps:(Props::Shared const &amp;)props oldProps:(Props::Shared const &amp;)oldProps\n{\n const auto &amp;oldViewProps = *std::static_pointer_cast&lt;RTNViewStreamViewProps const&gt;(_props);\n const auto &amp;newViewProps = *std::static_pointer_cast&lt;RTNViewStreamViewProps const&gt;(props);\n\n if (oldViewProps.color != newViewProps.color) {\n NSString * colorToConvert = [[NSString alloc] initWithUTF8String: newViewProps.color.c_str()];\n [_view setBackgroundColor:[self hexStringToColor:colorToConvert]];\n }\n\n [super updateProps:props oldProps:oldProps];\n}\n\nClass&lt;RCTComponentViewProtocol&gt; RTNViewStreamViewCls(void)\n{\n return RTNViewStreamView.class;\n}\n</code></pre>\n<p>Then, from other class, i try this :</p>\n<pre><code>- (instancetype)init {\n self = [super init];\n if (self) {\n RTNViewStreamView *classA = [RTNViewStreamView sharedInstance];\n NSLog(@&quot;init rtnstream: %p&quot;, classA.contentView);\n classA.contentView.backgroundColor = [UIColor redColor]; // Not work\n }\n return self;\n}\n</code></pre>\n<p>From logs, i see the <code>initWithFrame</code> method is re-run when i call the <code>sharedInstance</code> from other class :</p>\n<p><a href="https://i.sstatic.net/eqVgqSvI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/eqVgqSvI.png" alt="enter image description here" /></a></p>\n<p>I don't really understand why i can't retrieve my view instance? i need to use this instance to modify it somewhere else.</p>\n<p>I'm on React-Native project, i write TurboModule with Fabric.</p>\n"^^ . "0"^^ . "1"^^ . . . . "xcframework"^^ . "Looking at the results you printed, it seems that `RTNViewStreamView` was initialized twice. I'm not sure which instance you intend to use for editing. I don't understand why you don't let the `ViewController` hold the instance of `RTNViewStreamView` and instead use a singleton to hold it. In that case, the singleton will always end up holding only the most recently initialized instance."^^ . . . . "<p>I am getting this error at initialization of Parse.\nMost likely it is because I updated to XCode Version 16.0 (16A242d). MacOS is 14.5 (23F79).</p>\n<p>I have installed Parse as a pod. Also tried to remove it and install latest version as a Package Dependency but same error.</p>\n<pre><code>[Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id&lt;ParseMutableClientConfiguration&gt; configuration) {\n configuration.applicationId = @&quot;myAppId&quot;;\n configuration.clientKey = nil;\n configuration.server = @&quot;myParseServerUrlStringHostedonHeroku&quot;;\n}]];\n</code></pre>\n<p>Here is what I get when I run the app: (No errors while compiling.)</p>\n<pre><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: Invalid class name. Class names cannot start with an underscore.'\n*** First throw call stack:\n(\n 0 CoreFoundation 0x00000001804ae0f8 __exceptionPreprocess + 172\n 1 libobjc.A.dylib 0x0000000180087db4 objc_exception_throw + 56\n 2 CoreFoundation 0x00000001804ae008 -[NSException initWithCoder:] + 0\n 3 myApp.debug.dylib 0x0000000106d2f1f8 +[PFObject(Private) _assertValidInstanceClassName:] + 180\n 4 myApp.debug.dylib 0x0000000106d37598 -[PFObject init] + 436\n 5 myApp.debug.dylib 0x0000000106d37898 -[PFObject initWithObjectState:] + 92\n 6 myApp.debug.dylib 0x0000000106d379cc +[PFObject objectWithClassName:objectId:completeData:] + 248\n 7 myApp.debug.dylib 0x0000000106d37ae0 +[PFObject objectWithClassName:] + 80\n 8 myApp.debug.dylib 0x0000000106d37fcc +[PFObject object] + 252\n 9 myApp.debug.dylib 0x0000000106cf6bdc __56-[PFCurrentInstallationController getCurrentObjectAsync]_block_invoke.9 + 452\n 10 myApp.debug.dylib 0x0000000106a64f18 __62-[BFTask continueWithExecutor:successBlock:cancellationToken:]_block_invoke + 124\n 11 myApp.debug.dylib 0x0000000106a64848 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 88\n 12 myApp.debug.dylib 0x0000000106a615c0 __29+[BFExecutor defaultExecutor]_block_invoke_2 + 152\n 13 myApp.debug.dylib 0x0000000106a61da0 -[BFExecutor execute:] + 88\n 14 myApp.debug.dylib 0x0000000106a64b24 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke.15 + 44\n 15 myApp.debug.dylib 0x0000000106a642f4 -[BFTask runContinuations] + 508\n 16 myApp.debug.dylib 0x0000000106a63cd8 -[BFTask trySetResult:] + 208\n 17 myApp.debug.dylib 0x0000000106a65a50 -[BFTaskCompletionSource trySetResult:] + 88\n 18 myApp.debug.dylib 0x0000000106ce88fc __28-[PFAsyncTaskQueue enqueue:]_block_invoke_2 + 216\n 19 myApp.debug.dylib 0x0000000106a64848 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 88\n 20 libdispatch.dylib 0x00000001022cbec4 _dispatch_call_block_and_release + 24\n 21 libdispatch.dylib 0x00000001022cd73c _dispatch_client_callout + 16\n 22 libdispatch.dylib 0x00000001022d05a0 _dispatch_queue_override_invoke + 1320\n 23 libdispatch.dylib 0x00000001022e136c _dispatch_root_queue_drain + 372\n 24 libdispatch.dylib 0x00000001022e1f18 _dispatch_worker_thread2 + 256\n 25 libsystem_pthread.dylib 0x00000001022277d8 _pthread_wqthread + 224\n 26 libsystem_pthread.dylib 0x00000001022265d4 start_wqthread + 8\n</code></pre>\n<p>After debugging, this was causing the trouble:\nIn PFObject:</p>\n<pre><code>+ (instancetype)object {\n PFConsistencyAssert([self conformsToProtocol:@protocol(PFSubclassing)],\n @&quot;Can only call +object on subclasses conforming to PFSubclassing&quot;);\n NSString *className = [(id&lt;PFSubclassing&gt;)self parseClassName];\n Class class = [[self subclassingController] subclassForParseClassName:className] ?: [PFObject class];\n return [class objectWithClassName:className];\n}\n</code></pre>\n<p><code>NSString *className = [(id&lt;PFSubclassing&gt;)self parseClassName];</code> in this line className comes out to be &quot;_Installation&quot; because in PFInstallation there is:</p>\n<pre><code>+ (NSString *)parseClassName {\n return @&quot;_Installation&quot;;\n}\n</code></pre>\n<p>Also, <code>[[self subclassingController] subclassForParseClassName:className]</code> return nil.</p>\n<p>Spent almost entire day on this without breaks and frustrated. All I have a doubt on is that the subclasses are not registering in Parse-&gt;Core-&gt;PFObjectSubclassingController:</p>\n<pre><code>- (void)registerSubclass:(Class&lt;PFSubclassing&gt;)kls {\n pf_sync_with_throw(_registeredSubclassesAccessQueue, ^{\n [self _rawRegisterSubclass:kls];\n });\n}\n</code></pre>\n<p>which gives a nil at <code>[[self subclassingController] subclassForParseClassName:className]</code>.</p>\n<p>Please help! Desperately in need. Thank you!</p>\n"^^ . "I have another view controller for posting comments with similar code and constraints that works fine. Something seems to have gone awry in the constraints so I will try to rebuild from scratch. If it still shows problem I will share as minimum reproducible example. Thank you for all your attention to this."^^ . . . . . "@Cy-4AH yes, it was turned off, see the picture: https://developernote.com/2024/09/examples-of-c-objective-c-interop/#arcoff"^^ . . . . . . . "0"^^ . "Unconditional NSAssert in Objective-C?"^^ . "Are you using Objective-C as some sort of archaeological / historical exploration? This seems an odd way to "learn to create a Cocoa application"."^^ . "Pass AVAudioPCMBuffer.floatChannelData from Swift to Obj-C (C++)"^^ . . . . . . . "0"^^ . . . "1"^^ . . . "1"^^ . . . "1"^^ . "yandex"^^ . "@user6631314 - I have to wonder if you are creating and somehow "layering" multiple instances of your views? You've got some weird stuff going on with the gray lines *below* the text view: https://i.sstatic.net/BH4RXn9z.png"^^ . "1"^^ . . . "0"^^ . . . "0"^^ . . . "1"^^ . . . . "<h1>Sign verifier.m</h1>\n<p>This file has the utility to verify the data</p>\n<pre><code>#import &quot;SignatureVerifier.h&quot;\n#include \\&lt;Foundation/Foundation.h\\&gt;\n#import \\&lt;CommonCrypto/CommonCrypto.h\\&gt;\n\n@implementation SignatureVerifier\n\n- (BOOL)verifySignature:(NSString \\*)jsonString\n signature:(NSData \\*)signatureData\n publicKey:(SecKeyRef)publicKey\n hashFunction:(NSString \\*)hashFunction {\n\n // Validate input parameters\n if (!jsonString || !signatureData || !publicKey) {\n NSLog(@&quot;Error: Invalid input parameters&quot;);\n return NO;\n }\n\n // Convert the JSON string to data (normalize if necessary)\n NSData \\*jsonData = \\[jsonString dataUsingEncoding:NSUTF8StringEncoding\\];\n NSLog(@&quot;Json Data utf8: %@&quot;, jsonData);\n if (!jsonData) {\n NSLog(@&quot;Error converting JSON string to data&quot;);\n return NO;\n }\n\n // Hash the JSON data using SHA256\n NSData \\*hashedData = nil;\n if (\\[hashFunction isEqualToString:@&quot;SHA256&quot;\\]) {\n hashedData = \\[self sha256HashForData:jsonData\\];\n NSLog(@&quot;Hashed Data: %@&quot;, hashedData);\n } else {\n NSLog(@&quot;Unsupported hash function: %@&quot;, hashFunction);\n return NO;\n }\n\n if (!hashedData) {\n NSLog(@&quot;Error: Hashing failed&quot;);\n return NO;\n }\n\n // Verify the signature\n CFErrorRef error = NULL;\n BOOL result = SecKeyVerifySignature(\n publicKey,\n kSecKeyAlgorithmRSASignatureMessagePKCS1v15SHA256,\n (\\__bridge CFDataRef) hashedData,\n (\\__bridge CFDataRef) signatureData,\n &amp;error\n );\n\n if (!result || error) {\n if (error) {\n CFStringRef errorDescription = CFErrorCopyDescription(error);\n NSLog(@&quot;Error verifying signature: %@&quot;, errorDescription);\n CFRelease(errorDescription);\n }\n return NO;\n }\n\n NSLog(@&quot;Signature successfully verified.&quot;);\n return YES;\n }\n\n- (NSData \\*)sha256HashForData:(NSData \\*)data {\n if (!data) {\n NSLog(@&quot;Error: No data provided for hashing&quot;);\n return nil;\n }\n\n uint8_t hash\\[CC_SHA256_DIGEST_LENGTH\\];\n CC_SHA256(data.bytes, (CC_LONG)data.length, hash);\n\n return \\[NSData dataWithBytes:hash length:CC_SHA256_DIGEST_LENGTH\\];\n }\n\n@end\n</code></pre>\n<h1>main.m</h1>\n<p>This is the main file using the utility.<br />\nPlease consider the other utility function correct as they've been checked.</p>\n<pre><code>\n#import \\&lt;Foundation/Foundation.h\\&gt;\n#import &quot;JSONREADER.m&quot;\n#import &quot;KeyReader.h&quot;\n#import &quot;SignatureVerifier.h&quot;\n#import &quot;hex_to_data.h&quot;\n\nint main(int argc, const char \\* argv\\[\\]) {\n@autoreleasepool {\n\n // Create an instance of KeyReader\n KeyReader *keyReader = [[KeyReader alloc] init]; \n \n // Reading public key file \n NSString *keyFilePath = @&quot;./crl_verify.key&quot;;\n SecKeyRef publicKey = [keyReader publicKeyFromKeyFile:keyFilePath];\n \n if (publicKey) {\n NSLog(@&quot;Public key successfully created&quot;);\n // CFRelease(publicKey);\n } else {\n NSLog(@&quot;Failed to create public key&quot;);\n }\n \n JSONReader *jsonReader = [[JSONReader alloc] init];\n \n // Reading crl json file\n NSString *filePath = @&quot;./crl.json&quot;;\n \n NSError *json_read_error = nil;\n NSDictionary *jsonContent = nil;\n jsonContent = [jsonReader readJSONFromFile:filePath error:&amp;json_read_error];\n \n if (jsonContent) {\n NSLog(@&quot;Successfully read JSON: %@&quot;, jsonContent);\n \n // Example: Accessing a value in the JSON dictionary\n NSString *signature = jsonContent[@&quot;signature&quot;];\n NSLog(@&quot;Value for 'key': %@&quot;, signature);\n } else {\n NSLog(@&quot;Error: %@&quot;, [json_read_error localizedDescription]);\n }\n \n // Read tbs_cert_list\n NSError *json_convert_error = nil;\n NSString *jsonString = jsonContent[@&quot;tbs_cert_list&quot;];\n NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];\n NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:jsonData\n options:0\n error:&amp;json_convert_error];\n \n if (json_convert_error) {\n NSLog(@&quot;Error deserializing JSON: %@&quot;, [json_convert_error localizedDescription]);\n } else {\n NSLog(@&quot;tbs_cert_list JSON Dictionary: %@&quot;, jsonDict);\n }\n NSString *signature = jsonContent[@&quot;signature&quot;];\n NSLog(@&quot;Hex Sign: %@&quot;, signature);\n \n NSData *data = [HexUtils dataFromHexString: signature];\n NSLog(@&quot;hex_to_sign_data: %@&quot;, data);\n \n // NSData *signatureData = [[NSData alloc] initWithBase64EncodedString:data options:0];\n NSString *signatureData = [HexUtils base64StringFromHexString: signature];\n NSLog(@&quot;Base64 Encoded String: %@&quot;, signatureData);\n \n // Print parameters\n NSLog(@&quot;Verifying signature with the following parameters:&quot;);\n NSLog(@&quot;JSON String: %@&quot;, jsonString);\n NSLog(@&quot;Signature Data: %@&quot;, signatureData);\n NSLog(@&quot;Public Key: %@&quot;, publicKey);\n NSLog(@&quot;Hash Function: %@&quot;, @&quot;SHA256&quot;);\n \n // Instantiate SignatureVerifier``your text``\n SignatureVerifier *verifier = [[SignatureVerifier alloc] init];\n BOOL verified = [verifier verifySignature:jsonString\n signature:data\n publicKey:publicKey\n hashFunction:@&quot;SHA256&quot;];\n \n if (verified) {\n NSLog(@&quot;Signature is valid!&quot;);\n } else {\n NSLog(@&quot;Signature verification failed.&quot;);\n }\n \n // Release public key\n CFRelease(publicKey);\n \n }\n return 0;\n\n}\n</code></pre>\n<p>So I've verified the data using openssl and a python program which is working fine.\nBut I can not verify it in this program. What am I doing wrong ?</p>\n<p>This returns a failure in verification. However, it should verify the data.\nThe formats and types seems fine as per apple document.</p>\n<pre><code></code></pre>\n"^^ . . "0"^^ . . "Why add the Swift and SwiftUI tags when your code example is purely Obj-C? If you're actually using Swift and SwiftUI as well and you know that's causing the issue, you should also include the relevant parts in the question. Either way, you need to [edit] your question to include all relevant code in the form of a [mcve] in order to make the question on-topic."^^ . . . "Share UIView instance between class"^^ . "Is it possible to augment input components for `WKWebView`?"^^ . . . . . "Background view is for background, not for the content, content view frame is managed by the table view. In 99% of cases all you need to to with the cell can be done over the content view. Try to think it simple"^^ . "<p>we have created a function that is expanding copy module to support html format. Everything inside that function works fine but on 17.4+ iOS versions copying the html element strike-through <code>&lt;s&gt;or &lt;strike&gt;</code> tag is not working (other HTML elements are working fine). Looking the logs seems like <code>&lt;s&gt;</code> are getting stripped. Also list that have indents won't work on paste indent is missing.\nDoes anyone know fix for this or when this will be fixed or will it be fixed in next update?</p>\n<pre><code>void copyToClipboard(NSString *htmlContent) { \n UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];\n [pasteboard setValue:htmlContent forPasteboardType:@&quot;public.html&quot;]; \n}\n</code></pre>\n"^^ . . . . . "Suggested by [this answer](https://stackoverflow.com/a/3846072/5264491): "If your string is a C-String then you can use `strlen(str)`." Which would become `strlen(stringAsChar)` for your code."^^ . . "Deallocation for NSTextView in Objective-C"^^ . . . . . "How to control AVAudioPlayer volume when AVAudioSession category is PlayAndRecord"^^ . "cocoapods"^^ . . "1"^^ . . . "UISlider triggers reorder on Silicon Mac's UITableView"^^ . . . "Parse iOS XCode: Class names cannot start with an underscore"^^ . "1"^^ . . "<p>We are working on an iOS app. It is built on Capacitor, but I have generalized my question, so it may be irrelevant.</p>\n<p>The app uses a <code>WKWebView</code> to show an HTML form. In that form, there is an <code>input</code> element with <code>type=&quot;month&quot;</code> and <code>min</code>/<code>max</code> attributes.</p>\n<p><em>In case you are not familiar with HTML, <code>type=&quot;month&quot;</code>, despite it's name, is actually a year-month picker.</em></p>\n<p>For example:</p>\n<pre class="lang-html prettyprint-override"><code>&lt;input type=&quot;month&quot; min=&quot;2024-07&quot;/&gt;\n</code></pre>\n<p>On iOS, 13.4+ it shows a native <code>UIDatePicker</code> with <code>datePickerMode = .yearAndMonth</code> and <code>datePickerStyle = .wheels</code>. However, it does not support the <code>min</code> and <code>max</code> attributes.</p>\n<p>Is there a way to either augment the <code>UIDatePicker</code> that <code>WKWebView</code> shows for this HTML element or completely replace it? The goal being, of course, to support the <code>min</code> and <code>max</code> attributes by parsing their values and setting <code>minimumDate</code> and <code>maximumDate</code>, respectively?</p>\n"^^ . "mobile-development"^^ . . . . . "0"^^ . . "0"^^ . . . . "keychain"^^ . . . . "objective-c"^^ . "0"^^ . . . . "2"^^ . . . . . . . . "incomprehensible bug when adding an observer using NSKeyValueObservingOptionInitial"^^ . . "(thanks for pointing out the weird lines. They are created using a UILabel and I forgot to delete the default word Label in the storyboard inspector.)"^^ . "As suggested by @Gerhardh `sizeof(stringAsChar)` would be the size of a pointer (probably 8 or 4 bytes), not the length of the string, assuming Objective C is anything like C."^^ . . "1"^^ . . "0"^^ . "0"^^ . "1"^^ . "Ok, the issue appears when the observed object was not "realized" (a fault) before it was observed. If any attribute is accessed before observation, the issue does not occur."^^ . "1"^^ . . . . "<p>The issue likely stems from m_hook not being a strong reference in your C++ class. In Objective-C/C++ interop, plain pointers don't imply ownership. To create a strong reference, modify your AdHolder class to use a pointer to a pointer (AdHook** m_hook;). In the constructor, allocate it with m_hook = new AdHook*; *m_hook = [[AdHook alloc] initFromCpp:cpp_ad];. Add a destructor to clean up: if (m_hook) { [*m_hook release]; delete m_hook; }. When accessing, use (*holder()-&gt;m_hook)-&gt;m_loader. This ensures the AdHook object isn't deallocated unexpectedly. Also, verify that the AdHolder instance itself remains valid when you're accessing m_hook, as its premature destruction could lead to crashes.</p>\n"^^ . . . . . "<p><a href="https://basic.lexilabs.app" rel="nofollow noreferrer">Lexilabs</a> has a Kotlin Multiplatform library that enables AdMob <code>@Composables</code> called <a href="https://github.com/LexiLabs-App/basic/tree/main/basic-ads" rel="nofollow noreferrer"><code>basic-ads</code></a>.</p>\n<p>The only downside is that it requires Android's <code>Context</code> to initialize and build <code>@Composables</code>, but there's already <a href="https://medium.com/@robert.jamison/passing-android-context-in-kmp-jetpack-compose-8de5b5de7bdd" rel="nofollow noreferrer">a tutorial</a> out there for how to do that.</p>\n"^^ . "0"^^ . . . "1"^^ . . "<p>I updated my flutter version to latest and when run flutter build ios command getting this error below :-&gt;</p>\n<pre><code>Unable to get Xcode project information:\n 2024-10-04 17:21:46.356 xcodebuild[31047:2236830] Writing error result bundle to\n /var/folders/mm/83rw22ln29qgl9n2gcnzd9600000gn/T/ResultBundle_2024-04-10_17-21-0046.xcresult\nxcodebuild: error: Could not resolve package dependencies:\n ocmock is required using two different revision-based requirements (fe1661a3efed11831a6452f4b1a0c5e6ddc08c3d and\n ef21a2ece3ee092f8ed175417718bdd9b8eb7c9a), which is not supported\n</code></pre>\n<p>flutter version detail :-&gt;</p>\n<pre><code>Flutter 3.24.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 2663184aa7 (3 weeks ago) • 2024-09-11 16:27:48 -0500\nEngine • revision 36335019a8\nTools • Dart 3.5.3 • DevTools 2.37.3\n\n</code></pre>\n<p>I tried to remove ocmock from podfile using post_install that code is also below:-&gt;</p>\n<pre><code>post_install do |installer|\n installer.pods_project.targets.each do |target|\n if target.name == 'OCMock'\n target.remove_from_project\n end\n end\n installer.pods_project.targets.each do |target|\n if target.name == 'ocmock'\n target.remove_from_project\n end\n end\n</code></pre>\n<p>So please provide the solution to resolve this.</p>\n"^^ . . . . . . "0"^^ . "0"^^ . . . "Sure, the AdHook** approach creates a strong reference by using C++ to manage an Objective-C pointer. It allocates C++-controlled memory to store the Objective-C pointer, preventing ARC from releasing the object. The Objective-C runtime sees this as a persistent reference. When you release in the C++ destructor, you free both the Objective-C object and C++-managed memory. This bridges C++ and Objective-C memory management, controlling the Objective-C object's lifetime."^^ . . "1"^^ . . . . "0"^^ . "0"^^ . . "1"^^ . . . . "0"^^ . "1"^^ . . "0"^^ . "After UIAlert dismiss my screen becomes unresponsive IOS"^^ . "2"^^ . . "0"^^ . "0"^^ . . "1"^^ . . . . . . "<p>Couple notes...</p>\n<p>First, this line of your code:</p>\n<pre><code>[self styleAndAddBorderTo: self.myTextView];\n</code></pre>\n<p>discards any return value. Since you are passing <code>self.myTextView</code>, let's change your style method to:</p>\n<pre><code>- (void) styleAndAddBorderTo: (UITextView*) someTextView {\n [someTextView.layer setBackgroundColor: [[UIColor whiteColor] CGColor]];\n // etc\n}\n</code></pre>\n<p>Next, when you set constraints on UI elements in Storyboard, <code>.translatesAutoresizingMaskIntoConstraints</code> is automatically set to false - so you don't need to set that anywhere in your code.</p>\n<p>Third, you don't need to set <code>.masksToBounds</code> to true on the text view's layer.</p>\n<p>Fourth -- the only two ways I can think of to get your &quot;bleed&quot; problem would be:</p>\n<ul>\n<li>somewhere in your code you are setting <code>[self.myTextView setClipsToBounds: NO];</code> (because the code you've shown explicitly sets it to <code>YES</code>), or</li>\n<li>you have somehow overlaid another text view on top of the &quot;styled&quot; one</li>\n</ul>\n<p>So, here is your code, implementing the above notes:</p>\n<pre><code>@implementation YourViewController\n\n- (void) styleAndAddBorderTo: (UITextView*) someTextView {\n \n [someTextView.layer setBackgroundColor: [[UIColor whiteColor] CGColor]];\n [someTextView.layer setBorderWidth: 2.0];\n [someTextView.layer setCornerRadius:8.0f];\n [someTextView.layer setBorderColor:[[[UIColor grayColor] colorWithAlphaComponent:0.5] CGColor]];\n \n // not needed - UI elements (@IBOutlets) with constraints set in Storyboard\n // automatically set .translatesAutoresizingMaskIntoConstraints = FALSE\n //self.myTextView.translatesAutoresizingMaskIntoConstraints = FALSE;\n \n // not needed\n //[someTextView.layer setMasksToBounds:YES];\n \n // we'll keep this here, in case you've set it to NO in Storyboard\n // or somewhere else in your code\n [someTextView setClipsToBounds: YES];\n \n}\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n\n // let's set the view background to yellow, so we can\n // easily see the white background of the text view\n self.view.backgroundColor = UIColor.systemYellowColor;\n\n // let's make a really long string\n NSString *descript = @&quot;This is the description string - much, much longer than 32 characters.&quot;;\n for (int i = 0; i &lt; 5; i++) {\n descript = [NSString stringWithFormat:@&quot;%@\\n\\n%@&quot;, descript, @&quot;Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&quot;];\n }\n\n // descript.length should now equal 2,400\n NSLog(@&quot;%ld&quot;, descript.length);\n\n [self styleAndAddBorderTo: self.myTextView];\n \n if (descript.length&gt;=32) {\n self.myTextView.text = descript;\n \n // not needed - UI elements (@IBOutlets) with constraints set in Storyboard\n // automatically set .translatesAutoresizingMaskIntoConstraints = FALSE\n //self.myTextView.translatesAutoresizingMaskIntoConstraints = FALSE;\n\n self.myViewHeight.constant = 240;\n \n // this doesn't hurt anything, but is only needed\n // if you at some point have set\n // self.myViewHeight.active = NO;\n self.myViewHeight.active = YES;\n }\n else {\n //display in a UILabel\n }\n\n}\n\n@end\n</code></pre>\n"^^ . . . "0"^^ . . "<p>I'm trying to write a console app that uses UIKit that watches for clipboard changes. Here is the code so far:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &lt;Foundation/Foundation.h&gt;\n#import &lt;UIKit/UIKit.h&gt;\n\n@interface TestClass : NSObject\n- (void) pasteboardChanged:(NSNotification *) notification;\n@end\n\n\n@implementation TestClass\n- (void) dealloc {\n [[NSNotificationCenter defaultCenter] removeObserver:self];\n [super dealloc];\n}\n- (id) init {\n self = [super init];\n if (!self) return nil;\n\n [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pasteboardChanged:) name:UIPasteboardChangedNotification object:nil];\n\n return self;\n \n}\n- (void) pasteboardChanged:(NSNotification *) notification {\n printf(&quot;2\\n&quot;);\n}\n\n@end\n\n\nint main(){\nprintf(&quot;1\\n&quot;);\n TestClass* test = [[TestClass alloc] init];\n printf(&quot;2\\n&quot;);\n [[NSRunLoop currentRunLoop] run];\nprintf(&quot;3\\n&quot;);\n /*\ndispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0ul);\ndispatch_async(queue, ^{\n TestClass* test = [[TestClass alloc] init];\n // Perform async operation\n // Call your method/function here\n // Example:\n });\n[NSThread sleepForTimeInterval:6000.0f];\n*/\n}\n</code></pre>\n<p>I compiled it with <code>/usr/bin/clang test.m -F /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks -framework UIKit -target arm64-apple-ios13.4-macabi -framework Foundation</code>. It runs, but it seems that the selector does not fire (eg, copying things do not fire the selector). Is there something I'm doing incorrectly?</p>\n"^^ . . . . "That must be happening due to code you are not showing us. Strip down your code (or comment-out sections) until you have a [mre]."^^ . . . . . . . . . . . . . . "Memory pressure detection is not working on MacOS"^^ . . . . "admob"^^ . . "0"^^ . . . . . "It's a storyboard project and I'm think something has gotten messed up in the storyboard. If I create a new simple down storyboard from scrach I imagine it will work proerly. But leaving aside autolayout and constraints can you confirm the normal ways to prevent bleeding are [myTextView.layer setMasksToBounds:YES];\n [myTextView setClipsToBounds: YES]; and\n myTextView.translatesAutoresizingMaskIntoConstraints = NO; ?"^^ . . "0"^^ . . "0"^^ . "react-native"^^ . . "App shortcut actions not showing on iOS 18 shortcuts app"^^ . "0"^^ . "0"^^ . . . . "1"^^ . . . . . "1"^^ . "<p>As for my understanding (I'm not a dev), when faced with that kind of errors (FP, Cocoa), it usually could point to a few things:</p>\n<ol>\n<li>App blocked from accessing fp/cocoa (perms)</li>\n<li>Network/connectivity/not enough required system resources</li>\n<li>FP/Cocoa is failing and restarting but the app cannot resume the connection with service.</li>\n</ol>\n<p>I know that's not a lot, but hopefully, it will point you in the right direction.</p>\n"^^ . "uikit"^^ . . "1"^^ . . . . . . . . "0"^^ . . . . . . . "2"^^ . . . . "1"^^ . . . . . . . "<p>I'm trying to build and run my app with the new Xcode 16.0 to a device with iOS 18.0, but it is crashing immediately after launch with this stack trace:</p>\n<pre><code>0 libobjc.A.dylib`_objc_warn_deprecated\n1 realizeClassWithoutSwift\n2 map_images_nolock\n3 map_images\n4 invocation function for block in dyld4::RuntimeState::setObjCNotifiers(void (*)(char const&quot;, mach_header const*), void (*)(mach_header con...apped_info const*), void (*) (unsigned int, _dyld _objc_notify_mapped_info const*, void (unsigned int) block_pointer))::$_0::operator)( const\n5 dyld4::RuntimeLocks::withLoadersReadLock\n6 dyld4::RuntimeState::setObjCNotifiers\n7 dyld4:: APls::_dyld_objc_register_callbacks\n8_objc_init\n9_os_object_init\n10 libdispatch_init\n11 libSystem_initializer\n12 invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&amp;) const\n13 invocation function for block in dyld3::MachOAnalyzer::forEachinitializer(Diagnostics&amp;, dyld3::MachOAnalyzer::VMAddrConverter const&amp;, void (unsigned int) block_pointer, void const*) const\n14 invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&amp;, bool, bool&amp;) block_pointer) const\n15 dyld3::MachOFile::forEachLoadCommand\n16 dyld3::MachOFile::forEachSection\n17 dyld3::MachOAnalyzer::forEachInitializer\n18 dyld4::Loader::findAndRunAllinitializers\n19 dyld4::JustInTimeLoader::runInitializers\n20 dyld4::APIs::runAllinitializersForMain\n21 dyld4:: prepare\n22 dyld4::start(dyld4::KernelArgs*, void*, void*)::$_0::operatori() const\n23 start\n</code></pre>\n<p>If I build and run from Xcode 16.0 to devices with iOS 15 or iOS 17, the app builds and runs successfully.</p>\n<p>This is the only thing in the console, but my sense is that it's not related since it also appears when the app runs successfully on the other devices:</p>\n<pre><code>warning: (arm64) /Users/username/Library/Developer/Xcode/DerivedData/AppName-gevkjrdhpvsixnciokrsaracikam/Build/Products/Debug-iphoneos/AppName.app/AppName empty dSYM file detected, dSYM was created with an executable with no debug info.\n</code></pre>\n<p>I originally wrote my app in Objective-C, and later converted most of it to Swift. It still had the Swift and Objective-C bridging headers due to a few small Objective-C classes that still remain. But to work around a build error with PDFDocument.h in the iOS 18 SDK (I reported that to Apple, FB15106102), I commented out the <code>#import &quot;AppName-Swift.h&quot;</code> in my .pch file and cleaned the build folder to remove the Objective-C to Swift bridging. None of the remaining Objective-C code needs to reference my Swift classes, so that shouldn't be needed, and removing it allowed the app to build and run (briefly). Maybe the app is crashing because there's something else I need to do to remove that; on the other hand, it does run fine now on older iOS versions.</p>\n<p>I found the source code for <code>realizeClassWithoutSwift</code> here:</p>\n<p><a href="https://opensource.apple.com/source/objc4/objc4-756.2/runtime/objc-runtime-new.mm.auto.html" rel="nofollow noreferrer">https://opensource.apple.com/source/objc4/objc4-756.2/runtime/objc-runtime-new.mm.auto.html</a></p>\n<p>I haven't found anything about the <code>libobjc.A.dylib _objc_warn_deprecated</code> message.</p>\n<p>I have reported the crash to Apple (FB15106573) but am hoping to get some ideas here because who knows if and when Apple will respond.</p>\n<p><strong>UPDATE</strong></p>\n<p>I removed the console warning with <a href="https://stackoverflow.com/a/78204720/462162">this answer</a>, but the same crash still occurs. However, the problem does seem related to debugging because I noticed that after the app crashes, I can stop it from Xcode then run it by clicking the app icon on the device, and it runs fine. It only crashes while running from Xcode.</p>\n<p><strong>UPDATE 2</strong></p>\n<p>The problem is unchanged with Xcode 16.1 and iOS 18.1.</p>\n"^^ . . . "ocmock is required using two different revision-based requirements"^^ . "0"^^ . "sdk"^^ . . . . . . . "shortcut"^^ . "0"^^ . . . . . . "0"^^ . "1"^^ . . . "0"^^ . . "0"^^ . "1"^^ . "0"^^ . "0"^^ . . . . "0"^^ . . . . . . . . "<p><code>initWithMemoryCapacity:diskCapacity:diskPath:</code> was <a href="https://developer.apple.com/documentation/foundation/nsurlcache/1415637-initwithmemorycapacity" rel="nofollow noreferrer">deprecated iOS 13</a>.</p>\n<p>You should use the replacement initialiser</p>\n<pre><code>configuration.URLCache = [[NSURLCache alloc] initWithMemoryCapacity:20*1024*1024 \ndiskCapacity:100*1024*1024 \ndirectoryUrl: nil];\n</code></pre>\n"^^ . . . . "objective-c++"^^ . . "screencapturekit"^^ . . "Version 2 Objective-C ABI may not be mixed with earlier versions"^^ . . "reference-counting"^^ . . . "0"^^ . . . "Trying to create a CRC-16 CCITT-FALSE checksum - but result is incorrect"^^ . . . "0"^^ . "1"^^ . . . "<p>Sometimes I like to put <code>NSAssert(NO, @&quot;this should never happen&quot;)</code> in a block of code that should never be reached. Is there a better alternative for such unconditional asserts in Objective-C? I would like something like <code>NSTerminate(@&quot;this should never happen&quot;)</code> - a convenient function which prints a message and terminates the program unconditionally.</p>\n"^^ . . . . "openssl"^^ . . . . "Right, good to know I'm not going insane :)\nJust established that the issue must be in the MacOS itself - the binary compiled on 10.15 produces the same issue when executed on macOS 14, while working correctly on 10.15."^^ . "<p>I use grand central dispatch framework to handle memory pressure change via <code>DISPATCH_SOURCE_TYPE_MEMORYPRESSURE</code>. This is my program in Objective C:</p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &lt;Foundation/Foundation.h&gt;\n#import &lt;dispatch/dispatch.h&gt;\n\nint main(int argc, const char * argv[]) {\n @autoreleasepool {\n NSLog(@&quot;Starting memory pressure monitoring...&quot;);\n \n // Create a dispatch source for memory pressure events\n dispatch_source_t memoryPressureSource = dispatch_source_create(\n DISPATCH_SOURCE_TYPE_MEMORYPRESSURE, \n 0, \n DISPATCH_MEMORYPRESSURE_WARN | \n DISPATCH_MEMORYPRESSURE_CRITICAL | \n DISPATCH_MEMORYPRESSURE_NORMAL, \n dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0)\n );\n\n if (memoryPressureSource == NULL) {\n NSLog(@&quot;Failed to create dispatch source&quot;);\n return 1;\n }\n\n // Set the event handler block to be executed on memory pressure events\n dispatch_source_set_event_handler(memoryPressureSource, ^{\n NSLog(@&quot;Memory pressure event handled&quot;);\n });\n dispatch_source_set_registration_handler(memoryPressureSource, ^{\n NSLog(@&quot;Memory pressure event registered&quot;);\n });\n\n dispatch_activate(memoryPressureSource);\n\n // Keep the main thread alive to let the dispatch source process events\n dispatch_main();\n }\n return 0;\n}\n</code></pre>\n<p>I compile it via the command:</p>\n<p><code>clang -framework Foundation -framework CoreFoundation -o memory_pressure_tracker ./untitled.mm</code> and launch it:</p>\n<p><code>./memory_pressure_tracker</code></p>\n<p>At the same time in another terminal I emulate high memory pressure:</p>\n<p><code>sudo memory_pressure -l critical</code>.</p>\n<p>Despite the fact that memory pressure changes in activity monitor, my program does not write any logs about it. The only logs it writes are below:</p>\n<pre><code>2024-09-10 10:41:27.048 memory_pressure_tracker[130:11424978] Starting memory pressure monitoring...\n2024-09-10 10:41:27.048 memory_pressure_tracker[130:11424985] Memory pressure event registered\n</code></pre>\n<p>Where is the problem?</p>\n<p>I tested it on MacOS Sonoma 14.6.1 on M1 Max.</p>\n"^^ . . . . . . "Unfortunately, this didn't work for me. I also tried cleaning the build folder and deleting the DerivedData prior to rebuilding. Same error."^^ . . . "What do you mean with the comment "Not work" when you set background color?"^^ . . "0"^^ . . . "1"^^ . "1"^^ . . . "refcounting"^^ . "You can disable `ARC` for particular files and use `#if __has_feature(objc_arc)` to check is it on"^^ . . "macos"^^ . . . . . . . "iOS 17.4 + version bug when copying and pasting HTML (rich) text"^^ . "0"^^ . . "0"^^ . . . . . . . . "1"^^ . . . . . . . "0"^^ . . . "1"^^ . . . . . "0"^^ . . "0"^^ . "0"^^ . . "<p>We have a SDK in which we use keychain to store some data. The customers who integrate our SDK in their app are able to delete our data by using SecItemDelete on kSecClass.</p>\n<p>Is their any way we can protect the SDK's data from getting delete by the host app or use something only accessible to SDK only ?</p>\n<p>Thanks</p>\n<p>Not able to find any solution</p>\n"^^ . . . . . "Thanks, Mikhail. Some investigations today led me to your post, and indeed, it seems that unless you're actually using some amount of memory, you don't get notified."^^ . . . . "1"^^ . . . . "Crash on launch with "_objc_warn_deprecated" with Xcode 16 and iOS 18"^^ . "0"^^ . . . . . . . . . . "0"^^ . . "uitableview"^^ . "0"^^ . "For ARC it's ok and Apple recommends to use ivar directly in initializers. For example you have overridden `setFoo:` and it's behaviour is depending on some property of children class, but at the line `self.froo = foo` in the parent class initializer it's not set yet."^^ . . . . . . . . . . . . . . . "Can you try using the latest iOS 18?"^^ . . . . . . "<p>I solved this problem by following these steps:</p>\n<ol>\n<li>Open xcode (your project's ios folder or ios/Runner.xcworkspace)</li>\n<li>Select Runner</li>\n<li>Tap on Build Settings</li>\n<li>Find &quot;Apple clang - Language - Modules&quot; or you can just search &quot;allow&quot;</li>\n<li>You will see</li>\n</ol>\n<p>Allow non-modular Includes In Framework Modules - NO</p>\n<p>Change this to &quot;YES&quot;\n<a href="https://i.sstatic.net/WixeUIAw.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WixeUIAw.png" alt="enter image description here" /></a></p>\n<p>Then try to run your app again.</p>\n"^^ . "1"^^ . "@Gerhardh - I don't see the fix to use strlen() instead of sizeof()."^^ . "0"^^ . "Unable to verify message from signature"^^ . . "<p>The code like this:</p>\n<pre><code>NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];\nconfiguration.URLCache = [[NSURLCache alloc] initWithMemoryCapacity:20 * 1024 * 1024\n diskCapacity:100 * 1024 * 1024\n diskPath:@&quot;myCache&quot;];\nif (!configuration) {\n NSLog(@&quot;Failed to create session configuration.&quot;);\n return;\n}\n\n\nNSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];\nif (!session) {\n NSLog(@&quot;Failed to create session.&quot;);\n return;\n}\n\n\nNSURL *url = [NSURL URLWithString:@&quot;https://example.com&quot;];\nif (!url) {\n NSLog(@&quot;Invalid URL.&quot;);\n return;\n}\n\nNSURLRequest *request = [NSURLRequest requestWithURL:url];\nif (!request) {\n NSLog(@&quot;Failed to create request.&quot;);\n return;\n}\n\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n if (error) {\n NSLog(@&quot;Error: %@&quot;, error.localizedDescription);\n } else {\n NSLog(@&quot;Data received: %@&quot;, data);\n }\n}];\n\nif (!dataTask) {\n NSLog(@&quot;Failed to create data task.&quot;);\n return;\n}\n\ndataTask.priority = NSURLSessionTaskPriorityDefault; \n\n\n[dataTask resume];\n</code></pre>\n<p>the error message:</p>\n<blockquote>\n<p>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSFileManager createDirectoryAtURL:withIntermediateDirectories:attributes:error:]: URL is nil'\n*** First throw call stack:\n(0x1848bd08c 0x181bbf2e4 0x183585f48 0x185d2f2bc 0x185d2ec7c 0x10709271c 0x1070a3f04 0x185d2ea88 0x185d2db20 0x185d2d5f4 0x185d2d07c 0x185d274b0 0x185dd82c4 0x185dd8214 0x185dd730c 0x107090a30 0x10709271c 0x10709a5e8 0x10709b394 0x10709cb20 0x1070a85f0 0x1070a7c00 0x20bc27c7c 0x20bc24488)\nlibc++abi: terminating due to uncaught exception of type NSException</p>\n</blockquote>\n<p>the network request could be worked well under ios 18</p>\n"^^ . . . . . . "Hey Ingo - so do you think it's something related to the Obj-C code? would you mind posting your function for feeding the data and printing the result so I can compare what I have done to it?"^^ . . "0"^^ . "@Cy-4AH I do not use ARC, because there is `QT Purchasing` code in my project that does not use it and does `[objc_object release]` in destructors."^^ . . . . . . . . . "flutter"^^ . "crc"^^ . . . . . "You have made the whole question useless by removing the erroneous code and replacing it by the workging code. What help could any visitor gain from your question now? If you find the solution to your problem, do not vandalize your post but instead post it as an answer to your own question."^^ . . "1"^^ . . "It is a strong reference. It does deallocate if I set the `textView` to nil, but only if I `release` it first."^^ . . . . "@user6631314 - if you're not familiar with it yet, use `Debug View Hierarchy` so you can inspect the UI at run-time."^^ . . "0"^^ . "It's because "Program ended with exit code: 0". You don't have NSRunLoop"^^ . . "0"^^ . "0"^^ . . "uipasteboard"^^ . . "2"^^ . "0"^^ . . "0"^^ . . . . . . . . "0"^^ . "<p>I implemented push notification using OneSignal. I am using Objective-C.</p>\n<p>Here is the part of Pod file.</p>\n<pre><code>target 'PlugYou' do\n ...\n pod 'OneSignal', '&gt;= 2.11.2', '&lt; 3.0'\nend\ntarget 'OneSignalNotificationServiceExtension' do\n pod 'OneSignal', '&gt;= 2.11.2', '&lt; 3.0'\nend\n</code></pre>\n<p>It works well in iPhone 14 but not iPhone SE and iPhone 11, which iOS version is 17.6.1\nPlease help me.\nI need to make push notification works in all the iOS devices.</p>\n<p>Thanks.</p>\n"^^ . "cocoa"^^ . . . "1"^^ . "2"^^ . "To avoid initializing `RTNViewStreamView` twice, it is recommended that you create a separate singleton class to hold the instance of `RTNViewStreamView`."^^ . . "0"^^ . . . . "1"^^ . "-2"^^ . "<p>UIAlertController is dismissed automatically when user taps any action button from it. So just do what you want in the action handler, like proceeding logout with the method -didLogout, but don't try to manually dismiss the alert.</p>\n"^^ . "1"^^ . "<p>I have a custom SwiftUI containerView which contains a set of SwiftUI buttons.</p>\n<p>The SwiftUI button contains a UIKit UIView which I need to be used by the main UIViewConroller. The code looks something like as below:</p>\n<pre><code> public struct ContainerView: View {\n public var body: some View {\n LazyVStack {\n ForEach(viewModel.buttonViewModels, id:\\.self) { buttonViewModel in \n CustomButton(buttonViewModel)\n }\n }\n }\n }\n\n public class CustomButton: View {\n public var backgroundUIView = BackgroundUIView()\n public var body: some View {\n Button(action: viewModel.tapEvent), label: {\n ZStack {\n backgroundUIView\n Text(viewModel.title)\n } \n }\n }\n\n\n public BackgroundUIView: UIViewRepresentable {\n func makeUIView(context: Context) -&gt; UIView {\n let view = UIView()\n view.backgroundColor = .blue\n return view\n }\n\n\n public CustomHostingController: UIHostingController&lt;ContainerView&gt; {\n public var containerViewModel: ContainerViewModel\n\n public init?(containerViewModel: ContainerViewModel) {\n self.containerVieModel = containerViewModel\n super.init(rootView: ContainerView())\n }\n }\n</code></pre>\n<p>In CustomHostingController how can I access CustomButton at particular index I want something like this.</p>\n<pre><code>extension CustomHostingController {\n func getButtonAtIndex(index: Int) -&gt; CustomButton {\n rootView.body.subviews[index]\n }\n}\n</code></pre>\n<p>I need to find the CustomButton instance at particular index in CustomHostingController.</p>\n<p>Tried to find a way to find Swiftui button at particular index in ContainerView. like</p>\n<pre><code> extension CustomHostingController {\n func getButtonAtIndex(index: Int) -&gt; CustomButton {\n rootView.body.*subviews[index]*\n }\n }\n</code></pre>\n<p>In unlike UIKit in SwiftUI there is no way to do this <code>subViews[at index]</code>. How can I access CustomButton instance at particular index?</p>\n<p>I need access to CustomButton because CustomHostingController is a childViewController to a UIKit UIViewController, and I want to present a third party provided Popover controller (UIKit implementation) which requires the UIView as the source view for presenting it. The third party popover controller initializer needs a UIView or UIButton as the parameter sourceView so that the arrow pointer of the Popover controller can point to the UIView or UIButton.</p>\n<p>So I need to use the customButton instance like as below:</p>\n<p>'[[ThirdPartyPopoverController alloc] initWithDescription: @&quot;Test coachmark presented&quot; fromSourceView:customButton.backgroundUIView];`</p>\n"^^ . "0"^^ . . "<blockquote>\n<p>Is it okay for me to add my custom content to the backgroundView?</p>\n</blockquote>\n<p>No. The <code>backgroundView</code> should be limited to a simple view whose basic properties, such as its <code>backgroundColor</code>, you configure. It would be even better, nowadays, to use the cell's background configuration instead.</p>\n<blockquote>\n<p>Is it okay for me to manually change the position of the frame of the contentView when doing my swipe on the cell?</p>\n</blockquote>\n<p>No. Your content should be inside a view inside a scroll view (or other &quot;slideable&quot; view) inside the content view. Don't touch the content view itself.</p>\n"^^ . . . . "<p>The issue here is that Objective-C allows nullable pointers, and Swift has strict typing around optional and non-optional pointers.</p>\n<p>Since floatChannelData is of type UnsafePointer&lt;UnsafeMutablePointer&gt;, you can map it to the correct type using this conversion:</p>\n<pre><code>if let floatChannelData = buffer.floatChannelData {\n // Convert the pointer to the expected form\n let data = UnsafePointer&lt;UnsafeMutablePointer&lt;Float&gt;?&gt;(floatChannelData)\n \n audioProcess(Int32(buffer.format.channelCount),\n numSamples: Int32(buffer.frameLength),\n stride: Int32(buffer.stride),\n data: data)\n}\n</code></pre>\n<p>different UnsafePointer for Swift and Objective-C/C++</p>\n"^^ . . . . "<p>Ok I found the root cause. The problem what that the observed object was a fault.</p>\n<p>The observation instruction using <code>NSKeyValueObservingOptionInitial</code> causes the fault to fire, which results in changes of the other (observed) attributes (fetched from the store), triggering change notifications.</p>\n<p>Move along, nothing to see here.</p>\n"^^ . . . "1"^^ . . "0"^^ . "You can’t SwiftUI Views are not meant to be accessed from the outside or from parents. Views don’t belong in properties."^^ . "carplay"^^ . . . "2"^^ . "1"^^ . . "0"^^ . "0"^^ . "2"^^ . . "0"^^ . . . . "QLThumbnailGenerationRequest not generating thumbnail from the image captured from camera"^^ . "1"^^ . . "How to access SwiftUI Button instance at particular index in LazyVStack which the rootView of a UIHostingController?"^^ . . "1"^^ . . . . "ios"^^ . . . "2"^^ . . . "1"^^ . "<p>I am trying to capture a window image using ScreenCaptureKit.\nIt works fine in swift, but I need to use objective-c, and it <strong>never</strong> calls the completion handler when getting a SCSharableContent.\nIs there something obvious I've been missing for the last two days?</p>\n<pre><code>@import Foundation;\n@import CoreServices;\n@import to use ;\n\nBOOL CanCapture(void) {\n for(;;) {\n if (CGPreflightScreenCaptureAccess()) {\n return true;\n }\n if (!CGRequestScreenCaptureAccess()) {\n return false;\n }\n }\n return false;\n}\n\nint main(int argc, const char * argv[]) {\n @autoreleasepool {\n if (CanCapture()) {\n NSLog(@&quot;Here\\n&quot;);\n [SCShareableContent getShareableContentExcludingDesktopWindows: true\n onScreenWindowsOnly: true\n completionHandler: ^(SCShareableContent *shareableContent, NSError *error) {\n NSLog(@&quot;But not Here\\n&quot;);\n }];\n }\n }\n}\n</code></pre>\n"^^ . "kotlin"^^ . . . . . "This is correct sizeof was returning 8, I hadn't realised that was how sizeof worked, I have changed it to the string length and it's all working now, thanks for your help!"^^ . . . . . . "<p>I am unable to compile and run a Obj-C program on Ubuntu\nEnviroment:</p>\n<p>Ubuntu Version: 22.04, 24.04</p>\n<p>clang -v output:</p>\n<pre><code>Ubuntu clang version 14.0.0-1ubuntu1.1\nTarget: x86_64-pc-linux-gnu\nThread model: posix\nInstalledDir: /usr/bin\nFound candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11\nSelected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11\nCandidate multilib: .;@m64\nSelected multilib: .;@m64\n</code></pre>\n<p>Build Command:</p>\n<pre><code>clang++ -o checker checker.mm \\\n-I/opt/homebrew/opt/openssl@3/include \\\n-L/opt/homebrew/opt/openssl@3/lib \\\n-I/usr/local/include \\\n-isystem /usr/include/GNUstep \\\n-isystem /usr/local/include/GNUstep \\\n-L/usr/local/lib \\\n-fobjc-runtime=gnustep-2.0 \\\n-lssl -lcrypto -lgnustep-base -lobjc\n</code></pre>\n<p>Log with LD_DEBUG=libs shows that the lib at <code>/usr/local/lib/libobjc.so.4.6</code> might be the reason, so I tried to compile that as well, first with</p>\n<pre><code>cd ~\nwget https://github.com/gnustep/libobjc2/archive/v2.2.1.tar.gz\ntar xvzf v2.2.1.tar.gz\ncd libobjc2-2.2.1\nmkdir build\ncd build\nexport CC=`which clang`\nexport CXX=`which clang++`\ncmake ..\nmake\nsudo make install\nldconfig\n</code></pre>\n<p>Which, didn't work, then with script from <a href="https://github.com/plaurent/gnustep-build/tree/master" rel="nofollow noreferrer">https://github.com/plaurent/gnustep-build/tree/master</a> which didn't resolve the issue either, right now I'm at a blind for what could be going on with my program.</p>\n<p>Any and every help will be appriciated, thank you</p>\n"^^ . . . "This question is similar to: [A developer when going through a code base encounters two different syntaxes for creating a NSString with the given integer. (implemented in MRC)](https://stackoverflow.com/questions/69929144/a-developer-when-going-through-a-code-base-encounters-two-different-syntaxes-for). If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem."^^ . . . . . . . . . . . . . . "<p>It looks like MacOS is smart enough to not report small spikes in memory pressure and to not notify the apps which can not free some memory because they already use low amount of it.</p>\n<p>I've added the following lines to the beginning of <code>main</code> function to make the app consume some memory:</p>\n<pre><code>size_t size = 1024 * 1024 * 1024 / sizeof(int);\nint* largeArray = (int*)std::malloc(size * sizeof(int));\nfor (size_t i = 0; i &lt; size; ++i) {\n largeArray[i] = i;\n}\n</code></pre>\n<p>In addition, when I emulated critical memory pressure via the command <code>sudo memory_pressure -l critical</code> which kept allocating memory until pressure becomes critical, I did not get handler called because the pressure came back to normal state immediately.</p>\n<p>I managed to get handler called when I emulated pressure for 10 seconds while my test app consumed 1Gb of RAM:</p>\n<pre><code>sudo memory_pressure -S -l critical -s 10\n</code></pre>\n"^^ . . . . "0"^^ . "React Native CarPlay app not loading JavaScript when phone app is closed"^^ . . . "2"^^ . "2"^^ . "<p>We ran into the same issue. Simple fix is to register your PFObject classes at app start.</p>\n<p>On macOS Swift, it can be done here.</p>\n<pre><code>func applicationDidFinishLaunching(_ aNotification: Notification) {\n // Insert code here to initialize your application\n\n PFInstallation.registerSubclass()\n PFUser.registerSubclass()\n PFSession.registerSubclass()\n PersonClass.registerSubclass()\n}\n</code></pre>\n<p>we found it to be more convenient to do it here:</p>\n<pre><code>override func viewDidLoad() {\n super.viewDidLoad()\n\n let configuration = ParseClientConfiguration {\n $0.applicationId = Constants.PARSE_APPLICATION_ID\n $0.clientKey = Constants.PARSE_CLIENT_KEY\n $0.server = Constants.PARSE_SERVER\n }\n\n Parse.initialize(with: configuration)\n \n PFInstallation.registerSubclass()\n PFUser.registerSubclass()\n PFSession.registerSubclass()\n PersonClass.registerSubclass()\n}\n</code></pre>\n<p>assuming your classes, like our PersonClass above, conforms to the PFObject, PFSubclassing protocols</p>\n"^^ . . "<p>I changed Podfile with this:</p>\n<pre><code>source 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, :deployment_target =&gt; '14.0'\n\ntarget 'MyApp' do\n pod 'YandexMobileAdsMediation', '7.5.1'\nend\n\npost_install do |installer|\n installer.pods_project.targets.each do |target|\n target.build_configurations.each do |config|\n config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'\n end\n end\nend\n</code></pre>\n<p>and was able to compile my <code>.mm</code> file with</p>\n<pre><code>#import &lt;YandexMobileAds/YandexMobileAds-Swift.h&gt;\n</code></pre>\n<p>But I still do not understand well enough what this Podfile does.</p>\n"^^ . . "0"^^ . . "0"^^ . "0"^^ . . "ocmock"^^ . . . . . "<p>I'm building an iOS app that only allows you to listen to audio through the builtInReceiver when the proximity sensor is activated, like so:</p>\n<pre><code>@interface CDVAudioPlayer : AVAudioPlayer\n{\n NSString* mediaId;\n}\n----\nself.avSession = [AVAudioSession sharedInstance];\naudioFile.player = [[CDVAudioPlayer alloc] initWithContentsOfURL:resourceURL error:&amp;playerError];\n----\n[self.avSession setCategory:AVAudioSessionCategoryPlayAndRecord mode:AVAudioSessionModeDefault options:0 error:&amp;err];\n[self.avSession setActive:true error:&amp;err];\n[self.avSession overrideOutputAudioPort:AVAudioSessionPortOverrideNone error:&amp;err];\n</code></pre>\n<p>This works fine, except that when the proximity sensor is activated an the audio plays through the builtInReceiver the hardware volume buttons switch to in-call, thus having no effect on the <code>AVAudioPlayer</code>. Is there a way where I can let the in-call volume control the <code>AVAudioPlayer</code>?</p>\n"^^ . . . . "No. Your framework is part of the app and running in the app sandbox. It is not running in its own sandbox."^^ . . "0"^^ . . "kotlin-multiplatform"^^ . . . "rctbridge"^^ . "0"^^ . . . . "1"^^ . . . . "0"^^ . . . . "0"^^ . . . . . "<p>I still don't known why, but I stored the GeneratedPluginRegistrant.m and GeneratedPluginRegistrant.h files and just copy them under ios/Runner, then it can be build...</p>\n"^^ . "IIRC much of the `CGS` APIs are locked down through an 'ownership' model. Apps only 'own' their own windows and are only allowed to move those. The Dock process is a 'universal owner' and can manipulate all the windows. But IIRC, the Universal ownership is locked through a special entitlement, and when you give your own app that entitlement macOS will just not run it. The only way that I know of to manipulate windows is to use the Accessibiliy API. Which is slow and restrictive but it works."^^ . . . "It would help if you explained exactly what you need to do. Do you want to animate a `CAShapeLayer`? Do you want to draw the shape to the map bitmap? Do you just need to scale, rotate and color the image and place it on the map? It is ***possible*** to extract paths from a PDF file, but it can be finicky. For example, the AW109.pdf you linked to has some bad data in it, as seen here: https://i.sstatic.net/BOKtF0bz.png"^^ . . "avfoundation"^^ . "youtube-api"^^ . . "0"^^ . . . . "0"^^ . . "0"^^ . "0"^^ . "0"^^ . "@ThomasTempelmann: Here https://stackoverflow.com/a/12315845/1187415 is a link to a GitHub project https://github.com/sveinbjornt/IconFamily which claims to be able to read and write .icns data. I haven't tried it. It is written in Objective-C and uses many deprecated APIs, but perhaps you can get *some* ideas from there."^^ . "<p>Here's code, using deprecated functions (but there's no modern alternative, apparently):</p>\n<pre><code>#pragma clang diagnostic push\n#pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;\n\nNSData* icnsOfFileAtPath (NSString *path)\n{\n // based on https://github.com/sveinbjornt/IconFamily\n CFURLRef urlRef = CFURLCreateWithFileSystemPath (kCFAllocatorDefault, (CFStringRef)path, kCFURLPOSIXPathStyle, false);\n if (!urlRef) {\n return nil;\n }\n FSRef fsRef;\n bool ok = CFURLGetFSRef (urlRef, &amp;fsRef);\n CFRelease (urlRef);\n if (!ok) {\n return nil;\n }\n IconRef iconRef;\n SInt16 label;\n OSStatus res = GetIconRefFromFileInfo (&amp;fsRef, 0, NULL, kFSCatInfoNone, NULL, kIconServicesNormalUsageFlag, &amp;iconRef, &amp;label);\n if (res) {\n return nil;\n }\n IconFamilyHandle ifh;\n res = IconRefToIconFamily (iconRef, kSelectorAllAvailableData, &amp;ifh);\n ReleaseIconRef (iconRef);\n NSData *icns = [NSData dataWithBytes:*ifh length:GetHandleSize((Handle)ifh)];\n DisposeHandle ((Handle)ifh);\n return icns;\n}\n\n#pragma clang diagnostic pop\n</code></pre>\n"^^ . . . . . "@PaulBeusterien Podfile.lock details updated in the question. Kindly check and update"^^ . "1"^^ . "<p>I am developing a feature for my app where user can upload a PDF from shared storage in device (Drive, onDrive, Dropbox,..)\nI am using <strong>Kotlin Multiplatform 2.0.20</strong></p>\n<p>This is the code i am using to upload the PDF for iOS, it works fine for files selected from iCloud, Downloaded locally in the device and Dropbox but <strong>NOT</strong> for <code>Google Drive</code> and <code>OneDrive</code></p>\n<pre><code> val documentPickerController = UIDocumentPickerViewController(\n forOpeningContentTypes = listOf(UTTypePDF)\n )\n documentPickerController.allowsMultipleSelection = false\n val documentDelegate = remember {\n object : NSObject(), UIDocumentPickerDelegateProtocol {\n override fun documentPicker(\n controller: UIDocumentPickerViewController,\n didPickDocumentAtURL: NSURL\n ) {\n val accessing =\n didPickDocumentAtURL.startAccessingSecurityScopedResource()\n val data = try {\n NSData.dataWithContentsOfURL(didPickDocumentAtURL)\n } catch (e: Error) {\n e.printStackTrace()\n null\n }\n\n if (accessing == true) {\n didPickDocumentAtURL.stopAccessingSecurityScopedResource()\n }\n controller.dismissViewControllerAnimated(true, null)\n }\n }\n }\n</code></pre>\n<p>When debugging i find that the problem in this line : <code>NSData.dataWithContentsOfURL(didPickDocumentAtURL)</code> it returns <code>null</code></p>\n<p>no exception is thrown and even putting it in <code>try/catch</code> block did't help to understand the error behind the null value.</p>\n<p>I don't have an expert knowledge of ObjectiveC or Swift so i am reaching out for your help :)</p>\n<p>I found this is exactly a similar issue: <a href="https://www.hackingwithswift.com/forums/swiftui/error-domain-nsposixerrordomain-code-2-no-such-file-or-directory-when-using-fileimporter-then-read-the-content/20397" rel="nofollow noreferrer">https://www.hackingwithswift.com/forums/swiftui/error-domain-nsposixerrordomain-code-2-no-such-file-or-directory-when-using-fileimporter-then-read-the-content/20397</a></p>\n<p>except they use SwiftUI, but i am not so i wonder how can i fix it in my case.</p>\n<p>I appreciate if someone faced similar issue and can share his/her thoughts :)</p>\n<p>Thank you!</p>\n"^^ . . "Group rows are drawn in group row style. Workaround: Subclass `NSTableRowView`, override `isGroupRowStyle` and return `NO`."^^ . . "<p>I'm trying to move windows around from other spaces to the current window and have wasted many hours not understanding why nothing is being moved..</p>\n<p>I've tried various applications (hardcoding some screens now to test). I ensure window level is 0 and various other things, but the key thing is that the private API is not migrating the window. Common libs on the market today are using these calls on this Mac release, but I'm worried there is an additional step in the flow I'm missing.</p>\n<p>Demo repo: <a href="https://github.com/Schachte/mac-os-graphics" rel="nofollow noreferrer">https://github.com/Schachte/mac-os-graphics</a></p>\n<p>I've tried thread sleeps between windows, etc. The main snippet is this:</p>\n<pre class="lang-swift prettyprint-override"><code>static func addInitialRunningApplicationsWindows() {\n let cgsMainConnectionId = CGSMainConnectionID()\n let otherSpaces = [UInt64(213)]\n print(&quot;Other spaces found: \\(otherSpaces)&quot;)\n \n guard otherSpaces.count &gt; 0 else {\n print(&quot;No other spaces found&quot;)\n return\n }\n \n let windowsOnCurrentSpace = getWindowsInSpace([currentSpaceId])\n print(&quot;Windows on current space: \\(windowsOnCurrentSpace)&quot;)\n \n let windowsOnOtherSpaces = getWindowsInSpace(otherSpaces)\n print(&quot;Windows on other spaces: \\(windowsOnOtherSpaces)&quot;)\n \n let windowsOnlyOnOtherSpaces = Array(Set(windowsOnOtherSpaces).subtracting(windowsOnCurrentSpace))\n print(&quot;Windows to move: \\(windowsOnlyOnOtherSpaces)&quot;)\n \n guard windowsOnlyOnOtherSpaces.count &gt; 0 else {\n print(&quot;No windows to move&quot;)\n return\n }\n \n // Split windows into chunks to avoid overwhelming the API\n let chunkSize = 5\n let windowChunks = stride(from: 0, to: windowsOnlyOnOtherSpaces.count, by: chunkSize).map {\n Array(windowsOnlyOnOtherSpaces[$0..&lt;min($0 + chunkSize, windowsOnlyOnOtherSpaces.count)])\n }\n \n for chunk in windowChunks {\n print(&quot;Processing chunk of \\(chunk.count) windows&quot;)\n \n // First add windows to the current space\n CGSAddWindowsToSpaces(cgsMainConnectionId,\n chunk as NSArray,\n [currentSpaceId] as NSArray)\n \n // Give the system a moment to process\n Thread.sleep(forTimeInterval: 0.1)\n \n // Then remove from other spaces\n for spaceId in otherSpaces {\n CGSRemoveWindowsFromSpaces(cgsMainConnectionId,\n chunk as NSArray,\n [spaceId] as NSArray)\n \n // Give the system a moment to process\n Thread.sleep(forTimeInterval: 0.1)\n }\n \n // Verify the move for this chunk\n let windowsStillOnOtherSpaces = getWindowsInSpace(otherSpaces)\n let unmovedInChunk = chunk.filter { windowsStillOnOtherSpaces.contains($0) }\n \n if unmovedInChunk.count &gt; 0 {\n print(&quot;Warning: Failed to move \\(unmovedInChunk.count) windows in current chunk&quot;)\n \n // Try alternative method for unmoved windows\n for windowId in unmovedInChunk {\n if canMoveWindow(windowId) {\n print(&quot;Attempting alternative move for window \\(windowId)&quot;)\n CGSMoveWindowsToManagedSpace(cgsMainConnectionId,\n [windowId] as NSArray,\n currentSpaceId)\n Thread.sleep(forTimeInterval: 0.1)\n }\n }\n }\n }\n</code></pre>\n<h1>Output</h1>\n<pre><code>5\nOther spaces found: [213]\nWindows on current space: [115, 99, 98, 94, 26, 100, 25, 27, 24, 22, 38, 12159, 10, 116, 942, 12493, 12557, 13406]\nWindows on other spaces: [13749, 16723, 13747, 116, 13328]\nWindows to move: [16723, 13749, 13747, 13328]\nProcessing chunk of 4 windows\nWarning: Failed to move 4 windows in current chunk\nAttempting alternative move for window 16723\nWarning: Total failed moves: 4 windows\nUnmoved window IDs: [16723, 13749, 13747, 13328]\n5\n</code></pre>\n<p>Using inspiration from <a href="https://github.com/lwouis/alt-tab-macos" rel="nofollow noreferrer">https://github.com/lwouis/alt-tab-macos</a></p>\n<p>Thread sleeps, different windows, running as root, disabling SIP</p>\n"^^ . . . . "Yes. Property is `self.tableContents`, but `_tableContents` is it's instance variable. It's just compiler declaring ivars automatically for you."^^ . . . . "crashlytics"^^ . . . "1"^^ . . . . "0"^^ . . . "@Cy-4AH I don't think so, they are declared as `@property NSMutableArray* tableContents;` and `@property (weak) IBOutlet NSTableView *tableView;` am I missing something?"^^ . . . . . . . . "0"^^ . "0"^^ . "@Willeke here's the whole thing https://github.com/lucasderraugh/AppleProg-Cocoa-Tutorials/tree/master/Lesson%2053"^^ . "0"^^ . . . "0"^^ . "1"^^ . . . . "0"^^ . . . . . "can you please share error here? what you are getting while convert url to data."^^ . "0"^^ . . . "video"^^ . "0"^^ . . . "0"^^ . "1"^^ . . . . . . . . . "<p>I have an Objective-C app that sometimes takes over focus without the user actively switching to it. I want to track when this happens, so I can have a dump and analyze why this happens.</p>\n<p>For this reason, I wanted to see if when I get <code>applicationDidBecomeActive</code> I can distinguish when it happened because of the user (clicked on app in dock, cmd+tabbed to it, etc.) vs. when it happened because my app is broken (e.g. crashed and restarted).</p>\n<p>Obviously, I don't want to track ALL user input across the whole system.</p>\n<p>I'm developing for MacOS.</p>\n<p>Is there a way to do that?</p>\n"^^ . "0"^^ . "3"^^ . "1"^^ . . . "xcode"^^ . "crash"^^ . . "application-lifecycle"^^ . . . . . . "0"^^ . "0"^^ . . . . . . "You might be better off converting your Airplane "icons" to `CGPath` and then scaling / rotating the path for use as `CAShapeLayer`. As an example, I used that PDF to create a path -- various sizing: https://i.sstatic.net/AJUXwbL8.png -- and then `40x40` with rotation and positioning: https://i.sstatic.net/cwRNflYg.png ..."^^ . . . "Thanks. Nothing looks problematic to me. Sorry."^^ . "0"^^ . "@IRP_HANDLER yes, if you only mutate the array using the methods of the `NSArrayController`."^^ . . . . . . . . . . . . . "<p>I'm following this code <a href="https://github.com/lucasderraugh/AppleProg-Cocoa-Tutorials/tree/master/Lesson%2053" rel="nofollow noreferrer">here</a> where\nI have an NSTableView that displays the folder name as a group header and then the contents of the folder below, for this example these are all images.</p>\n<p><a href="https://i.sstatic.net/GFKWqSQE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/GFKWqSQE.png" alt="table" /></a></p>\n<p>So like, here I have a folder named <strong>flags</strong> and a folder named <strong>states</strong>, what I want to do is to change the font size of this header, I have successfully changed the text color but for some reason I can't change the font size neither through storyboard nor programmatically. Here's my <a href="https://developer.apple.com/documentation/appkit/nstableviewdelegate/tableview(_:viewfor:row:)?language=objc" rel="nofollow noreferrer">tableView:viewForTableColumn:row:</a> method</p>\n<pre><code> -(NSView*)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row;\n{\n \n DesktopEntity *entity = _tableContents[row];\n \n \n if ([entity isKindOfClass:[DesktopFolderEntity class]])\n {\n NSTextField *groupCell = [tableView makeViewWithIdentifier:@&quot;GroupCell&quot; owner:self];\n [groupCell setStringValue: entity.name];\n\n [groupCell setFont:[NSFont fontWithName:@&quot;Arial&quot; size:40]];\n [groupCell setTextColor:[NSColor magentaColor]];\n return groupCell;\n }\n else if ([entity isKindOfClass:[DesktopImageEntity class]])\n {\n NSTableCellView *cellView = [tableView makeViewWithIdentifier:@&quot;ImageCell&quot; owner:self];\n [cellView.textField setStringValue: entity.name];\n [cellView.textField setFont:[NSFont fontWithName:@&quot;Impact&quot; size:20]];\n [cellView.imageView setImage: [(DesktopImageEntity *)entity image]];\n return cellView;\n }\n \n return nil;\n}\n</code></pre>\n<p>what am I doing wrong here, and how can I change the font size programmatically?</p>\n<h2>Edit</h2>\n<p>I tried changing the font size in the second if statement for the &quot;<strong>ImageCell</strong>&quot; and it works, but I still can't get it to work for the &quot;<strong>GroupCell</strong>&quot; in the first if statement.</p>\n<p>Looking a bit further, there's this method <a href="https://developer.apple.com/documentation/appkit/nstableviewdelegate/tableview(_:isgrouprow:)?language=objc" rel="nofollow noreferrer">tableView:isGroupRow:</a> that I'm using:</p>\n<pre><code>-(BOOL)tableView:(NSTableView *)tableView isGroupRow:(NSInteger)row\n{\n DesktopEntity *entity = _tableContents[row];\n \n if ([entity isKindOfClass:[DesktopFolderEntity class]])\n {\n return YES;\n }\n \n return NO;\n}\n</code></pre>\n<p>I found out that if I comment out this function those changes work and the font size gets updated, <strong>but</strong> after removing this function, the cell won't act like a group cell but rather as a normal cell which is not what I wanted. Any way around this?</p>\n<p>Here's the table after trying to change the font size and color(while still maintaining the isGroupRow method), you can see that the font color changed but its size remains the same, what gives?</p>\n<p><a href="https://i.sstatic.net/TMXOL38J.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TMXOL38J.png" alt="enter image description here" /></a></p>\n"^^ . "<p>I'm developing an app using Kotlin Multiplatform and Googles MLKit for barcode scanning. I'm unable to create a VisionImage in the captureOutput method of a AVCaptureVideoDataOutputSampleBufferDelegate. When trying, I am encountering periodic freezes every 15 frames for 10 seconds.</p>\n<p>In my CameraViewController (iosMain)</p>\n<pre><code>class CameraViewController(\n private val onQRCodeDetected: (String) -&gt; Unit\n) : UIViewController(null, null), AVCaptureVideoDataOutputSampleBufferDelegateProtocol {\n</code></pre>\n<p>I overwrite captureOutput</p>\n<pre><code> override fun captureOutput(\n output: AVCaptureOutput,\n didOutputSampleBuffer: CMSampleBufferRef?,\n fromConnection: AVCaptureConnection\n ) { \n frameCounter+=1\n logging(&quot;CViewC&quot;).i { &quot;FRAME #$frameCounter&quot; }\n</code></pre>\n<p>so far everything works perfect. captureOutput gets called each frame in time and logs the framecount. When I add the following line things break.</p>\n<pre><code>val visionImage = MLKVisionImage(didOutputSampleBuffer)\n</code></pre>\n<p>Now the first 15 calles of captureOutput are ok. During this duration the preview on the phone works fluent. Then the preview freezes and captureOutput is not called. This lasts for 10 seconds. After the 10 seconds I receive again 15 frames normally. This cicle goes on and the app never crashes.</p>\n<p>When I add now the line</p>\n<pre><code>CFRelease(didOutputSampleBuffer)\n</code></pre>\n<p>I get a continuous flow of 288 frames until a crash. The crash report indicates that I tried to release an already released buffer(Detected over-release of a CFTypeRef %p (%lu / %s)).</p>\n<p>I tried to copy the Buffer:</p>\n<pre><code>val copiedBufferVar = nativeHeap.alloc&lt;CMSampleBufferRefVar&gt;()\nCMSampleBufferCreateCopy(\n allocator = kCFAllocatorDefault,\n sbuf = didOutputSampleBuffer,\n sampleBufferOut = copiedBufferVar.ptr\n)\nval visionImage = MLKVisionImage(didOutputSampleBuffer.value)\nCFRelease(copiedBufferVar.value)\n</code></pre>\n<p>Since I assumed the Buffers were not released from memory because of the strong reference of the VisionImage to the Buffer. (I don't know if that makes sense - I desperately tried to make sense of something). This resulted in the same thing. A cycle of 15 frames OK and 10 Seconds freeze.</p>\n<p>I tried to release the VisionImage from memory by making it nullable and setting it to null after usage. This also change nothing. LLM's recommended using a autoreleasepool but that also didn't help.</p>\n<p>So I guess it is a memory problem. I thought my AVCaptureSession takes care of this stuff automatically. I configured it like this. I removed some null checks to keep it shorter here.</p>\n<pre><code>@OptIn(ExperimentalForeignApi::class)\nprivate fun setupCaptureSession() {\n\n captureSession = AVCaptureSession().apply {\n beginConfiguration()\n sessionPreset = AVCaptureSessionPreset1280x720\n }\n\n val device = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo)\n val input = AVCaptureDeviceInput.deviceInputWithDevice(device, null)\n if (captureSession?.canAddInput(input) == true) {\n captureSession?.addInput(input)\n }\n videoOutput = AVCaptureVideoDataOutput().apply {\n setSampleBufferDelegate(this@CameraViewController, processingQueue)\n videoSettings = mapOf(\n kCVPixelBufferPixelFormatTypeKey to NSNumber(kCVPixelFormatType_32BGRA) \n )\n alwaysDiscardsLateVideoFrames = true\n\n }\n if (captureSession?.canAddOutput(videoOutput!!) == true) {\n captureSession?.addOutput(videoOutput!!)\n }\n captureSession?.commitConfiguration()\n previewLayer = AVCaptureVideoPreviewLayer(session = captureSession!!).apply {\n videoGravity = AVLayerVideoGravityResizeAspectFill\n }\n}\n</code></pre>\n"^^ . "@ThomasTempelmann: What I noticed: The 'icns' item in the pasteboard contains an icon of type 'FD D9 2F A8' when copying a file in the Finder. According to https://en.wikipedia.org/wiki/Apple_Icon_Image_format that is for the dark mode. The icns from GetIconRefFromFileInfo does not contain that icon."^^ . . . "user-interface"^^ . "0"^^ . . . "0"^^ . . . . "<p>I had the same issue. What worked for me was calling <code>kotlin.native.runtime.GC.collect()</code> as soon as the MLKVisionImage was no longer needed.</p>\n<pre><code>var visionImage: MLKVisionImage? = MLKVisionImage(didOutputSampleBuffer)\n// ...\nrecognizer.processImage(visionImage as MLKCompatibleImageProtocol) { mlkText, nsError -&gt;\n visionImage = null\n kotlin.native.runtime.GC.collect()\n // ...\n}\n\n</code></pre>\n"^^ . . . "swift"^^ . "1"^^ . "0"^^ . . . "0"^^ . . . . "0"^^ . "0"^^ . . "0"^^ . "Using only headers is a bad habit. Stick to convention."^^ . . . . . . . "1"^^ . . . . . "even though the file is there, this happen only for files selected from onDrive and google drive"^^ . . . . "Actually, only certain interactions with window are locked down through the 'ownership' model IIRC. I think moving windows is among the forbidden things but I'm not entirellyyy sure anymore."^^ . "2"^^ . "0"^^ . . . . . "0"^^ . . . "0"^^ . "<p>I am working on a cross-platform application, and we recently released updates for our apps. We received a large number of crashes in our Crashlytics logs. All the crashes seem to occur in the APM submodule classes with &quot;__isPlatformVersionAtLeast SIGABRT (ABORT).&quot; While checking the Crashlytics event summary details, I found that the crashes happen during the execution of the didFinishLaunchingWithOptions function in the AppDelegate.</p>\n<p><strong>didFinishLaunchingWithOptions:</strong></p>\n<pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { \n //Firebase \n [FIRPerformance sharedInstance].instrumentationEnabled = 0; \n [FIRApp configure]; \n NSDictionary *props = @{ @&quot;TESTING&quot;: @&quot;iOS&quot;, @&quot;Date&quot;: [NSDate date] }; \n //Clevertap\n [[CleverTap sharedInstance] setInAppNotificationDelegate:self];\n [[CleverTap sharedInstance] setPushNotificationDelegate:self];\n NSString *appPath = [[NSBundle mainBundle] bundlePath]; \n NSLog(@&quot;appPath ------ %@&quot;,appPath); \n // Config an additional instance \n NSLog(@&quot;multiple instance registration&quot;); \n CleverTapInstanceConfig *ctConfig = [[CleverTapInstanceConfig alloc] initWithAccountId:@&quot;TEST*******&quot; accountToken:@&quot;TEST*****&quot;]; \n NSLog(@&quot;multiple instance registration %@&quot;,ctConfig);\n CleverTap *additionalCleverTapInstance = [CleverTap instanceWithConfig:ctConfig];\n [AEPMobileCore setLogLevel:AEPLogLevelDebug];\n [AEPMobileCore configureWithAppId:@&quot;99********&quot;]; \n return YES;\n}\n</code></pre>\n<p><strong>Podfile:</strong></p>\n<pre><code>pod 'Firebase/Analytics' \npod 'Firebase/Auth' \npod 'Firebase/Crashlytics', '10.28.1' \npod 'FirebasePerformance', '10.28.0' \npod 'FirebaseRemoteConfig' \npod 'CleverTap-iOS-SDK', '6.2.1' \n</code></pre>\n<p><strong>Stack Trace:</strong></p>\n<pre><code>Crashed: APMIdentityWorkerQueue \n0 libsystem_kernel.dylib 0xc274 __pthread_kill + 8 \n1 libsystem_pthread.dylib 0x7ef8 pthread_kill + 268\n2 libsystem_c.dylib 0x77ad8 abort + 128 \n3 libsystem_malloc.dylib 0x9c38 malloc_vreport + 896 \n4 libsystem_malloc.dylib 0x98a8 malloc_report + 64 \n5 libsystem_malloc.dylib 0x8e80 find_zone_and_free + 528 \n6 App 0xfe574 (Missing UUID 0faca6be3dbe3121a960c0897cece480) \n7 App 0xf7e04 (Missing UUID 0faca6be3dbe3121a960c0897cece480) \n8 App 0xfc250 (Missing UUID 0faca6be3dbe3121a960c0897cece480) \n9 App 0xfbbec (Missing UUID 0faca6be3dbe3121a960c0897cece480) \n10 App 0x2b4d00 (Missing UUID 0faca6be3dbe3121a960c0897cece480) \n11 App 0x2bed74 (Missing UUID 0faca6be3dbe3121a960c0897cece480) \n12 App 0x18344c (Missing UUID 0faca6be3dbe3121a960c0897cece480) \n13 libsystem_pthread.dylib 0x7ef8 pthread_kill + 268 \n14 App 0x28354fc __isPlatformVersionAtLeast + 4384462076 \n15 ??? 0x3015b5920 (Missing) \n16 ??? 0xd5e00078c (Missing) \n17 ??? 0x1f058ed (Missing)\n</code></pre>\n<p>APMExperimentWorkerQueue</p>\n<pre><code>0 libsqlite3.dylib 0x815f0 sqlite3_table_column_metadata + 2400\n1 libsqlite3.dylib 0x13b2c sqlite3_exec + 46032\n2 libsqlite3.dylib 0xaae0 sqlite3_exec + 9092\n3 libsqlite3.dylib 0x9ac8 sqlite3_exec + 4972\n4 libsqlite3.dylib 0x9158 sqlite3_exec + 2556\n5 libsqlite3.dylib 0x12830 sqlite3_exec + 41172\n6 libsqlite3.dylib 0x11f20 sqlite3_exec + 38852\n7 libsqlite3.dylib 0x11e64 sqlite3_exec + 38664\n8 libsqlite3.dylib 0xb14bc sqlite3_sourceid + 132108\n9 libsqlite3.dylib 0xd130 sqlite3_exec + 18900\n10 libsqlite3.dylib 0xc224 sqlite3_exec + 15048\n11 libsqlite3.dylib 0x9ac8 sqlite3_exec + 4972\n12 libsqlite3.dylib 0x9158 sqlite3_exec + 2556\n13 libsqlite3.dylib 0x8d30 sqlite3_exec + 1492\n14 App 0x58249c -[APMSqliteStore prepareSQL:error:] + 4339819676\n15 App 0x58295c -[APMSqliteStore validateDatabaseWithError:] + 4339820892\n16 App 0x58289c -[APMSqliteStore openAndValidateDatabase:] + 4339820700\n17 App 0x57ecbc -[APMSqliteStore initWithDatabasePath:error:] + 4339805372\n18 App 0x505ae4 -[APMEDatabase initializeDatabaseResourcesWithContext:databasePath:] + 4339309284\n19 App 0x505a0c -[APMEDatabase initWithPath:] + 4339309068\n20 App 0x50d294 -[APMETaskManager startTaskManagerOnWorkerQueue] + 4339339924\n21 App 0x50d24c __35-[APMETaskManager startTaskManager]_block_invoke + 4339339852\n22 App 0x50e578 __46-[APMETaskManager dispatchAsyncOnWorkerQueue:]_block_invoke + 4339344760\n23 libdispatch.dylib 0x213c _dispatch_call_block_and_release + 32\n24 libdispatch.dylib 0x3dd4 _dispatch_client_callout + 20\n25 libdispatch.dylib 0xb400 _dispatch_lane_serial_drain + 748\n26 libdispatch.dylib 0xbf30 _dispatch_lane_invoke + 380\n27 libdispatch.dylib 0x16cb4 _dispatch_root_queue_drain_deferred_wlh + 288\n28 libdispatch.dylib 0x16528 _dispatch_workloop_worker_thread + 404\n29 libsystem_pthread.dylib 0x4934 _pthread_wqthread + 288\n30 libsystem_pthread.dylib 0x10cc start_wqthread + 8\n</code></pre>\n<p><strong>Podfile.lock</strong></p>\n<pre><code>- Firebase/Analytics (10.28.1):\n - Firebase/Core\n - Firebase/Auth (10.28.1):\n - Firebase/CoreOnly\n - FirebaseAuth (~&gt; 10.28.0)\n - Firebase/Core (10.28.1):\n - Firebase/CoreOnly\n - FirebaseAnalytics (~&gt; 10.28.0)\n - Firebase/CoreOnly (10.28.1):\n - FirebaseCore (= 10.28.1)\n - Firebase/Crashlytics (10.28.1):\n - Firebase/CoreOnly\n - FirebaseCrashlytics (~&gt; 10.28.1)\n - FirebaseABTesting (10.29.0):\n - FirebaseCore (~&gt; 10.0)\n - FirebaseAnalytics (10.28.0):\n - FirebaseAnalytics/AdIdSupport (= 10.28.0)\n - FirebaseCore (~&gt; 10.0)\n - FirebaseInstallations (~&gt; 10.0)\n - GoogleUtilities/AppDelegateSwizzler (~&gt; 7.11)\n - GoogleUtilities/MethodSwizzler (~&gt; 7.11)\n - GoogleUtilities/Network (~&gt; 7.11)\n - &quot;GoogleUtilities/NSData+zlib (~&gt; 7.11)&quot;\n - nanopb (&lt; 2.30911.0, &gt;= 2.30908.0)\n - FirebaseAnalytics/AdIdSupport (10.28.0):\n - FirebaseCore (~&gt; 10.0)\n - FirebaseInstallations (~&gt; 10.0)\n - GoogleAppMeasurement (= 10.28.0)\n - GoogleUtilities/AppDelegateSwizzler (~&gt; 7.11)\n - GoogleUtilities/MethodSwizzler (~&gt; 7.11)\n - GoogleUtilities/Network (~&gt; 7.11)\n - &quot;GoogleUtilities/NSData+zlib (~&gt; 7.11)&quot;\n - nanopb (&lt; 2.30911.0, &gt;= 2.30908.0)\n - FirebaseAppCheckInterop (10.29.0)\n - FirebaseAuth (10.28.0):\n - FirebaseAppCheckInterop (~&gt; 10.17)\n - FirebaseCore (~&gt; 10.0)\n - GoogleUtilities/AppDelegateSwizzler (~&gt; 7.8)\n - GoogleUtilities/Environment (~&gt; 7.8)\n - GTMSessionFetcher/Core (&lt; 4.0, &gt;= 2.1)\n - RecaptchaInterop (~&gt; 100.0)\n - FirebaseCore (10.28.1):\n - FirebaseCoreInternal (~&gt; 10.0)\n - GoogleUtilities/Environment (~&gt; 7.12)\n - GoogleUtilities/Logger (~&gt; 7.12)\n - FirebaseCoreExtension (10.29.0):\n - FirebaseCore (~&gt; 10.0)\n - FirebaseCoreInternal (10.29.0):\n - &quot;GoogleUtilities/NSData+zlib (~&gt; 7.8)&quot;\n - FirebaseCrashlytics (10.28.1):\n - FirebaseCore (~&gt; 10.5)\n - FirebaseInstallations (~&gt; 10.0)\n - FirebaseRemoteConfigInterop (~&gt; 10.23)\n - FirebaseSessions (~&gt; 10.5)\n - GoogleDataTransport (~&gt; 9.2)\n - GoogleUtilities/Environment (~&gt; 7.8)\n - nanopb (&lt; 2.30911.0, &gt;= 2.30908.0)\n - PromisesObjC (~&gt; 2.1)\n - FirebaseInstallations (10.29.0):\n - FirebaseCore (~&gt; 10.0)\n - GoogleUtilities/Environment (~&gt; 7.8)\n - GoogleUtilities/UserDefaults (~&gt; 7.8)\n - PromisesObjC (~&gt; 2.1)\n - FirebasePerformance (10.28.0):\n - FirebaseCore (~&gt; 10.5)\n - FirebaseInstallations (~&gt; 10.0)\n - FirebaseRemoteConfig (~&gt; 10.0)\n - FirebaseSessions (~&gt; 10.5)\n - GoogleDataTransport (~&gt; 9.2)\n - GoogleUtilities/Environment (~&gt; 7.13)\n - GoogleUtilities/ISASwizzler (~&gt; 7.13)\n - GoogleUtilities/MethodSwizzler (~&gt; 7.13)\n - GoogleUtilities/UserDefaults (~&gt; 7.13)\n - nanopb (&lt; 2.30911.0, &gt;= 2.30908.0)\n - FirebaseRemoteConfig (10.29.0):\n - FirebaseABTesting (~&gt; 10.0)\n - FirebaseCore (~&gt; 10.0)\n - FirebaseInstallations (~&gt; 10.0)\n - FirebaseRemoteConfigInterop (~&gt; 10.23)\n - FirebaseSharedSwift (~&gt; 10.0)\n - GoogleUtilities/Environment (~&gt; 7.8)\n - &quot;GoogleUtilities/NSData+zlib (~&gt; 7.8)&quot;\n - FirebaseRemoteConfigInterop (10.29.0)\n - FirebaseSessions (10.29.0):\n - FirebaseCore (~&gt; 10.5)\n - FirebaseCoreExtension (~&gt; 10.0)\n - FirebaseInstallations (~&gt; 10.0)\n - GoogleDataTransport (~&gt; 9.2)\n - GoogleUtilities/Environment (~&gt; 7.13)\n - GoogleUtilities/UserDefaults (~&gt; 7.13)\n - nanopb (&lt; 2.30911.0, &gt;= 2.30908.0)\n - PromisesSwift (~&gt; 2.1)\n - FirebaseSharedSwift (10.29.0)\n - GoogleAppMeasurement (10.28.0):\n - GoogleAppMeasurement/AdIdSupport (= 10.28.0)\n - GoogleUtilities/AppDelegateSwizzler (~&gt; 7.11)\n - GoogleUtilities/MethodSwizzler (~&gt; 7.11)\n - GoogleUtilities/Network (~&gt; 7.11)\n - &quot;GoogleUtilities/NSData+zlib (~&gt; 7.11)&quot;\n - nanopb (&lt; 2.30911.0, &gt;= 2.30908.0)\n - GoogleAppMeasurement/AdIdSupport (10.28.0):\n - GoogleAppMeasurement/WithoutAdIdSupport (= 10.28.0)\n - GoogleUtilities/AppDelegateSwizzler (~&gt; 7.11)\n - GoogleUtilities/MethodSwizzler (~&gt; 7.11)\n - GoogleUtilities/Network (~&gt; 7.11)\n - &quot;GoogleUtilities/NSData+zlib (~&gt; 7.11)&quot;\n - nanopb (&lt; 2.30911.0, &gt;= 2.30908.0)\n - GoogleAppMeasurement/WithoutAdIdSupport (10.28.0):\n - GoogleUtilities/AppDelegateSwizzler (~&gt; 7.11)\n - GoogleUtilities/MethodSwizzler (~&gt; 7.11)\n - GoogleUtilities/Network (~&gt; 7.11)\n - &quot;GoogleUtilities/NSData+zlib (~&gt; 7.11)&quot;\n - nanopb (&lt; 2.30911.0, &gt;= 2.30908.0)\n - GoogleDataTransport (9.4.1):\n - GoogleUtilities/Environment (~&gt; 7.7)\n - nanopb (&lt; 2.30911.0, &gt;= 2.30908.0)\n - PromisesObjC (&lt; 3.0, &gt;= 1.2)\n - GoogleMLKit/BarcodeScanning (6.0.0):\n - GoogleMLKit/MLKitCore\n - MLKitBarcodeScanning (~&gt; 5.0.0)\n - GoogleMLKit/MLKitCore (6.0.0):\n - MLKitCommon (~&gt; 11.0.0)\n - GoogleMLKit/TextRecognition (6.0.0):\n - GoogleMLKit/MLKitCore\n - MLKitTextRecognition (~&gt; 4.0.0)\n - GoogleToolboxForMac/Defines (4.2.1)\n - GoogleToolboxForMac/Logger (4.2.1):\n - GoogleToolboxForMac/Defines (= 4.2.1)\n - &quot;GoogleToolboxForMac/NSData+zlib (4.2.1)&quot;:\n - GoogleToolboxForMac/Defines (= 4.2.1)\n - GoogleUtilities/AppDelegateSwizzler (7.13.3):\n - GoogleUtilities/Environment\n - GoogleUtilities/Logger\n - GoogleUtilities/Network\n - GoogleUtilities/Privacy\n - GoogleUtilities/Environment (7.13.3):\n - GoogleUtilities/Privacy\n - PromisesObjC (&lt; 3.0, &gt;= 1.2)\n - GoogleUtilities/ISASwizzler (7.13.3):\n - GoogleUtilities/Privacy\n - GoogleUtilities/Logger (7.13.3):\n - GoogleUtilities/Environment\n - GoogleUtilities/Privacy\n - GoogleUtilities/MethodSwizzler (7.13.3):\n - GoogleUtilities/Logger\n - GoogleUtilities/Privacy\n - GoogleUtilities/Network (7.13.3):\n - GoogleUtilities/Logger\n - &quot;GoogleUtilities/NSData+zlib&quot;\n - GoogleUtilities/Privacy\n - GoogleUtilities/Reachability\n - &quot;GoogleUtilities/NSData+zlib (7.13.3)&quot;:\n - GoogleUtilities/Privacy\n - GoogleUtilities/Privacy (7.13.3)\n - GoogleUtilities/Reachability (7.13.3):\n - GoogleUtilities/Logger\n - GoogleUtilities/Privacy\n - GoogleUtilities/UserDefaults (7.13.3):\n - GoogleUtilities/Logger\n - GoogleUtilities/Privacy\n - GoogleUtilitiesComponents (1.1.0):\n - GoogleUtilities/Logger\n - GTMSessionFetcher/Core (3.5.0)\n - nanopb (2.30910.0):\n - nanopb/decode (= 2.30910.0)\n - nanopb/encode (= 2.30910.0)\n - nanopb/decode (2.30910.0)\n - nanopb/encode (2.30910.0)\n - PromisesObjC (2.4.0)\n - PromisesSwift (2.4.0):\n - PromisesObjC (= 2.4.0)\n</code></pre>\n<p><strong>Deployment version: 12.2 &amp; 13.0</strong></p>\n<p>Could anyone know the above issue?</p>\n"^^ . . . . "1"^^ . "6"^^ . . "`_tableContents` and `_tableView` are instance variables though."^^ . . . . . . . . "0"^^ . . . "<p>By default Cocoa binding of <code>NSTextFiled</code>'s value to a property only does model update when text field loses input focus.</p>\n<p>Is there a way to force an update on, for example, form button click and not using 'Continuously Update Value'?</p>\n<p>What have I tried.</p>\n<p>I've created Xcode macOS Objective-C project with XIB interface.</p>\n<p>I've laid out my MainMenu's form in the following way:</p>\n<p><a href="https://i.sstatic.net/7A6TUgSe.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7A6TUgSe.png" alt="Form layout" /></a></p>\n<p>I've added to the project the following class:</p>\n<pre><code>@interface Person : NSObject\n@property (weak) NSString* firstName;\n@property (weak) NSString* middleName;\n@property (weak) NSString* lastName;\n@end\n</code></pre>\n<p>and modified my AppDelegeate:</p>\n<pre><code>@interface AppDelegate : NSObject &lt;NSApplicationDelegate&gt;\n@property (strong) Person* person;\n@end\n</code></pre>\n<p>Finally, I've bound my form <code>NSTextFiled</code>s to <code>AppDelegate</code>'s <code>person</code>'s properties as follows:</p>\n<p><a href="https://i.sstatic.net/LhrSlZTd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/LhrSlZTd.png" alt="Binding" /></a></p>\n<p>and connected the save button action to the following method:</p>\n<pre><code>- (IBAction)onSave:(id)sender {\n NSLog(@&quot;%@ %@ %@&quot;, self.person.firstName, self.person.middleName, self.person.lastName);\n}\n</code></pre>\n<p>Now, when I run the application and</p>\n<ol>\n<li>Enter 'John' into the first text field, click second one;</li>\n<li>Enter 'Lee' into the second text field, click third one;</li>\n<li>Enter 'Hooker' into the third text field <strong>and click save button</strong></li>\n</ol>\n<p>, I got in the log <code>John Lee (null)</code>.</p>\n<p>This, obviously, means, that by default bound values are updated only when text field loses input focus.</p>\n<p>So, is there a way to force Cocoa to update all form's bound values on button click?</p>\n<p>The 'Continuously Update Value' option does the thick, but I'm going to avoid updating model on each keyboard hit.</p>\n"^^ . "new-architecture"^^ . . "Qt6 using Objective-C script in CPP (H) file"^^ . "You don't say where you are obtaining this date from, but are you looking for https://developer.apple.com/documentation/foundation/nsiso8601dateformatter?language=objc ?"^^ . . . . . . "core-data"^^ . . . "2"^^ . "<p>In an effort to enforce tighter memory safety, iOS 18 introduced new memory allocation features:</p>\n<blockquote>\n<p>The system memory allocator (malloc(3)) has switched to a new implementation for most allocation sizes. Users might experience exposure of latent memory access bugs due to changes in heap layout, differences in performance for allocation-heavy workloads, and changes in fragmentation. (127493322)</p>\n</blockquote>\n<p>This likely includes changes in how memory allocation for zero-sized buffers is handled to guard against information disclosure and other memory safety issues.</p>\n<p>According to the malloc documentation:</p>\n<blockquote>\n<p>Crashes in memory allocators are almost always related to heap corruption, such as overflowing an allocated chunk...</p>\n</blockquote>\n<p>You are not checking the return status of the AudioConverterGetProperty function. Check that maxPacketSize is initialized and not zero as a result of this call. Also check that the size is actually sufficient.</p>\n<p><a href="https://developer.apple.com/documentation/ios-ipados-release-notes/ios-ipados-18-release-notes#Memory-Allocation" rel="nofollow noreferrer">iOS &amp; iPadOS 18 Release Notes</a><br />\n<a href="https://man7.org/linux/man-pages/man3/malloc.3.html" rel="nofollow noreferrer">malloc(3) — Linux manual page</a></p>\n"^^ . . . . . "0"^^ . . . . "<p>As the title states, I'm looking for the correct format of the Apple auto-renewable subscription &quot;expires_date&quot;.</p>\n<p>The &quot;expires_date&quot; field comes from App Store receipt json data.</p>\n<p>for example:</p>\n<pre><code> [{\n &quot;quantity&quot;: &quot;1&quot;,\n &quot;product_id&quot;: &quot;test2&quot;,\n &quot;transaction_id&quot;: &quot;1000000472106082&quot;,\n &quot;original_transaction_id&quot;: &quot;1000000472106082&quot;,\n &quot;purchase_date&quot;: &quot;2018-11-13 16:46:31 Etc/GMT&quot;,\n &quot;purchase_date_ms&quot;: &quot;1542127591000&quot;,\n &quot;purchase_date_pst&quot;: &quot;2018-11-13 08:46:31 America/Los_Angeles&quot;,\n &quot;original_purchase_date&quot;: &quot;2018-11-13 16:46:31 Etc/GMT&quot;,\n &quot;original_purchase_date_ms&quot;: &quot;1542127591000&quot;,\n &quot;original_purchase_date_pst&quot;: &quot;2018-11-13 08:46:31 America/Los_Angeles&quot;,\n &quot;is_trial_period&quot;: &quot;false&quot;,\n &quot;expires_date&quot; : &quot;2023-05-24 18:01:31 Etc/GMT&quot;\n }]\n</code></pre>\n<p>I'm using:\n<code>@&quot;yyyy-MM-dd HH:mm:ss VV&quot;</code></p>\n<p>I see generally see dates like:\n<code>2023-05-24 18:01:31 Etc/GMT</code></p>\n<p>This appears to work most of the time. However, there are cases where it appears to be failing, generally, but not always I see more failures from iOS devices in the UK. I don't know what the date string looks like in those cases, unfortunately, as this code is being performed on the device.</p>\n<p>There is no information on the apple developer site as to the correct format. There is a deprecated document that states its RFC3339 date format. However, this is not correct. It is also not ISO8601 format.</p>\n<p>BTW, here's basically the code I'm using.</p>\n<pre><code> NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease];\n formatter.dateFormat = @&quot;yyyy-MM-dd HH:mm:ss VV&quot;;\n formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@&quot;en_US_POSIX&quot;];\n \n NSDate* expireDate = [formatter dateFromString:expireDate];\n</code></pre>\n<p>I then compare it to now with a date created like:</p>\n<pre><code>NSDate* nowDate = [NSDate date];\nif(([nowDate compare:expireDate] == NSOrderedDescending) ||\n ([nowDate compare:bufferDate] == NSOrderedSame))\n{\n //the subscription has expired\n retVal = true;\n}\n</code></pre>\n<p>Like I said a vast majority of the time the format I provided works, but occasionally it does not. So I suspect an issue with the format of the expires_date field.</p>\n"^^ . . "2"^^ . . . . . . "<p>I'm running RN 0.76.3 with New Architecture enabled, and <code>react-native-code-push</code> 9.0.0</p>\n<p>When downloading a CodePush update, I don't get progress events before the download has finished.</p>\n<p>I've found that the reason is that the method</p>\n<p><code>- (void)didUpdateFrame:(RCTFrameUpdate *)update</code></p>\n<p>of the CodePush module is never invoked, because</p>\n<p><code>- (void)registerModuleForFrameUpdates:(id&lt;RCTBridgeModule&gt;)module withModuleData:(RCTModuleData *)moduleData;</code></p>\n<p>is never called with the <code>CodePush</code> module.</p>\n<p>I can see that <code>RCTTurboModuleManager.mm</code> contains this code which <em>should</em> register CodePush for updates, but because <code>bridge</code> is <code>nil</code>, it doesn't happen.</p>\n<pre><code> if (_bridge) {\n RCTModuleData *data = [[RCTModuleData alloc] initWithModuleInstance:(id&lt;RCTBridgeModule&gt;)module\n bridge:_bridge\n moduleRegistry:_bridge.moduleRegistry\n viewRegistry_DEPRECATED:nil\n bundleManager:nil\n callableJSModules:nil];\n [_bridge registerModuleForFrameUpdates:(id&lt;RCTBridgeModule&gt;)module withModuleData:data];\n }\n</code></pre>\n<p>I guess there's some method or protocol that needs to be implemented in <a href="https://github.com/microsoft/react-native-code-push/blob/master/ios/CodePush/CodePush.m" rel="nofollow noreferrer"><code>CodePush.m</code></a> to make it register for frame updates with the New Architecture?</p>\n"^^ . . . . . "0"^^ . . . "0"^^ . . "Programmatically check there a "disk image password" in KeyChain"^^ . "@夢のの夢 -- I added a screen-cap of the animation to my answer. Is that not what you're getting?"^^ . . "1"^^ . "0"^^ . "firebase"^^ . . "Draw PDF with a different colour in a CALayer. (Objective-C)"^^ . "1"^^ . . . . . "looks like an answer generated by ChatGPT, OpenAI, Google AI or some other AI."^^ . "0"^^ . "2"^^ . "Nice demo; actually you only need six vc's (on a small simulator) to see the problem. Four items appear in the tab bar, one item appears in the More list; one item is missing. You could do quite a bit to simplify and clean up the example before sending it to Apple."^^ . "@Willeke this works only if I call `[arrayController setContent: myMutableArray]` every time I make any change to the array."^^ . . "encryption"^^ . . "1"^^ . . . . "0"^^ . . . "0"^^ . . "1"^^ . . "key-pair"^^ . "<p>Implemented iOS PencilKit for React-native with a native bridge. The canvasView's content area can be panned and zoomed.</p>\n<p>However, I'm encountering a strange behavior...</p>\n<p>When drawing in the content area while completely zoomed out (the canvas area is completely visible), the canvas drawing behaves perfectly fine.</p>\n<p>However, when zoomed-in (so only a portion of the canvas is visible) and the user starts to draw, strokes at the lower and upper edges of the content area will flicker for a couple of seconds. Why does it do that?</p>\n<p>Further, if I set the minimumZoomScale so that in effect it is like setting resizeMode = 'cover' for the content area (i.e. the content area covers the entire frame), it doesn't have that strange behavior. Doing this however, means user cannot view the entire content area on the screen at the same time.</p>\n<pre><code>- (UIView *)view {\n\n CGFloat deviceWidth = [UIScreen mainScreen].bounds.size.width;\n CGFloat deviceHeight = [UIScreen mainScreen].bounds.size.height;\n CGRect viewRect = CGRectMake(0, 0, deviceWidth, deviceHeight);\n _canvasView = [[CanvasView alloc] initWithFrame:viewRect];\n\n _canvasView.zoomScale = 1.0; \n _canvasView.backgroundColor = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.0]; \n _canvasView.drawingPolicy = PKCanvasViewDrawingPolicyAnyInput; \n _canvasView.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;\n _canvasView.multipleTouchEnabled = true;\n _canvasView.delegate = self;\n\n return _canvasView;\n}\n\n\nRCT_EXPORT_METHOD(setupCanvas\n : (nonnull NSNumber *)viewTag imagePath\n : (NSString *)imagePath width\n : (CGFloat)width height\n : (CGFloat)height traceImagePath\n : (NSString *)traceImagePath traceImageSize\n : (nonnull NSNumber *)traceImageSize) {\n\n dispatch_async(dispatch_get_main_queue(), ^{\n NSLog(@&quot;Set Toolpicker&quot;);\n [self setupToolPicker];\n\n NSLog(@&quot;Set Canvas size&quot;);\n [self setCanvasDimensions:width height:height];\n\n if (imagePath != (id)[NSNull null] &amp;&amp; imagePath.length != 0) {\n NSLog(@&quot;Draw on image&quot;);\n [self drawOnImage:imagePath];\n }\n\n \n });\n\n}\n\n\n- (void)setCanvasDimensions:(CGFloat)width height:(CGFloat)height {\n\n [self-&gt;_canvasView setContentSize:CGSizeMake(width, height)];\n\n CGFloat canvasRepWidth = [[UIScreen mainScreen] bounds].size.width;\n \n self-&gt;_canvasView.minimumZoomScale = canvasRepWidth \n self-&gt;_canvasView.maximumZoomScale = 4.0;\n self-&gt;_canvasView.zoomScale = canvasRepWidth / width;\n self-&gt;_canvasView.contentOffset = CGPointZero;\n\n}\n\n</code></pre>\n<p><a href="https://i.sstatic.net/f3SWiK6t.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/f3SWiK6t.gif" alt="Flickering at edge of canvas" /></a></p>\n"^^ . . . . . . "0"^^ . "nsimage"^^ . "0"^^ . . . . . . . . . . "0"^^ . . "0"^^ . "<p>In my app I’m running into a problem leaking custom objects passed into a chain of methods that store HTML files into a custom object. Where each method finds a local copy of a file, the file is read in and referenced by an NSString in the custom object. When no local copy of the file exists, the method makes an asynchronous network request with the completion routine saving the contents locally and again storing a reference to the data read in the custom object.</p>\n<p>Things work fine as long as I have local copies of each file: the HTML is read from the local file, the reference is stored in the custom object, and the next method in the chain is called. There are about 2 dozen methods in the chain, and once done the HTML files are processed, I set the reference to the custom object to nil, and repeat the whole process with a different set of 24 HTML files. As long as everything is local, an examination of the memory map shows that no objects have leaked.</p>\n<p>Problems begin, however, when any one of the HTML files is not available locally and that file is fetched from the web. In those cases, the custom object used to store references to the data is never released via ARC.</p>\n<p>My code (here, a mix of real and pseudo code) looks like this:</p>\n<pre><code>@interface CustomObject : NSObject\n@property (strong) NSString *htmlPage1;\n@property (strong) NSString *htmlPage2;\n@property (strong) NSString *htmlPage3;\n@property (strong) NSMutableArray *array;\n@property (strong) DifferentCustomObject *c1;\n@end\n</code></pre>\n<p>The custom object is then created within a loop, like so:</p>\n<pre><code>- (void) loop: (int) n {\n CustomObject *co;\n int i;\n for (i = 0; i &lt; n; ++i) {\n co = [[CustomObject alloc] init];\n co.c1 = [[DifferentCustomObject alloc] init];\n [self startFileFetchChain: co];\n }\n}\n</code></pre>\n<p>And the custom object is set to nil once the request chain has ended.</p>\n<pre><code>- (void) endFileFetchChain: (CustomObject *) co {\n if (co.array)\n [co.array removeAllObjects];\n if (co.c1)\n co.c1 = nil;\n co = nil;\n}\n</code></pre>\n<p>This is the beginning of the chain of methods that will (hopefully) fetch 24 HTML files.</p>\n<pre><code>- (void) startFileFetchChain: (CustomObject *) co {\n __block NSURLSessionTask *task = nil;\n NSURL *pageURL;\n // Check to see if we have a local copy of the file, which gets stored in localPageSource\n if (localPageSource) {\n // Store a reference to read data in the custom object\n co.htmlPage1 = localPageSource;\n // Call the next method in the chain\n [self requestNextPageInTheChain: co];\n }\n else {\n // Create the URL for this page page, which we put in pageURL\n task = [[NSURLSession sharedSession] dataTaskWithURL:pageURL completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n switch ([httpResponse statusCode]) {\n case 200:\n // Store the HTML page into the custom object\n co.htmlPage1 = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];\n // Save this file locally so we won’t have to make a network request next time\n dispatch_async(dispatch_get_main_queue(),^{\n // File system code here; missing for brevity\n [co.htmlPage1 writeToFile: localPath atomically:YES encoding:NSUTF8StringEncoding error:nil];\n // Call the next method in the chain\n [self requestNextPageInTheChain: co];\n });\n break;\n default:\n // Error case. The chain is severed before running to completion\n [self endFileFetchChain: co];\n break;\n }\n }];\n [task resume];\n }\n}\n</code></pre>\n<p>The chain continues here.</p>\n<pre><code>- (void) requestNextPageInTheChain: (CustomObject *) co {\n // Basically, a repeat of the above, but storing the local or network fetched HTML page into co.htmlPage2\n // and then chaining to a subsequent method to request the next HTML page.\n // This repeats for all 24 HTML pages until we reach the final page, which is in the next method.\n }\n\n- (void) requestLastPageInTheChain: (CustomObject *) co {\n __block NSURLSessionTask *task = nil;\n NSURL *pageURL;\n // Check to see if we have a local copy of the file, which gets stored in localPageSource\n if (localPageSource) {\n // Store a reference to read data in the custom object\n co.htmlPage1 = localPageSource;\n // Call the next method in the chain\n [self processAllThePages: co]; // &lt;— We’re now done with all the requests\n }\n else {\n // Create the URL for this page page, which we put in pageURL\n task = [[NSURLSession sharedSession] dataTaskWithURL:pageURL completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n switch ([httpResponse statusCode]) {\n case 200:\n // Store the HTML page into the custom object\n co.htmlPage1 = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];\n // Save this file locally so we won’t have to make a network request next time\n dispatch_async(dispatch_get_main_queue(),^{\n // File system code here; missing for brevity\n [co.htmlPage1 writeToFile: localPath atomically:YES encoding:NSUTF8StringEncoding error:nil];\n // Call the next method in the chain\n [self processAllThePages: co]; // &lt;— We’re now done with all the requests\n });\n break;\n default:\n // Error case. The chain is severed before running to completion\n [self endFileFetchChain: co];\n break;\n }\n }];\n [task resume];\n }\n }\n</code></pre>\n<p>And the chain concludes with this method.</p>\n<pre><code>- (void) processAllThePages: (CustomObject *) co {\n // Do a bunch of stuff with the 24 HTML pages \n [self endFileFetchChain: co];\n}\n</code></pre>\n<p>Okay, when all of the files I need to process are stored locally, the code progresses through each of the request methods, finally getting to processAllThePages, which calls the method to end the chain and set the object originally allocated in the loop to nil. The next time through the loop we allocate a new object, initiate the chain, and — as long as we don’t have to make a request through the network — again process all the files and call endFileFetchChain to set the custom object to nil so it can be releases. However, when we DO have to go to the network for a file request, the custom object is never released, even though the code does call endFileFetchChain where the object is set to nil.</p>\n<p>My guess is that because the network requests are asynchronous, the code returns immediately to the main loop where a new CustomObject is allocated and another request chain is initiated. Even though I do eventually call endFileFetchChain on the first object (which I’ve verified by comparing object addresses), the reference count never goes to zero because the original reference created in the loop is still around. Does that sound right? And if so, how might I go about restructuring the code to avoid the problem?</p>\n<p>Oh! Also, when a custom object contains other custom objects, will those objects be released when the parent object is released, or so I need some sort of custom de-allocation routine on each of my custom objects?</p>\n<p>Thanks!</p>\n"^^ . . . . "0"^^ . . . "Thanks for your response. Can you share some code?"^^ . . "Instead of the workaround, fire KVO notifications with `willChangeValueForKey:` and `didChangeValueForKey:`."^^ . . . . . . "0"^^ . . . . . . . "0"^^ . . . "Have you tried an attributed string?"^^ . "0"^^ . . . . "1"^^ . . . . "0"^^ . "Tip: run and pause the app and execute debugger command `image lookup -rn NSMutableAttributedString` or `image lookup -rn appendString:`."^^ . . "ARC and the release of custom objects passed into async network methods"^^ . "0"^^ . . . . . . . . . . . . . "<p>I've loaded a black and transparent .PDF icon to a CGPDFPageRef and need to draw it out to a CALayer with a specified colour. I can scale and rotate it correctly but don't know how to change the colour it's rendered in.</p>\n<p>This is part of a macOS desktop application that maps aircraft in flight. I have been using an NSImage to draw .PNG aircraft icons but as my source icons are 128x128 they often appear slightly blurry when an NSImage is scaled down to 40x40. I have been converting the icons to 128x128 Vector PDF files and the code below draws them correctly scaled and orientated on a CALayer but I don’t seem to be able to change the colour they are drawn in.</p>\n<p>When I used NSImages to load .png’s I have some code to read the .png to an NSImage then create a new NSImage with the changed colour and I suspect I’ll need to do the same with a PDF but have no idea how to do that.</p>\n<p>My code to render the .PDF icon to the map is:</p>\n<pre><code>// Render a PDF vector icon\n- (void)drawAircraftInContext:(CGContextRef)context acft:(Aircraft *)acft\n{\n CGContextSaveGState (context);\n\n CGRect pdfRect = CGPDFPageGetBoxRect (acft.pdf, kCGPDFCropBox);\n\n CGContextTranslateCTM (context, acft.x, acft.y);\n CGContextRotateCTM (context, degreesToRadians (acft.heading));\n CGContextTranslateCTM (context, (_iconSize / 2), (_iconSize / 2));\n CGContextScaleCTM (context, .0 - (_iconSize / pdfRect.size.width), .0 - (_iconSize / pdfRect.size.height));\n\n// None of this block actually works - the colour remains black with a clear background.\n CGContextSetAlpha (context, _radarView.militaryAlpha);\n CGContextSetFillColorWithColor (context, _militaryColour);\n CGContextSetStrokeColorWithColor (context, _militaryColour);\n CGContextSetBlendMode (context, kCGBlendModeMultiply);\n// How do we change the colour of the image?\n\n CGContextDrawPDFPage (context, acft.pdf);\n\n CGRect rect = CGRectMake (0.0 - (_iconSize / 2.0), 0.0 - (_iconSize / 2.0), _iconSize, _iconSize);\n\n // Draw a highlight\n if (acft == _radarView.selected &amp;&amp; !_radarView.showOnlySelectedAircraft)\n [self drawAircraftHighlightInContext:context rect:rect acft:acft];\n\n CGContextRestoreGState (context);\n}\n</code></pre>\n<p>The code to load the PDF is:</p>\n<pre><code> //Experimental to see if PDF images can be treated as vectors rather than images.\n if (acft.pdfIcon)\n {\n NSURL *nsurl = [NSURL fileURLWithPath:filename isDirectory:NO];\n CFURLRef url = (CFURLRef)CFBridgingRetain(nsurl);\n CGPDFDocumentRef pdf = CGPDFDocumentCreateWithURL (url);\n CGPDFPageRef page = CGPDFDocumentGetPage (pdf, 1);\n\n /* Might need to create another CGPDFPageRef from the original and draw\n into it with the correct colour. */\n\n acft.pdf = page;\n }\n</code></pre>\n<p>Which then falls through to create an NSImage which I don’t need to do if I can change the colour:</p>\n<pre><code> image = [[NSImage alloc] initWithContentsOfFile:filename];\n\n /*\n * Our .png images are just black but we'll need to use the specified colour\n * to indicate military, civilian or simulator.\n */\n [image lockFocus];\n [[[NSColor colorWithCGColor:colour] colorWithAlphaComponent:alpha] set];\n NSRect imageRect = { NSZeroPoint, [image size] };\n NSRectFillUsingOperation (imageRect, NSCompositeSourceIn);\n [image unlockFocus];\n }\n</code></pre>\n<pre><code> if (image)\n {\n CGRect rect = CGRectMake (0.0, 0.0, _iconSize, _iconSize);\n\n return ([image CGImageForProposedRect:&amp;rect\n context:nil\n hints:@{}]);\n }\n</code></pre>\n<pre><code> return ([image CGImageForProposedRect:&amp;rect\n context:nil\n hints:@{}]);\n }\n</code></pre>\n"^^ . . . . . . "Runner-Bridging-Header.h:1:9: error: 'GeneratedPluginRegistrant.h' file not found"^^ . . . . . . "0"^^ . . . "0"^^ . "0"^^ . . "automatic-ref-counting"^^ . . . "Force Cocoa to update bound value on button click"^^ . . . "0"^^ . . . . . "<ol>\n<li><p>Metal has been available since OS X El Capitan (10.11)</p>\n<p><code>@available(macOS 10.11, *) public func MTLCopyAllDevices() -&gt; [any MTLDevice]</code></p>\n</li>\n<li><p><a href="https://developer.apple.com/documentation/metal/gpu_devices_and_work_submission/detecting_gpu_features_and_metal_software_versions#3233355" rel="nofollow noreferrer">Detecting GPU Features and Metal Software Versions</a></p>\n</li>\n</ol>\n"^^ . . "1"^^ . . . "uiviewanimation"^^ . . "<p>I tried with NSWorkspace but i able to identify when application is lauched not process not any daemon.</p>\n<pre><code>NSWorkspace.shared.notificationCenter.addObserver(forName: NSWorkspace.didLaunchApplicationNotification, object: nil, queue: nil)\n</code></pre>\n<pre><code>let source = DispatchSource.makeProcessSource(identifier: pid, eventMask: [.fork], queue: queue)\n source.setEventHandler(handler: completion)\n source.resume()\n</code></pre>\n<p>dispatchsource always tell if new process is launched but no information about child process</p>\n"^^ . "0"^^ . . . . . . "0"^^ . . "0"^^ . . . . . . . "Okay, so what's the *input* for generating the data? Do you want to get it for a particular file? Or do you just want to know how icns data should be structured?"^^ . . . . "I do have PDFKit.framework in my Frameworks"^^ . . "@Willeke seems like the workaround is calling `[[self mutableArrayValueForKey:@"myMutableArray"] addObject: newObject];` every time I add a new element, I suppose this complies with KVO..."^^ . . "0"^^ . . "0"^^ . . . . . . . . "How complex is your "Airplane Icon"? There may be a much simpler way to handle this..."^^ . "uiview"^^ . . . . . . . . . "0"^^ . "0"^^ . "2"^^ . "0"^^ . . . "@KJ - file won't download from that link. I posted an example project at: https://github.com/DonMag/PDFPathExtract ... you can clone the repo or download the PDF file only."^^ . "nsapplication"^^ . . . . "rpbroadcastsamplehandler"^^ . . . . . . "1"^^ . . . . . . "iphone"^^ . . "1"^^ . . "3"^^ . "<p>Thanks @Willeke for your tips ,now I know the whole thing behind this problem.</p>\n<p>As the image lookup -rn NSMutableAttributedString says</p>\n<p>There will be a <code>appendString</code> defined in <code>ScreenReaderCore framework</code></p>\n<pre><code>ScreenReaderCore`-[NSMutableAttributedString(SCRCMutableAttributedStringExtras) appendString:] \n</code></pre>\n<p><strong>For Question 1:</strong></p>\n<p>there will be duplicate methods for sure !\nAnd because this ScreenReaderCore is seemd to used for Voice-Over . The simulator is not using this framework . So this duplication exist only in real device.</p>\n<p><strong>For question 2.1</strong></p>\n<p>The method duplication in different category can not be found by the compilor , and this function will be invoked is undefined , It's very dangerous , So it's better to add prefix to the method name in catetory.</p>\n<p><strong>For question 2.2:</strong></p>\n<p>Just as @Willeke comment.\nrun and pause the app and execute debugger command</p>\n<pre><code>image lookup -rn NSMutableAttributedString or image lookup -rn appendString:. – \n</code></pre>\n"^^ . "0"^^ . "Overlapping Video Frames in RPBroadcastSampleHandler with ReplayKit"^^ . "1"^^ . . . "0"^^ . . . . . . . "1"^^ . . . . . . . . "This question is similar to: [Force Header Files to Compile as C++ in Xcode](https://stackoverflow.com/questions/32827389/force-header-files-to-compile-as-c-in-xcode). If you believe it’s different, please [edit] the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem."^^ . . "1"^^ . . "How do I bind an NSMutableArray to an NSPopUpButton"^^ . . "0"^^ . "@user9398585 - the most reliable path extraction works when the PDF contains **only** closed, filled (but not bordered) paths. Since Cocoa appears to do a great job of rendering the PDF as an `NSImage`, clearly it's doing a lot of other work with the PDF data. If you can stick to filled paths, you should be OK. Otherwise, I'd use `NSImage` (unless you need different fill and stroke colors)."^^ . . "I don't want to use an infinite loop to get new process information. Process tail does not give the child process information. The same goes for DispatchSource. DispatchSource notifies me whenever a new process is forked or exec, but information about the child process is not provided anywhere."^^ . "<p>Normally, I use only *.h files in my c++ project as scripts are short and I don't need to really generate many files.</p>\n<p>So, currently I have a c++ script used only in a header file. Also in there, I have some objective-c script, which currently works. However, another one does not.</p>\n<p>I, of course, understand using objective-c in cpp file is not as easy However, it can be managed. Unfortunately, I have no experience with this just yet.</p>\n<p>How to run the fallowing code inside cpp (header) file without having the script in separate *.mm file?</p>\n<pre class="lang-objectivec prettyprint-override"><code> #ifndef PERMISSION_H\n #define PERMISSION_H\n\n #include &lt;QMainWindow&gt;\n #include &lt;QMessageBox&gt;\n #include &lt;QtCore/QObject&gt;\n #include &lt;QtCore/QMetaObject&gt;\n #include &lt;QUrl&gt;\n #include &lt;QDesktopServices&gt;\n\n #if defined(Q_OS_ANDROID)\n #include &lt;QtCore/qjniobject.h&gt;\n #include &lt;QtCore/qcoreapplication.h&gt;\n #include &lt;QtCore/private/qandroidextras_p.h&gt;\n #elif defined(Q_OS_IOS)\n #include &lt;objc/objc.h&gt;\n #include &lt;objc/message.h&gt;\n #include &lt;objc/runtime.h&gt;\n //#include &lt;UIKit/UIKit.h&gt; // this brings this error: http://www.j88.tech/appdev/macos-qt-carbon-h-warning/\n //#include &lt;QtCore/private/qcore_map_p.h&gt; // if I undcomment this, error from line above changes to: &quot;expected unqualified-id/applications/Xcode.app/Contents/Developer/...&quot;\n #endif\n\n class Permission : public QObject\n {\n Q_OBJECT\n \n\n public:\n Permission(QObject *parent = nullptr) : QObject(parent) {}\n\n // Photo Library\n Q_INVOKABLE bool requestMedia() {\n #if defined(Q_OS_ANDROID)\n\n // ANDROID: cpp script to request permission for camera galery pictures... this works fine, no need to show the code here\n\n #elif defined(Q_OS_IOS)\n\n // iOS: objective-c script to request permission for camera galery pictures... this works fine\n\n __block BOOL isAuthorized;\n id phPhotoLibrary = (id) objc_getClass(&quot;PHPhotoLibrary&quot;);\n SEL mediaPermission = sel_registerName(&quot;requestAuthorization:&quot;);\n typedef void (^CompletionHandler)(int);\n CompletionHandler completionHandler = ^(int status) {\n switch (status) {\n case 3: // PHAuthorizationStatusAuthorized\n qDebug() &lt;&lt; &quot;Permission for photo library access granted.&quot;;\n isAuthorized = YES;\n break;\n case 1: // PHAuthorizationStatusDenied\n case 2: // PHAuthorizationStatusRestricted\n qDebug() &lt;&lt; &quot;Permission for photo library access denied.&quot;;\n isAuthorized = NO;\n break;\n case 0: // PHAuthorizationStatusNotDetermined\n qDebug() &lt;&lt; &quot;Permission for photo library access not determined.&quot;;\n isAuthorized = NO;\n break;\n }\n };\n ((void (*)(id, SEL, CompletionHandler))objc_msgSend)(phPhotoLibrary, mediaPermission, completionHandler);\n return isAuthorized;\n\n #endif\n return true; // in case of Windows, where we always have proper permissions\n }\n\n\n // Photo Library - Settings\n Q_INVOKABLE void settingsMedia() {\n #if defined(Q_OS_ANDROID)\n\n // ANDROID: cpp script to open app settings and from here user needs to manualy navigate to permisison&gt;camera and switch to allow (if there is possible to go deeper and open settings inside this camera permission, i would be interested to learn)... this works fine\n\n QJniObject activity = QNativeInterface::QAndroidApplication::context();\n if (!activity.isValid()) { qCritical() &lt;&lt; &quot;Activity not valid&quot;; return; }\n\n QJniObject bundle = QJniObject::fromString(&quot;package:com.RESTOFMYBUNDLEID&quot;);\n if (!bundle.isValid()) { qCritical() &lt;&lt; &quot;Bundle not valid&quot;; return; }\n\n QJniObject uri = QJniObject::callStaticObjectMethod(&quot;android/net/Uri&quot;, &quot;parse&quot;, &quot;(Ljava/lang/String;)Landroid/net/Uri;&quot;, bundle.object&lt;jstring&gt;());\n if (!activity.isValid()) { qCritical() &lt;&lt; &quot;Uri not valid&quot;; return; }\n\n QJniObject packageName = QJniObject::fromString(&quot;android.settings.APPLICATION_DETAILS_SETTINGS&quot;);\n if (!packageName.isValid()) { qCritical() &lt;&lt; &quot;Package not valid&quot;; return; }\n\n QJniObject intent = QJniObject(&quot;android/content/Intent&quot;,&quot;(Ljava/lang/String;)V&quot;, packageName.object&lt;jstring&gt;());\n if (!intent.isValid()) { qCritical() &lt;&lt; &quot;Intent not valid&quot;; return; }\n\n intent.callObjectMethod(&quot;addCategory&quot;, &quot;(Ljava/lang/String;)Landroid/content/Intent;&quot;, QJniObject::fromString(&quot;android.intent.category.DEFAULT&quot;).object&lt;jstring&gt;());\n intent.callObjectMethod(&quot;setData&quot;, &quot;(Landroid/net/Uri;)Landroid/content/Intent;&quot;, uri.object&lt;jobject&gt;());\n QtAndroidPrivate::startActivity(intent.object&lt;jobject&gt;(), 10101);\n\n #elif defined(Q_OS_IOS)\n\n // iOS: objective-c script to open app settings and from here user needs to manualy navigate to permisison&gt;camera and switch to allow (same comment as above, if I can open directly in app settings in camera permission, i would like to know how)...\n // THIS is what does not work... seems that it does not know NSURL\n \n // NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];\n // if ([[UIApplication sharedApplication] canOpenURL:url]) {\n // [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {\n // if (success) {\n // qDebug() &lt;&lt; &quot;Opened settings&quot;;\n // }\n // }];\n // }\n\n #endif\n }\n };\n\n #endif // PERMISSION_H\n</code></pre>\n"^^ . . . "0"^^ . . "0"^^ . "0"^^ . . . "a further complication, but a separate issue was that even with the GC you can't block the queue the AVCaptureVideoDataOutputSampleBufferDelegate is running on for long. Solved it by using (coroutines) channel that drops the current frame if the last one has not finished processing yet."^^ . "c++"^^ . . . . "1"^^ . . . . . "0"^^ . "This is what the App produces. http://www.iridiumblue.com/pages/Radar.png"^^ . . . "0"^^ . . . "I've added http://www.iridiumblue.com/pages/C130.svg The SVG file looks readable and probably much easier extract a CGPath from than the PDF."^^ . "1"^^ . . . "2"^^ . . . "qt"^^ . . . . . . . . . . . "0"^^ . . . . "How to use EditorConfig with Xcode?"^^ . . . . . . . "<p>Turns out that YouTube blocks the navigation interaction when the user taps the title. Therefore the WebKit navigation delegate receives no calls.</p>\n<p><strong>But this is ONLY the case with the title.</strong></p>\n<p>Tapping at other places will still take you to YouTube app.</p>\n<p>In other words:</p>\n<p><strong>YouTube is purposefully blocking the taps on the title and saying we are the one's violating their terms and conditions.</strong></p>\n<p>Therefore you need to write a hack using the <code>WKUIDelegate</code></p>\n<pre><code>- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures {\n if (navigationAction.request.URL) {\n [[UIApplication sharedApplication] openURL:navigationAction.request.URL options:@{} completionHandler:nil];\n }\n return nil;\n}\n</code></pre>\n<p>and also inject JavaScript:</p>\n<pre><code>- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {\n NSString *js = @&quot;document.querySelector('.ytp-title-link').onclick = function() { &quot;\n &quot; window.webkit.messageHandlers.openInSafari.postMessage(this.href); &quot;\n &quot; return false; &quot;\n &quot;};&quot;;\n [webView evaluateJavaScript:js completionHandler:nil];\n}\n</code></pre>\n<p>and add a script handler:</p>\n<pre><code>[webView.configuration.userContentController addScriptMessageHandler:self name:@&quot;openInSafari&quot;];\n\n- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {\n if ([message.name isEqualToString:@&quot;openInSafari&quot;]) {\n NSString *urlString = (NSString *)message.body;\n NSURL *url = [NSURL URLWithString:urlString];\n if (url) {\n [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];\n }\n }\n}\n</code></pre>\n"^^ . . . "1"^^ . . . . "1"^^ . . . "0"^^ . . "0"^^ . . . . "This is the error: Error Domain=NSCocoaErrorDomain Code=260 "The file “cv-template.pdf” couldn’t be opened because there is no such file.""^^ . . . "react-native-code-push"^^ . . "0"^^ . "0"^^ . "0"^^ . . . . . . . . . . "`makeFirstResponder:` might return `NO`."^^ . . . "0"^^ . . . "0"^^ . . . . "1"^^ . . . . "0"^^ . "1"^^ . . . . "asynchronous"^^ . . . . "Also have a look at the secure enclave very nice stuff https://developer.apple.com/documentation/cryptokit/secureenclave"^^ . . . "0"^^ . . . "PocketSVG looks like it would do the job if I can't get the PDFs to work. https://github.com/pocketsvg/PocketSVG"^^ . . . . "0"^^ . "javascript"^^ . . . . . . . . . . "Don't need check `co.c1` for `nil` to assign `nil` to it. And you don't need to reset it is you nullify `co`"^^ . . . . . . "You animate the constraints, not the frame"^^ . "6"^^ . . . "0"^^ . . . . . . . . . . . "1"^^ . . . "Source of applicationDidBecomeActive: user vs. bug?"^^ . . . "1"^^ . . . . "cgcontextdrawpdfpage"^^ . "clevertap"^^ . "@MartinR Thank you for finding that for me. Yes, it contains a function, based on the deprecated `GetIconRefFromFileInfo`, that does what I need. If you'd please turn this into an answer, so that I can mark it as resolved."^^ . "0"^^ . . . . "I don't have iOS but is there a way to set a recording frame rate?"^^ . "Thanks @VC.One **(1)** `processSampleBuffer:withType:` is a method of `RPBroadcastSampleHandler`, called by ReplayKit after capturing audio or video.\n**(2)** To access `CVPixelBuffer` data on the CPU, you must lock it first.\n**(3)** ReplayKit passes in a new frame each time `processSampleBuffer` is called, so a new data object must be created each time.\n**(4)** This is just test code to verify that `CVPixelBuffer` changes before and after copying. I initially wanted to rotate the frame, but incorrect images appeared. Testing showed that errors occurred even with just copying."^^ . . . "NA = New Architecture"^^ . "2"^^ . . . "0"^^ . . "0"^^ . . . . . . . . . "0"^^ . "<p>Use KQueue or FSEvents to Monitor /proc Directory</p>\n<pre><code>import Foundation\n\n// Setup KQueue to monitor the `/proc` directory for new process creation\nlet procPath = &quot;/proc&quot;\nlet kqueue = kqueue()\nvar event = kevent(ident: UInt(procPath.hashValue), filter: EVFILT_VNODE, flags: EV_ADD | EV_ENABLE, fflags: NOTE_WRITE, data: 0, udata: nil)\n\nlet fd = open(procPath, O_RDONLY)\nkevent(kqueue, &amp;event, 1, nil, 0, nil)\n\nDispatchQueue.global().async {\n var eventList = [kevent()]\n \n while true {\n let eventCount = kevent(kqueue, nil, 0, &amp;eventList, 1, nil)\n if eventCount &gt; 0 {\n print(&quot;New process or daemon launched!&quot;)\n }\n }\n}\n</code></pre>\n<p>also for Audit System</p>\n<p>modify /etc/security/audit_control to log exec events. Add the following line to the flags in audit_control:</p>\n<pre><code>flags:lo,aa,ex\n</code></pre>\n<p>restart the audit daemon:</p>\n<pre><code>sudo audit -s\n</code></pre>\n<p>Tail the audit logs in your Swift program to track new processes and daemons.</p>\n<pre><code>import Foundation\n\nlet task = Process()\ntask.launchPath = &quot;/usr/bin/tail&quot;\ntask.arguments = [&quot;-f&quot;, &quot;/var/audit/current&quot;]\n\nlet pipe = Pipe()\ntask.standardOutput = pipe\ntask.launch()\n\nlet fileHandle = pipe.fileHandleForReading\nfileHandle.readabilityHandler = { handle in\n let data = handle.availableData\n if let output = String(data: data, encoding: .utf8) {\n print(&quot;New process or daemon detected: \\(output)&quot;)\n }\n}\n</code></pre>\n<p>You can continue using DispatchSource, but to also capture child processes, you’ll need to monitor process forks and track their parent-child relationships using pid information.</p>\n<pre><code>let pid: pid_t = 1 // Replace with process ID to track (e.g., `launchd`)\nlet queue = DispatchQueue.global()\n\nlet source = DispatchSource.makeProcessSource(identifier: pid, eventMask: [.fork, .exec], queue: queue)\n\nsource.setEventHandler {\n print(&quot;Process forked or executed&quot;)\n}\n\nsource.setCancelHandler {\n print(&quot;Source cancelled&quot;)\n}\n\nsource.resume()\n</code></pre>\n"^^ . . "0"^^ . "Export public key by private key with `SecKeyCopyPublicKey` on macOS failed?"^^ . . "core-motion"^^ . . . "1"^^ . . "0"^^ . . "0"^^ . . "<p>I have the following method signature in Obj-C:</p>\n<p><code>- (void)handleOpenUrl:(NSURL * _Nullable)url options:(NSDictionary * _Nullable)options</code></p>\n<p>And to my mind, the Swift version should be:</p>\n<p><code>func handleOpenUrl(_ url: URL?, options: [AnyHashable: Any]?)</code></p>\n<p>Im trying to mock a library by using an extension to make conform to a protocol containing the above signature. But my Swift version doesnt work. Can anyone help me as to why? Most common error is:</p>\n<p><code>Unavailable instance method 'handleOpenUrl(_:options:)' was used to satisfy a requirement of protocol 'xxxLibProtocol'</code></p>\n"^^ . . . . . . "0"^^ . "I was able to fix the problem by inserting @autoreleasepool at a strategic point within the main loop. In my actual code, that one loop is really three loops, so I found a spot that was a good balance of performance and managing the memory."^^ . . . "0"^^ . "ios18"^^ . "Caret is hiding behind UITextField border"^^ . . "0"^^ . . . . "-1"^^ . "0"^^ . . "0"^^ . . . . . "metal"^^ . . . . . "0"^^ . "<p>The documentation around Cocoa is lacking when it comes to Native fullscreen support. I'm trying to find out if Cocoa supports toggling a window into fullscreen while simultaneously opening a modal dialog.</p>\n<p>This seems to trigger the application to leave fullscreen instantly as if it's some kind of safety mechanism (or bug). Does anybody if this is the case?</p>\n<p>Below follows the sample application that creates this behavior, but I've seen similar behavior in real world applications, which led me to write this sample application to ask if anybody has any clues.</p>\n<p>The sample application has a button (two buttons really, but 1 is only interesting), that toggles the fullscreen and simultaneously opens a modal save-as dialog. This creates this described behavior.</p>\n<pre class="lang-objectivec prettyprint-override"><code>\n\n#import &quot;AppDelegate.h&quot;\n\n@interface AppDelegate ()\n\n@property (strong) NSWindow *window;\n@property (strong) NSButton *fullscreenButton;\n@property (strong) NSButton *saveOnlyButton;\n\n@end\n\n@implementation AppDelegate\n\n- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {\n // Create the window\n NSRect frame = NSMakeRect(0, 0, 600, 400);\n self.window = [[NSWindow alloc] initWithContentRect:frame\n styleMask:(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable)\n backing:NSBackingStoreBuffered\n defer:NO];\n [self.window setTitle:@&quot;Fullscreen &amp; Save Panel&quot;];\n [self.window makeKeyAndOrderFront:nil];\n \n // Create the fullscreen and save button\n self.fullscreenButton = [[NSButton alloc] initWithFrame:NSMakeRect(200, 180, 200, 50)];\n [self.fullscreenButton setTitle:@&quot;Go Fullscreen &amp; Save&quot;];\n [self.fullscreenButton setTarget:self];\n [self.fullscreenButton setAction:@selector(fullscreenButtonClicked:)];\n [[self.window contentView] addSubview:self.fullscreenButton];\n \n // Create the save only button\n self.saveOnlyButton = [[NSButton alloc] initWithFrame:NSMakeRect(200, 100, 200, 50)];\n [self.saveOnlyButton setTitle:@&quot;Open Save Panel&quot;];\n [self.saveOnlyButton setTarget:self];\n [self.saveOnlyButton setAction:@selector(saveOnlyButtonClicked:)];\n [[self.window contentView] addSubview:self.saveOnlyButton];\n \n [self.window center];\n}\n\n- (void)applicationWillTerminate:(NSNotification *)aNotification {\n // Insert code here to tear down your application\n}\n\n- (void)fullscreenButtonClicked:(id)sender {\n // Go fullscreen\n [self.window toggleFullScreen:nil];\n \n // Open &quot;Save As&quot; panel (modal)\n [self openSavePanel];\n}\n\n- (void)saveOnlyButtonClicked:(id)sender {\n // Open &quot;Save As&quot; panel (modal)\n [self openSavePanel];\n}\n\n- (void)openSavePanel {\n // Open &quot;Save As&quot; panel in modal mode\n NSSavePanel *savePanel = [NSSavePanel savePanel];\n [savePanel setTitle:@&quot;Save As&quot;];\n [savePanel setMessage:@&quot;Choose a location to save the file.&quot;];\n [savePanel setAllowedFileTypes:@[@&quot;txt&quot;, @&quot;pdf&quot;]];\n \n // Make the save panel modal\n NSInteger result = [savePanel runModal]; // This will make the panel modal\n \n if (result == NSModalResponseOK) {\n NSURL *selectedFileURL = [savePanel URL];\n // Handle the file URL here if necessary\n NSLog(@&quot;File will be saved at: %@&quot;, selectedFileURL.path);\n }\n}\n\n@end\n</code></pre>\n"^^ . . . "nstableview"^^ . . . "appkit"^^ . "0"^^ . . . . . "0"^^ . "Apparently the transition to full screen fails if you run a modal save panel at the same time. Why do you want to do this?"^^ . . . . . . "1"^^ . . . "0"^^ . . . . . "0"^^ . . "0"^^ . "uitabbarcontroller"^^ . . . . . . . . . "aac"^^ . . . "0"^^ . . . "<p>MaxPacketSize and the size of the cache before you agree, can from the above, do not use the</p>\n<pre><code>status = AudioConverterGetProperty (_encodeConvertRef,\nkAudioConverterPropertyMaximumOutputPacketSize,\n&amp;size,\n&amp;maxPacketSize); \n</code></pre>\n<p>The computed maxPacketSize</p>\n"^^ . "What are the versions in Podfile.lock?"^^ . "<p>There are different microphones that can be connected via a 3.5-inch jack or via USB or via Bluetooth, the behavior is the same.</p>\n<p>There is a code that gets access to the microphone (connected to the 3.5-inch audio jack) and starts an audio capture session. At the same time, the microphone use icon starts to be displayed. The capture of the audio device (microphone) continues for a few seconds, then the session stops, the microphone use icon disappears, then there is a pause of a few seconds, and then a second attempt is made to access the same microphone and start an audio capture session. At the same time, the microphone use icon is displayed again. After a few seconds, access to the microphone stops and the audio capture session stops, after which the microphone access icon disappears.</p>\n<p>Next, we will try to perform the same actions, but after the first stop of access to the microphone, we will try to pull the microphone plug out of the connector and insert it back before trying to start the second session. In this case, the second attempt to access begins, the running part of the program does not return errors, but the microphone access icon is not displayed, and this is the problem. After the program is completed and restarted, this icon is displayed again.</p>\n<p>This problem is only the tip of the iceberg, since it manifests itself in the fact that it is not possible to record sound from the audio microphone after reconnecting the microphone until the program is restarted.</p>\n<p>Is this normal behavior of the AVFoundation framework? Is it possible to somehow make it so that after reconnecting the microphone, access to it occurs correctly and the usage indicator is displayed? What additional actions should the programmer perform in this case? Is there a description of this behavior somewhere in the documentation?</p>\n<p>Below is the code to demonstrate the described behavior.</p>\n<p>I am also attaching an example of the microphone usage indicator icon.</p>\n<p>Computer description: MacBook Pro 13-inch 2020 Intel Core i7 macOS Sequoia 15.1.</p>\n<pre><code>#include &lt;chrono&gt;\n#include &lt;condition_variable&gt;\n#include &lt;iostream&gt;\n#include &lt;mutex&gt;\n#include &lt;thread&gt;\n\n#include &lt;AVFoundation/AVFoundation.h&gt;\n#include &lt;Foundation/NSString.h&gt;\n#include &lt;Foundation/NSURL.h&gt;\n\nAVCaptureSession* m_captureSession = nullptr;\nAVCaptureDeviceInput* m_audioInput = nullptr;\nAVCaptureAudioDataOutput* m_audioOutput = nullptr;\n\nstd::condition_variable conditionVariable;\nstd::mutex mutex;\nbool responseToAccessRequestReceived = false;\n\nvoid receiveResponse()\n{\n std::lock_guard&lt;std::mutex&gt; lock(mutex);\n responseToAccessRequestReceived = true;\n conditionVariable.notify_one();\n}\n\nvoid waitForResponse()\n{\n std::unique_lock&lt;std::mutex&gt; lock(mutex);\n conditionVariable.wait(lock, [] { return responseToAccessRequestReceived; });\n}\n\nvoid requestPermissions()\n{\n responseToAccessRequestReceived = false;\n [AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio completionHandler:^(BOOL granted)\n {\n const auto status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio];\n std::cout &lt;&lt; &quot;Request completion handler granted: &quot; &lt;&lt; (int)granted &lt;&lt; &quot;, status: &quot; &lt;&lt; status &lt;&lt; std::endl;\n receiveResponse();\n }];\n\n waitForResponse();\n}\n\nvoid timer(int timeSec)\n{\n for (auto timeRemaining = timeSec; timeRemaining &gt; 0; --timeRemaining)\n {\n std::cout &lt;&lt; &quot;Timer, remaining time: &quot; &lt;&lt; timeRemaining &lt;&lt; &quot;s&quot; &lt;&lt; std::endl;\n std::this_thread::sleep_for(std::chrono::seconds(1));\n }\n}\n\nbool updateAudioInput()\n{\n [m_captureSession beginConfiguration];\n\n if (m_audioOutput)\n {\n AVCaptureConnection *lastConnection = [m_audioOutput connectionWithMediaType:AVMediaTypeAudio];\n [m_captureSession removeConnection:lastConnection];\n }\n\n if (m_audioInput)\n {\n [m_captureSession removeInput:m_audioInput];\n [m_audioInput release];\n m_audioInput = nullptr;\n }\n\n AVCaptureDevice* audioInputDevice = [AVCaptureDevice deviceWithUniqueID: [NSString stringWithUTF8String: &quot;BuiltInHeadphoneInputDevice&quot;]];\n\n if (!audioInputDevice)\n {\n std::cout &lt;&lt; &quot;Error input audio device creating&quot; &lt;&lt; std::endl;\n return false;\n }\n\n // m_audioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioInputDevice error:nil];\n // NSError *error = nil;\n NSError *error = [[NSError alloc] init];\n m_audioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioInputDevice error:&amp;error];\n if (error)\n {\n const auto code = [error code];\n const auto domain = [error domain];\n const char* domainC = domain ? [domain UTF8String] : nullptr;\n std::cout &lt;&lt; code &lt;&lt; &quot; &quot; &lt;&lt; domainC &lt;&lt; std::endl;\n }\n\n\n if (m_audioInput &amp;&amp; [m_captureSession canAddInput:m_audioInput]) {\n [m_audioInput retain];\n [m_captureSession addInput:m_audioInput];\n }\n else\n {\n std::cout &lt;&lt; &quot;Failed to create audio device input&quot; &lt;&lt; std::endl;\n return false;\n }\n\n if (!m_audioOutput)\n {\n m_audioOutput = [[AVCaptureAudioDataOutput alloc] init];\n if (m_audioOutput &amp;&amp; [m_captureSession canAddOutput:m_audioOutput])\n {\n [m_captureSession addOutput:m_audioOutput];\n }\n else\n {\n std::cout &lt;&lt; &quot;Failed to add audio output&quot; &lt;&lt; std::endl;\n return false;\n }\n }\n\n [m_captureSession commitConfiguration];\n\n return true;\n}\n\nvoid start()\n{\n std::cout &lt;&lt; &quot;Starting...&quot; &lt;&lt; std::endl;\n\n const bool updatingResult = updateAudioInput();\n if (!updatingResult)\n {\n std::cout &lt;&lt; &quot;Error, while updating audio input&quot; &lt;&lt; std::endl;\n return;\n }\n\n [m_captureSession startRunning];\n}\n\nvoid stop()\n{\n std::cout &lt;&lt; &quot;Stopping...&quot; &lt;&lt; std::endl;\n [m_captureSession stopRunning];\n}\n\nint main()\n{\n requestPermissions();\n\n m_captureSession = [[AVCaptureSession alloc] init];\n\n start();\n timer(5);\n stop();\n\n timer(10);\n\n start();\n timer(5);\n stop();\n}\n</code></pre>\n<p><a href="https://i.sstatic.net/TMIzTGKJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TMIzTGKJ.png" alt="enter image description here" /></a></p>\n<p>Is this normal behavior of the AVFoundation framework? Is it possible to somehow make it so that after reconnecting the microphone, access to it occurs correctly and the usage indicator is displayed? What additional actions should the programmer perform in this case? Is there a description of this behavior somewhere in the documentation?</p>\n"^^ . . "0"^^ . . . . . . "nsarray"^^ . "1"^^ . "<p>On my macOS app I would like to know whether the user has defined a password in the KeyChain for a given encrypted Disk Image. I do not want to know the password itself. I just need to know whether the password is in the KeyChain or not.</p>\n<p>I can clearly see the password is on the KeyChain.app, as</p>\n<ul>\n<li>name: &quot;MyDisk.dmg&quot;</li>\n<li>kind: &quot;disk image password&quot;</li>\n<li>Account: D0899FA8-C……</li>\n<li>Access Group: com.apple.DisklmagesKeychainGroup</li>\n</ul>\n<p>So, from my macOS app I unsuccessfully tried to get that item using <code>SecItemCopyMatching</code> with any kind of <code>kSecClass</code>: <code>kSecClassInternetPassword, kSecClassGenericPassword, kSecClassCertificate, kSecClassKey, kSecClassIdentity</code>.</p>\n<pre><code>NSDictionary *query = @{\n (__bridge NSString*)kSecClass : (__bridge NSString*)kSecClassGenericPassword,\n (__bridge NSString*)kSecReturnAttributes: (id)kCFBooleanTrue,\n (__bridge NSString*)kSecMatchLimit : (NSString*)kSecMatchLimitAll\n };\n\nNSArray *items = nil;\n OSStatus status = SecItemCopyMatching((CFDictionaryRef)query, (CFTypeRef*)&amp;items);\n</code></pre>\n<p>I get any kind of item but no one reports MyDisk.dmg or any other data that can drive me to the MyDisk.dmg volume.</p>\n<p>Even if it should return just the NSURL credentials, I also unsuccessfully tried</p>\n<pre><code>NSDictionary *credentials = [[NSURLCredentialStorage sharedCredentialStorage] allCredentials];\n</code></pre>\n<p>And I event tried, unsuccessfully</p>\n<pre><code>security dump-keychain -d login.keychain\n</code></pre>\n<p>How can I know that there is a keychain item for a given Disk Image Password, a Local Disk Password and a Remote Disk Password?</p>\n<p>I run macOS 15.1 and XCode 16.1.</p>\n"^^ . . . . . . . . . . . . . . "subscription"^^ . . . . . . . . . . . "Because mutable array and KVO can lead to odd and hard to debug issues, I tend to make the observed one an `NSArray`. Reduces surprises."^^ . . "Well if you are nitpicking using `sender` and assuming it is a `NSView` subclass isn't exactly 1000% fault proof either. But it will do when the action methods is called from a button. `id` could be replaced with a static type (`NSView *` or `NSButton *`) which would also make `sender.window` work again. But this all doesn't matter since the runtime system makes that connection and doesn't care. For all practical purposes though this solution will do the job."^^ . . . "Info: I assume, your user's password is stored in the KeyChain. The encrypted string thus has no more security than the access to the key chain. You might also directly store your string into the key chain instead of CoreData. You also might consider to add an additional layer of security on top of the KeyChain by requiring [Local Authentication](https://developer.apple.com/documentation/localauthentication): when the app needs access to the secure item it will then authenticate the user via TouchID, FaceID or Passcode. The resulting LAContext which grants access can be reused or invalidated."^^ . "cmmotionmanager"^^ . . . . . "1"^^ . "2"^^ . . . . . . . . "0"^^ . . . "2"^^ . "youtube"^^ . "1"^^ . . "<p>I have defined a method appendString method in a NSMuatableAttributedString category like this:</p>\n<pre><code>@implementation NSMutableAttributedString (HTML)\n\n\n// appends a plain string extending the attributes at this position\n- (void)appendString:(NSString *)string\n{\n NSParameterAssert(string);\n \n NSUInteger length = [self length];\n...\n</code></pre>\n<p>And this method is worked well in iOS17 and before .</p>\n<p>But when it cames iOS18 . this appendString will not be called.</p>\n<p>So I doubt maybe there is a system-defined appendString already.</p>\n<p>So I write a demo in empty project to print all the NSMuatableAttributedString method in iOS18 like these:</p>\n<pre><code>@interface ViewController ()\n\n@end\n\n@implementation ViewController\n\nvoid printNSStringCategories() {\n unsigned int count;\n Class nsStringClass = [NSMutableAttributedString class];\n\n \n // 获取所有的方法\n Method *methods = class_copyMethodList(nsStringClass, &amp;count);\n \n for (unsigned int i = 0; i &lt; count; i++) {\n SEL selector = method_getName(methods[i]);\n NSString *methodName = NSStringFromSelector(selector);\n NSLog(@&quot;NSMutableAttributedString method: %@&quot;, methodName);\n }\n \n free(methods);\n}\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n // Do any additional setup after loading the view.\n printNSStringCategories();\n}\n</code></pre>\n<p>And test it in my iPhone (iOS18.2) , the log will printed</p>\n<pre><code>NSMutableAttributedString method: appendString:withAttributes:\nNSMutableAttributedString method: cr_appendStorage:fromRange:\nNSMutableAttributedString method: cr_appendString:\nNSMutableAttributedString method: appendString:withAttributes:\nNSMutableAttributedString method: appendString:\n</code></pre>\n<p>So it seems a <code>appendString:</code> is aleady defined in system SDK .</p>\n<p>But the weird thing is when I run this code in the Xcode simulator (iOS18.1)\nthis <code>appendString:</code> will not print .</p>\n<p><strong>1 Is it a bug of SDK ? because the <code>appendString:</code> only exist in device-build , and not exist in simulator-build?</strong></p>\n<p>two more furthur question:</p>\n<p>2.1 if the SDK contains <code>appendString:</code> already , why the <code>appendString:</code> defined in my category not cause the duplicate symbol error when compile</p>\n<p>2.2 As the question 2.1 said , there maybe same symbols in runtime . Is there any way to find the framework/library which defined those same-name symbols ? (e.g: there are two <code>appendString:withAttributes:</code> in the log , I want to find the two places define each <code>appendString:withAttributes:</code> exactly)</p>\n"^^ . . . . . . "<p>With the release of Xcode 16 apple added <a href="https://developer.apple.com/documentation/xcode-release-notes/xcode-16-release-notes#New-Features-in-Xcode-16-Beta" rel="nofollow noreferrer">support</a> for EditorConfig:</p>\n<blockquote>\n<p>Added support for EditorConfig. The editor now respects indentation\nsettings given in .editorconfig files. Xcode supports the following\nsettings: <strong>indent_style</strong>, <strong>tab_width</strong>, <strong>indent_size</strong>, <strong>end_of_line</strong>,\n<strong>insert_final_newline</strong>, <strong>max_line_length</strong>, and <strong>trim_trailing_whitespace</strong>.\nSee <a href="https://editorconfig.org" rel="nofollow noreferrer">https://editorconfig.org</a> for more information. Settings from\n<strong>.editorconfig</strong> files normally take precedence over settings given in\nthe <strong>“Text Editing”</strong> section of <strong>View &gt; Inspectors &gt; File</strong> for a file or\ngroup. This can be disabled by unchecking the <strong>“Prefer Settings from\nEditorConfig”</strong> checkbox on the Indentation tab of <strong>Xcode &gt; Settings &gt;\nText Editing</strong>. (20796230)</p>\n</blockquote>\n<p>In my project I create a new <strong>.editorconfig</strong> file under root directory:</p>\n<pre><code># EditorConfig is awesome: https://EditorConfig.org\n\n# top-most EditorConfig file\nroot = true\n\n[*]\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = false\ninsert_final_newline = false\n\n[*.swift]\nindent_style = space\nindent_size = 4\n\n[*.{h, m, mm}]\nindent_style = space\nindent_size = 4\n\n[*.metal]\nindent_style = space\nindent_size = 4\n</code></pre>\n<p>However, when I try to re-indent, it's not working</p>\n"^^ . "I ended up doing it like [this](https://pastebin.com/dSLRWKv0)"^^ . "0"^^ . "0"^^ . . . . "0"^^ . "Not sure what NA stands for ... I'll update my question with some key parts of my logic"^^ . "Convert this obj-c method signature to swift"^^ . "0"^^ . . "0"^^ . "0"^^ . "<p>A few notes...</p>\n<p>First, as I mentioned in my comments, shapes / paths in PDF files can be finicky.</p>\n<p>Using the original PDF you linked to - <a href="http://www.iridiumblue.com/pages/AW109.pdf" rel="nofollow noreferrer">http://www.iridiumblue.com/pages/AW109.pdf</a> :</p>\n<p><a href="https://i.sstatic.net/oeKDp8A4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/oeKDp8A4.png" alt="AW109" /></a></p>\n<p>And, using a PDF of an AC130 (can't remember where I got it):</p>\n<p><a href="https://i.sstatic.net/bcydG6Ur.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bcydG6Ur.png" alt="AC130" /></a></p>\n<p>You <em><strong>can</strong></em> edit the paths in the PDF file to fix problems... but, as you can see, fixing that AC130 might be a fair amount of work.</p>\n<p>If it were me, I would generate my own <code>CGMutablePath</code> -- most PDF / vector editors can export the paths in various formats - such as SVG which can be converted fairly easily to <code>CGPathMoveToPoint(...)</code> / <code>CGPathAddLineToPoint(...)</code> / <code>CGPathAddCurveToPoint(...)</code> / etc.</p>\n<p>If you're set on using PDF files and extracting the paths, here is some <strong>Example</strong> code...</p>\n<hr />\n<p><strong>Extractor.h</strong></p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n#import &lt;PDFKit/PDFKit.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface Extractor : NSObject\n+ (NSArray&lt;id&gt; *)extractVectorPathsFromPDF:(NSURL *)pdfURL;\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<hr />\n<p><strong>Extractor.m</strong></p>\n<pre><code>#import &quot;Extractor.h&quot;\n\n@implementation Extractor\n\nvoid ExtractPathsFromContent(CGPDFScannerRef scanner, void *info);\n\nvoid moveToCallback(CGPDFScannerRef scanner, void *info);\nvoid lineToCallback(CGPDFScannerRef scanner, void *info);\nvoid curveToCallback(CGPDFScannerRef scanner, void *info);\nvoid closePathCallback(CGPDFScannerRef scanner, void *info);\n\nCGMutablePathRef currentPath = NULL;\n\n+ (NSArray&lt;id&gt; *)extractVectorPathsFromPDF:(NSURL *)pdfURL {\n PDFDocument *pdfDocument = [[PDFDocument alloc] initWithURL:pdfURL];\n if (!pdfDocument) {\n NSLog(@&quot;Unable to load PDF document.&quot;);\n return nil;\n }\n \n NSMutableArray&lt;id&gt; *vectorPaths = [NSMutableArray array];\n \n // Iterate through all pages in the PDF document\n for (NSInteger pageIndex = 0; pageIndex &lt; pdfDocument.pageCount; pageIndex++) {\n PDFPage *pdfPage = [pdfDocument pageAtIndex:pageIndex];\n if (!pdfPage) continue;\n \n CGPDFPageRef cgPage = pdfPage.pageRef;\n if (!cgPage) continue;\n \n // Set up the scanner to process PDF content streams\n CGPDFContentStreamRef contentStream = CGPDFContentStreamCreateWithPage(cgPage);\n CGPDFOperatorTableRef operatorTable = CGPDFOperatorTableCreate();\n \n // Register custom callbacks for common operators for path extraction\n CGPDFOperatorTableSetCallback(operatorTable, &quot;m&quot;, &amp;moveToCallback); // move to\n CGPDFOperatorTableSetCallback(operatorTable, &quot;l&quot;, &amp;lineToCallback); // line to\n CGPDFOperatorTableSetCallback(operatorTable, &quot;c&quot;, &amp;curveToCallback); // curve to\n CGPDFOperatorTableSetCallback(operatorTable, &quot;h&quot;, &amp;closePathCallback); // close path\n \n CGPDFScannerRef scanner = CGPDFScannerCreate(contentStream, operatorTable, (__bridge void *)(vectorPaths));\n \n // Initialize a new path for the page\n currentPath = CGPathCreateMutable();\n \n // Scan the PDF content\n CGPDFScannerScan(scanner);\n \n // After scanning, add the current path to the paths array\n if (currentPath) {\n [vectorPaths addObject:(__bridge_transfer id)currentPath];\n currentPath = NULL;\n }\n \n // Clean up\n CGPDFScannerRelease(scanner);\n CGPDFContentStreamRelease(contentStream);\n CGPDFOperatorTableRelease(operatorTable);\n }\n \n return [vectorPaths copy];\n}\n\n// Callback for &quot;move to&quot; operator\nvoid moveToCallback(CGPDFScannerRef scanner, void *info) {\n CGPDFReal x, y;\n if (CGPDFScannerPopNumber(scanner, &amp;y) &amp;&amp; CGPDFScannerPopNumber(scanner, &amp;x)) {\n CGPathMoveToPoint(currentPath, NULL, x, y);\n }\n}\n\n// Callback for &quot;line to&quot; operator\nvoid lineToCallback(CGPDFScannerRef scanner, void *info) {\n CGPDFReal x, y;\n if (CGPDFScannerPopNumber(scanner, &amp;y) &amp;&amp; CGPDFScannerPopNumber(scanner, &amp;x)) {\n CGPathAddLineToPoint(currentPath, NULL, x, y);\n }\n}\n\n// Callback for &quot;curve to&quot; operator\nvoid curveToCallback(CGPDFScannerRef scanner, void *info) {\n CGPDFReal x1, y1, x2, y2, x3, y3;\n if (CGPDFScannerPopNumber(scanner, &amp;y3) &amp;&amp; CGPDFScannerPopNumber(scanner, &amp;x3) &amp;&amp;\n CGPDFScannerPopNumber(scanner, &amp;y2) &amp;&amp; CGPDFScannerPopNumber(scanner, &amp;x2) &amp;&amp;\n CGPDFScannerPopNumber(scanner, &amp;y1) &amp;&amp; CGPDFScannerPopNumber(scanner, &amp;x1)) {\n CGPathAddCurveToPoint(currentPath, NULL, x1, y1, x2, y2, x3, y3);\n }\n}\n\n// Callback for &quot;close path&quot; operator\nvoid closePathCallback(CGPDFScannerRef scanner, void *info) {\n CGPathCloseSubpath(currentPath);\n}\n\n@end\n</code></pre>\n<hr />\n<p>which can be used like this:</p>\n<pre><code>NSString *pdfName = @&quot;AW109&quot;;\nNSString *pdfPath = [[NSBundle mainBundle] pathForResource:pdfName ofType:@&quot;pdf&quot;];\nNSURL *pdfUrl = [NSURL fileURLWithPath:pdfPath isDirectory:NO];\n\n// get the paths from the PDF\n// the PDF has only one page, so we're expecting only one path\nNSArray&lt;id&gt; *vectorPaths = [Extractor extractVectorPathsFromPDF:pdfUrl];\nCGPathRef pth = (CGPathRef)CFBridgingRetain([vectorPaths firstObject]);\n\n// we now have a CGPathRef which can be drawn using CGContextDrawPath\n// or set as the .path of a CAShapeLayer\n</code></pre>\n<hr />\n<p>Another approach, which <em>might</em> be a better option -- use an <code>NSImageView</code> with the PDF file as an <code>NSImage</code>, and then scale / rotate / position that image view as a subview:</p>\n<pre><code>NSImageView *imgView = [NSImageView new];\nimgView = [NSImageView new];\nimgView.wantsLayer = YES;\nimgView.imageScaling = NSImageScaleProportionallyUpOrDown;\n\n// desired color\nimgView.contentTintColor = NSColor.redColor;\n\nNSString *pdfName = @&quot;AW109&quot;;\nNSString *pdfPath = [[NSBundle mainBundle] pathForResource:pdfName ofType:@&quot;pdf&quot;];\nNSURL *pdfUrl = [NSURL fileURLWithPath:pdfPath isDirectory:NO];\n\nNSImage *img = [[NSImage alloc] initWithContentsOfURL:pdfUrl];\nimg.template = YES;\nimgView.image = img;\n</code></pre>\n<p>After some quick testing, Cocoa appears to do a nice job of processing the PDF file, and scales its <em>paths</em> when it is rendered.</p>\n<p>For example - the original AW109.pdf, scaled to 3 sizes (image views are also each rotated 45º):</p>\n<p><a href="https://i.sstatic.net/IXNSqeWk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/IXNSqeWk.png" alt="Image Views" /></a></p>\n<hr />\n<p>All the above images are placed on top of a &quot;checker board pattern&quot; so we can see the transparency.</p>\n"^^ . "1"^^ . "0"^^ . "0"^^ . . . . . "@eggor Is the revised solution in the answer not working for you?"^^ . "Thanks @DonMag. The issue I think was that I had Deploy to 10.10 set when I added PDFKit. I removed it changed to macOS 12 then re-added and it worked. I do get some of the artefacts that you have previously shown. I'm not sure why but I may have to do some work on the icons and see if I need to simplify them. The C130.pdf has the engines as separate objects which may not help. I'll look at the NSImageView as well. Thank you very much for the time you spent on this. Your PDF Extractor is brilliant, Thanks."^^ . . . . . . . . . "Interesting message : https://forums.developer.apple.com/forums/thread/748135 "After trying a little bit around, I think it is because OneDrive does not have its file locally, hence the error "no such file or directory". If in OneDrive I mark the file as "keep offline available", then it works." Could that be also you case? In other the words, they have the file listed, they have a refernce on it, but it's on demand through their own service to download it really."^^ . . "0"^^ . . "@KJ - yes, that AC130 is (likely) bigger and more detailed than needed. When I grabbed that, the OP had not indicated where he was getting the PDF file(s) from, nor whether he could edit them. I imagine it's also possible he would *want* to display a larger, detailed view of the icon. However, it is a good example of the difference between path extraction and loading the PDF as an `NSImage`."^^ . . . "1"^^ . "@MartinR Since my app doesn't require sandboxing I could probably use the private API. I'll have a look with Hopper inside."^^ . "0"^^ . . . . . . "1"^^ . . . . . . . "0"^^ . . "CoreData re-encrypt string property"^^ . . . . . . . "The input is the icon information that the Finder has and that it would put into the Clipboard if you Copy the file. I am writing a program that mimics the Finder's behavior, for any file."^^ . "1"^^ . "<p>The actual Swift signature generated for this ObjC function is:</p>\n<pre class="lang-swift prettyprint-override"><code>func handleOpen(_ url: URL?, options: [AnyHashable : Any]?)\n</code></pre>\n<p>If a method name has a suffix that matches the name of the first parameter, this suffix is removed from the name of the Swift method, as it would otherwise violate <a href="https://www.swift.org/documentation/api-design-guidelines/#omit-needless-words" rel="nofollow noreferrer">Swift's API Design Guidelines</a>.</p>\n<p>In the Xcode editor of an ObjC file, you can also display the &quot;Generated Interface&quot; for Swift. Just click the &quot;Related Items&quot; Button and Select &quot;Generated Interface&quot;.\nApple describes this in the Technote <a href="https://developer.apple.com/documentation/technotes/tn3108-viewing-the-interface-of-your-swift-code" rel="nofollow noreferrer">TN3108</a>.</p>\n<p>If you can change the code of the libraries, you may also change the Swift method signatures with <a href="https://developer.apple.com/documentation/swift/improving-objective-c-api-declarations-for-swift" rel="nofollow noreferrer">NS_REFINED_FOR_SWIFT</a>.</p>\n"^^ . "@Willeke can I avoid this by using an NSArrayController instead?"^^ . "Thanks @DonMag. I'll try that code at the weekend. I assumed that PDF would be better supported for drawing, scaling and colouring vector icons. I'm creating my own icons in Affinity Designer 2 (350 to date) so could easily export as SVG if I knew how to extract a CGPath from an SVG. My own C-130 is at http://www.iridiumblue.com/pages/C130.pdf (256x256)."^^ . . . . "0"^^ . . "<p>On iOS, when using ReplayKit to record the screen, overlapping video frames appear in the callback of RPBroadcastSampleHandler.</p>\n<p>I am recording video on iOS using ReplayKit and found that after copying data in the <a href="https://developer.apple.com/documentation/replaykit/rpbroadcastsamplehandler/processsamplebuffer(_:with:)?language=objc" rel="nofollow noreferrer">processSampleBuffer:withType:</a> callback using memcpy, the data changes. This occurs particularly frequently when the screen content changes rapidly, making it look like the frames are overlapping.\n<a href="https://i.sstatic.net/6Xo64BMk.jpg" rel="nofollow noreferrer">image</a></p>\n<p>I found that the values starting from byte 672 in the video data on my device often change. Here is the test demo:</p>\n<pre><code>- (void)processSampleBuffer:(CMSampleBufferRef)sampleBuffer withType:(RPSampleBufferType)sampleBufferType {\n switch (sampleBufferType) {\n case RPSampleBufferTypeVideo: {\n CVPixelBufferRef pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);\n CVPixelBufferLockBaseAddress(pixelBuffer, kCVPixelBufferLock_ReadOnly);\n \n int ret = 0;\n uint8_t *oYData = CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 0);\n size_t oYSize = CVPixelBufferGetHeightOfPlane(pixelBuffer, 0) * CVPixelBufferGetBytesPerRowOfPlane(pixelBuffer, 0);\n \n uint8_t *oUVData = CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 1);\n size_t oUVSize = CVPixelBufferGetHeightOfPlane(pixelBuffer, 1) * CVPixelBufferGetBytesPerRowOfPlane(pixelBuffer, 1);\n if (oYSize &lt;= 672) {\n return;\n }\n uint8_t tempValue = oYData[672];\n \n uint8_t *tYData = malloc(oYSize);\n memcpy(tYData, oYData, oYSize);\n if (tYData[672] != oYData[672]) {\n NSLog(@&quot;$$$$$$$$$$$$$$$$------ t:%d o:%d temp:%d&quot;, tYData[672], oYData[672], tempValue);\n }\n free(tYData);\n CVPixelBufferUnlockBaseAddress(pixelBuffer, kCVPixelBufferLock_ReadOnly);\n break;\n }\n default: {\n break;\n }\n }\n}\n</code></pre>\n<p>Output:</p>\n<pre><code>$$$$$$$$$$$$$$$$------ t:110 o:124 temp:110\n$$$$$$$$$$$$$$$$------ t:111 o:133 temp:111\n$$$$$$$$$$$$$$$$------ t:124 o:138 temp:124\n$$$$$$$$$$$$$$$$------ t:133 o:144 temp:133\n$$$$$$$$$$$$$$$$------ t:138 o:151 temp:138\n$$$$$$$$$$$$$$$$------ t:144 o:156 temp:144\n$$$$$$$$$$$$$$$$------ t:151 o:135 temp:151\n$$$$$$$$$$$$$$$$------ t:156 o:78 temp:156\n$$$$$$$$$$$$$$$$------ t:135 o:76 temp:135\n$$$$$$$$$$$$$$$$------ t:78 o:77 temp:78\n$$$$$$$$$$$$$$$$------ t:76 o:80 temp:76\n$$$$$$$$$$$$$$$$------ t:77 o:80 temp:77\n$$$$$$$$$$$$$$$$------ t:80 o:79 temp:80\n$$$$$$$$$$$$$$$$------ t:79 o:80 temp:79\n</code></pre>\n"^^ . . . "@Willeke for some reason it only works for the second if statement, but not for the first when trying to change the font size for the groupcell"^^ . . . . "1"^^ . . . . . . "<p><strong>NOTE: i am not expert in kotlin</strong></p>\n<p>on swift side we are doing it this way.</p>\n<pre><code>if fileURL.startAccessingSecurityScopedResource() {\n if let data = try? Data(contentsOf: fileURL) {\n //USE DATA HERE\n }\n fileURL.stopAccessingSecurityScopedResource()\n}\n</code></pre>\n"^^ . . "0"^^ . . . . . "0"^^ . . . "@HangarRash: I spent some time on this problem and I found no way to get the icns data out of the NSImage that iconForFile returns."^^ . . . "Availability of Metal in pre-Mojave systems"^^ . . . "0"^^ . . . "@user9398585 - you mention PocketSVG ... that library (as well as other SVG libs) typically processes an SVG file and creates a view with multiple shape layers."^^ . "1"^^ . "0"^^ . "Unable to move windows on Sonoma using private APIs in Swift"^^ . . "@GerdK Yeah, in this form works like a charm! Thank you very much!"^^ . . . . "<p>I managed to find the reason behind this issue and a solution.</p>\n<p><strong>The problem:</strong>\nin iOS cloud storage (Google Drive, OneDrive, Dropbox,..) provide placeholders not the real URI to the file and unless the file is downloaded locally you cannot get the Data of the file.\nEven it seems to you that you can access files from Google Drive, or any other cloud storage from the shared storage in iOS u can not get the data only if they are downloaded in the device.</p>\n<p><strong>The solution:</strong>\nThere are 2 solution for this problem:</p>\n<ol>\n<li><p>Use each Cloud service/API separately to manage access remote files. that way you need to implement each API separately.</p>\n</li>\n<li><p>Display a preview of the file using <code>documentInteractionController</code> and it will take care of loading the file, and then you got access to data.</p>\n</li>\n</ol>\n<p>I personally found the second solution more efficient, because in my case i just need the data of the selected file and displaying the file to the user is not problem for me so i am not limited to implement the logic only in the background.</p>\n<p>here is my solution:</p>\n<pre><code>lateinit var documentInteractionDelegate: DocumentInteractionControllerDelegate\nval documentInteractionController = UIDocumentInteractionController()\n\nval documentPickerController = UIDocumentPickerViewController(\n forOpeningContentTypes = listOf(UTTypePDF)\n)\n\ndocumentPickerController.allowsMultipleSelection = false\n\nval documentPickerDelegate = remember {\n object : NSObject(), UIDocumentPickerDelegateProtocol {\n override fun documentPicker(\n controller: UIDocumentPickerViewController,\n didPickDocumentAtURL: NSURL\n ) {\n val accessing = didPickDocumentAtURL.startAccessingSecurityScopedResource()\n if (accessing) {\n documentInteractionController.URL = didPickDocumentAtURL\n documentInteractionDelegate =\n DocumentInteractionControllerDelegate(\n fileUrl = documentInteractionController.URL,\n handelDocInfoCallback = handelDocInfo\n )\n documentInteractionController.delegate = documentInteractionDelegate\n presentDocumentInteractionController(documentInteractionController)\n\n didPickDocumentAtURL.stopAccessingSecurityScopedResource()\n }\n controller.dismissViewControllerAnimated(true, null)\n }\n\n override fun documentPickerWasCancelled(controller: UIDocumentPickerViewController) {\n println(&quot;$TAG Document picker was cancelled.&quot;)\n }\n }\n}\n</code></pre>\n<p>and this the <code>DocumentInteractionControllerDelegate</code> class:</p>\n<pre><code>@OptIn(ExperimentalForeignApi::class)\nclass DocumentInteractionControllerDelegate(\n private val fileUrl: NSURL?,\n val handelDocInfoCallback: (DocumentInfo) -&gt; Unit\n) : NSObject(),\n UIDocumentInteractionControllerDelegateProtocol {\n\n /**\n * Specifies the UIViewController that will host the preview.\n */\n override fun documentInteractionControllerViewControllerForPreview(controller: UIDocumentInteractionController): UIViewController {\n println(&quot;Providing the view controller for document preview.&quot;)\n return UIApplication.sharedApplication.keyWindow?.rootViewController ?: UIViewController()\n }\n\n /**\n * Optional: Called when the preview is about to begin\n * Called before the document preview begins.\n */\n override fun documentInteractionControllerWillBeginPreview(controller: UIDocumentInteractionController) {\n println(&quot;Document preview will begin.&quot;)\n }\n\n /**\n * Called when the document preview is done (e.g., dismissed)\n */\n @OptIn(BetaInteropApi::class)\n override fun documentInteractionControllerDidEndPreview(controller: UIDocumentInteractionController) {\n println(&quot;Document preview ended. ${fileUrl?.path}&quot;)\n // You can perform any action here after the preview has ended, like notifying the user or handling another task\n val accessible = fileUrl?.startAccessingSecurityScopedResource()\n println(&quot;Document preview ended. - accessible $accessible&quot;)\n if (accessible == true) {\n memScoped {\n val errorPtr: ObjCObjectVar&lt;NSError?&gt; = alloc&lt;ObjCObjectVar&lt;NSError?&gt;&gt;()\n val newData = fileUrl?.path?.let {\n NSData.dataWithContentsOfFile(\n it,\n NSDataReadingUncached,\n errorPtr.ptr\n )\n }\n println(&quot;$TAG errorPtr: ${errorPtr.value}&quot;)\n println(&quot;$TAG newData: ${newData?.toByteArray()?.size}&quot;)\n \n }\n fileUrl?.stopAccessingSecurityScopedResource()\n }\n\n }\n\n /**\n * Returns the UIView that acts as the anchor for the preview animation.\n */\n override fun documentInteractionControllerViewForPreview(controller: UIDocumentInteractionController): UIView? {\n println(&quot;Providing view for document preview.&quot;)\n return UIApplication.sharedApplication.keyWindow?.rootViewController?.view\n }\n}\n\nfun presentDocumentInteractionController(documentInteractionController: UIDocumentInteractionController): Boolean {\n // Present the document interaction controller\n val displayed = try {\n documentInteractionController.presentPreviewAnimated(true)\n } catch (e: Exception) {\n e.printStackTrace()\n false\n }\n return displayed\n}\n</code></pre>\n"^^ . "I should have said that our app targets 10.11 but, you're right, my question would have been clearer if I have written `else if (@available(macOS 10.11, *))`. It's especially about 10.11 to 10.13 and the necessity to switch to openGL when the GPU doesn't support Metal, not about which version of Metal. The Apple doc is unclear about that, so I can just presume that if there is no MTLDevice, it means that Metal is unavailable (?) - which would also mean that there is no other possible failure (?). I'm just looking for a confirmation of that assumption."^^ . . . . . . . "<p>I've been creating a key pair on macOS by <code>SecKeyCreateRandomKey</code>.</p>\n<p>According to Apple Document (<a href="https://developer.apple.com/documentation/security/generating-new-cryptographic-keys?language=objc" rel="nofollow noreferrer">https://developer.apple.com/documentation/security/generating-new-cryptographic-keys?language=objc</a>), I store private key in keychain and export public key by <code>SecKeyCopyPublicKey</code> everytime.</p>\n<blockquote>\n<p>You could add a kSecPublicKeyAttrs attribute to the attributes dictionary, specifying a distinct tag and keychain storage for the public key. However, it’s typically easier to store only the private key and then generate the public key from it when needed. That way you don’t need to keep track of another tag or clutter your keychain.</p>\n</blockquote>\n<p>However, I found on few macOS, the exported public key is always null, so I have to create key pair again every time. Maybe I can store both private key and public key to solve this problem, but does it have some better solution?</p>\n<p>Code to create key pair:</p>\n<pre class="lang-cpp prettyprint-override"><code>@autoreleasepool {\n const auto* application_tag =\n [@(identity.c_str()) dataUsingEncoding:NSUTF8StringEncoding];\n\n NSMutableDictionary* attributes = [@{\n (id)kSecAttrKeyType : (__bridge id)kSecAttrKeyTypeECSECPrimeRandom,\n (id)kSecAttrKeySizeInBits : @256,\n (id)kSecAttrAccessible : (__bridge id)kSecAttrAccessibleAfterFirstUnlock,\n (id)kSecPrivateKeyAttrs : @{\n (id)kSecAttrIsPermanent : @YES,\n (id)kSecAttrApplicationTag : application_tag,\n (id)kSecAttrAccessGroup : @(GetAccessGroup().c_str()),\n },\n } mutableCopy];\n\n CFErrorRef err = nullptr;\n SecKeyRef key =\n SecKeyCreateRandomKey((__bridge CFDictionaryRef)attributes, &amp;err);\n if (err || !key) {\n if (error) {\n // handling error...\n }\n return false;\n }\n return true;\n}\n</code></pre>\n<p>and simply use <code>SecKeyCopyPublicKey</code> to export public key</p>\n<pre><code>SecKeyRef pub_key = SecKeyCopyPublicKey(pvt_key_); // it is null ?\n</code></pre>\n"^^ . . . . "0"^^ . "How to animate an UIView by setting its frame that has auto layout constraints?"^^ . . . . . . . . . . . "0"^^ . . "flicker"^^ . . . . . . . . . . . . "@KJ - and, to be clear, I'm trying to offer the OP some help. This is not my task, and I don't know what constraints the OP has, nor do I know his full intents."^^ . "keychain"^^ . . . . "0"^^ . . "objective-c"^^ . "@user9398585 - This is what I get with your `C130.PDF`: https://i.sstatic.net/itF7XF6j.png ... Now, it's very possible (likely) that my PDF path extractor is only suitable for simple paths and could be vastly improved. I still think using image views as subviews will be the most reliable and straightforward approach. If subviews won't work, I can also give you sample code to generate scaled + rotated + solid-color images which could be used as `CALayer contents`."^^ . . "Is PDFDocument available in macOS 12 Monterey? The documentation seems to suggest it does but I get:\n \n Undefined symbols for architecture x86_64:\n "_OBJC_CLASS_$_PDFDocument", referenced from:\n objc-class-ref in PDFExtractor.o\nld: symbol(s) not found for architecture x86_64\nclang: error: linker command failed with exit code 1 (use -v to see invocation)\n\n But PDFDocument.h also has this:\n PDFKIT_CLASS_AVAILABLE(10_4, 11_0)"^^ . . . "0"^^ . "How to get the 'com.apple.icns' data of a file for filling the pasteboard?"^^ . . . . "0"^^ . . "React-Native PencilKit: Strokes at the edges of canvasView flicker for a couple seconds when user draws after zooming in on canvas"^^ . . . . . . "0"^^ . "0"^^ . . "0"^^ . "I tried your code and it works for me. Post a [mre] please."^^ . "1"^^ . . "Can you use image views as subviews? If so, that's an option. If that won't work with what you're trying to do, if you post a [mre] I'm pretty sure I can modify your code to allow "coloring" the image."^^ . . . "@user9398585 -- *"'v' and 'y' type curves"* -- I considered that. I added code to log any of those, but have not found a PDF that contain them. Some quick searching indicates it's unusual. There is a lot about PDF path/shape data that I am not familiar with. For example, if I create a PDF from either Sketch or InkScape... if I have a shape with both Fill and Border, my "extract path" code gets two paths, with the Border path inverted on the y-axis..."^^ . "1"^^ . . "1"^^ . . "0"^^ . "0"^^ . . . "Doesn't use instance variables anyway. Use properties instead. Instance variable should be used only in initialisers."^^ . . "memory-leaks"^^ . . . "1"^^ . . . . . . . . "1"^^ . "<p>New to Swift and new to working on native iOS code with React Native. I'm trying to use the common <code>UITextField</code> approach to blocking screenshots on certain screens. I have a function <code>initTextField</code> here:</p>\n<pre class="lang-swift prettyprint-override"><code>private var secureTextField: UITextField?\n\nprivate func initTextField() {\n let boundLength = max(UIScreen.main.bounds.size.width, UIScreen.main.bounds.size.height)\n \n secureTextField = UITextField(frame: CGRect(x: 0, y: 0, width: boundLength, height: boundLength))\n secureTextField!.isSecureTextEntry = true\n secureTextField!.isUserInteractionEnabled = false\n secureTextField!.backgroundColor = .red\n \n if let rootView = UIApplication.shared.keyWindow?.rootViewController?.view {\n for subview in rootView.subviews {\n subview.addSubview(secureTextField!)\n subview.layer.superlayer?.addSublayer(secureTextField!.layer)\n secureTextField!.layer.sublayers?.last?.addSublayer(subview.layer)\n }\n }\n }\n</code></pre>\n<p>This works. The screenshots turn out red and on the app switcher the app is also red. I ended up having to use this definition for <code>rootView</code>, not sure if it's because I'm using React Native but anyway, it works.</p>\n<p>On certain screens I want to disable this and allow screenshots but haven't figured out how to do this. How can I undo/remove the <code>UITextField</code> on all of the sublayers/subviews?</p>\n<p>Thanks!</p>\n"^^ . "0"^^ . . "Run the app within Xcode, trigger the leak, then click the *Debug Memory Graph* control found within the debugger controls. The output will take a moment to produce, when ready study it: select the leaking objects on the left, and study the produced graph. Usually that provides a smoking gun."^^ . "0"^^ . "1"^^ . . "1"^^ . . . "<p>Even though everything is perfect and set up correctly, the accessToken is not returning.</p>\n<ul>\n<li><p>I'm running my project in xCode on WmWare</p>\n</li>\n<li><p>I'm testing it on a real device, I'm connected to the PC via cable.</p>\n</li>\n<li><p>I am switching my application to Spotify, and after approval for the authorize process, it returns to the application, but the accessToken returns nil every time.</p>\n</li>\n<li><p>I am sure that my code verifier code challenge client id, client secret and redirect uri data are correct.</p>\n</li>\n</ul>\n<p>return Warning :</p>\n<pre><code> Failed to initiate session: invalid_grant\nError domain: com.spotify.sdk.login\n Error code: 1\nUser Info: {\n NSLocalizedDescription = &quot;invalid_grant&quot;;\n}\n</code></pre>\n<p><strong>Please Help Me</strong></p>\n"^^ . "0"^^ . . "0"^^ . . . . . "audiounit"^^ . . "NSMuatableAttributedString's appendString method only exist in iPhone-device build in iOS18, and not exist in Simulator-build"^^ . "0"^^ . . . . . "macOS has an `iconutil` command line tool which can create icns files. Interestingly, this is linked agains the *private* IconServices framework (as can be seen from `otool -L /usr/bin/iconutil`)."^^ . "1"^^ . . "thank you for your response, still with kotlin/native it doesn't work"^^ . . "multimedia"^^ . "nspasteboard"^^ . . . . . . . . . . "0"^^ . . "<p>When one copies a file in Finder, the pasteboard contains a 'icns' type with the various icon descriptions of the copied item(s).</p>\n<p>I need to accomplish the same effect in my code, i.e. generate the data I can put into the pasteboard for the <code>com.apple.icns</code> type.</p>\n<p>How do I collect the data for this type? All I can find in AppKit are functions for getting an NSImage for a file, but nothing that gives me the icns resource.</p>\n"^^ . "@Willeke hey, I totally forgot about this... but can't you be a little bit more specific? Like, I created an array controller and set a bind to to the NSArray with **bind:toObject:withKeyPath:options:** but I'm not sure yet how do observe the changes to the array, the documentation is a bit confusing ."^^ . . . . "1"^^ . . . . . . . "0"^^ . "Upload PDF from shared local storage in iOS (Drive, OneDrive, Dropbox..) to server with Ktor Fails"^^ . . "<p>Turns out it's a <a href="https://developer.apple.com/documentation/xcode-release-notes/xcode-16-release-notes#Known-Issues" rel="nofollow noreferrer">known issue</a>:</p>\n<blockquote>\n<p>Changes to .editorconfig are not reflected immediately in open files.\n(120389049)</p>\n</blockquote>\n<p>Workaround: Quit and restart Xcode.</p>\n"^^ . . "<p>I'm using Core Data in my iOS application and I have one property that is encrypted using ValueTransformer:</p>\n<pre><code>class EncryptedStringTransformer: ValueTransformer {\nprivate var encryptionKey: String\n\ninit(encryptionKey: String) {\n self.encryptionKey = encryptionKey\n super.init()\n}\n\noverride class func allowsReverseTransformation() -&gt; Bool {\n return true\n}\n\noverride class func transformedValueClass() -&gt; AnyClass {\n return NSData.self\n}\n\noverride func transformedValue(_ value: Any?) -&gt; Any? {\n guard let string = value as? String,\n let data = string.data(using: .utf8),\n let encryptedData = EncryptionUtils.aes256EncryptData(data, withKey: encryptionKey) else { return nil }\n return encryptedData\n}\n\noverride func reverseTransformedValue(_ value: Any?) -&gt; Any? {\n guard let encryptedData = value as? Data,\n let decryptedData = EncryptionUtils.aes256DecryptData(encryptedData, withKey: encryptionKey) else { return nil }\n return String(data: decryptedData, encoding: .utf8)\n}\n\nfunc updateEncryptionKey(newKey: String) {\n self.encryptionKey = newKey\n}\n}\n</code></pre>\n<p>The encrypted property is String:\n@NSManaged public var message: String?</p>\n<p>and it set in the CoreData model as Transformable</p>\n<p>the encryption is based on the user password that can be changed, if the user updates the password I want to re-encrypt the property, I try to do it using this function:</p>\n<pre><code>func reEncryptDataWithNewPassword(oldPassword: String, newPassword: String) -&gt; ReEncryptDBStatus {\nlet fetchRequest: NSFetchRequest&lt;Message&gt; = Message.fetchRequest()\nguard let messages = try? context.fetch(fetchRequest) else {\n return .failed\n}\n\nguard !messages.isEmpty else {\n return .success\n}\n\nfor message in messages {\n if let _ = message.message {\n message.message = message.message\n }\n}\n\nValueTransformer.setValueTransformer(EncryptedStringTransformer(encryptionKey: newPassword), forName: .encryptedStringTransformer)\n\ndo {\n try context.save()\n} catch {\n return .failed\n}\n\nreturn .success\n}\n</code></pre>\n<p>The problem is that trying <code>context.save()</code> does not force the DB to update the property, and <code>transformedValue</code> in <code>EncryptedStringTransformer</code> is not called when I call <code>context.save()</code>.</p>\n<p>Any idea what can be the problem?</p>\n"^^ . . . "process-monitoring"^^ . . . . "unfortunately no, I see you using `myView.translatesAutoresizingMaskIntoConstraints = NO;` and NSLayoutConstraints in `viewDidLoad `I am not using any of these. Not sure if it has anything to do with it."^^ . . "Cocoa - Block implicitly retains 'self' - Different solutions"^^ . "0"^^ . "react-native"^^ . "1"^^ . "just one more question, in this same file I have other blocks for implementing my NSTableView, am I supposed to get a weak reference to self before each one of these blocks, or is it ok to declared the weak reference as a global once and use it across all the blocks?"^^ . . . . "0"^^ . . . "Another question:\n\nYou say "The react-native-code-push library depends on code-push, which basically contains the JS code. But in order to support the new arch, the whole project needs to be a Turbo Module. So it needs the JSI interface and codegen information."\n\nMy impression was that NA had a compatibility layer that would handle stuff like this?\n\nAlso, I find it hard to see any documentation about the methods used for RN Code Push and other modules, the only results I get by googling is the source code itself?"^^ . "May be problem with name? Doesn't see how `.encryptedStringTransformer` declared? May be use `@objc` and declare explicit name"^^ . . . "Is there any way to get notify whenever new process , daemon and application is launched ? MACOS"^^ . "uikit"^^ . "0"^^ . . . . "<p>I have an NSPopUpButton defined in my view controller :</p>\n<pre><code>@property (weak) IBOutlet NSPopUpButton* popUpButton;\n</code></pre>\n<p>this view controller also has an NSMutableArray which includes some objects of type NSDictionary, for instance:</p>\n<pre><code>NSDictionary *obj = @{@&quot;name1&quot;: @&quot;something&quot;,\n @&quot;name2&quot;: @&quot;something else&quot;};\n [myMutableArray addObject: obj];\n</code></pre>\n<p>I'd like my NSPopUpButton to reflect the contents of the name1 field of all elements contained in this array, but I have no idea how to achieve that with the bindings inspector in Xcode.</p>\n<p>If I select the NSPopUpButton in the storyboard the following is shown in the bindings inspector:</p>\n<p><a href="https://i.sstatic.net/nZlRa4PN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/nZlRa4PN.png" alt="Xcode bindings inspector" /></a></p>\n<p>am I supposed to use &quot;Contents&quot; or &quot;Content Values&quot; to achieve of what I want?(assuming it's even possible). I've seen some people use an ArrayController but I'd like to know if it's possible to go about this without it.</p>\n"^^ . . . . . "0"^^ . . "<h1>Problem with &quot;More&quot; Tab in <code>UITabBarController</code> on iOS 18</h1>\n<p>I'm working on an iOS application using Objective-C and <code>UITabBarController</code>. I have more than five tabs, so the additional ones are placed under the &quot;More&quot; tab. However, when I click on the &quot;More&quot; tab in <strong>iOS 18.0</strong>, the first item does not show up properly. This issue does not occur in iOS 17 or earlier versions.</p>\n<p><a href="https://i.sstatic.net/4Fx0DbLj.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4Fx0DbLj.jpg" alt="enter image description here" /></a></p>\n<p><a href="https://i.sstatic.net/K8orlaGy.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/K8orlaGy.jpg" alt="enter image description here" /></a></p>\n<h2>Development Environment</h2>\n<ul>\n<li><p><strong>Xcode Version</strong>: 15</p>\n</li>\n<li><p><strong>Deployment Target</strong>: iOS 17</p>\n</li>\n</ul>\n<h2>Steps to Reproduce</h2>\n<ol>\n<li><p>Create a new iOS project in Xcode and set the deployment target to iOS 17.</p>\n</li>\n<li><p>Delete the default main storyboard and add a new <code>UITabBarController</code> as the initial view controller.</p>\n</li>\n<li><p>Populate the <code>UITabBarController</code> with more than five tabs so that the additional ones appear under the &quot;More&quot; menu.</p>\n</li>\n<li><p>Run the app on an iOS 18.0 simulator or device.</p>\n</li>\n<li><p>Navigate to the &quot;More&quot; menu in the tab bar.</p>\n</li>\n</ol>\n<h2>Expected Behavior</h2>\n<p>All items in the &quot;More&quot; menu should appear as expected.</p>\n<h2>Actual Behavior</h2>\n<p>The first item in the &quot;More&quot; menu does not appear initially but is visible when editing the menu.</p>\n<h2>What I've Tried</h2>\n<ul>\n<li><p>Verified that each view controller is correctly initialized and has a title and image.</p>\n</li>\n<li><p>Logged the contents of the <code>moreNavigationController</code> to confirm that it contains the correct view controllers.</p>\n</li>\n<li><p>Tested by reducing the number of view controllers to fewer than five, which resolves the issue but is not a viable solution for the app.</p>\n</li>\n<li><p>Ensured all navigation controllers are configured consistently (e.g., translucency, bar style).</p>\n</li>\n</ul>\n<h2>Additional Notes</h2>\n<ul>\n<li><p>The issue only occurs when the <code>UITabBarController</code> is set up using the storyboard. When initialized and configured programmatically, the problem does not occur.</p>\n</li>\n<li><p>The behavior is specific to iOS 18.0; everything works as expected in iOS 17.</p>\n</li>\n</ul>\n<h2>Workaround</h2>\n<ul>\n<li>To temporarily avoid this issue, initialize and set up the <code>UITabBarController</code> programmatically instead of using the storyboard.</li>\n</ul>\n<p>What could be causing the first item under the &quot;More&quot; tab to not show up correctly on iOS 18 when using a storyboard configuration? Any insights or suggestions for debugging this issue would be greatly appreciated!</p>\n<p>You can find a minimal code example that reproduces this issue on my GitHub: <a href="https://github.com/wajahat414/IOS_18_Navigation_menu_bug" rel="nofollow noreferrer">iOS 18 UITabBarController Bug Repository</a>.</p>\n"^^ . . . "1"^^ . . . "0"^^ . . . "0"^^ . . . . . . . "0"^^ . . . . "Just use `inset(by:)` instead of `offset By(dx:dy:)`"^^ . . . . . "1"^^ . . "@Cy-4AH I am using properties though"^^ . . "0"^^ . "sdk"^^ . "css"^^ . "0"^^ . . "0"^^ . . "spotify"^^ . "@MartinR This certainly isn't the first time Apple has deprecated something and the supposed replacement isn't really a valid replacement. Oh well."^^ . "<p>So I have this snippet here which involves a block:</p>\n<pre><code>NSArray&lt;Class&gt; *acceptableClasses = @[[DesktopEntity class]];\n __block NSInteger insertIdx = row;\n \n \n [info enumerateDraggingItemsWithOptions:0 forView:_tableView classes:acceptableClasses searchOptions:nil usingBlock:^(NSDraggingItem *draggingItem, NSInteger idx, BOOL *stop)\n {\n \n \n DesktopEntity *entity = draggingItem.item;\n \n \n [_tableContents insertObject:entity atIndex: insertIdx];\n [_tableView insertRowsAtIndexes:[NSIndexSet indexSetWithIndex:insertIdx] withAnimation:NSTableViewAnimationEffectGap];\n \n \n draggingItem.draggingFrame = [_tableView frameOfCellAtColumn:0 row: insertIdx];\n ++insertIdx;\n }];\n</code></pre>\n<p>it compiles fine but I'm getting a warning:</p>\n<blockquote>\n<p>Block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior</p>\n</blockquote>\n<p>I'm having some trouble understanding <strong>what it means</strong>. I managed to make the warning disappear by just typing the self keyword before the variables:</p>\n<pre><code>[self.tableContents insertObject:entity atIndex: insertIdx];\n[self.tableView insertRowsAtIndexes:[NSIndexSet indexSetWithIndex:insertIdx] withAnimation:NSTableViewAnimationEffectGap];\n\n\ndraggingItem.draggingFrame = [self.tableView frameOfCellAtColumn:0 row: insertIdx];\n++insertIdx;\n</code></pre>\n<p>But I've also seen people using constructs such as</p>\n<pre><code>__weak typeof(self) weakSelf = self;\n</code></pre>\n<p>and then using this 'weakSelf' instead, what's the difference here and is my first approach wrong?</p>\n"^^ . . . . "Application crash with _isPlatformVersionAtLeast SIGABRT (ABORT) - APMIdentityWorkerQueue"^^ . "Please I would request anyone seeing this to report also, as the apps using this code are in production and clients are reporting that menu is not there"^^ . "HTH\nAlso note that there is a little trick how you can view the generated Swift interface for ObjC types at any time. See [TN3108](https://developer.apple.com/documentation/technotes/tn3108-viewing-the-interface-of-your-swift-code).\nI will add this to my answer, as this is probably helpful information."^^ . . "<p>I'm trying to build a mixed Swift/Objective-C library using Bazel, but Swift code cannot access types defined in the Objective-C header. I've spent nearly two weeks researching and trying various solutions found in Bazel documentation and other sources, but none have worked.</p>\n<p>The project is <a href="https://github.com/a1049145827/BSText" rel="nofollow noreferrer">BSText</a>, with some Objective-C code.\nThe key files are:\nBSText.h (umbrella header with Objective-C type definitions)\nSwift files in BSText/ directory that need to access Objective-C types\nFull source code: BSText GitHub Repository</p>\n<h1>Setup</h1>\n<p>The BSText library has an umbrella header containing Objective-C declarations BSText/Bstext.h</p>\n<p>My Bazel build file:</p>\n<pre><code># Objective-C header target\nobjc_library(\n name = &quot;BSTextObjC&quot;,\n hdrs = [&quot;BSText/BSText.h&quot;],\n sdk_frameworks = [\n &quot;Foundation&quot;,\n &quot;UIKit&quot;,\n &quot;CoreText&quot;,\n ],\n includes = [&quot;BSText&quot;],\n visibility = [&quot;//visibility:public&quot;],\n)\n\n# Swift library target\nswift_library(\n name = &quot;BSTextLib&quot;,\n module_name = &quot;BSText&quot;,\n srcs = glob([\n &quot;BSText/**/*.swift&quot;,\n ]),\n swiftc_inputs = [&quot;BSText/BSText.h&quot;],\n deps = [&quot;:BSTextObjC&quot;],\n copts = [\n &quot;-enable-bare-slash-regex&quot;,\n &quot;-suppress-warnings&quot;,\n ],\n visibility = [&quot;//visibility:public&quot;],\n)\n\napple_bundle_version(\n name = &quot;BSText_Version&quot;,\n build_version = &quot;1&quot;,\n short_version_string = &quot;1.1.13&quot;,\n)\n\napple_xcframework(\n name = &quot;BSText&quot;,\n bundle_id = &quot;com.geekbruce.bstext&quot;,\n bundle_name = &quot;BSText&quot;,\n infoplists = [&quot;Framework/BSText/Info.plist&quot;],\n minimum_os_versions = {\n &quot;ios&quot;: &quot;13.0&quot;,\n },\n ios = {\n &quot;simulator&quot;: [&quot;x86_64&quot;, &quot;arm64&quot;],\n &quot;device&quot;: [&quot;arm64&quot;],\n },\n umbrella_header = &quot;BSText/BSText.h&quot;,\n deps = [\n &quot;:BSTextLib&quot;,\n ],\n version = &quot;:BSText_Version&quot;\n)\n\n</code></pre>\n<p>Error\nWhen building, I get multiple errors about TextAction not being found:</p>\n<pre><code>error: cannot find type 'TextAction' in scope\n @objc open var textTapAction: TextAction?\n ^\n</code></pre>\n<h1>What I've Tried</h1>\n<p>Added swiftc_inputs with the header file\nAdded header to deps\nDifferent combinations of includes paths\nCreating module maps\nVarious combinations of objc_bridging_header, generates_header, and module_name\nConsulting Bazel documentation and GitHub issues\nSearching through rule_swift and rule_apple repositories for examples\nDifferent build configurations and compiler options</p>\n<p>Despite all these attempts and extensive research, I haven't been able to get the Swift code to recognize the Objective-C types. Any help would be greatly appreciated as I'm running out of ideas to try.</p>\n"^^ . "1"^^ . "React Native New Architecture - CodePush does not register for frame updates"^^ . . . . "Both approaches end up showing the red `secureTextField` when ran so I don't think it's working. Perhaps something to do with how it's being initialised in the first place."^^ . . . "<p>I've run</p>\n<pre class="lang-bash prettyprint-override"><code>flutter clean &amp; flutter pub get\n</code></pre>\n<p>many times\nand when I run <code>flutter build ios</code> it will complain about</p>\n<pre class="lang-bash prettyprint-override"><code>/Users/john.z/Desktop/frontendRepos/flutter_alp_invoicing/ios/Runner/Runner-Bridg\n ing-Header.h:1:9: error: 'GeneratedPluginRegistrant.h' file not found\n #import &quot;GeneratedPluginRegistrant.h&quot;\n</code></pre>\n<p><a href="https://i.sstatic.net/lQtzSbA9.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/lQtzSbA9.png" alt="enter image description here" /></a>\nand I search from the file system, it really not exists. I think it's created by flutter automatically. but why it's missing</p>\n<p>I also run the following command many times</p>\n<pre class="lang-bash prettyprint-override"><code>cd ios\npod install\n</code></pre>\n<p>besides, my Podfile looks like this</p>\n<pre class="lang-rb prettyprint-override"><code># Uncomment this line to define a global platform for your project\nplatform :ios, '12.0'\n\n# CocoaPods analytics sends network stats synchronously affecting flutter build latency.\nENV['COCOAPODS_DISABLE_STATS'] = 'true'\n\nproject 'Runner', {\n 'Debug' =&gt; :debug,\n 'Profile' =&gt; :release,\n 'Release' =&gt; :release,\n}\n\ndef flutter_root\n generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)\n unless File.exist?(generated_xcode_build_settings_path)\n raise &quot;#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first&quot;\n end\n\n File.foreach(generated_xcode_build_settings_path) do |line|\n matches = line.match(/FLUTTER_ROOT\\=(.*)/)\n return matches[1].strip if matches\n end\n raise &quot;FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get&quot;\nend\n\nrequire File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)\n\nflutter_ios_podfile_setup\n\ntarget 'Runner' do\n use_frameworks!\n use_modular_headers!\n\n flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))\n target 'RunnerTests' do\n inherit! :search_paths\n end\nend\n\npost_install do |installer|\n installer.pods_project.targets.each do |target|\n flutter_additional_ios_build_settings(target)\n end\nend\n\n</code></pre>\n<p>the Generated.xcconfig file always be created after I run <code>flutter build ios</code>.... it's not as the docs said after I run <code>flutter pub get</code>, it's kind of a mess.</p>\n<p>so I need to run <code>flutter build ios</code> first to generate the Generated.xcconfig, then I can run pod install. but however the GeneratedPluginRegistrant.h file is still missing.</p>\n<p>I also tried recreate the ios folder</p>\n<p>I've searched the internet and asked the chatgpt, still not know why. anyone can help me? thanks</p>\n"^^ . "0"^^ . . "Thanks @DonMag. If I can get the CGPath I can then hopefully scale the aircraft andchoose to just draw the outline or fill with colours to indicate military, police or civilian and various squark codes such as emergency or QRA. I usually draw CGPath's onto a CALayer with something like CGContextDrawPath (context, kCGPathStroke) or kCGPathFill. I'm not animating the aircraft just drawing them every 15 seconds. I think I can fix the errors in my .PDF by making them a single layer with a single path in. That helicopter was at least two layers as I thought I might animate the blades in the future."^^ . . . . "<p>Is it correct to consider:</p>\n<ol>\n<li>that Metal is available on any Mac running Mojave or greater?</li>\n<li>that Metal is unavailable on earlier systems if <code>MTLCopyAllDevices()</code> returns an empty array?</li>\n</ol>\n<p>In other words, is this test correct in any case?</p>\n<pre><code>if (@available(macOS 10.14, *)) { \n MetalCompatible = true;\n} else {\n MetalCompatible = MTLCopyAllDevices().count &gt; 0;\n}\n</code></pre>\n<p>Incidentally, is there a better approach to test the availability of Metal on old macOS systems?</p>\n"^^ . . . "0"^^ . "Cocoa: Native fullscreen transition and modal dialog on MacOS not working"^^ . . . . . . . . . "@KJ - there are still some issues. I loaded your PDFs into my example app: https://i.sstatic.net/MtONnpBW.png ... notice that your `AW109red` still has the path glitch. Also, paths in PDFs can contain transforms (such as rotation) as seen in your `airDoc3`. As I said in my answer, if it were me I'd create my own CGPaths. If we're sticking with PDFs, I'd say using `NSImage` / `NSImageView` is much more reliable... although, that would not allow different stroke+fill colors."^^ . . . . . "CoreMotion: attitude (roll/pitch/yaw) returning very inaccurate values"^^ . . "objective-c++"^^ . "1"^^ . "0"^^ . . . . . "wkwebview"^^ . . "0"^^ . . . . "0"^^ . "Thanks @DonMag. A CGPath is much more useful to me than the image so if I could load the PDF to a CGPath that would be great."^^ . . . . . "in-app-purchase"^^ . . "calayer"^^ . . . . . "1"^^ . "0"^^ . . . . . . "0"^^ . "0"^^ . . . . "1"^^ . "0"^^ . . . . . "pencilkit"^^ . . "Can't change the font size of an NSTableView"^^ . . "Can't remove UITextField from sublayers"^^ . . . "<p>I've been given a warning by YouTube that the embedded video in my app has a title that is meant to be clickable and take the user to YouTube.</p>\n<p>However I cannot understand how that is meant to happen because all we're doing is using a WKWebview to load a url</p>\n<p>Is there something I'm missing? Is there something that needs to be added to the url?</p>\n<pre><code>WKWebView *webView = [[WKWebView alloc] initWithFrame: self.videoContainerView.bounds];\n webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;\n NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString: [NSString stringWithFormat:@&quot;https://www.youtube.com/embed/%@&quot;, rowViewModel.videoId]]];\n webView.clipsToBounds = YES;\n webView.contentMode = UIViewContentModeScaleAspectFill;\n [webView loadRequest:request];\n</code></pre>\n<p>I've tried looking around to see if there are parameters that can be passed but I'm not sure I found anything useful.</p>\n"^^ . "macos"^^ . . "0"^^ . . "@夢のの夢 - no, that has nothing to do with it. If you are not using constraints, I don't now why you were talking about them in your post (and post title). Did you run my example code as-is? If not, try it. If you made changes to *your* code based on my answer, and it's still not working, then post your full, modified code so we can see what's happening."^^ . . . "1"^^ . "0"^^ . "<p>The easiest way is to make sure the text fields relinquish first responder state which implies ending edit. Example:</p>\n<pre><code> - (IBAction)onSave:(id)sender {\n [[sender window] makeFirstResponder:[sender window]]; // &lt;-- this!\n NSLog(@&quot;%@ %@ %@&quot;, self.person.firstName, self.person.middleName, self.person.lastName);\n}\n</code></pre>\n"^^ . . . . "Can you be a bit more specific in what you need, adding everything here is going to be a lot of work. It involves JS code, native iOS code, native Android code and my backend code."^^ . "0"^^ . . "0"^^ . . . . "0"^^ . . . . "1"^^ . . "<p>To delete the layer associated with the <code>UITextField</code>, you need to remove the <code>UITextField</code> from its superview, which will automatically detach its layer from the view hierarchy. If you still need to manipulate the layer separately for some reason, you can directly remove the layer from its superlayer. Here's how you can do it:</p>\n<hr />\n<h2>Removing the <code>UITextField</code> and Its Layer</h2>\n<p>You can extend the <code>removeTextField()</code> method to ensure that the layer is also removed from the view hierarchy:</p>\n<pre><code>/// Removes the secure text field and its layer, enabling screenshots.\nprivate func removeTextField() {\n guard let textField = secureTextField else { return }\n \n // Remove the text field from its superview\n textField.removeFromSuperview()\n \n // Additionally, remove the text field's layer from its superlayer if needed\n textField.layer.removeFromSuperlayer()\n \n // Clean up the reference\n secureTextField = nil\n}\n</code></pre>\n<hr />\n<h2>Explanation</h2>\n<ol>\n<li><code>textField.removeFromSuperview()</code>: This will detach the <code>UITextField</code> from its parent view, which also effectively removes the corresponding layer from the view hierarchy.</li>\n<li><code>textField.layer.removeFromSuperlayer()</code>: This line ensures that the layer itself is detached from its superlayer if it's still attached. This step is typically not necessary if you have already removed the <code>UITextField</code> from the view hierarchy, but it can be added as a precaution.</li>\n<li><code>secureTextField = nil</code>: Clears the reference to the <code>UITextField</code> to prevent memory leaks.</li>\n</ol>\n<hr />\n<h2>Removing Layers from Other Views</h2>\n<p>If you've previously added the <code>UITextField</code>'s layer to other views or layers manually, you would need to iterate over those views or layers to remove the text field's layer from each. Here’s how you can do that:</p>\n<pre><code>/// Removes the secure text field's layer from all superlayers where it might have been added.\nprivate func removeTextFieldLayerFromAllSuperlayers() {\n guard let textField = secureTextField else { return }\n \n // Iterate over all superlayers to remove the layer\n if let superlayers = textField.layer.sublayers {\n for sublayer in superlayers {\n sublayer.removeFromSuperlayer()\n }\n }\n \n // Now remove the text field itself\n textField.removeFromSuperview()\n secureTextField = nil\n}\n</code></pre>\n<hr />\n<h2>When to Use This Approach</h2>\n<ul>\n<li>If you've added the <code>UITextField</code>'s layer to multiple sublayers manually (e.g., using <code>addSublayer()</code>), then you may need to remove those layers explicitly.</li>\n</ul>\n<p>This code ensures a thorough cleanup of both the view and the layer, allowing you to toggle the screenshot-blocking feature safely.</p>\n"^^ . "virtual-machine"^^ . "0"^^ . "2"^^ . . . "appdelegate"^^ . . . . . "<p>To answer your question first:\nAt least one things that is missing is <a href="https://github.com/reactwg/react-native-new-architecture/blob/main/docs/turbo-modules.md#add-event-emitting-capabilities" rel="nofollow noreferrer">event emitting capabilities</a>, but I doubt that alone will fix your problems.</p>\n<p>The <code>react-native-code-push</code> library depends on <code>code-push</code>, which basically contains the JS code. But in order to support the new arch, the whole project needs to be a Turbo Module. So it needs the JSI interface and codegen information.</p>\n<hr />\n<p>I also use Codepush and decided to take another approach, since the existing Codepush library contains a lot of legacy code (Windows for example). After doing some research I figured it was likely less work to start from scratch and only implement the things needed for my project. On a high level you only need to have this functionality:</p>\n<p><strong>Build time</strong></p>\n<ol>\n<li>Create new bundles for Android and iOS (simply the existing <code>react-native</code> CLI commands)</li>\n<li>Upload to cloud storage</li>\n</ol>\n<p><strong>Run time</strong></p>\n<ol>\n<li>A way to check the currently active bundle and compare it to the cloud bundles ( = version check)</li>\n<li>Download new bundles when available and write to the file system</li>\n<li>Point RN to most recent bundle</li>\n<li>cleanup of old bundles</li>\n</ol>\n<p><em>Edit</em>\nSome key parts of the interface, adding logic is going to lead to to a lot of code here ...</p>\n<pre class="lang-js prettyprint-override"><code>// TS Spec file\nimport { TurboModule, TurboModuleRegistry } from &quot;react-native&quot;;\n\nexport interface Spec extends TurboModule {\n getAppVersion(): Promise&lt;string&gt;;\n initiateUpdate(): Promise&lt;{ success: boolean }&gt;;\n checkForUpdate(): Promise&lt;{ updateAvailable: boolean }&gt;;\n restartApp(): void;\n}\n\nexport default TurboModuleRegistry.getEnforcing&lt;Spec&gt;('OTA');\n</code></pre>\n<p>Then I basically have 3 main files containing most of the logic:</p>\n<p><strong>Codepush.mm</strong>\nContains the C++ interface for the spec file + 4 core functions:</p>\n<pre class="lang-none prettyprint-override"><code>@interface OTA: NSObject &lt;NativeOTASpec&gt;\n\n- (void)downloadPackage:(NSString *)updatePackageUrl destinationPath:(NSString *)destinationPath resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;\n- (void)unzipFileAtPath:(NSString *)zipPath toDestination:(NSString *)destinationPath completionHandler:(void (^)(NSError *error))completionHandler;\n- (void)removeFileAtURL:(NSURL *)fileURL;\n+ (nullable NSURL *)bundleURL;\n\n@end\n</code></pre>\n<p><strong>DownloadManager.mm</strong></p>\n<p>Has one main function, rest is monitoring and safety checks. It downloads the zip folder from the request url, unzips it, and provides a progress callback during download. On download success the file is verified and if all checks succeed the app is rebooted and the new Bundle will replace the existing one</p>\n<pre class="lang-none prettyprint-override"><code>- (id)init:(NSString *)downloadFilePath\noperationQueue:(dispatch_queue_t)operationQueue\nprogressCallback:(void (^)(float))progressCallback\ndoneCallback:(void (^)(BOOL))doneCallback\nfailCallback:(void (^)(NSError *err))failCallback;\n</code></pre>\n<p><strong>FolderUtils.mm</strong></p>\n<p>Manages creation and deletion of folders for the different bundles, plus cleanup of deprecated bundle version</p>\n<h1>Pseudo code</h1>\n"^^ . . "A good check is to create a sample project with Swift and Objectif and write the needed method in one language, and check how it's translated in the other one."^^ . . "0"^^ . . . . . . . . . "Actually, IIRC there were also some older, lesser known APIs that could be used to bring a window to the front and stuff programmatically, but they were quite restrictive as well. I don't remember the names but I remember they were really old and deprecated for years but still worked."^^ . . "replaykit"^^ . . . "@Willeke ,thanks ! works like charm! seems ScreenReaderCore`-[NSMutableAttributedString(SCRCMutableAttributedStringExtras) appendString:] has defined in the system ! My 2.2 question is solved !!"^^ . . . . . "0"^^ . . "0"^^ . . "Issue with scrolling through WKWebView when direction=rtl"^^ . "0"^^ . . . "<p>I'm adding offset to caret to it was not just behind symbol, but 2 points away.</p>\n<pre><code>public final class MyTextField: UITextField {\n\n override public func caretRect(for position: UITextPosition) -&gt; CGRect {\n super.caretRect(for: position).offsetBy(dx: 2, dy: 0)\n }\n}\n</code></pre>\n<p>But when entered text is as long as TextField, cursor (caret) become not visible. How to keep entered text + caret inside TextField bounds?</p>\n"^^ . "you are a life saver, thanks"^^ . "2"^^ . "I don't think you would ever need to store you public key as a new one can be generated pretty easily now days. You can however as the documentation states store it in the keychain, you just have to write your own logic for it. I will say also I moved over to CryptoKit awhile ago and it has a steep learning curve, but it's quite a bit nicer. have a look at this sample code on storing keys https://developer.apple.com/documentation/cryptokit/storing_cryptokit_keys_in_the_keychain"^^ . . . . . "core-graphics"^^ . "1"^^ . . . . . . "I think I have some 'v' and 'y' type curves in my PDF which might cause an issue as I think they have different characteristics to a 'c' curve."^^ . "can you include `encodeConverterComplexInputDataProc` and the crash dump?"^^ . . . "0"^^ . . "<p>You can achieve this by connecting the <code>Content</code> binding with <code>myMutableArray</code> <strong>and</strong> the <code>Content Values</code> binding with <code>myMutableArray.name1</code>.</p>\n<p>You may however run into another problem: adding objects to <code>NSMutableArray</code> does not fire key-value notifications, so if you add values after the UI did load those will not display.</p>\n<p>To work around this after modifications you can assign the mutable array to another instance variable and bind the UI to that array in an observable fashion:</p>\n<pre><code>// modify array\nself.observedArray=myMutableArray;\n</code></pre>\n"^^ . . . "There are no functions or configurations for setting the frame rate."^^ . "1"^^ . "Personally I wouldn't waste time waiting for an "answer" on Stack Overflow; you won't get one. It's clearly a bug, you've proved it, you've got an easy workaround, report it to Apple and move on. Thanks again for documenting this so clearly."^^ . . . . . "1"^^ . . "**(1)** So `processSampleBuffer` can't happen on a Timer (_eg:_ 30 times per second)? **(2)** What happens if you don't involve `BufferLock` (_eg:_ is now getting a better picture)? **(3)** What happens if you make `*oYData` and `*oUVData` into global variables so it's not making a new `uint8_t` every time? Or is it required to be that way? **(4)** Your `return` should ideally first print a message to notify that a size was incorrect and clear the `*oYData` & `*oUVData` buffers instead of just silently returning to the rest of program code."^^ . . . "1"^^ . . . . "Thanks for the response and the memory graph was very helpful. As it turns out, the code above works fine and doesn't "technically" leak. However... the 'n' passed into the loop that drives the process is quite large; around 12,000. So that means that I was loading approximately 288,000 web pages of various sizes, along with a tone of custom objects being created and disposed of within this single loop. While nothing was leaking, the autorelease pool was HUGE!!! This eventually filled available memory until the application crashed."^^ . . . . "1"^^ . . "0"^^ . . . . . . . . . . "In iOS 18, using AudioUnit for audio recording, converting PCM format to AAC crashes the application"^^ . . . . "2"^^ . . . "@user9398585 - you added the framework, but did you `#import <PDFKit/PDFKit.h>`?"^^ . . . "flutter"^^ . . . . . "like I'm unsure on whether to declare a macro like `#define WEAKSELF __weak typeof(self) weakSelf = self;` or just declare it as a global"^^ . "<p>As Willeke explained, the solution here is to subclass <a href="https://developer.apple.com/documentation/appkit/nstablerowview?language=objc" rel="nofollow noreferrer">NSTableRowView</a> and override the <a href="https://developer.apple.com/documentation/appkit/nstablerowview/isgrouprowstyle?language=objc" rel="nofollow noreferrer">isGroupRowStyle</a> method</p>\n<pre><code>@interface CustomTableRowView : NSTableRowView\n\n@end\n\n@implementation CustomTableRowView\n\n-(BOOL)isGroupRowStyle\n{\n return NO;\n}\n\n //custom background for a table row view\n- (void)drawBackgroundInRect:(NSRect)dirtyRect\n{\n\n NSColor *groupBackgroundColor = [NSColor windowBackgroundColor];\n [groupBackgroundColor setFill];\n NSRectFill(dirtyRect);\n\n}\n\n@end\n</code></pre>\n<p>I also had to override <a href="https://developer.apple.com/documentation/appkit/nstableviewdelegate/tableview(_:rowviewforrow:)?language=objc" rel="nofollow noreferrer">rowViewForRow</a> for the NSTableViewDelegate:</p>\n<pre><code>- (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row\n{\n DesktopEntity *entity = _tableContents[row];\n \n if ([entity isKindOfClass:[DesktopFolderEntity class]])\n {\n return [[CustomTableRowView alloc] init];\n }\n \n // use default row for non-group rows\n return nil;\n}\n</code></pre>\n"^^ . "Unable to access Objective-C types in Swift when building with Bazel"^^ . . . "1"^^ . . . "<p>The problem is NOT the auto-layout constraints...</p>\n<p>The issue is that setting the frame of a subview in <code>[UIView animateWithDuration:...]</code> triggers a call to <code>layoutSubviews</code> ... where you again set the frame of the subview.</p>\n<p>To avoid that, we can add a <code>CGRect</code> property to track <code>self.bounds</code> and, in <code>layoutSubviews</code>, only update <code>_imageView.frame</code> if <code>self.bounds</code> has changed.</p>\n<p>Example code...</p>\n<hr />\n<p><strong>MyView.h</strong></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MyView : UIView\n-(void)animateOnImage;\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<hr />\n<p><strong>MyView.m</strong></p>\n<pre><code>#import &quot;MyView.h&quot;\n\n@implementation MyView\n\n{\n UIView *_imageView;\n CGRect myBounds;\n}\n\n- (instancetype)init\n{\n self = [super init];\n if (self) {\n _imageView = [UIView new];\n _imageView.backgroundColor = UIColor.blueColor;\n [self addSubview:_imageView];\n myBounds = CGRectZero;\n }\n return self;\n}\n- (void)layoutSubviews\n{\n [super layoutSubviews];\n \n // debug - log that layoutSubviews was called\n NSLog(@&quot;layoutSubviews&quot;);\n \n // only execute the following if self.bounds has changed\n if (!CGRectEqualToRect(myBounds, self.bounds)) {\n \n // debug - log that self.bounds has changed\n NSLog(@&quot;self.bounds changed, so set _imageView frame&quot;);\n myBounds = self.bounds;\n _imageView.frame = self.bounds;\n }\n}\n\n-(void)animateOnImage {\n [UIView animateWithDuration:2 animations:^{\n [self shrinkImageView];\n }];\n}\n\n- (void)shrinkImageView {\n _imageView.frame = CGRectMake(50, 100, 150, 200);\n _imageView.alpha = 0.5;\n}\n\n\n@end\n</code></pre>\n<hr />\n<p><strong>AnimSubViewController.h</strong></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface AnimSubViewController : UIViewController\n\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<hr />\n<p><strong>AnimSubViewController.m</strong></p>\n<pre><code>#import &lt;UIKit/UIKit.h&gt;\n#import &quot;AnimSubViewController.h&quot;\n#import &quot;MyView.h&quot;\n\n@interface AnimSubViewController ()\n{\n MyView *myView;\n}\n@end\n\n@implementation AnimSubViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n self.view.backgroundColor = UIColor.systemBackgroundColor;\n \n myView = [MyView new];\n myView.backgroundColor = UIColor.systemYellowColor;\n myView.translatesAutoresizingMaskIntoConstraints = NO;\n [self.view addSubview:myView];\n \n UILayoutGuide *g = self.view.safeAreaLayoutGuide;\n \n [NSLayoutConstraint activateConstraints:@[\n [myView.topAnchor constraintEqualToAnchor:g.topAnchor constant:120.0],\n [myView.leadingAnchor constraintEqualToAnchor:g.leadingAnchor constant:80.0],\n [myView.trailingAnchor constraintEqualToAnchor:g.trailingAnchor constant:-80.0],\n [myView.bottomAnchor constraintEqualToAnchor:g.bottomAnchor constant:-120.0],\n ]];\n \n}\n\n- (void)viewDidAppear:(BOOL)animated\n{\n [super viewDidAppear:animated];\n [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(animateView) userInfo:nil repeats:NO];\n}\n\n- (void)animateView\n{\n [myView animateOnImage];\n}\n\n@end\n</code></pre>\n<hr />\n<p><a href="https://i.sstatic.net/bZ7DY3pU.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bZ7DY3pU.gif" alt="demo" /></a></p>\n"^^ . "<pre><code> AudioBufferList* convertPCMToAAC (XDXRecorder *recoder) {\nUInt32 maxPacketSize = 0;\nUInt32 size = sizeof(maxPacketSize);\nOSStatus status;\n\nstatus = AudioConverterGetProperty(_encodeConvertRef,\n kAudioConverterPropertyMaximumOutputPacketSize,\n &amp;size,\n &amp;maxPacketSize);\n// log4cplus_info(&quot;AudioConverter&quot;,&quot;kAudioConverterPropertyMaximumOutputPacketSize status:%d \\n&quot;,(int)status);\n\nAudioBufferList *bufferList = (AudioBufferList *)malloc(sizeof(AudioBufferList));\nbufferList-&gt;mNumberBuffers = 1;\nbufferList-&gt;mBuffers[0].mNumberChannels = _targetDes.mChannelsPerFrame;\nbufferList-&gt;mBuffers[0].mData = malloc(maxPacketSize);\nbufferList-&gt;mBuffers[0].mDataByteSize = kTVURecoderPCMMaxBuffSize;\n\nAudioStreamPacketDescription outputPacketDescriptions;\n\nUInt32 inNumPackets = 1;\n\npthread_mutex_lock(&amp;pcmBufferMutex);\n\nstatus = AudioConverterFillComplexBuffer(_encodeConvertRef,\n encodeConverterComplexInputDataProc,\n pcm_buffer,\n &amp;inNumPackets,\n bufferList,\n &amp;outputPacketDescriptions);\npthread_mutex_unlock(&amp;pcmBufferMutex);\nif(status != noErr){\n // log4cplus_debug(&quot;Audio Recoder&quot;,&quot;set AudioConverterFillComplexBuffer status:%d inNumPackets:%d \\n&quot;,(int)status, inNumPackets);\n free(bufferList-&gt;mBuffers[0].mData);\n free(bufferList);\n return NULL;\n}\n\nif (recoder.needsVoiceDemo) {\n OSStatus status = AudioFileWritePackets(recoder.mRecordFile,\n FALSE,\n bufferList-&gt;mBuffers[0].mDataByteSize,\n &amp;outputPacketDescriptions,\n recoder.mRecordPacket,\n &amp;inNumPackets,\n bufferList-&gt;mBuffers[0].mData);\n // log4cplus_info(&quot;write file&quot;,&quot;write file status = %d&quot;,(int)status);\n if (status == noErr) {\n recoder.mRecordPacket += inNumPackets; \n }\n}\n\nreturn bufferList;\n}\n</code></pre>\n<p>The above code for converting PCM to AAC works normally in iOS versions below 18, but in iOS 18, crashes occur during the conversion process. The console does not provide much useful information, and the application crashes at malloc(maxPacketSize) or AudioConverterFillComplexBuffer(), displaying the message AURemoteIO::IOThread (14): EXC_BAD_ACCESS (code=1, address=0x0). Please help identify the cause of the crash.</p>\n<p>I hope to completely solve this crash problem.</p>\n"^^ . . . "Thank you! but the animation now is shrinking starting from MyView's origin x and y (0,0), then moving toward its final position, instead of shrinking from the center :("^^ . . "First item in UITabBarController's 'More' tab not showing up properly when using storyboard and run on device with ios 18.0"^^ . . "@IRP_HANDLER the easiest way is to bind in IB. In code: `[arrayController bind:NSContentArrayBinding toObject:self withKeyPath:@"myMutableArray" options:nil]` (`self` is the view controller)."^^ . . . . . . . . . . . . "0"^^ . "qt6"^^ . . "And to your last question: pay attention to circular references like A->B->C->A. These will not ever release unless you break them up."^^ . . "0"^^ . "cocoa"^^ . "cocoa-bindings"^^ . . . "0"^^ . "0"^^ . . "bazel"^^ . "<p>The block <em>does</em> retain <code>self</code> the way you're doing it.</p>\n<p>If you know for a fact that the block is not being stored for later use by the runtime, that's fine; but if you cannot be <em>sure</em> that the block is not being stored for later use, you risk a <em>retain cycle:</em> the block retains <code>self</code> but perhaps, behind the scenes, someone is retaining the block, thus preventing <code>self</code> from ever going out of existence.</p>\n<p>And in that case, you should use the <a href="https://stackoverflow.com/a/8248598/341994">&quot;weak-strong dance&quot;</a>, as illustrated in the code at the end of your question, which breaks the retain cycle by referring to <code>self</code> with a weak reference.</p>\n<p>But which is the case? Is this block retained behind the scenes or not? Alas, the runtime's behavior behind the scenes is opaque. One way to find out experimentally whether there is a retain cycle is to implement <code>dealloc</code> on <code>self</code> to log to the console, and try running the app with the code your way. If the printing in <code>dealloc</code> never happens, then <code>self</code> is never being deallocated because you've created a retain cycle and you know that the weak-strong dance is needed.</p>\n<p>Personally, I'd be inclined just to do the weak-strong dance and let it go at that. It is over-used in a knee-jerk way by a lot of programmers, so you are right to doubt its necessity here; but it does no harm and can do good, so it might be best to err on the side of caution.</p>\n"^^ . . . . . "<p>I have an eBook with dir=rtl and I'm using the following css to split the content of the html into columns:</p>\n<pre><code>#book {\n width:350px;\n height:750px;\n\n margin-left:25px;\n margin-right:25px;\n\n -webkit-column-count:auto;\n -webkit-column-width:350px;\n\n -webkit-column-gap:50px;\n \n text-align:justify;\n word-wrap: break-word;\n}\n</code></pre>\n<p>I use the following line to get the Webview's Content Width to calculate the number of columns produced:</p>\n<pre><code>[myWKWebView stringByEvaluatingJavaScriptFromString:@&quot;document.getElementsByTagName('html')[0].scrollWidth;&quot;]\n</code></pre>\n<p>I use the following to scroll through the WebView horizontally:</p>\n<pre><code>[myWKWebView evaluateJavaScript:[NSString stringWithFormat:@&quot;window.scrollTo(%d,0);&quot;,xPosition]];\n</code></pre>\n<p>All the above code works perfectly well, until I introduce the direction to the css:</p>\n<pre><code>direction:rtl;\n</code></pre>\n<p>Upon adding the direction to the css, scrollWidth stops giving the correct measurement and scrollTo function ceases to work.</p>\n<p>I use the direction in the css, to order the columns from right to left.\nIs there an alternative that doesn't affect the scrolling feature and the scrollWidth?</p>\n<p>Kindly note, this is the code used to initialize the WebView:</p>\n<pre><code>WKWebViewConfiguration *theConfiguration = [[WKWebViewConfiguration alloc] init];\ntheConfiguration.selectionGranularity = WKSelectionGranularityCharacter;\n[theConfiguration.preferences setValue:@&quot;TRUE&quot; forKey:@&quot;allowFileAccessFromFileURLs&quot;];\ntheConfiguration.preferences.javaScriptEnabled = true;\nmyWKWebView = [[WKWebView alloc] initWithFrame:self.view.frame configuration:theConfiguration];\nmyWKWebView.UIDelegate = self;\nmyWKWebView.userInteractionEnabled = true;\nmyWKWebView.contentMode = UIViewContentModeScaleAspectFit;\nmyWKWebView.autoresizesSubviews = true;\nmyWKWebView.scrollView.scrollEnabled = true;\nmyWKWebView.multipleTouchEnabled = true;\n\n[self.view addSubview: myWKWebView];\n</code></pre>\n"^^ . "0"^^ . . . . . . . . "1"^^ . . "Answer adapted to that."^^ . "0"^^ . "0"^^ . "Recording audio from a microphone using the AVFoundation framework does not work after reconnecting the microphone"^^ . . . "uitextfield"^^ . . "process-monitor"^^ . . . . . . "0"^^ . . "iOS Camera Freezes and Crashes with MLKit Barcode Scanning in Kotlin Multiplatform"^^ . . . . "google-mlkit"^^ . . . "YouTube video in Objective C app needs to redirect to YouTube"^^ . . . "0"^^ . "editorconfig"^^ . "0"^^ . . "0"^^ . . "Thank for you replaying @DonMag An example icon is at http://www.iridiumblue.com/pages/AW109.pdf It is a single page 128x128 in black on a clear background. I would like to change the colour of the black part to reflect military/civil/etc and apply an alpha if possible. I'm currently converting the icons to an NSImage which then losses quality whens called to say 40x40. Thanks."^^ . "@ThomasTempelmann: If you have a working solution then you are welcome to post that as a (self) answer."^^ . "0"^^ . "ios"^^ . . "<p>I want to add a &quot;bubble horizon&quot; to a camera application to help the user keep their iPhone level.</p>\n<p>For this, I'm using the CoreMotion Attitude functionality of CMMotionManager.\nHowever, the output I'm getting is very inaccurate.</p>\n<p>I'm comparing my readings with Apple's own Measure app which is dead accurate, so the sensors are working fine. My own readings seem to be several degrees off.</p>\n<p>I'm using quaternion transformation to calculate Roll (don't need Pitch/Yaw for this use case) to avoid gimbal lock, but am I perhaps missing some calibration step or something?</p>\n<pre><code>\n- (void)initializeMotionManager { \n if (self.motionManager.deviceMotionAvailable) { \n self.motionManager.deviceMotionUpdateInterval = 0.1; // Update interval in seconds\n NSOperationQueue *queue = [NSOperationQueue mainQueue]; \n\n [self.motionManager startDeviceMotionUpdatesUsingReferenceFrame:CMAttitudeReferenceFrameXArbitraryZVertical toQueue:queue withHandler:^(CMDeviceMotion *motion, NSError *error) { \n // error handling removed for readability\n [self processDeviceMotion:motion];\n }];\n\n }\n}\n\n- (void)processDeviceMotion:(CMDeviceMotion *)motion {\n\n // use quaternions to avoid Gimbal Lock\n CMQuaternion quat = motion.attitude.quaternion;\n\n // calculate roll in degrees\n double roll = atan2( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) );\n roll = radiansToDegrees( roll );\n\n NSLog( @&quot;Roll: %f&quot;, roll ); // readings tend to be +/- 3 degrees\n}\n</code></pre>\n"^^ . . "kotlin"^^ . . . "uinavigationcontroller"^^ . . "0"^^ . . . . "0"^^ . "0"^^ . . "The deprecation of `GetIconRefFromFileInfo` states that you should use [`NSWorkspace iconForFile:`](https://developer.apple.com/documentation/appkit/nsworkspace/1528158-iconforfile?language=objc) instead. I have no idea if that's a workable solution for your case."^^ . . . . . . . . . . "0"^^ . . "Correct format of Apple auto-renewable subscription expires_date"^^ . . . "1"^^ . . . . . . . "@gerd-k Got "Property 'window' not found on object of type '__strong id'" :("^^ . "0"^^ . . . . . . "0"^^ . . "<p>I have a UIView subclass called MyView as such</p>\n<pre><code>@implementation MyView\n{\n UIView&lt;SomeImageProtocol&gt; *_imageView;\n}\n\n- (instancetype) init\n{\n if (self = super) {\n _imageView = ...\n [self addSubview:_imageView];\n }\n}\n\n...\n- (void)layoutSubviews\n{\n [super layoutSubviews];\n\n _imageView.frame = self.bounds;\n}\n\n..\n</code></pre>\n<p>In my MyViewController, I want to trigger some image animation, i.e shrinking in size:</p>\n<pre><code>-(void)viewDidLoad\n{\n _dwellTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(animateView) userInfo:nil repeats:NO];\n}\n\n- (void)animateView\n{\n [myView animateOnImage];\n}\n</code></pre>\n<p>In MyView class, animation doesn't seem to work when I set <code>_imageView</code>'s frames, but when I set its opacity like <code>.alpha</code> or <code>.layer.cornerRadius</code>, it works just fine. The resources I came across online suggested that <code>_imageView</code> has Auto Layout constraints and its frame is still controlled by I have specified in <code>layoutSubviews</code>. The animation seems to always end in Auto Layout.</p>\n<pre><code>-(void)animateOnImage {\n [UIView animateWithDuration:2 animations:^{\n [self shrinkImageView];\n }];\n}\n\n- (void)shrinkImageView {\n // Doesn't work\n _imageView.frame = CGRectMake(100, 100, 400, 500);\n // Works\n _imageView.alpha = 0.5;\n}\n</code></pre>\n"^^ . "I cannot access the access token in SessionManager on Spotift IOS SDK"^^ . . . . "file-upload"^^ . "1"^^ . . . . . . . "<p>I am developing an app using Ionic Angular, and I am using a camera preview plugin to display the camera feed. I made modifications in the native code (Objective-C) to use the <code>AVCaptureDeviceTypeBuiltInTripleCamera</code> for newer iPhones. The camera works as expected, but the preview is always rotated like landscape mode.</p>\n<p>I want to ensure the camera always displays in portrait orientation, regardless of the device's physical orientation.</p>\n<p><strong>Here’s what I’ve done so far:</strong></p>\n<pre><code>- (void)startCamera:(CDVInvokedUrlCommand*)command {\n CDVPluginResult *pluginResult;\n\n if (self.sessionManager != nil) {\n pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@&quot;Camera already started!&quot;];\n [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];\n return;\n }\n\n if (command.arguments.count &gt; 3) {\n CGFloat x = (CGFloat)[command.arguments[0] floatValue] + self.webView.frame.origin.x;\n CGFloat y = (CGFloat)[command.arguments[1] floatValue] + self.webView.frame.origin.y;\n CGFloat width = (CGFloat)[command.arguments[2] floatValue];\n CGFloat height = (CGFloat)[command.arguments[3] floatValue];\n NSString *defaultCamera = command.arguments[4];\n BOOL tapToTakePicture = (BOOL)[command.arguments[5] boolValue];\n BOOL dragEnabled = (BOOL)[command.arguments[6] boolValue];\n BOOL toBack = (BOOL)[command.arguments[7] boolValue];\n CGFloat alpha = (CGFloat)[command.arguments[8] floatValue];\n BOOL tapToFocus = (BOOL) [command.arguments[9] boolValue];\n BOOL disableExifHeaderStripping = (BOOL) [command.arguments[10] boolValue]; // ignore Android only\n self.storeToFile = (BOOL) [command.arguments[11] boolValue];\n\n // Create the session manager\n self.sessionManager = [[CameraSessionManager alloc] init];\n\n // render controller setup\n self.cameraRenderController = [[CameraRenderController alloc] init];\n self.cameraRenderController.dragEnabled = dragEnabled;\n self.cameraRenderController.tapToTakePicture = tapToTakePicture;\n self.cameraRenderController.tapToFocus = tapToFocus;\n self.cameraRenderController.sessionManager = self.sessionManager;\n self.cameraRenderController.view.frame = CGRectMake(x, y, width, height);\n self.cameraRenderController.delegate = self;\n\n [self.viewController addChildViewController:self.cameraRenderController];\n\n if (toBack) {\n // Display the camera below the webview\n\n // Make transparent\n self.webView.opaque = NO;\n self.webView.backgroundColor = [UIColor clearColor];\n\n [self.webView.superview addSubview:self.cameraRenderController.view];\n [self.webView.superview bringSubviewToFront:self.webView];\n } else {\n self.cameraRenderController.view.alpha = alpha;\n [self.webView.superview insertSubview:self.cameraRenderController.view aboveSubview:self.webView];\n }\n\n // Setup session with ultra-wide or default camera\n self.sessionManager.delegate = self.cameraRenderController;\n\n [self.sessionManager setupSession:defaultCamera completion:^(BOOL started) {\n if (started) {\n // Configure ultra-wide camera if session started successfully\n [self.sessionManager configureUltraWideCamera];\n\n [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK] callbackId:command.callbackId];\n } else {\n [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@&quot;Failed to start camera&quot;] callbackId:command.callbackId];\n }\n }];\n\n } else {\n pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@&quot;Invalid number of parameters&quot;];\n [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];\n }\n}\n\n</code></pre>\n<p>its rotating only when i call <strong>[self.sessionManager configureUltraWideCamera];</strong></p>\n<pre><code>- (void)configureUltraWideCamera {\n NSError *error = nil;\n\n // Find an AVCaptureDevice of type ultra-wide camera\n AVCaptureDevice *ultraWideCamera = [AVCaptureDevice defaultDeviceWithDeviceType:AVCaptureDeviceTypeBuiltInTripleCamera\n mediaType:AVMediaTypeVideo\n position:AVCaptureDevicePositionBack];\n\n if (ultraWideCamera) {\n AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:ultraWideCamera error:&amp;error];\n\n if (!error &amp;&amp; input) {\n [self.session beginConfiguration]; // Begin session reconfiguration\n [self.session removeInput:self.videoDeviceInput]; // Remove current input\n if ([self.session canAddInput:input]) {\n [self.session addInput:input]; // Add ultra-wide input\n self.videoDeviceInput = input; // Update the input property \n\n // Commit the session configuration\n [self.session commitConfiguration];\n [self.session startRunning];\n\n \n\n NSLog(@&quot;Switched to Ultra-Wide Camera and locked orientation to portrait&quot;);\n } else {\n [self.session commitConfiguration];\n NSLog(@&quot;Cannot add ultra-wide camera input to the session&quot;);\n }\n } else {\n NSLog(@&quot;Error creating input for ultra-wide camera: %@&quot;, error.localizedDescription);\n }\n } else {\n NSLog(@&quot;Ultra-Wide Camera is not supported on this device&quot;);\n }\n}\n</code></pre>\n<p>Modified the plugin's Objective-C code to use <code>AVCaptureDeviceTypeBuiltInTripleCamera</code> to enable the ultra-wide camera for newer iPhones.</p>\n"^^ . . . . . "As the table view shows the selected content of a source list (another view), the arrows keys should navigate the source list, even if the focus is on the table view (trust me, it makes sense UI-wise). I can subclass if there is no simpler alternative."^^ . . "0"^^ . . . . "scorm"^^ . . . "NSTableView dragImageForRowsWithIndexes: produces a blank image"^^ . "0"^^ . . "<p>So I have a view-based NSTableView whose contents are stored in an NSMutableArray. Basically I created a table view in the storyboard and inserted a control of type &quot;Image and Text Table CellView&quot;, this table just holds a string and an image, for this example it's just a quiz and a grade:</p>\n<p><a href="https://i.sstatic.net/4XUKYOLj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4XUKYOLj.png" alt="table" /></a></p>\n<p>Now I would like to somehow implement a function to allow me to edit these two strings, the <strong>NSTableViewDataSource</strong> has this method called <a href="https://developer.apple.com/documentation/appkit/nstableviewdatasource/tableview(_:setobjectvalue:for:row:)?language=objc" rel="nofollow noreferrer">tableView:setObjectValue:forTableColumn:row:</a> but it states that it should not be used for view-based tables and that I should instead use:</p>\n<blockquote>\n<p>target/action to set each item in the view cell.</p>\n</blockquote>\n<p>But what does that mean exactly? Am I supposed to subclass NSTableView?</p>\n"^^ . . "<p>If you are compiling against an older SDK which does not know about newer APIs, then @available won't work, because the compiler still needs to know the method it's calling.</p>\n<p>Normally, you would do this once you switch to a newer SDK (i.e. newer Xcode).</p>\n<p>You can forcibly declare the method though, if you need to enable building with SDKs (i.e. using an older Xcode). You can check if you are compiling against an SDK older than the API in question, and if so, declare it the same way Apple does. This can go in your .m file so only the code that needs it can &quot;see&quot; it, or more publicly if you need the @available check across several files.</p>\n<pre><code>#if TARGET_OS_OSX &amp;&amp; (!defined(__MAC_15_0) || __MAC_OS_X_VERSION_MAX_ALLOWED &lt; __MAC_15_0)\n@interface NSCursor (ForwardDeclaration15_0_Methods)\n@property (class, readonly, strong) NSCursor *columnResizeCursor NS_SWIFT_NAME(columnResize) API_AVAILABLE(macos(15.0));\n@end\n#endif\n</code></pre>\n<p>After that, the compiler knows about the method, and the code you had above should work, even with an older Xcode. The name of the category does not matter (though best to avoid duplicating another one).</p>\n"^^ . . "4"^^ . . "1"^^ . "0"^^ . . . "<blockquote>\n<p>am I doing this right or is there another way to get this side bar?</p>\n</blockquote>\n<p>Yes. The other way is to build a custom split view from <code>NSView</code>s.</p>\n<blockquote>\n<p>Do I really have to manually add a toolbar item with a target/action to make this work on appkit?</p>\n</blockquote>\n<p>Yes. The target is the <code>NSSplitViewController</code> and the action is <code>toggleSidebar(_:)</code>.</p>\n"^^ . . . "1"^^ . . . . . . "1"^^ . "0"^^ . . . "BTW - ASCII is a subset of UTF-8. If the file is ASCII, decoding as UTF-8 will succeed."^^ . . . . . "1"^^ . . . . . "<p>I want to use Appkit/Cocoa to create a split view with a side bar, I have this sample code in SwiftUI that does that:</p>\n<pre class="lang-swift prettyprint-override"><code>import SwiftUI\n\nstruct ContentView: View {\n var body: some View {\n NavigationSplitView {\n // Sidebar\n List {\n NavigationLink(&quot;Item 1&quot;, value: &quot;Item 1 Details&quot;)\n NavigationLink(&quot;Item 2&quot;, value: &quot;Item 2 Details&quot;)\n NavigationLink(&quot;Item 3&quot;, value: &quot;Item 3 Details&quot;)\n }\n .navigationTitle(&quot;Items&quot;)\n } content: {\n // Main content (detail view for selected item)\n Text(&quot;Select an item to see details.&quot;)\n .padding()\n } detail: {\n // Detail view (for the selected item)\n Text(&quot;Select an item from the sidebar to view details.&quot;)\n .padding()\n }\n }\n}\n\nstruct MyApp: App {\n var body: some Scene {\n WindowGroup {\n ContentView()\n }\n }\n}\n</code></pre>\n<p><a href="https://i.sstatic.net/gY7FLzAI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gY7FLzAI.png" alt="enter image description here" /></a></p>\n<p>Now, for AppKit I tried using an NSSplitViewController:</p>\n<p><a href="https://i.sstatic.net/pB6Cc26f.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/pB6Cc26f.png" alt="enter image description here" /></a></p>\n<pre class="lang-objectivec prettyprint-override"><code>@interface SplitViewController : NSSplitViewController&lt;NSSplitViewDelegate&gt;\n\n@property (strong) IBOutlet NSSplitView *splitView;\n\n@property (weak) IBOutlet NSSplitViewItem *sideBarView;\n@property (weak) IBOutlet NSSplitViewItem *rightView;\n\n-(IBAction)hideSideBarNow:(id)sender;\n\n@end\n</code></pre>\n<p>Notice that I also had to manually add a ToolbarItem with the 'sidebar.left' icon that calls a method to collapse the view when clicked:</p>\n<p><a href="https://i.sstatic.net/kEwx177b.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/kEwx177b.png" alt="enter image description here" /></a></p>\n<pre class="lang-objectivec prettyprint-override"><code>-(void)hideSideBarNow:(id)sender\n{\n static BOOL isCollapsing = YES;\n [[[[self splitViewItems] firstObject] animator] setCollapsed:isCollapsing];\n \n isCollapsing = !isCollapsing;\n}\n</code></pre>\n<p>This works fine and all but I noticed the button looks a bit different if you compare it to the SwiftUI version or any other macOS applications. So I wonder am I doing this right or is there another way to get this side bar? Do I really have to manually add a toolbar item with a target/action to make this work on appkit?</p>\n<p>I know that I could use <a href="https://developer.apple.com/documentation/swiftui/nshostingcontroller" rel="nofollow noreferrer">NSHostingController</a> to use a SwiftUI controller but I want to do it with Appkit/Cocoa only.</p>\n"^^ . . "2"^^ . "async-await"^^ . "3"^^ . . . . . . "0"^^ . . . . . "Try removing all of the `NSPasteboardItem` code and simply do `[pasteboard writeObject:@[ url ]];`. `NSURL` conforms to `NSPasteboardWriting`."^^ . . . . . . . "0"^^ . . . . . . "<p>I have a mobile app that uses for taking voice calls between two parties via VoIP protocol. That was worked until iOS 16 and now it is giving one way audio issues. That means when I try to take a call to another user, sometimes that user cannot hear my voice. This is sporadic and it activates the audio when I toggle the speaker button. So I am using PortSIP (licensed) SDK for SIP connections and RNCallKeep library to handle CallKit operations. I have tried activating audio using AVAudioSession's <code>[audioSession setActive:YES error:nil]</code> but no any improvements either. Also tried to set Configurations manually to</p>\n<pre><code> BOOL success = [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord\n mode:AVAudioSessionModeVoiceChat\n options:AVAudioSessionCategoryOptionAllowBluetooth\n error:&amp;error];\n</code></pre>\n<p>But still I have the issues.</p>\n<p>Then I tried to set configs to the RNCallKeep like below.</p>\n<pre><code> NSDictionary *audioSession = @{\n @&quot;categoryOptions&quot;: @(AVAudioSessionCategoryOptionAllowBluetooth),\n @&quot;mode&quot;: AVAudioSessionModeVoiceChat\n };\n \n [RNCallKeep setup:@{\n @&quot;appName&quot;: @&quot;My App&quot;,\n @&quot;maximumCallGroups&quot;: @1,\n @&quot;maximumCallsPerCallGroup&quot;: @1,\n @&quot;includesCallsInRecents&quot;: @NO,\n @&quot;supportsVideo&quot;: @NO,\n @&quot;imageName&quot;: @&quot;app-icon.png&quot;,\n @&quot;audioSession&quot;: audioSession\n }];\n</code></pre>\n<p>Still no any improvements.</p>\n<p>When I tried to run <code>RNCallKeep.setAudioRoute(systemId, audioRouteName);</code> with below parameters to forcefully set the audio route to phone. But still having issues with it.</p>\n<pre><code>RNCallKeep.setAudioRoute(&lt;some id&gt;,&quot;phone&quot;);\n</code></pre>\n<p>So can anyone help me to get through this. Thank you.</p>\n"^^ . "<p>Recently, in Swift 5.9 I think Apple released support for interoperability between Swift and Objective-C++/C++. I'm currently working on a project that has a lot of Swift, Objective-C and Objective-C++/C++ and not being able to interoperate between Swift and C++ has always been a sticking point requiring an array messy wrappers. In the spirit of this, I updated my project's Swift version to Swift 6 to support this.</p>\n<p>The last setting I needed to change was <strong>C++ and Objective-C Interoperability</strong> from C/Objective-C to C++/Objective-C++. Doing this though created numerous errors of the variety of</p>\n<pre><code>/Users/---/Bridging-Header.h:7:9 failed to emit precompiled header '/Users/---/Library/Developer/Xcode/DerivedData/Project-akhczzqbkaltwdgzmryrlhcpnduq/Build/Intermediates.noindex/PrecompiledHeaders/Bridging-Header-swift_3CPL2KPLMYXOU-clang_35SMM50I2WP8K.pch' for bridging header '---/Bridging-Header.h'\n</code></pre>\n<p>Note: sensitive file paths have been omitted and replaced with ---</p>\n<p>I've tried playing with various related build settings to get rid of these errors but all to no avail.</p>\n<p><strong>How do I properly update my project to avoid these errors and fully support Objective-C++/C++ interoperability?</strong></p>\n"^^ . . . . "0"^^ . . . . . "0"^^ . "0"^^ . . "0"^^ . . . "1"^^ . "ionic-framework"^^ . . . . . . . . "conditional-binding"^^ . "<p>I'm trying to debug incoming MMC &quot;locate&quot; messages that are being sent from Pro Tools to my macOS app. I can't parse the bytes I'm receiving - they seem to be encoded or wrapped or something.</p>\n<p>My development environment is: macOS Sequoia, Xcode 16.1, targeted minimum deployment macOS 13.5, Objective-C.</p>\n<p>I've defined my input port using Core MIDI, like this:</p>\n<pre><code>MIDIInputPortCreateWithProtocol(client, CFSTR(&quot;Input port&quot;), kMIDIProtocol_1_0, &amp;inPort, gReceiveBlock);\n</code></pre>\n<p>I get the MIDI message in my gReceiveBlock callback routine, so I know everything is setup properly (endpoints, ports, MMC ID, etc). But the bytes in the incoming packet don't line up with what is in the MIDI spec. I'm using the MIDI Monitor app to sniff messages, and it shows the packet sent from Pro Tools:</p>\n<pre class="lang-none prettyprint-override"><code>16:48:30.173 From IAC Driver Bus 1 SysEx Universal Real Time 13 bytes F0 7F 01 06 44 06 01 01 01 0F 23 00 F7 \n</code></pre>\n<p>But in my app, when I examine the packet, I see:</p>\n<pre class="lang-none prettyprint-override"><code>\n timeStamp MIDITimeStamp 0x0000000000000000\n wordCount UInt32 0x00000004\n words UInt32[64] \n [0] UInt32 0x<b>3016</b>7f01\n [1] UInt32 0x06440601\n [2] UInt32 0x<b>3035</b>0101\n [3] UInt32 0x0f<b>210000</b>\n</code></pre>\n<p>I've bolded the bytes that don't match between MIDI Monitor's &quot;words&quot; buffer and mine. Specifically, in my buffer the first byte is not a SysEx byte (0xF0), there are extra bytes inserted between the control bytes and the timecode bytes, the frames value of the timecode bytes is incorrect, and there's no ending byte (0xF7).</p>\n<p>Here's the code that receives the bytes:</p>\n<pre><code>MIDIReceiveBlock const gReceiveBlock = ^(const MIDIEventList *eventList, void *srcConnRefCon) {\n // Process each packet in the event list\n const MIDIEventPacket *packet = &amp;eventList-&gt;packet[0];\n for (int i = 0; i &lt; eventList-&gt;numPackets; ++i) {\n // Get the MIDI words (32-bit data chunks)\n for (int w = 0; w &lt; packet-&gt;wordCount; ++w) {\n uint32_t word = packet-&gt;words[w];\n // Process the packet\n }\n packet = MIDIEventPacketNext(packet);\n }\n};\n</code></pre>\n<p>What am I not getting? BTW I tried changing <code>kMIDIProtocol_1_0</code> to <code>kMIDIProtocol_2_0</code> when creating the input port, but same result.</p>\n"^^ . "https://developer.apple.com/documentation/security/trust-result-dictionary-keys you just need check value of `kSecTrustCertificateTransparency` flag"^^ . . "<p>If I understand the goal of your <code>visibleRange</code> method, the following code (converted to a category on <code>UITextView</code>) seems to be what you are looking for using TextKit 2 code:</p>\n<pre class="lang-objectivec prettyprint-override"><code>@interface UITextView (MyApp)\n\n- (NSRange)visibleRange; // TextKit 1 code\n- (NSRange)visibleRange2; // TextKit 2 code\n\n@end\n\n@implementation UITextView (MyApp)\n\n// Your original TextKit 1 code\n- (NSRange)visibleRange {\n // Get the layout manager associated with the text view\n NSLayoutManager *layoutManager = self.layoutManager;\n\n // Get the visible rectangle of the text view\n CGRect visibleRect = self.bounds;\n\n // Convert the visible rectangle into a glyph range\n NSRange glyphRange = [layoutManager glyphRangeForBoundingRect:visibleRect\n inTextContainer:self.textContainer];\n\n // Convert the glyph range into a character range and return it\n return [layoutManager characterRangeForGlyphRange:glyphRange actualGlyphRange:NULL];\n}\n\n// Updated to use TextKit 2\n- (NSRange)visibleRange2 {\n NSTextLayoutManager *layoutManager = self.textLayoutManager;\n NSTextViewportLayoutController *controller = layoutManager.textViewportLayoutController;\n // Get the text range visible in the viewport\n NSTextRange *range = controller.viewportRange;\n if (range.isEmpty) {\n return NSMakeRange(0, 0);\n } else {\n id&lt;NSTextLocation&gt; start = range.location;\n id&lt;NSTextLocation&gt; end = range.endLocation;\n // Convert the abstract text locations into offset indexes to the actual text\n NSInteger si = [layoutManager offsetFromLocation:layoutManager.documentRange.location toLocation:start];\n NSInteger ei = [layoutManager offsetFromLocation:layoutManager.documentRange.location toLocation:end];\n\n // Return the indexes as a start and length\n return NSMakeRange(si, ei - si);\n }\n}\n\n@end\n</code></pre>\n<p>With this category you can call <code>visibleRange</code> or <code>visibleRange2</code> directly on your <code>UITextView</code>. Only call one or the other, not both. If you call <code>visibleRange</code> before calling <code>visibleRange2</code>, <code>visibleRange2</code> will return an empty result due to the fallback to TextKit 1. At least this is true when running the Mac Catalyst version of the app.</p>\n<p>Apple's sample app <a href="https://developer.apple.com/documentation/uikit/textkit/using_textkit_2_to_interact_with_text?language=objc" rel="nofollow noreferrer">Using TextKit 2 to interact with text</a> provides some useful code to help figure out this API.</p>\n"^^ . . . . "xcode"^^ . "crash"^^ . . "<p>So in swift there are &quot;lazy vars&quot; so I wanted to try the same thing in objective-c.</p>\n<p>Say I have a class with the following property:</p>\n<pre><code>@interface MainWindowController : NSWindowController&lt;NSWindowDelegate&gt;\n\n@property(nonatomic, strong) NSTabViewController *tabViewController;\n\n@end\n</code></pre>\n<p>After reading multiple questions here I noticed that people are <a href="https://stackoverflow.com/a/4142614/20276285">always</a> encouraged to access properties via :</p>\n<pre><code>self.tabViewController\n</code></pre>\n<p>rather than:</p>\n<pre><code>_tabViewController\n</code></pre>\n<p>but if I want to use lazy instantiation for this property I am pretty much compelled to use the backing ivar am I right? Like for the getter:</p>\n<pre><code>(NSTabViewController *)tabViewController\n{\n if( !_tabViewController )\n {\n _tabViewController = [[NSTabViewController alloc] init];\n // ...\n }\n \n return _tabViewController;\n}\n</code></pre>\n<p>if I use self.tabViewController here in the if statement it would recursively call the getter forever.</p>\n<p>Is this considered a correct usage of <code>_ivar</code> instead of <code>self.ivar</code>?</p>\n"^^ . . . . "1"^^ . . . . . . . . . . . "0"^^ . "<p>I have tried this which doesn't work:</p>\n<pre><code> NSString *string = @&quot;Click Here&quot;;\n NSURL *url = [NSURL URLWithString:@&quot;https://google.com&quot;];\n\n // Get the shared pasteboard\n NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];\n\n // Create a new pasteboard item\n NSPasteboardItem *item = [[NSPasteboardItem alloc] init];\n [item setString:string forType:NSPasteboardTypeString];\n [item setString:url.absoluteString forType: @&quot;org.chromium.source-url&quot;];\n\n // Clear the pasteboard and write the new item\n [pasteboard clearContents];\n [pasteboard writeObjects:@[item]];\n NSLog(@&quot;Hyperlink copied to pasteboard: %@ -&gt; %@&quot;, string, url);\n</code></pre>\n<p>I have also tried this which doesn't work:</p>\n<pre><code>NSString *string = @&quot;Click Here&quot;;\n NSURL *url = [NSURL URLWithString:@&quot;https://google.com&quot;];\n\n // Get the shared pasteboard\n NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];\n\n // Create a new pasteboard item\n NSPasteboardItem *item = [[NSPasteboardItem alloc] init];\n [item setString:string forType:NSPasteboardTypeString];\n [item setString:url.absoluteString forType:NSPasteboardTypeURL];\n\n // Clear the pasteboard and write the new item\n [pasteboard clearContents];\n [pasteboard writeObjects:@[item]];\n NSLog(@&quot;Hyperlink copied to pasteboard: %@ -&gt; %@&quot;, string, url);\n</code></pre>\n<p>I only get a string to paste.</p>\n"^^ . "1"^^ . . . . "<p>I definitely remember being able to jump to definitions of system classes (e. g. <code>NSWindow</code>) in past versions of Xcode. Not in 16.2. Is that a setting that needs to be enabled, or something is broken in my setup, or is it an intentional change in functionality?</p>\n<p>EDIT: seems like something is broken in my Xcode setup. It jumps as expected to definitions of <em>my</em> classes, but not to the definitions of <em>framework</em> classes. Almost as if there is an index that enables the jumping logic, and it needs to be rebuilt for the MacOS SDK itself...</p>\n"^^ . "null"^^ . "widget"^^ . "<p>So basically I have this empty view with an <a href="https://developer.apple.com/documentation/appkit/nsprogressindicator?language=objc" rel="nofollow noreferrer">NSProgressIndicator</a>:</p>\n<pre><code>@interface TestVC : NSViewController\n\n@property IBOutlet NSProgressIndicator *progress;\n\n@end\n</code></pre>\n<p>I want to make it really big like say 300x300, but Xcode only allows a &quot;Small&quot; or a &quot;Regular&quot; size:</p>\n<p><a href="https://i.sstatic.net/gYvr7omI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gYvr7omI.png" alt="enter image description here" /></a></p>\n<p>I tried changing the frame in the awakeFromNib function:</p>\n<pre><code>-(void)awakeFromNib\n{\n NSRect customFrame = NSMakeRect(50, 50, 300, 300);\n [progress setFrame:customFrame];\n}\n</code></pre>\n<p>but it doesn't work, is there any way to arbitrarily scale an NSProgressIndicator?</p>\n<p>I also tried subclassing it:</p>\n<pre><code>@implementation CustomProgressBar\n\n- (void)drawRect:(NSRect)dirtyRect\n{\n [super drawRect:dirtyRect];\n}\n\n-(void)awakeFromNib\n{\n [super awakeFromNib];\n [self setFrameSize:NSMakeSize(300, 300)]; \n}\n\n@end\n</code></pre>\n"^^ . . . . "0"^^ . . "This should not be a subclass of `UIColor`. It should subclass `NSObject`. It's just a class that happens to have four `UIColor` properties. This subclass does not pass the classic "is a" relationship."^^ . . . . . . "keydown"^^ . . . "xcode16"^^ . . "One way Audio issues in iOS 18.2 on call apps"^^ . . "0"^^ . "Why is Clang adding underscore suffixes to Objective-C parameter names in autogenerated headers"^^ . . . "@Willeke as in the controller itself doesn't change at all. From what I've seen so far it seems that it's not possible to customize NSProgressIndicator."^^ . "concurrency"^^ . "0"^^ . . "swift"^^ . . . . "0"^^ . . . . . . . "0"^^ . . . . "How to migrate the NCWidgetProviding to WidgetKit in Objective-C iOS app"^^ . . . . . . "<p>I want to implement an addon using Rust to expose an addListener API. When I modify the system's time zone, I can receive a callback.\nusing <a href="https://crates.io/crates/core-foundation-sys" rel="nofollow noreferrer">core_foundation_sys</a> and <a href="https://neon-rs.dev/" rel="nofollow noreferrer">neon</a>\nThe code is as follows:</p>\n<pre><code>extern &quot;C&quot; fn notification_callback(\n _center: notification_center::CFNotificationCenterRef,\n _observer: *mut c_void,\n _name: notification_center::CFNotificationName,\n _object: *const c_void,\n _user_info: CFDictionaryRef,\n) {\n println!(&quot;timezone_change&quot;);\n}\n\nfn init_notification {\n unsafe {\n let center = notification_center::CFNotificationCenterGetLocalCenter();\n let observer = &amp;Observer as *const _ as *mut c_void;\n let name = CFStringCreateWithCString(\n kCFAllocatorDefault,\n b&quot;kCFTimeZoneSystemTimeZoneDidChangeNotification\\0&quot;.as_ptr() as *const i8,\n kCFStringEncodingUTF8,\n );\n let object = ptr::null();\n let suspension_behavior: isize =\n CFNotificationSuspensionBehaviorDeliverImmediately as isize;\n notification_center::CFNotificationCenterAddObserver(\n center,\n observer,\n notification_callback,\n name,\n object,\n suspension_behavior,\n );\n\n // Run the main loop to keep the application alive and responsive to notifications\n CFRunLoopRun();\n }\n}\nfn add_date_listener(mut cx: FunctionContext) -&gt; JsResult&lt;JsUndefined&gt; {\n let cb_name_js = &amp;cx.argument::&lt;JsString&gt;(0)?;\n let cb_name = cb_name_js.value(&amp;mut cx);\n\n if cb_name == &quot;timezone_change&quot; {\n init_notification();\n TimeZoneChangeEvent::new(cx)\n } else {\n Ok(cx.undefined())\n }\n}\n\nfn create_date_module(cx: &amp;mut ModuleContext) -&gt; NeonResult&lt;()&gt; {\n let date = cx.empty_object();\n let get_timezone_fn = JsFunction::new(cx, get_timezone)?;\n let add_date_listener_fn = JsFunction::new(cx, add_date_listener)?;\n date.set(cx, &quot;getTimeZone&quot;, get_timezone_fn)?;\n date.set(cx, &quot;addListener&quot;, add_date_listener_fn)?;\n cx.export_value(&quot;date&quot;, date)?;\n\n Ok(())\n}\n\n#[neon::main]\nfn main(mut cx: ModuleContext) -&gt; NeonResult&lt;()&gt; {\n create_date_module(&amp;mut cx)?;\n Ok(())\n}\n\n</code></pre>\n<p>nodejs usage:</p>\n<pre><code>const addon = require('dist/x.node');\naddon.date.addListener('timezone_change', () =&gt; {\n console.log(timezone_change);\n})\n</code></pre>\n<p>print: timezone_change\nBut I can't do anything else because the main thread of Node.js is blocked.</p>\n<p>I have tried the following:\nModify init_notification to the following code:</p>\n<pre><code>fn init_notification() {\n thread::spawn(move || {\n unsafe {\n let center = notification_center::CFNotificationCenterGetLocalCenter();\n let observer = &amp;Observer as *const _ as *mut c_void;\n let name = CFStringCreateWithCString(\n kCFAllocatorDefault,\n b&quot;kCFTimeZoneSystemTimeZoneDidChangeNotification\\0&quot;.as_ptr() as *const i8,\n kCFStringEncodingUTF8,\n );\n let object = ptr::null();\n let suspension_behavior: isize =\n CFNotificationSuspensionBehaviorDeliverImmediately as isize;\n notification_center::CFNotificationCenterAddObserver(\n center,\n observer,\n notification_callback,\n name,\n object,\n suspension_behavior,\n );\n\n // Run the main loop to keep the application alive and responsive to notifications\n CFRunLoopRun();\n }\n });\n}\n\n</code></pre>\n<p>The result is that no notification was received,How to achieve receiving notifications without blocking the main process of Node.js?</p>\n"^^ . . "1"^^ . "0"^^ . . . "0"^^ . . "<p>We’re using a UIColor subclass with three public properties (hovered, pressed, disabled) and one private property (idle) to model stateful colors. The idle state is considered the default color for any reference to an instance of this subclass.</p>\n<p>This implementation has worked very well for our needs. However, as we added dark mode support, we noticed an issue: while all colors update automatically in response to trait changes (e.g., dark mode), the default idle color does not.</p>\n<p>Interestingly, when we experimented with exposing idle as a public property, it updated correctly in dark mode. This makes us suspect that there’s an issue with how the idle property is resolved internally in our subclass.</p>\n<p>Below is the relevant implementation:</p>\n<pre><code>@interface CUIColorVariant : UIColor\n\n@property (nonatomic, readonly) UIColor *hovered;\n@property (nonatomic, readonly) UIColor *pressed;\n@property (nonatomic, readonly) UIColor *disabled;\n\n- (instancetype)initWithIdle:(UIColor *)idle hovered:(UIColor *)hovered pressed:(UIColor *)pressed disabled:(UIColor *)disabled;\n\n@end\n\n\n@interface CUIColorVariant ()\n\n@property (nonatomic, strong) UIColor *idle;\n\n@end\n\n@implementation CUIColorVariant\n\n- (instancetype)initWithIdle:(UIColor *)idle hovered:(UIColor *)hovered pressed:(UIColor *)pressed disabled:(UIColor *)disabled {\n self = [super init];\n if (self) {\n _idle = idle;\n _hovered = hovered;\n _pressed = pressed;\n _disabled = disabled;\n }\n return self;\n}\n\n#pragma mark - Required UIColor methods\n\n- (CGColorRef)CGColor {\n return self.idle.CGColor;\n}\n\n- (CIColor *)CIColor {\n return self.idle.CIColor;\n}\n\n- (void)set {\n [self.idle set];\n}\n\n- (void)setFill {\n [self.idle setFill];\n}\n\n- (void)setStroke {\n [self.idle setStroke];\n}\n\n- (UIColor *)colorWithAlphaComponent:(CGFloat)alpha {\n return [self.idle colorWithAlphaComponent:alpha];\n}\n\n- (UIColor *)resolvedColorWithTraitCollection:(UITraitCollection *)traitCollection {\n return [self.idle resolvedColorWithTraitCollection:traitCollection];\n}\n\n- (BOOL)getWhite:(nullable CGFloat *)white alpha:(nullable CGFloat *)alpha {\n return [self.idle getWhite:white alpha:alpha];\n}\n\n- (BOOL)getHue:(nullable CGFloat *)hue saturation:(nullable CGFloat *)saturation brightness:(nullable CGFloat *)brightness alpha:(nullable CGFloat *)alpha {\n return [self.idle getHue:hue saturation:saturation brightness:brightness alpha:alpha];\n}\n\n- (BOOL)getRed:(nullable CGFloat *)red green:(nullable CGFloat *)green blue:(nullable CGFloat *)blue alpha:(nullable CGFloat *)alpha {\n return [self.idle getRed:red green:green blue:blue alpha:alpha];\n}\n\n#pragma mark - Required NSObject methods\n\n- (BOOL)isEqual:(id)object {\n if ([object isKindOfClass:CUIColorVariant.class]) {\n return [self.idle isEqual:[(CUIColorVariant*)object idle]]\n &amp;&amp; [self.hovered isEqual:[(CUIColorVariant*)object hovered]]\n &amp;&amp; [self.pressed isEqual:[(CUIColorVariant*)object pressed]]\n &amp;&amp; [self.disabled isEqual:[(CUIColorVariant*)object disabled]];\n } else {\n return NO;\n }\n}\n\n- (void)forwardInvocation:(NSInvocation *)invocation {\n SEL aSelector = [invocation selector];\n\n if ([self.idle respondsToSelector:aSelector]) {\n [invocation invokeWithTarget:self.idle];\n } else {\n [super forwardInvocation:invocation];\n }\n}\n\n-(NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector {\n if ([self.idle respondsToSelector:aSelector]) {\n return [[self idle] methodSignatureForSelector:aSelector];\n } else {\n return [super methodSignatureForSelector:aSelector];\n }\n}\n\n- (NSUInteger)hash {\n return self.idle.hash ^ self.hovered.hash ^ self.pressed.hash ^ self.disabled.hash;\n}\n\n- (id)copy {\n return [[CUIColorVariant alloc] initWithIdle:[_idle copy] hovered:[_hovered copy] pressed:[_pressed copy] disabled:[_disabled copy]];\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n return [[CUIColorVariant allocWithZone:zone] initWithIdle:[_idle copyWithZone:zone]\n hovered:[_hovered copyWithZone:zone]\n pressed:[_pressed copyWithZone:zone]\n disabled:[_disabled copyWithZone:zone]];\n}\n@end\n</code></pre>\n<p>We suspect the issue might be related to how the UIColor dynamic resolving mechanism interacts with our subclass, but we’re not entirely sure where the problem lies.</p>\n<p>Observations</p>\n<ol>\n<li>If we expose the idle property publicly, it updates correctly in dark mode.</li>\n<li>Other stateful colors (hovered, pressed, disabled) update as expected.</li>\n<li>The idle property is initialized dynamically, but it seems to resolve statically when used as the default color for the subclass.</li>\n<li>The hovered, focused, disabled properties are instances of <code>UIDynamicCatalogColor</code>, idle however is not (unless accessed directly via its property)</li>\n</ol>\n<p>Could this issue be related to how UIColor resolves dynamic colors internally? How can we ensure that the idle color dynamically updates in dark mode while still treating it as the default color for our subclass? Any clues or suggestions would be greatly appreciated.</p>\n<p>Thank you!</p>\n"^^ . . "<p>I am trying to prepare a Cocoa Swift / Objective-C GUI around a binary executable on macOS, and this binary executable is shipped with a <a href="https://webmin.com" rel="nofollow noreferrer">webmin</a> module to edit its configuration file. Would it be possible to run this module into <a href="https://webmin.com" rel="nofollow noreferrer">webmin</a> in a <a href="https://developer.apple.com/documentation/webkit/wkwebview?language=objc" rel="nofollow noreferrer">WKWebView</a> ? Thanks a lot for your attention and for any suggestion. I am not a skilled web developer so I really don't know how to convince :) <a href="https://developer.apple.com/documentation/webkit/wkwebview?language=objc" rel="nofollow noreferrer">WKWebView</a> to render cgi and perl. I can put all the webmin and webmin module files into the application bundle in a separate folder and point to that folder with a NSURLRequest. Something like:</p>\n<pre><code>// Mac WebMin\n//\n// Created by Alfonso Maria Tesauro on 18/12/24.\n//\n\n#import &lt;Cocoa/Cocoa.h&gt;\n#import &lt;WebKit/WebKit.h&gt;\n\n@interface AppDelegate : NSObject &lt;NSApplicationDelegate&gt;\n\n@property (assign) IBOutlet WKWebView *webMinWKWebView;\n\n\n@end\n\n//\n// AppDelegate.m\n// Mac WebMin\n//\n// Created by Alfonso Maria Tesauro on 18/12/24.\n//\n\n#import &quot;AppDelegate.h&quot;\n\n@interface AppDelegate ()\n\n@property (strong) IBOutlet NSWindow *window;\n\n@end\n\n@implementation AppDelegate\n\n- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application\n\n NSString *webminFolderPath = [[NSBundle mainBundle] pathForResource:@&quot;webMinFiles&quot; ofType:@&quot;&quot;];\n\nNSURL *webMinFilesURLInBundle = [NSURL fileURLWithPath:[webminFolderPath stringByAppendingPathComponent:@&quot;index.cgi&quot;]];\n\nNSURLRequest *webMinRequest = [[NSURLRequest alloc] initWithURL:webMinFilesURLInBundle];\n\n[self.webMinWKWebView loadRequest:webMinRequest];\n\n}\n\n\n- (void)applicationWillTerminate:(NSNotification *)aNotification {\n // Insert code here to tear down your application\n}\n\n\n- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app {\n return YES;\n}\n\n\n@end\n</code></pre>\n"^^ . . "0"^^ . "Standard C++ name mangling?"^^ . . "0"^^ . "0"^^ . . . . "0"^^ . "That only follows half of my answer. You also need to store the instance in an instance variable."^^ . "0"^^ . . . . . . "0"^^ . . . . "0"^^ . "3"^^ . . . "nstoolbar"^^ . . . "<p>I had a Swift method with a parameter called <code>module</code>. I noticed that the <code>[Project]-Swift.h</code> autogenerated header renamed that parameter to <code>module_</code> in the Objective-C signature for that method. After some more investigation, it looks like this is happening for C++ keywords:</p>\n<pre class="lang-swift prettyprint-override"><code>@objcMembers class SomeClass: NSObject {\n func someMethod(init: String) {}\n\n // ↓ These will append an underscore in the header file.\n func someMethod(template: String) {}\n func someMethod(consteval: String) {}\n}\n</code></pre>\n<p>becomes:</p>\n<pre class="lang-objectivec prettyprint-override"><code>SWIFT_CLASS(&quot;_TtC9iOSTester9SomeClass&quot;)\n@interface SomeClass : NSObject\n- (void)someMethodWithInit:(NSString * _Nonnull)init;\n- (void)someMethodWithTemplate:(NSString * _Nonnull)template_;\n- (void)someMethodWithConsteval:(NSString * _Nonnull)consteval_;\n- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;\n@end\n</code></pre>\n<p>Is this documented behaviour of the compiler or just some implementation detail? Why would it be necessary?</p>\n"^^ . . . "1"^^ . "Some people compile source code with Objective-C++. Probably to avoid keyword collisions, is my guess."^^ . . . . . . "Is this an existing project or new project? Do you have a pre-existing bridging header? If so, what headers are you importing in your bridging header?"^^ . "mac-catalyst"^^ . "2"^^ . "1"^^ . . "0"^^ . . "this problem is related to getting file types from web page itself @Willeke"^^ . "0"^^ . "0"^^ . "1"^^ . . . . "2"^^ . "0"^^ . "skia"^^ . . "Command-clicking on `NSWindow` jumps to the NSWindow class definition in the AppKit header. Option-clicking on `NSWindow` brings up a Quick Help pop-up about NSWindow; at the bottom of that pop-up is Open In Developer Documentation, and clicking that brings up the NSWindow entry in the documentation window. None of this seems very different from earlier versions. Is there something else you remember from earlier versions that's missing here? Perhaps you are wishing for the Symbol Navigator, which is indeed gone."^^ . . "<p>It is indeed a setting, in the Navigation preferences:</p>\n<p><a href="https://i.sstatic.net/e8Qlx9Rv.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/e8Qlx9Rv.png" alt="enter image description here" /></a></p>\n<p>When I command-click on NSWindow in this code...</p>\n<p><a href="https://i.sstatic.net/JpySAAs2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JpySAAs2.png" alt="enter image description here" /></a></p>\n<p>... I get this:</p>\n<p><a href="https://i.sstatic.net/QsdiPwqn.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/QsdiPwqn.png" alt="enter image description here" /></a></p>\n<p>I believe that's what you're looking for. I can't explain why that doesn't happen on your machine. I would suggest quitting Xcode and deleting the derived data and caches.</p>\n"^^ . . . . "I still see that and Jump To Definition at the top of that popup menu still works."^^ . "This all has to do with KVO change notifications. Assigning to `self.ivar` will fire them, while assigning to `_ivar` will not. Because KVO would access above getter, the lazy initialization should NOT fire a KVO notice. So in the `ivar` accessor replace all `self.ivar` with `_ivar`. However if you are also setting a derived `ivar2` in the accessor, for that you should use `self.ivar2`."^^ . . . . . "macOS 14 doesn't know about macOS 15 APIs, hence the error. Build with Xcode 16 on a Mac with macOS 15 to use macOS 15 APIs."^^ . . . . "<p>I'm trying to implement a custom sort for a column in an NSTableView. The data for this column contains double values inside a custom object, where some of the values are positive, some are negative, and some are &quot;not applicable&quot; (i.e. this row doesn't matter and should be sorted to the bottom).</p>\n<p>I've created a comparison method in my table view that looks like this...</p>\n<pre><code>- (NSComparisonResult) myCompare:(id) obj1 : (id) obj2 {\n\n if (obj1 &lt; obj2)\n return NSOrderedAscending;\n else if (obj1 &gt; obj2)\n return NSOrderedDescending;\n else\n return NSOrderedSame; // they must be the same\n};\n</code></pre>\n<p>...where the comparisons of obj1 and obj2 actually dig into the data of the objects being compared.</p>\n<p>In my storyboard, the Sort key for the column is: myObject</p>\n<p>And the selector for the column is: myCompare:</p>\n<p>Running the code and clicking on the column I wish to sort on results in:</p>\n<p>Thread 1: &quot;-[__NSCFNumber myCompare:]: unrecognized selector sent to instance 0x600003824740&quot;</p>\n<p>Obviously, things aren't set up quite right. I made some changes to my viewWillAppear method to set the sort descriptors, but the same error appears. How do I get my table view to recognize and call the custom sort routine?</p>\n"^^ . . . . . "No more "jump to definition" for system classes in Xcode?"^^ . . . "The project compiles and runs. Now that I look at it, same in an Objective C++ iOS project. Haven't tried with a Swift one. Looks like my Xcode is broken."^^ . . "1"^^ . . "0"^^ . . "Why do you care how Objective-C header is generated? That `module_` doesn't used anywhere. For me it looks like as minor bag. You can report it if you want."^^ . "What is the equivalent of SwiftUI NavigationSplitView and NavigationLink in Cocoa/Appkit?"^^ . "0"^^ . . "0"^^ . "Usually the key events are sent to the focused UI element. There is no simple way to change that."^^ . . . "0"^^ . . . . "0"^^ . . . "clang"^^ . "0"^^ . . . . . . . . "1"^^ . . . "I see. Then request to install certificate is right solution. You can use single CA authority for your servers and install CA's certificate. Also it's sound like that you have enterprise app and MDM solutions can help: for example install remotely you app already with certificate."^^ . "Reduced too much code for demonstrating the question object."^^ . "Swift ASCII string fails, but works in Objective-C"^^ . . . "0"^^ . . . "0"^^ . "0"^^ . . . . "`when accessed from Swift, they are ingested as non-optional` that is odd. They should be ingested as optionals or as undetermined. May be you have NS_ASSUME_NONNULL_BEGIN in bridging file, what is wrong."^^ . "1"^^ . . . "1"^^ . . . . . "1"^^ . . . . . "0"^^ . . . "That would be a different question. I'm responding to what you asked. I'm suggesting that you should complete revise your desires."^^ . . . "wkwebviewconfiguration"^^ . "1"^^ . "`NSTableView` does send unused keyDown events to the next responder. What are you trying to accomplish? Why don't you want to subclass `NSTableView`?"^^ . "0"^^ . "0"^^ . "2"^^ . . . . . . "0"^^ . "1"^^ . . . . "0"^^ . . "app-store"^^ . . . "automatic-ref-counting"^^ . . . . . . "<p>I have several <code>NSTableView</code> instances whose <code>draggingDestinationFeedbackStyle</code> is set to <code>NSTableViewDraggingDestinationFeedbackStyleGap</code>.</p>\n<p>The delegate method <code>tableView:validateDrop:proposedRow:proposedDropOperation:</code> returns <code>NSDragOperationMove</code>.</p>\n<p>When I drag a row upward, all the rows that are above the dragged row and below the destination move down, to create the &quot;gap&quot;, <em>except</em> the row just above the dragged row. This one never moves down. So the next row (which moves down as it should), overlap with the row that doesn't move down.</p>\n<p>(Moving a row downwards works as it should.)</p>\n<p>This has been happening on all macOS version I've tested (11 to 15) and in all table views that I tested (even in a test project that contains nothing but the table in a window).</p>\n<p>What am I doing wrong?</p>\n"^^ . "0"^^ . "1"^^ . . . . "Sorry I got confused. The code is NOT inside viewDidLoad, but inside a global free function."^^ . . "0"^^ . . . "Thanks, although it is just opening a file with a few digits, and I’m also supporting macOS before async/await"^^ . . . . . . . . "<p>It seems your application is using a framework that refers to an older version of the swift library. Also see the thread <a href="https://forums.developer.apple.com/forums/thread/687259" rel="nofollow noreferrer">here</a>, especially the following comment (quote):</p>\n<blockquote>\n<p>This issue happens for chained dependencies. Suppose you have App -&gt; A.framework -&gt; B.framework. If you change B's target OS version and rebuilt B, this error occures.</p>\n<p>The solution is to rebuilt A as well.</p>\n<p>Of course, if you don't have the source code of A, you will have to revert to the old version of B</p>\n<p>from iOS developer @ authing</p>\n</blockquote>\n<p>The demangled name of the symbol you that is used by your (or the framework's) code is (maybe that helps):</p>\n<pre><code>_swift::swift50override_conformsToProtocol(\n swift::TargetMetadata&lt;swift::InProcess&gt; const*,\n swift::TargetProtocolDescriptor&lt;swift::InProcess&gt; const*,\n swift::TargetWitnessTable&lt;swift::InProcess&gt; const* (*)(swift::TargetMetadata&lt;swift::InProcess&gt; const*, swift::TargetProtocolDescriptor&lt;swift::InProcess&gt; const*)\n)\n</code></pre>\n<p>If this does not help, maybe if you add more information to your question, a better response can be given...</p>\n"^^ . "You would have better luck asking in the github repo for this plugin."^^ . . "<p>When an <code>NSTableView</code>'s <code>draggingDestinationFeedbackStyle</code> is set to <code>NSTableViewDraggingDestinationFeedbackStyleGap</code>, the method <code>dragImageForRowsWithIndexes:tableColumns:event:offset:</code> returns an <code>NSImage</code> that appears to have the correct size, but it has no visible content (regardless of the <code>offset</code> argument).\nSo I cannot set an image for dragged rows at the beginning of a drag in <code>tableView:draggingSession:willBeginAtPoint:forRowIndexes:</code>. There is nothing I can show under the cursor.</p>\n<p>The image appears correct with another <code>draggingDestinationFeedbackStyle</code>.</p>\n<p>Any solution that would allow using the whole dragged row as the image component of a dragged item using <code>NSTableViewDraggingDestinationFeedbackStyleGap</code>?</p>\n"^^ . "<p>You ask why “<code>@preconcurrency import</code> does not silence <code>Sendable</code> warning?”</p>\n<p>The error you are receiving is not about trying to send a non-<code>Sendable</code> type. It is about your use of this <code>sending</code> closure (as outlined in <a href="https://github.com/swiftlang/swift-evolution/blob/main/proposals/0430-transferring-parameters-and-results.md" rel="nofollow noreferrer">SE-0430</a>), which is an specific extension to region-based isolation. Do not conflate <code>Sendable</code> types with <code>sending</code> parameters; they are two different things. The <code>@preconcurrency import</code> addresses the former (temporarily silencing non-<code>Sendable</code> warnings for legacy types that have not gone through a review for concurrency), but not the latter.</p>\n"^^ . "0"^^ . . "<p>In my mac application, <code>validateToolBarItem:</code> isn't called after a row of a <code>NSTableView</code> is dropped.</p>\n<p>The <a href="https://developer.apple.com/documentation/appkit/nstoolbar/validatevisibleitems()?language=objc" rel="nofollow noreferrer">docs</a> list events that don't trigger toolbar validation, but <code>mouseUp:</code> isn't one of them. So I'm not sure why the toolbar doesn't validate after that a table row is dropped, since this is associated with a mouse up event.</p>\n<p>To force validation, I call <code>setWindowsNeedUpdate:</code> on <code>NSApp</code> within <code>tableView:acceptDrop:row:dropOperation:</code>.</p>\n<p>I wonder if there is a better solution.</p>\n"^^ . . "<p>This should help you with the Swift's AppTransaction API in Objective-C for receipt validation.</p>\n<p>A few suggestions to improve it:</p>\n<p>1- The Swift code should use proper Swift naming conventions:</p>\n<pre><code>private func validateAppStoreReceipt() async -&gt; Int {\n// Lowercase first letter for function names.\n }\n</code></pre>\n<p>2- Consider using an enum for return codes instead of magic numbers:</p>\n<pre><code>@objc public enum ReceiptValidationResult: Int {\ncase valid = 1\ncase invalid = 99 }\n</code></pre>\n<p>3- Add error handling for specific AppTransaction verification errors:</p>\n<pre><code>case .unverified(_, let error):\nswitch error {\ncase .invalidSignature:\n return .invalidSignature\ncase .deviceNotSupported:\n return .deviceNotSupported\ndefault:\n return .invalid\n}\n</code></pre>\n<p>4- In Objective-C, consider using dispatch groups if you need to wait for the async validation:</p>\n<pre><code>dispatch_group_t group = dispatch_group_create();\n dispatch_group_enter(group);\n [self.receiptValidation getValidityOfAppStoreReceiptWithCompletionHandler:^(NSInteger result, NSError *error) {\n // Handle result\n dispatch_group_leave(group); }];\n</code></pre>\n<p>If this helps, Please dont forget to approve it!</p>\n"^^ . . "1"^^ . . "1"^^ . . . . . . . "0"^^ . "0"^^ . "1"^^ . . . . . . . . "1"^^ . . "1"^^ . "0"^^ . . "0"^^ . . . "0"^^ . . "Check if shift/cmd/option/caps-lock key is pressed in iOS app"^^ . "1"^^ . "0"^^ . . . "Can you show some examples of how your code incorrectly converts the color? Show the extended sRGB color components, the expected result and the actual result."^^ . . "<p>I'm encountering an interesting performance pattern when running a Go benchmark on iOS using gomobile. The CPU usage shows regular gaps of 30ms and 40ms between execution periods when monitored using Instruments.</p>\n<p>Here's my minimal reproduction:</p>\n<pre><code>// benchmark/benchmark.go\npackage benchmark\n\nfunc BasicOperations() {\n var sum float64\n \n for i := int32(1); i != 0; i++ {\n sum += 1\n sum *= 2\n sum -= 1\n sum /= 2\n }\n}\n</code></pre>\n<p>I build the framework using:</p>\n<pre><code>gomobile bind -target=ios -o Benchmark.xcframework ./benchmark\n</code></pre>\n<p>When running this on an iOS device and profiling with Instruments, I observe:</p>\n<p>Regular CPU usage patterns of about 30ms and 40ms duration (shown as blue bars in the CPU profile)\nGaps between these CPU usage periods of varying lengths\nThis pattern repeats consistently throughout execution</p>\n<p><a href="https://i.sstatic.net/Wmn3VUwX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Wmn3VUwX.png" alt="Instruments Screenshot" /></a>\nQuestions:</p>\n<ol>\n<li><p>Why does Go's runtime introduce these regular execution gaps on iOS?</p>\n</li>\n<li><p>Is this expected behavior for Go on mobile platforms?</p>\n</li>\n<li><p>How can I minimize these gaps to achieve more consistent CPU utilization?</p>\n</li>\n</ol>\n<p>Environment:</p>\n<p>iOS 18.2\nGo 1.21\ngomobile latest version\nTesting on physical iPhone device</p>\n"^^ . . . "language-interoperability"^^ . "0"^^ . "3"^^ . "ascii"^^ . . . . . "How do I implement SSL Pinning using acmacalister/jetfire? (Objective-C)"^^ . . "1"^^ . . . . "1"^^ . . "validateToolBarItem not called"^^ . . "Great job - it really works. Thank you so much."^^ . . . . "python"^^ . . . . . . "1"^^ . . . "As your comment implies, don't use `sleep`. You have passed a completion handler, so you already have wrapped the asynchronous Swift code in something that will work with Objective C. Now you just have to handle it as you would any other asynchronous result in Objective C. It is a mistake to try and make it synchronous. Your UI needs to show some activity state and once you have the result you can update the UI and move on"^^ . "0"^^ . . . "1"^^ . . "uicolor"^^ . "1"^^ . . "c++"^^ . . . "0"^^ . . . . "-1"^^ . . "0"^^ . . "0"^^ . . . . . . . . "1"^^ . . . . "uitextview"^^ . . . . . . . . "0"^^ . "0"^^ . . "0"^^ . . . . "0"^^ . "Finally got resolved the issue. I had to inject the javascript into WKWeView to fire the browser unload event."^^ . . "1"^^ . "The way you describe your memory issues, it sounds like out of bounds/trying to access memory you shouldn't access from that point in code. It doesn't turn up as an error immediately, but can have all kinds of effects later on, which is what you're observing. If you can run a suitable sample with address sanitizer, that could reveal where the first invalid access lies. I don't expect static lib to be the cause."^^ . . . . "Update Xcode Project to Support Objective-C++/C++ Interop"^^ . . "1"^^ . . "Could you please elaborate and reference the Apple Developer documents? I found SSL pinning using NSURLConnection but that's deprecated"^^ . . "1"^^ . . "<p>I'm making an iOS application which can use hardware keyboard or run on Apple-Silicon macs. It seems that macos apps can take use of a very convenient APIs for checking if some of the modifier keys are pressed (<a href="https://stackoverflow.com/questions/16532789/how-to-check-if-option-key-is-down-when-user-clicks-a-nsbutton">How to check if Option key is down when user clicks a NSButton</a>) like <code>BOOL alt = [NSEvent modifierFlags] &amp; NSAlternateKeyMask</code>. This is exactly what I want, but I can't find anything like this for iOS-based app.</p>\n<p>UIEvent has <a href="https://developer.apple.com/documentation/uikit/uievent/modifierflags" rel="nofollow noreferrer">modifierFlags</a> but only as an instance property.</p>\n<p>NSEvent has both <a href="https://developer.apple.com/documentation/appkit/nsevent/modifierflags-swift.property?language=objc" rel="nofollow noreferrer">instance modifierFlags</a> as well as <a href="https://developer.apple.com/documentation/appkit/nsevent/modifierflags-swift.type.property?language=objc" rel="nofollow noreferrer">static modifierFlags</a> which can be used for querying the state anywhere inside the app without bothering with observing keyboard events.</p>\n"^^ . "Ionic Angular Camera Preview Plugin: How to Keep AVCaptureDeviceTypeBuiltInTripleCamera in Portrait Orientation?"^^ . . . "Unable to Specify File Types in WKWebView Using runOpenPanelWithParameters on macOS"^^ . "0"^^ . . . . . . . "0"^^ . . . "0"^^ . . "0"^^ . "<p>I need to migrate the NCWidgetProviding to WidgetKit, because the widget is not working in the iOS latest version like 18.1 and other versions.</p>\n<p>How to migrate this in Objective-C</p>\n"^^ . "<p>I'm developing macOS application that uses NSURLSession to sent remote https requests. Some connections uses client-side authentication as part of the tis flow and I've coded a non-default behavior to unlock the system keychain and lookup for a suitable certificate that matches one of the acceptedIssuers in the server request.</p>\n<p>When trying to unlock the system keychain, I get popup window asking to provide user credential in order to get access. However, the popup keeps showing up on every attempt to unlock the keychain and I'd like the OS to &quot;remember&quot; the user credentials and avoid re-asking the user for approval. when running the application in elevated mode by calling its binary directly from <code>sudo</code> I get and additional option which is &quot;always allow&quot;. I'd like to be able to do the same when app runs in regular user mode.</p>\n<p>This is the API I use to unlock the keychain which likely trigger the popup:</p>\n<pre><code>OSStatus SecKeychainUnlock(SecKeychainRef __nullable keychain, UInt32 passwordLength, const void * __nullable password, Boolean usePassword)\n</code></pre>\n<p>I call is without password in the following way :</p>\n<pre><code>status = SecKeychainUnlock(keychain, 0, nullptr, false);\n</code></pre>\n<p>How is this possible ?</p>\n<p>Thanks</p>\n"^^ . "I remember the former - right-click (or Ctrl+click) on a class name in the source code editor, then "Jump to definition", the topmost command in the popup menu. That's what, it seems, broke somehow."^^ . . . . . . . . . "0"^^ . . . "How does it not work?"^^ . "`@preconcurrency` reduces an error to a warning. It does not make the facts magically go away."^^ . . . "<p>The problem is <code>requiringSecureCoding:NO</code>. You <em>must</em> use secure coding at this point. That means you must make Grade adopt NSSecureCoding, not NSCoding; and you must list all the classes you intend to unarchive in a set at unarchiving time.</p>\n<p>So, Grade is now an <code>NSObject&lt;NSSecureCoding&gt;</code>; I'll fill in a few blanks you omitted from your question:</p>\n<pre><code>@implementation Grade\n\n+ (BOOL) supportsSecureCoding { return YES; }\n\n- (instancetype)initWithName:(NSString*)name grade:(NSInteger)grade\n{\n self = [super init];\n if(self) {\n self.name = name;\n self.grade = grade;\n }\n return self;\n}\n\n- (NSString*) description {\n return [NSString stringWithFormat: @&quot;name: %@, grade: %ld&quot;, self.name, self.grade];\n}\n\n// And the rest is as you have it:\n\n-(void)encodeWithCoder:(NSCoder *)coder\n{\n [coder encodeObject:self.name forKey:@&quot;name&quot;];\n [coder encodeInt64:self.grade forKey:@&quot;grade&quot;];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)coder\n{\n self = [super init];\n if(self)\n {\n self.name = [coder decodeObjectForKey:@&quot;name&quot;];\n self.grade = [coder decodeInt64ForKey:@&quot;grade&quot;];\n }\n\n return self;\n}\n\n@end\n</code></pre>\n<p>And now, let's make an array of Grade, archive it, and unarchive it:</p>\n<pre><code>NSArray&lt;Grade*&gt; *array = @[\n [[Grade alloc] initWithName: @&quot;Matt&quot; grade: 4],\n];\nNSData *data = [NSKeyedArchiver archivedDataWithRootObject: array requiringSecureCoding:YES error: nil];\nNSLog(@&quot;archived data: %@&quot;, data);\n\nNSError *error = nil;\nNSSet *classesSet = [NSSet setWithObjects:[NSString class], [Grade class], [NSArray class], nil];\nNSArray *arrayFromData = (NSArray*)[NSKeyedUnarchiver unarchivedObjectOfClasses: classesSet fromData: data error: &amp;error];\n\nNSLog(@&quot;array: %@&quot;, arrayFromData);\n</code></pre>\n<p>Result:</p>\n<pre><code>archived data: {length = 279 ... }\narray: (\n &quot;name: Matt, grade: 4&quot;\n)\n</code></pre>\n<p>Quod erat demonstrandum.</p>\n"^^ . . . "@preconcurrency import does not silence Sendable warning"^^ . "How to present the "always allow" button when typing credentials to access system keychain"^^ . . . . . "1"^^ . . . . . "0"^^ . . . "<p>I'm trying to use a different property names for a future macOS version due to deprecation. Specifically, <a href="https://developer.apple.com/documentation/appkit/nscursor/columnresize?language=objc" rel="nofollow noreferrer">NSCursor.columnResizeCursor</a> is available on 15.0+, but I'm using the 14.0 SDK.</p>\n<p>I read that <code>@available</code> guards are the correct way to handle this. However, the code below does not compile when ran with</p>\n<p><code>clang -mmacos-version-min=10.14 -weak_framework AppKit main.m</code>.</p>\n<p>The error is</p>\n<p><code>error: property 'columnResizeCursor' not found on object of type 'NSCursor'</code></p>\n<p>Is there anything I am doing wrong? I was under the impression that weak linking the AppKit framework wouldn't have it complain about missing properties.</p>\n<pre><code>// main.m\n\n#include &lt;AppKit/AppKit.h&gt;\n\nint main() {\n if (@available(macOS 15.0, *)) {\n // This line does not compile!\n [NSCursor.columnResizeCursor set];\n } else {\n [NSCursor.resizeLeftRightCursor set];\n }\n}\n</code></pre>\n"^^ . . . . . . . "0"^^ . . . "0"^^ . "1"^^ . . . . "<p>While coding in Objective-C, I stumbled upon something very weird. When I add an allocated target to a <code>UISwitch</code> from a different class, it doesn't get called. But if the function is deallocated it gets called normally.</p>\n<p>Can someone explain this to me and is there anyway to call an allocated function from a different class in <code>a UISwitch</code>?</p>\n<p>Doesn't work:</p>\n<pre class="lang-objectivec prettyprint-override"><code>@implementation CustomClass : NSObject\n-(void) test {\n \n NSLog(@&quot;TEST&quot;);\n}\n@end\n\nUISwitch *uiSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(100, 100, 50, 50)];\n[uiSwitch addTarget:[CustomClass alloc] action:@selector(test) forControlEvents:UIControlEventValueChanged];\n[self addSubview:uiSwitch];\n</code></pre>\n<p>Works:</p>\n<pre class="lang-objectivec prettyprint-override"><code>@implementation CustomClass : NSObject\n+(void) test {\n \n NSLog(@&quot;TEST&quot;);\n}\n@end\n\n\nUISwitch *uiSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(100, 100, 50, 50)];\n[uiSwitch addTarget:[CustomClass class] action:@selector(test) forControlEvents:UIControlEventValueChanged];\n[self addSubview:uiSwitch];\n</code></pre>\n"^^ . "0"^^ . "xcuielement"^^ . "0"^^ . . . . . "MIDI Machine Control packet has unexpected bytes"^^ . "1"^^ . . . . "0"^^ . . . . "1"^^ . . . . . . . "0"^^ . . . "@matt: that worked. Specifically, I deleted `~/Library/Developer/Xcode/DerivedData/SymbolCache.noindex`, restarted Xcode, and it came back. Make an answer, I'll accept."^^ . "0"^^ . "Appkit Cocoa - NSCoding decoding error - NSCocoaErrorDomain 4864"^^ . . . . "Why delete your [previous question](https://stackoverflow.com/questions/79301650/whats-the-cocoa-appkit-equivalent-of-swiftui-navigationsplitview) and repost it again as a new question? Why not just update the original as needed?"^^ . . "4"^^ . . . "0"^^ . "Notification presentation is not something your app does, so it is not part of the system under test and you should not make any attempt to test it. You can mock the notification center to see whether your app configures and adds the notification as expected, but that would be a unit test, not a UI test."^^ . "iobluetooth"^^ . . . . "0"^^ . . "0"^^ . . . . . "0"^^ . . . . . . . . . . "Is the problem how to get the file types from the web page or how to specify the file types in the open panel?"^^ . "1"^^ . "0"^^ . . . "1"^^ . "0"^^ . "angular"^^ . "Reference counting an uninitialized object"^^ . . . . "Thanks for the replies, but this does not solve our problem. The root certificate of authority we are using is self-signed. We have decided to request the users to download and install this certificate instead of including the certificate in the app, and pinning it."^^ . . "How do you get the packet? Post your code please."^^ . . . . "@willeke Ok just edited my post to include the code that receives the bytes"^^ . "0"^^ . . "@matt re- "preconcurrency reduces an error to a warning. It does not make the facts magically go away." I believe this is false, with preconcurrency import, I was able to silence the error for a non-closure type. see my new code added at the end"^^ . . "A little example from Apple: https://developer.apple.com/forums/thread/688302"^^ . "1"^^ . . "ios18"^^ . . . . . . . . . . "0"^^ . "0"^^ . "Skia memory issues when used from static library on iOS"^^ . . . . . . . . . "0"^^ . . . "1"^^ . "nstableview"^^ . "appkit"^^ . . "colors"^^ . . . . . . . "But this api is used to set allowsFileExtentions to be uploaded."^^ . . "0"^^ . "gomobile"^^ . . . "interface-builder"^^ . . . . . . . "1"^^ . . . . . "portsip"^^ . . "0"^^ . "2"^^ . . "0"^^ . . "0"^^ . "0"^^ . . "0"^^ . "2"^^ . "I wasn't able to get any error from the code you originally showed, so I could not comment directly on your assertions."^^ . . . "What point to use self-signed certificate? You can use Let's Encrypt at least."^^ . . "@available guard/weak linking not compiling"^^ . . . "1"^^ . . . . "2"^^ . "0"^^ . "1"^^ . "0"^^ . . "It looks like a bug in `NSTableView` to me. Try a different Row Size Style in the XIB/Storyboard."^^ . . . "2"^^ . "0"^^ . . "I trired the same soultion suggested above but that alos not work. \n\nDevice_swift.framework version is ios10\n\n\nMyFileFramework.frameworkversion is ios10\n\n`tapas.mukherjee@BTM-Y39T7931V9 iOS % xcrun vtool -arch arm64 -show MyFileFramework.xcframework/ios-arm64_armv7/MyFileFramework.framework/MyFileFramework\nMyFileFramework.xcframework/ios-arm64_armv7/MyFileFramework.framework/MyFileFramework (architecture arm64):\nLoad command 8\n cmd LC_VERSION_MIN_IPHONEOS\n cmdsize 16\n version 10.0\n sdk 15.0\nLoad command 9\n cmd LC_SOURCE_VERSION\n cmdsize 16\n version 0.0`"^^ . . . . . . "@matt did you enable swift 6?"^^ . . "0"^^ . . . . . "@Rob I have updated my code snippet on caller side"^^ . "Thank you! How would you find out if caps-lock is on or off before any event has been occurred, for example at the application launch? If I understand correctly on macos you can query this static NSEvent.modifierFlags.capsLock. It's just so unfortunate that iOS SDK omitted this feature, I was hoping I've missed something. Seems obvious that those states should be static just like on macos."^^ . . "Can the Rust compiled node extension listen for notification events on the Mac system?"^^ . "1"^^ . "1"^^ . "0"^^ . . . . . . . "1"^^ . "1"^^ . . "@HangerRash, it still doesnt work, can you join a zoom call and help me implement it bec I tried it 5 times and it doesnt work"^^ . "1"^^ . "2"^^ . "Hi @matt , could you please give me an example about mocking the notification center by object-c(unit test)? Thank you very much."^^ . . . "Application Crashes in Xcode 16 After macOS Upgrade, Worked Fine in Xcode 15.4"^^ . "1"^^ . . "<p>I've compiled Skia for iOS:</p>\n<pre><code>bin/gn gen out/ios-apple --args='target_os=&quot;ios&quot; target_cpu=&quot;arm64&quot; ios_use_simulator=false skia_enable_tools=false is_official_build=false is_debug=true is_trivial_abi=false skia_use_metal=true skia_use_expat=false skia_use_system_expat=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false skia_use_system_freetype2=false skia_use_system_harfbuzz=false skia_use_system_icu=false skia_enable_gpu=true skia_enable_skottie=false skia_compile_modules=true extra_cflags=[&quot;-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks&quot;] extra_ldflags=[&quot;-framework&quot;, &quot;CoreFoundation&quot;, &quot;-framework&quot;, &quot;Metal&quot;]'\n</code></pre>\n<p>This is how I'm using it in a View Controller:</p>\n<pre><code>#import &lt;MetalKit/MetalKit.h&gt;\n#import &lt;Metal/Metal.h&gt;\n#import &lt;UIKit/UIKit.h&gt;\n\n#define SK_GANESH\n#define SK_METAL\n\n#import &lt;include/gpu/ganesh/GrDirectContext.h&gt;\n#import &lt;include/core/SkSurface.h&gt;\n\n@interface SkiaViewController : UIViewController &lt;MTKViewDelegate&gt;\n\n@property (nonatomic, strong) MTKView *mtkView;\n@property (nonatomic, strong) id&lt;MTLDevice&gt; metalDevice;\n@property (nonatomic, strong) id&lt;MTLCommandQueue&gt; metalQueue;\n\n@property (nonatomic, assign) sk_sp&lt;GrDirectContext&gt; grDirectContext;\n@property (nonatomic, assign) sk_sp&lt;SkSurface&gt; surface;\n@end\n</code></pre>\n<pre><code>#import &lt;MetalKit/MetalKit.h&gt;\n#import &lt;Metal/Metal.h&gt;\n\n#define SK_GANESH\n#define SK_METAL\n\n#import &quot;include/gpu/ganesh/GrTypes.h&quot;\n#import &quot;include/gpu/ganesh/SkSurfaceGanesh.h&quot;\n#import &quot;include/gpu/ganesh/mtl/GrMtlTypes.h&quot;\n\n#import &lt;include/gpu/ganesh/GrBackendSurface.h&gt;\n#import &lt;include/gpu/ganesh/SkSurfaceGanesh.h&gt;\n#import &lt;include/gpu/ganesh/mtl/GrMtlBackendContext.h&gt;\n#import &lt;include/gpu/ganesh/mtl/GrMtlBackendSurface.h&gt;\n#import &lt;include/gpu/ganesh/mtl/GrMtlDirectContext.h&gt;\n#import &lt;include/gpu/ganesh/mtl/SkSurfaceMetal.h&gt;\n\n#import &lt;include/gpu/ganesh/GrDirectContext.h&gt;\n#import &lt;include/core/SkSurface.h&gt;\n#import &lt;include/core/SkCanvas.h&gt;\n#import &lt;include/core/SkColorSpace.h&gt;\n\n#import &quot;SkiaViewController.h&quot;\n\n@implementation SkiaViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n \n#ifndef SK_GANESH\n NSLog(@&quot;SK_GANESH is undefined&quot;);\n#endif\n \n#ifndef SK_METAL\n NSLog(@&quot;SK_METAL is undefined&quot;);\n#endif\n \n [self setMetalDevice:MTLCreateSystemDefaultDevice()];\n [self setMetalQueue:[[self metalDevice] newCommandQueue]];\n \n if(![self metalDevice]) {\n NSLog(@&quot;Metal is not supported on this device&quot;);\n return;\n }\n \n if(![self metalQueue]) {\n NSLog(@&quot;Failed to create Metal command queue&quot;);\n return;\n }\n \n // Initialize MTKView\n self.mtkView = [[MTKView alloc] initWithFrame:self.view.bounds device:self.metalDevice];\n self.mtkView.delegate = self;\n self.mtkView.enableSetNeedsDisplay = YES;\n \n [self.mtkView setDepthStencilPixelFormat:MTLPixelFormatDepth32Float_Stencil8];\n [self.mtkView setColorPixelFormat:MTLPixelFormatBGRA8Unorm];\n [self.mtkView setSampleCount:1];\n \n NSLog(@&quot;self.metalDevice.maxBufferLength=%lu&quot;, self.metalDevice.maxBufferLength);\n \n self.mtkView.layer.borderWidth = 2.0; // Set border width\n self.mtkView.layer.borderColor = [UIColor redColor].CGColor; // Set border color\n \n [self.view addSubview:self.mtkView];\n \n // Initialize Skia with Metal\n GrMtlBackendContext backendContext = {};\n backendContext.fDevice.retain((__bridge void*)[self metalDevice]); // also tried __bridge_retained\n backendContext.fQueue.retain((__bridge void*)[self metalQueue]);\n \n GrContextOptions grContextOptions;\n \n self.grDirectContext = GrDirectContexts::MakeMetal(backendContext, grContextOptions);\n \n if (![self grDirectContext]) {\n NSLog(@&quot;Failed to create GrDirectContext&quot;);\n return;\n }\n \n NSLog(@&quot;Created GrDirectContext&quot;);\n}\n\n#pragma mark - MTKViewDelegate\n\n- (void)drawInMTKView:(nonnull MTKView *)view {\n}\n\n- (void)mtkView:(nonnull MTKView *)view drawableSizeWillChange:(CGSize)size {\n \n}\n\n@end\n</code></pre>\n<p>In this case it works fine.</p>\n<p>But if I create a static library inside the same project, move ViewController into that static library and use view controller from the static library in my app, I'm facing memory issues in <code>GrDirectContexts::MakeMetal</code>.</p>\n<p>Sometimes it crashes with bad access error, sometimes some of pointers are becoming <code>nullptr</code>, for example in <code>backendContext</code> right after setting these values.</p>\n<p>Same if I move this Skia initialization in a separate C++ library (compiled by CMake, not in Xcode directly).</p>\n<p>I guess that this is some issue with Skia's smart pointers (maybe something is stripped when linking with static lib?), but I'm not familiar with Obj-C development and interop with C++ for iOS.</p>\n<p><strong>UPD.</strong> I've tested with a simple C++ library without passing any Obj-C pointers to Skia, and can confirm that I have exactly the same issues with it — at some point a pointer inside an <code>sk_sp</code> becomes invalid (for example, when Skia tries to free it).</p>\n<p>What may be wrong here?</p>\n"^^ . . . . . . . . "1"^^ . . . "0"^^ . . . "`UIEvent` has [`modifierFlags`](https://developer.apple.com/documentation/uikit/uievent/3538961-modifierflags) too. What exactly are you trying to create? Please be more specific."^^ . . "coremidi"^^ . "midi"^^ . . "0"^^ . "UIColor Subclass with Stateful Colors: Idle Color Doesn’t Update in Dark Mode"^^ . . . "0"^^ . . . "0"^^ . "0"^^ . "0"^^ . "Don't use `try?`. Use `try/catch` and print `error` in the `catch` so you can see why it fails."^^ . "@simd Actually I just found some private API in IOKit that allows you to do this. It's not exposed in the IOKit headers on iOS (but they are exposed on macOS, that's how I found them) so App Store might reject your app if you use those."^^ . "0"^^ . . "string"^^ . . "0"^^ . "@HangerRash, A friend of mine came and explained it to me because my code situation was a bit different but it was mostly similar to your answer!"^^ . . "1"^^ . "The only way is to implement new widget with SwiftUI. You will bet even not able to use `UIViewRepresentable`."^^ . "I only handled this once long time ago, so I don't have details, but I think you can treat values `[0, 1]` as is, like normal sRGB, but then for everything else, you need to treat it as HDR, so either clamp them or apply some other gamma transfer function. Take a look here: https://learnopencv.com/high-dynamic-range-hdr-imaging-using-opencv-cpp-python/"^^ . . . . "`NSASCIIStringEncoding` typically allows lossy encoding conversions by default; presumably, some of the data is getting thrown away. Can you try with `NSNonLossyASCIIStringEncoding` and see what you get?"^^ . "0"^^ . . . . . . "0"^^ . . "0"^^ . "0"^^ . "0"^^ . . "0"^^ . . "0"^^ . . . "nssortdescriptor"^^ . . "It is not renaming the parameters at all. In Objective-C, the parameter name is part of the method name. In `someMethodWithTemplate:`, the `Template` part is the parameter name, based directly on your `template` but with an initial capital letter, which is standard convention and part of "renamification". The `template_` you are asking about is merely an _internal_ name, and is effectively meaningless (it is thrown away and affects nothing)."^^ . . "@Evan93 What exactly is _"an extendedSRGB color taken from a Swift program"_? Do you get numbers from it, and if yes, then do you have an example **integer** or **float** for us to discuss? Not even clear if here you are dealing with 10-bits per channel or 16-bits or 32-bits..."^^ . . . . . . . . . . . "0"^^ . . . . . "Problem with deleting SDP service (macOS, IOBluetooth)"^^ . . "Objective-C Appropriate usage of ivar instead of property for lazy instantiation"^^ . . "Okay, you can probably write your own static property like that. Just use `pressesBegan`/`pressesEnded` etc to update it."^^ . "0"^^ . "0"^^ . . . . . . . . . . "The public status of the idle property seems like it should not affect anything. I do wonder if the -copy and copyWithZone: methods should simply return self -- i.e. that is pretty much a read-only instance. Maybe the -copy is doing something strange in some situations. (Normally, -copy simply calls -copyWithZone: with a NULL zone parameter, so you don't duplicate code.) If you are re-setting the "idle" value based on state, then maybe copy returning a new instance is required. Can't fathom how the idle property is declared would matter, though you should probably declare it atomic."^^ . . "cgo"^^ . . . . . . "<p>I have an <code>NSTableView</code> that doesn't allow selecting rows. I'd like <code>keyDown:</code> events (edit: from arrow keys) to reach the view's controller (which is also its <code>delegate</code>).\nBy default, a table view &quot;consumes&quot; these events, so they don't go up the responder chain.\nHow can I prevent that, preferably without subclassing <code>NSTableView</code>?</p>\n"^^ . "Cocoa Appkit - How do I set a custom size for an NSProgressIndicator?"^^ . . . "Prevent NSTableView from responding to keyDown:"^^ . . . . . "0"^^ . . . . . . "0"^^ . "0"^^ . "webmin"^^ . . . "0"^^ . "0"^^ . . . . "rust"^^ . "keychain"^^ . "1"^^ . . . . "Appkit & Cocoa - How to support editing for a view-based NSTableView?"^^ . "0"^^ . "objective-c"^^ . . . "2"^^ . . . . . . "0"^^ . . . "0"^^ . . . . "<p>I am write a wkwebview application in macos where I want to enable file upload to my website loaded in wkwebview.\nI found few articles telling to use runOpenPanelWithParameters which runs for me but I stuck in a problem.</p>\n<p>Problem:</p>\n<p>The method works to open the file dialog, but I'm stuck on how to properly handle the file(s) selected by the user and upload them to my website.\ni.e: If website only want img upload, from chrome it fade out files other then img, I want to achieve same in wkwebview.</p>\n<pre><code>- (void)webView:(WKWebView *)webView runOpenPanelWithParameters:(WKOpenPanelParameters *)parameters initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSArray&lt;NSURL *&gt; * _Nullable))completionHandler {\n NSOpenPanel *openPanel = [NSOpenPanel openPanel];\n openPanel.canChooseFiles = YES;\n openPanel.canChooseDirectories = NO;\n openPanel.allowsMultipleSelection = parameters.allowsMultipleSelection;\n\n [openPanel beginWithCompletionHandler:^(NSModalResponse result) {\n if (result == NSModalResponseOK) {\n completionHandler(openPanel.URLs);\n } else {\n completionHandler(nil);\n }\n }];\n}\n</code></pre>\n"^^ . . . . . . "Best way to represent Objective-C properties as optionals in Swift"^^ . . . "0"^^ . "0"^^ . "1"^^ . . "0"^^ . "NSTableView doesn't move row down when using NSTableViewDraggingDestinationFeedbackStyleGap"^^ . . . . . . "Go Mobile Performance: Regular CPU Usage Gaps on iOS"^^ . "<p>How to get the content of a notification in XCUITest, specifically the notification's identifier</p>\n<p>I have a piece of code in my app to show a notification as follows:</p>\n<pre><code>- (NSString *)showNotificationWithIdentifier:(NSString * _Nullable)identifier\n title:(NSString *)title\n description:(NSString *)description {\n NSString *_id;\n // No ID specified (automatic increment)\n if (identifier == nil) {\n NSUserDefaults *prefer = [[NSUserDefaults alloc] initWithSuiteName:AfibNotificationManager.TAG];\n NSString *latestIdStr = [prefer stringForKey:AfibNotificationManager.LATEST_ID_KEY];\n int tmpId;\n if (latestIdStr == nil) {\n tmpId = INT_MIN;\n } else {\n tmpId = [latestIdStr intValue];\n tmpId += 1;\n }\n _id = [NSString stringWithFormat:@&quot;%d&quot;, tmpId];\n [prefer setValue:_id forKey:AfibNotificationManager.LATEST_ID_KEY];\n }\n // ID specified\n else {\n _id = identifier;\n }\n \n UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];\n content.title = title;\n content.body = description;\n content.sound = [UNNotificationSound defaultSound];\n UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:_id content:content trigger:nil];\n dispatch_async(dispatch_get_main_queue(), ^{\n [[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:request withCompletionHandler:nil];\n });\n \n return _id;\n}\n</code></pre>\n<p>This is my UITest code:</p>\n<pre><code>- (void)checkNotification {\n \n XCUIApplication *app = [[XCUIApplication alloc] init];\n [app launch];\n [app.buttons[@&quot;btn&quot;] tap]; //click button will call method showNotificationWithIdentifier to show notification\n \n XCUIApplication *springboard = [[XCUIApplication alloc];\n initWithBundleIdentifier:@&quot;com.apple.springboard&quot;];\n XCUICoordinate *start = [app coordinateWithNormalizedOffset:CGVectorMake(0.5, 0.0)];\n XCUICoordinate *finish = [app coordinateWithNormalizedOffset:CGVectorMake(0.5, 1.5)];\n [start pressForDuration:0.1 thenDragToCoordinate:finish];\n XCUIElement *notification = springboard.buttons[@&quot;NotificationCell&quot;];\n XCTAssertTrue([notification waitForExistenceWithTimeout:5]);\n NSString *identifier = notification.identifier;\n}\n</code></pre>\n<p>When I perform XCUITest to get notification information such as notification identifier, I encounter difficulties and it seems incorrect. Could you help me with a way to retrieve the notification identifier, label, and check if the notification has been displayed or not? Thank you.</p>\n"^^ . "1"^^ . "<p>I'm experiencing an issue where my application crashes when I try to run it in Xcode 16. The application was running fine in Xcode 15.4 before I upgraded macOS. Below is the crash log.</p>\n<p>I've tried several solutions, including reinstalling the pod files, but nothing seems to work. I would greatly appreciate any suggestions on what modifications might be required at the project end to resolve this issue.</p>\n<p><strong>Crash Log:</strong></p>\n<pre><code>Error creating LLDB target at path '/Users/tapas.mukherjee/Library/Developer/Xcode/DerivedData/MyBB-evzcojyxpgcemkczklduotjqrkpb/Build/Products/Debug-iphonesimulator/My BB Live.app', target architecture: arm64 : the specified architecture 'arm64-*-*' is not compatible with 'x86_64-apple-ios15.0.0-simulator' in '/Users/tapas.mukherjee/Library/Developer/Xcode/DerivedData/MyBB-evzcojyxpgcemkczklduotjqrkpb/Build/Products/Debug-iphonesimulator/My BB Live.app/My BB Live'.\nUsing an empty LLDB target instead but this can cause slow memory reads.warning: (x86_64) /Users/tapas.mukherjee/Library/Developer/CoreSimulator/Devices/3C76D943-FB74-4300-8DFB-D367B196D0B8/data/Containers/Bundle/Application/6B59D8DB-7A93-4D89-9012-26EFDE3C4856/My BB Live.app/My BB Live empty dSYM file detected, dSYM was created with an executable with no debug info.\ndyld[29372]: Symbol not found: __ZN5swift34swift50override_conformsToProtocolEPKNS_14TargetMetadataINS_9InProcessEEEPKNS_24TargetProtocolDescriptorIS1_EEPFPKNS_18TargetWitnessTableIS1_EES4_S8_E\n Referenced from: &lt;4B33FED0-BDFE-3506-A7E7-D22FDC44F7E9&gt; /Users/tapas.mukherjee/Library/Developer/Xcode/DerivedData/My_BB-evzcojyxpgcemkczklduotjqrkpb/Build/Products/Debug-iphonesimulator/MyFileFramework.framework/MyFileFramework\n Expected in: &lt;8132C051-30BA-3316-B5A5-8D8C1070184B&gt; /Users/tapas.mukherjee/Library/Developer/CoreSimulator/Devices/3C76D943-FB74-4300-8DFB-D367B196D0B8/data/Containers/Bundle/Application/6B59D8DB-7A93-4D89-9012-26EFDE3C4856/My BB Live.app/Frameworks/Device_swift.framework/Device_swift\nMessage from debugger: Terminated due to signal 6\nLogging Error: Failed to initialize logging system due to time out. Log messages may be missing. If this issue persists, try setting IDEPreferLogStreaming=YES in the active scheme actions environment variables.\n</code></pre>\n<p><strong>Project setup:</strong>\n<a href="https://i.sstatic.net/XqwAkqcg.png" rel="nofollow noreferrer">Project Setup</a></p>\n<p>Thank you in advance for your help!</p>\n<p>I tried the below solutions:</p>\n<p>Reinstalling the pod files and Check the project setup with suggestion\nand added the framework again in the project.</p>\n"^^ . . . . . . . . . . . . . "0"^^ . "0"^^ . . . . . "<p>My goal is to implement a wss connection using SSL pinning on an React Native iOS module. For this problem, I chose to use <a href="https://cocoapods.org/pods/jetfire" rel="nofollow noreferrer">Jetfire</a>. I have the following class:</p>\n<pre><code>@interface RCTWebSocketSslPinning : RCTEventEmitter &lt;RCTBridgeModule, JFRWebSocketDelegate&gt;\n\n@property (nonatomic, strong) JFRWebSocket *socket;\n@property bool hasListeners;\n\n-(void)sendEventToJavaScript:(NSString *)eventName withParams:(id)params;\n@end\n</code></pre>\n<p>And the following <code>fetch</code> method:</p>\n<pre><code>RCT_EXPORT_METHOD(fetch:(NSString *)url withOptions:(NSDictionary *)options callback:(RCTResponseSenderBlock)callback)\n{\n RCTLogInfo(@&quot;Pretending to fetch %@ with options: %@&quot;, url, options.description);\n \n self.socket = [[JFRWebSocket alloc] initWithURL:[NSURL URLWithString: url] protocols:nil];\n self.socket.delegate = self;\n \n NSString *path = [[NSBundle mainBundle] pathForResource:@&quot;rootCA_public&quot; ofType:@&quot;cer&quot;];\n NSData *data = [NSData dataWithContentsOfFile:path];\n\n if (data) {\n NSLog(@&quot;Certificate loaded successfully!&quot;);\n } else {\n NSLog(@&quot;Failed to load certificate. Check the file path.&quot;);\n callback(@[ @&quot;Failed to load certificate.&quot;, [NSNull null]]);\n }\n \n self.socket.security = [[JFRSecurity alloc] initWithCerts:@[[[JFRSSLCert alloc] initWithData:data]] publicKeys:YES];\n [self.socket connect];\n \n callback(@[[NSNull null], @&quot;WebSocket fetch complete.&quot;]);\n}\n</code></pre>\n<p>I implemented this method following the <a href="https://github.com/acmacalister/jetfire" rel="nofollow noreferrer">Jetfire guide here</a> however when I run the program I get a run-time error within JFRSecurity.m:</p>\n<pre><code>- (SecKeyRef)extractPublicKeyFromCert:(SecCertificateRef)cert policy:(SecPolicyRef)policy {\n \n SecTrustRef trust;\n SecTrustCreateWithCertificates(cert,policy,&amp;trust); // ERROR: Thread x: EXC_BAD_ACCESS (code=1, address=0x8)\n SecTrustResultType result = kSecTrustResultInvalid;\n SecTrustEvaluate(trust,&amp;result);\n SecKeyRef key = SecTrustCopyPublicKey(trust);\n CFRelease(trust);\n return key;\n}\n</code></pre>\n<p>I analyzed the project and I get this message:\n<a href="https://i.sstatic.net/82m251aT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/82m251aT.png" alt="jetfire/JFRSecurity.m L:84" /></a></p>\n<p>I'm not familiar with Objective-C, and I'm not sure if this is a problem with the library that I'm using or if it's the way I'm attempting to extract the certificate from path.</p>\n"^^ . "0"^^ . . . "Custom sorting column of NSTableView"^^ . "@simd it’s called [`alphaShift`](https://developer.apple.com/documentation/uikit/uikeymodifierflags/alphashift) in UIKit."^^ . . "0"^^ . "0"^^ . "1"^^ . "SCORM lesson status is "In Progress" even after complete the reading of lesson"^^ . . "0"^^ . . "@HangerRash. thanks for the edit and taking your time to answer this but sadly it still doesnt get called :/\n[uiSwitch addTarget:[[CustomClass alloc] init] action:@selector(test) forControlEvents:UIControlEventValueChanged];"^^ . "0"^^ . . "0"^^ . . . . . . . . "0"^^ . . . "0"^^ . "react-native-call-keep"^^ . . . . "Nullable = optional."^^ . . . . . "0"^^ . . "That fails too. It seems that Swift has a strict ASCII decoder and will fail if there's any bytes outside the standard ASCII range. Whereas Obj-C's ASCII initialiser is more lenient. (Info obtained from ChatGPT)"^^ . "`eventList` isn't a MIDI event. Enumerate the events in the list with `MIDIEventListForEachEvent`. Check `message.type` and get the sysEx data. In Swift: `let sysExMessage = message.sysEx` and `sysExMessage.data.0` .. `sysExMessage.data.5`."^^ . "1"^^ . . . . . "react-native"^^ . "0"^^ . "You can't just only call properties. Something, somewhere needs to actually access the instance variable (even if it's an auto-synthesized property), after all, that's where the actual storage is. It is perfectly normal for your property getters and setters to directly interact with the ivars. Most other code should go through those getters and setters, though."^^ . "Btw this API is only really for small scripts and fiddling around. It blocks the thread, so for a real app you should use the async file APIs instead, which you can await without blocking the thread"^^ . "0"^^ . . "It will not detect what kind of allowed files are requested by web"^^ . . . . . "3"^^ . . . . . "uikit"^^ . . "0"^^ . "1"^^ . "0"^^ . . "1"^^ . "0"^^ . . "Thanks. Most row size styles fix the issue, except "custom" and "match canvas"."^^ . . . "1"^^ . "@DavidPasztor it is an existing project with an existing bridging header. I am currently importing a bunch of Objective-C code into Swift via the bridging header, but I would like to add various Objective-C++ files to that as well."^^ . . "1"^^ . "0"^^ . . "Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/259168/discussion-between-rob-and-hl666)."^^ . . "<p>The best way is HangarRash's way: you modify the headers in your Objective-C code to say that things that can be <code>nil</code> (what Swift would call an Optional) are <code>nullable</code>.</p>\n<p>If you can't do that, you can use the following absolutely horrible approach. Suppose <code>theVideo</code> has arrived as a Data, but you know that it might in fact be <code>nil</code>. Then say</p>\n<pre><code>if let theVideo = theVideo as Any as? Optional&lt;Data&gt;, let theVideo {\n</code></pre>\n<p>Here you are casting <code>theVideo</code> <em>up</em> to an Any so that you can cast it <em>down</em> to anything it all, including what you suspect it to be, an Optional wrapping a Data. Now you can (and do) safely unwrap it.</p>\n<p>I really can't recommend this trick, though. It's better to update the headers of your Objective-C code to be more friendly to Swift.</p>\n"^^ . "-1"^^ . . . "0"^^ . . "@Evan93 PS: _"When I used this formula, it seemed to convert negative numbers back into negative numbers"_ A possible solution might be to **mask** or **bit-shift** the resulting channel number into range of 8-bits. Bit-Masking would remove the sign. What/How to do the conversion will depend on the **bit-depth** of your extendedSRGB color... If not sure, then tell us some numbers for primary and secondary hues."^^ . . . . . . . "cocoa-touch"^^ . . . "0"^^ . "0"^^ . "1"^^ . . "1"^^ . . . . "0"^^ . . . "0"^^ . . . . "Who needs SSL pinning when Certificate Transparency is supported from the box."^^ . . . . . . "0"^^ . . . "macos-sequoia"^^ . . "The extended sRGB colorspace is used to describe colors with a larger gamut (Display P3) while still being compatible with sRGB. I *think* that truncating the components to 0.0 ... 1.0 should be the right approach."^^ . "thank you for doing such a thoughtful research on that! From an SDK design point of view I personally think it would better to have an ability to query an array of keyboard devices from the singleton UIDevice/UIApplication, from which you would be able to query the state of each keyboard as an instance properties. I don't know why they made this so hard for us! But now I know I'm not missing anything obvious"^^ . . . . "bluetooth"^^ . "0"^^ . "0"^^ . . . "<p>Okay. After 2 weeks of searching I have found a solution to this issue.\nSeems in RNCallKeep library when you end the call if you used normal <code>RNCallKeep.endCall()</code> function, there may be some AudioSession can be hanging there and cause audio issues for the next calls. So my fix was calling <code>RNCallKeep.endAllCalls()</code> instead. So then this will clear all the audio sessions and restore the default configurations. This was fixed my audio issues.</p>\n"^^ . "0"^^ . . "0"^^ . "You might have better luck web searching for “Master-Detail view” it is the old name for Navgation Split View"^^ . . . "Unfortunately, I had a 'property not found on object of type viewController' error. However, when I specify the name of the textVIew, it now works as is: `NSTextLayoutManager *layoutManager = self.textView.textLayoutManager;`"^^ . "To rephrase Hangars' statement: there's no input of any text encoding which fails when trying utf8 and succeeds with ASCII. So, your statement in the title "Swift ASCII string fails, but works in Objective-C" can never happen - unless something else is badly wrong (for example, but very unlikely, the implementation of Objective-C's character encoding). Can you please provide the input?"^^ . . "0"^^ . . . "0"^^ . . . "<p>I'm having some trouble with NSCoding, I have this simple &quot;Grade&quot; class:</p>\n<pre><code>@interface Grade : NSObject&lt;NSCoding&gt;\n\n@property (copy) NSString *name;\n@property NSInteger grade;\n\n@end\n</code></pre>\n<p>It implements <a href="https://developer.apple.com/documentation/foundation/nscoding?language=objc" rel="nofollow noreferrer">NSCoding</a> as follows:</p>\n<pre><code>-(void)encodeWithCoder:(NSCoder *)coder\n{\n [coder encodeObject:self.name forKey:@&quot;name&quot;];\n [coder encodeInt64:self.grade forKey:@&quot;grade&quot;];\n}\n\n\n\n- (instancetype)initWithCoder:(NSCoder *)coder\n{\n self = [super init];\n if(self)\n {\n self.name = [coder decodeObjectForKey:@&quot;name&quot;];\n self.grade = [coder decodeInt64ForKey:@&quot;grade&quot;];\n }\n \n return self;\n}\n</code></pre>\n<p>I have an NSMutableArray of these objects which I put into an archive like so:</p>\n<pre><code> NSArray&lt;Grades*&gt; *array = [NSArray arrayWithArray:self.tableContents];\n NSData *data = [NSKeyedArchiver archivedDataWithRootObject: array requiringSecureCoding:NO error: nil];\n NSLog(@&quot;archived data: %@&quot;, data);\n</code></pre>\n<p>This is working fine but the problem is when I try to extract from this archive:</p>\n<pre><code>NSError *error = nil;\nNSArray *arrayFromData = [NSKeyedUnarchiver unarchivedObjectOfClass:[NSArray class] fromData:data error:&amp;error];\n</code></pre>\n<p>I keep getting an error: <strong>'NSCocoaErrorDomain - code: 4864'</strong> in my NSError variable and the NSKeyedUnarchiver keeps returning nil.</p>\n<p>What am I doing wrong here?</p>\n"^^ . "1"^^ . "Sorry what is a GAIT? The code is inside `viewDidLoad` of an empty template project (i didn't know it matters, but i was clearly wrong, sorry)"^^ . . "objective-c++"^^ . "it still exists when I open my projects and control click on various bits & pieces of my code in Xcode 16.2... have you compiled your project yet?"^^ . . . "<p>A few observations:</p>\n<ol>\n<li><p>The simple way to add a URL (without the “display text”) is to just write the <code>NSURL</code> as an object and be done with it.</p>\n<pre class="lang-objectivec prettyprint-override"><code>[pasteboard writeObjects:@[url]];\n</code></pre>\n</li>\n<li><p>If you use <code>NSPasteboardTypeURL</code>, it would be <code>setPropertyList</code>, not <code>setString</code>.</p>\n</li>\n<li><p>I know there are sources that suggest that you can set <code>setString</code> with the display text, but in my experience, apps that pick up the simple string representation do not generally also simultaneously pick up the URL. And for apps that only pick up the string, the URL is generally more important than the “Click here” text, so I would be inclined to make the simple string representation the URL rather than the display text.</p>\n</li>\n<li><p>I think the best way to support the “Click here” display text is with the RTF and HTML representations. The RTF representation has greater utility than the HTML, but it simply depends upon where you plan on pasting this. Different apps offer differing level of support for different representations.</p>\n</li>\n</ol>\n<p>Anyway, perhaps:</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSURL *url = [NSURL URLWithString:@&quot;https://example.com&quot;];\nNSString *displayText = @&quot;Click here&quot;;\n\nNSPasteboard *pasteboard = [NSPasteboard generalPasteboard];\n[pasteboard clearContents];\n\nNSPasteboardItem *item = [[NSPasteboardItem alloc] init];\n\n// Add the URL as the string representation\n[item setString:url.absoluteString forType:NSPasteboardTypeString];\n\n// Add RTF representation\nNSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:displayText];\nNSRange range = NSMakeRange(0, displayText.length);\n[attributedString addAttribute:NSLinkAttributeName value:url range:range];\nNSData *rtf = [attributedString RTFFromRange:range documentAttributes:@{}];\n[item setData:rtf forType:NSPasteboardTypeRTF];\n\n// Add HTML representation\nNSString *htmlString = [NSString stringWithFormat:@&quot;&lt;a href=\\&quot;%@\\&quot;&gt;%@&lt;/a&gt;&quot;, url.absoluteString, displayText];\n[item setString:htmlString forType:NSPasteboardTypeHTML];\n\n// Add the URL\n[item setPropertyList:url.absoluteString forType:NSPasteboardTypeURL];\n\n// Write the `NSPasteboardItem`\n[pasteboard writeObjects:@[item]];\n</code></pre>\n<p>When I view this with a ClipboardViewer (one of the additional Xcode <a href="https://developer.apple.com/download/all/?q=clipboard%20viewer" rel="nofollow noreferrer">developer tools</a>), this results in it having a URL, RTF, and HTML representations.</p>\n"^^ . . . "0"^^ . "darkmode"^^ . "go"^^ . . "wkwebview"^^ . . . . . . "2"^^ . "The formula you found is the *transfer function* of the extended sRGB color space, and f(x) is the transfer function of the non-extended sRGB color space. This formula is not how you convert from sRGB to extended sRGB."^^ . "Ah yes, that’s what I meant to say."^^ . "How to get the content of a notification in XCUITest?"^^ . "0"^^ . . . . . "@Alexander If you add `NS_ASSUME_NONNULL_BEGIN` then you only need to annotate properties, parameters, and return values that *can* be `nil` since that macro makes everything non-nil by default."^^ . "node.js"^^ . . "<p>I am trying to write some code in Python to display a color taken from a Swift program. However, that color is in the <code>extendedSRGB</code> format. <code>extendedSRGB</code> is similar to standard sRGB except RGB values can be outside of the typical 0 to 1 range. Upon further research, it seems that this is an Apple-made color format, so it is not supported in languages other than Swift or Objective-C. Note: it is called <code>extendedSRGBColorSpace</code> in Objective-C.</p>\n<p>I attempted to clip the RGB channels using <code>srgb = np.clip(extended_srgb, 0, 1)</code>. I also tried taking the absolute value of the channels using <code>srgb = np.abs(extended_srgb)</code>. However, neither of these techniques gave the correct color, particularly for shades of green. According to the <a href="https://developer.apple.com/documentation/appkit/nscolorspace/extendedsrgb" rel="nofollow noreferrer">extendedSRGB Apple Developer docs</a>:</p>\n<blockquote>\n<p>This color space has the same colorimetry as sRGB, but component values below 0.0 and above 1.0 may be encoded in this color space. Negative values are encoded as the signed reflection of the original encoding function. y(x) = sign(x)*f(abs(x))</p>\n</blockquote>\n<p>I tried following this to create a formula for converting <code>extendedSRGB</code> values back into standard sRGB format, but was unable to. When I used this formula, it seemed to convert negative numbers back into negative numbers. I also do not know what f(x) is in this case.</p>\n<p>My question is, what exactly is the formula for converting colors in the <code>extendedSRGB</code> format into standard sRGB format? Alternatively, is there any way in Python to convert from <code>extendedSRGB</code> colors to sRGB?</p>\n"^^ . "1"^^ . "xcuitest"^^ . . . . . "0"^^ . . . . "0"^^ . "Apple provides an entire documentation page for just this: https://developer.apple.com/documentation/swift/designating-nullability-in-objective-c-apis. You’ll probably want to start with wrapping most of your Objective C headers with `NS_ASSUME_NONNULL_BEGIN`, and then annotating the properties that you’re certain can never be nil."^^ . . . . . . . . . . . . . . . . . . . . "1"^^ . "macos"^^ . . . . "0"^^ . . "<p>We have SCORM lesson feature in our iOS mobile app. We open the SCORM lesson in WKWebView with the following code:</p>\n<pre><code>WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];\n if([[NSUserDefaults standardUserDefaults] objectForKey:[TMEUserDefaultKeys cdnSetCookie]]) {\n WKUserContentController *userContentController = [[WKUserContentController alloc] init];\n [userContentController addScriptMessageHandler:self name:@&quot;callNativeAction&quot;];\n [userContentController addScriptMessageHandler:self name:@&quot;callNativeActionWithArgs&quot;];\n WKUserScript *cookieScript = [[WKUserScript alloc]\n initWithSource:[NSString\n stringWithFormat:@&quot;document.cookie = '%@';&quot;,\n [[NSUserDefaults standardUserDefaults] objectForKey:[TMEUserDefaultKeys cdnSetCookie]]]\n injectionTime:WKUserScriptInjectionTimeAtDocumentStart\n forMainFrameOnly:YES];\n [userContentController addUserScript:cookieScript];\n [configuration setUserContentController:userContentController];\n }\n \n WKPreferences *preferences = [[WKPreferences alloc] init];\n preferences.javaScriptEnabled = YES;\n preferences.javaScriptCanOpenWindowsAutomatically = YES;\n configuration.preferences = preferences;\n configuration.websiteDataStore = [WKWebsiteDataStore defaultDataStore];\n configuration.allowsInlineMediaPlayback = YES;\n configuration.allowsAirPlayForMediaPlayback = YES;\n configuration.allowsPictureInPictureMediaPlayback = YES;\n configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone; //WKAudiovisualMediaTypeNone;\n NSArray&lt;NSHTTPCookie *&gt; *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];\n for(NSHTTPCookie *cookie in cookies) {\n [configuration.websiteDataStore.httpCookieStore setCookie:cookie completionHandler:nil];\n }\n\n self.webView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:configuration];\n self.webView.UIDelegate = self;\n self.webView.navigationDelegate = self;\n self.webView.allowsLinkPreview = YES;\n self.webView.translatesAutoresizingMaskIntoConstraints = false;\n self.webView.scrollView.bounces = NO;\n self.webView.scrollView.showsVerticalScrollIndicator = NO;\n self.webView.allowsBackForwardNavigationGestures = YES;\n self.webView.contentMode = UIViewContentModeScaleAspectFit;\n \n UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(setNavigationBarWithGestureRecognizer:)];\n UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(setNavigationBarWithGestureRecognizer:)];\n swipeUp.delegate = self;\n swipeDown.delegate = self;\n // Setting the swipe direction.\n [swipeUp setDirection:UISwipeGestureRecognizerDirectionUp];\n [swipeDown setDirection:UISwipeGestureRecognizerDirectionDown];\n [self.webView addGestureRecognizer:swipeUp];\n [self.webView addGestureRecognizer:swipeDown];\n \n [self.view addSubview:self.webView];\n</code></pre>\n<p>Even after we complete the reading of lesson, while we fetch the status of the lesson, it returns In Progress.</p>\n<p>Thanks in advance.</p>\n"^^ . . . . . "<p>I have some Objective C code compiled with ARC:</p>\n<pre class="lang-objectivec prettyprint-override"><code>void func(void) {\n NSString *string;\n\n // Do some stuff. Maybe return early.\n\n string = @&quot;initialized&quot;;\n\n // Other stuff.\n}\n</code></pre>\n<p>How does ARC handle an uninitialized object pointer? I assume that, like a C pointer, <code>string</code> initially contains stack garbage. If so, then how does ARC know what to do with it if, say, I were to return before initializing the variable?</p>\n<p>Do I need to initialize it to, say, <code>nil</code>, to avoid memory leaks?</p>\n<p>Does it matter if the reference was to a dispatch object or block instead of an <code>NSObject</code>?</p>\n"^^ . . . . . . "@Jack Let me know if my updated answer clarifies the changes you need to make."^^ . . . . . . . . . . . . . "How to convert from extendedSRGB color to standard sRGB outside of Swift or Objective-C"^^ . . . . . "0"^^ . . "0"^^ . . . "3"^^ . . . "<p>EDIT: changed this question into an answer, for those needing a solution for old Objective-C apps.</p>\n<p>Soon Apple will change the receipts for mac Apps to SHA-256 encoding, so if you like me still use SHA-1 to verify receipts you will be in trouble as of January 25 2025.</p>\n<p>To just verify the receipt for the App after download, no in-app purchases, AppTransaction seems the way to go. Objective-C code below calls AppTransaction from Swift, returning an int.</p>\n<p><a href="https://developer.apple.com/documentation/technotes/tn3138-handling-app-store-receipt-signing-certificate-changes" rel="nofollow noreferrer">Technote 3138</a> explains via <a href="https://developer.apple.com/documentation/appstorereceipts/validating_receipts_on_the_device" rel="nofollow noreferrer">Validating receipts on the device</a>: &quot;The receipt isn’t necessary if you use AppTransaction to validate the app download, or Transaction to validate in-app purchases&quot;.</p>\n<p>Swift module:</p>\n<pre><code>import Foundation\nimport StoreKit\n\npublic final class ReceiptValidation : NSObject {\n \n private func ValidityOfAppStoreReceipt() async -&gt; Int {\n do {\n let verificationResult = try await AppTransaction.shared\n print(&quot;verificationResult=&quot;,verificationResult)\n\n switch verificationResult {\n case .verified(let appTransaction):\n // StoreKit verified that the user purchased this app and the properties in the AppTransaction instance. Add your code here.\n return 1;\n case .unverified(let appTransaction, let verificationError):\n // The app transaction didn't pass StoreKit's verification. Handle unverified app transaction information according to your business model. Add your code here.\n return 99;\n }\n }\n catch {\n // Handle errors.\n print(&quot;error.localizedDescription=&quot;, error.localizedDescription)\n return 99;\n }\n }\n \n \n @objc public func getValidityOfAppStoreReceipt() async throws -&gt; Int {\n\n let validity = await ValidityOfAppStoreReceipt();\n \n print(&quot;(swift) validity=&quot;, validity);\n return validity;\n }\n \n}\n</code></pre>\n<p>Objective-c code:</p>\n<pre><code>- (void) ReceiptValidatedWith:(int)validation_code\n// Called from completion block\n{ \n if (validation_code != 1) {\n ALog(@&quot;AppStore receipt invalid, exiting.&quot;);\n [NSApp terminate:self];\n }\n else {\n ALog(@&quot;AppStore receipt VALID, continuing.&quot;);\n }\n}\n\n- (void) validateReceipt\n// Validating receipt now only possible via Swift, call method AppTransaction.shared in swift module.\n// As that all is async code we need to jump through some hoops to get at the value of the validity code.\n{\n ALog(@&quot;validating receipt...&quot;);\n \n // 'WithCompletionHandler' is automatically added\n [self.receiptValidation getValidityOfAppStoreReceiptWithCompletionHandler:^(NSInteger validation_code, NSError *error) {\n [self ReceiptValidatedWith:validation_code]; // called on completion of the Swift code\n }];\n} \n</code></pre>\n<p>.h</p>\n<pre><code>// AppStore receipt validation module (Swift)\n@property (nonatomic,strong) ReceiptValidation *receiptValidation; // swift\n</code></pre>\n<p>.m</p>\n<pre><code>@synthesize receiptValidation; // swift module\n\n// AppStore receipt validation with swift module\nself.receiptValidation = [[ReceiptValidation alloc] init];\n</code></pre>\n"^^ . . "1"^^ . . . . . "Glad it worked. I'm not sure what the edits were intended for. `UITextView` already has a `textLayoutManager` property. No need to add the property to the category. And it makes no sense to add a `viewDidLoad` method to `UITextView`. `viewDidLoad` is for a `UIViewController`, not a `UITextView`."^^ . "0"^^ . "0"^^ . . . "See [Encapsulating Data](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html)"^^ . . . . "1"^^ . . . "0"^^ . "But this creates a new problem. ``dragImageForRowsWithIndexes:`` returns a blank image when I call this method within ``tableView:draggingSession:willBeginAtPoint:forRowIndexes:``. This returns the correct image of the row when the row size style is "custom"."^^ . . . . "0"^^ . . . . . . "0"^^ . . . "0"^^ . "option-type"^^ . . "<p>I figured out what the problem was, which had to do with my custom comparison method, as opposed to anything I was doing in the storyboard or setting up the sort descriptors. Apple's Table View Programming Guide goes into some detail about the comparison selector stating, &quot;This comparison selector expects a single parameter&quot; (<a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/TableView/SortingTableViews/SortingTableViews.html" rel="nofollow noreferrer">Table View Programming Guide for Mac)</a>, where I had been expecting a method that takes a pair of parameters like sorting an NSArray. The correct custom comparison method goes in the custom object that will be compared and looks like this:</p>\n<pre><code>- (NSComparisonResult) myCompare:(id) obj {\n\n myObject *objToCompare = (myObject *) obj;\n\n if (objToCompare.value &lt; value)\n return NSOrderedAscending;\n else if (objToCompare.value &gt; value)\n return NSOrderedDescending;\n else\n return NSOrderedSame; // they must be the same\n};\n</code></pre>\n"^^ . "We cannot use Let's Encrypt. We provide clients with physical servers, and these servers are installed and designed to operate on a local network without internet access. These servers, all in local networks, do not have domain names."^^ . "Got it, thanks @Willeke"^^ . "1"^^ . "1"^^ . . "0"^^ . . . "0"^^ . . . . . . "0"^^ . . . . "<p>I am working on a hybrid Objective-C/Swift project containing many legacy Objective-C NSObjects with properties.</p>\n<p>In Objective-C, the values of the properties can be nil. However, when accessed from Swift, they are ingested as non-optional. I don't want to change the legacy Objective-C code as it is used throughout the project in many places.</p>\n<p>What Swift code can I write to access the properties given that they may be nil? Here is a stripped down version of the code with two things I have tried:</p>\n<p>Objective-C:</p>\n<pre class="lang-objectivec prettyprint-override"><code>@interface myObject : NSObject\n\n@property (nonatomic, retain) NSData * video;\n</code></pre>\n<p>Swift</p>\n<pre class="lang-swift prettyprint-override"><code>//object with property is sent in Notification\n\nif let latest = notification.userInfo?[&quot;incoming&quot;] as? myObject {\n // Approach 1...compare to nil gives compiler warning\n let thevideo = latest.video \n if theVideo != nil { //thows compiler warning Comparing non-optional value of type 'Data' to 'nil' always returns true\n //do something with video\n } else {\n //handle nil case\n }\n \n // Approach 2..treat it like optional gives compiler error \n if let aVideo = latest.video {\n //compiler error: initializer for conditional binding must have Optional type, not 'Data'\n \n //Do something with the video if it exists\n } else {\n //handle nil case\n }\n</code></pre>\n<p>How can I check if the property is nil given that it is not an optional in Swift?</p>\n"^^ . . . . . "0"^^ . . . . . . . . . . . "1"^^ . . . "0"^^ . "1"^^ . . . . . "0"^^ . . "The simplest is to change `@property (nonatomic, retain) NSData * video;` to `@property (nonatomic, retain, nullable) NSData * video;` in the .h file. Then the property will be optional in Swift."^^ . "<blockquote>\n<p>I assume that, like a C pointer, <code>string</code> initially contains stack garbage.</p>\n</blockquote>\n<p>This is actually <strong>not</strong> the case. From the <a href="https://clang.llvm.org/docs/AutomaticReferenceCounting.html#conversion-of-pointers-to-ownership-qualified-types" rel="nofollow noreferrer">Clang ARC docs</a>:</p>\n<blockquote>\n<p>It is undefined behavior if the storage of a <code>__strong</code> or <code>__weak</code> object is not properly initialized before the first managed operation is performed on the object, or if the storage of such an object is freed or reused before the object has been properly deinitialized.</p>\n</blockquote>\n<p>i.e., garbage object pointers are invalid under ARC rules</p>\n<blockquote>\n<p>Storage for a <code>__strong</code> or <code>__weak</code> object may be properly initialized by filling it with the representation of a null pointer, e.g. by acquiring the memory with <code>calloc</code> or using <code>bzero</code> to zero it out. A <code>__strong</code> or <code>__weak</code> object may be properly deinitialized by assigning a null pointer into it. A <code>__strong</code> object may also be properly initialized by copying into it (e.g. with <code>memcpy</code>) the representation of a different <code>__strong</code> object whose storage has been properly initialized; doing this properly deinitializes the source object and causes its storage to no longer be properly initialized.</p>\n</blockquote>\n<p>i.e., <code>strong</code> references are valid when they either point to <code>nil</code> or a valid object pointer. (<code>weak</code> references are a little more complicated)</p>\n<p>The crux:</p>\n<blockquote>\n<p>These requirements are followed automatically for objects whose initialization and deinitialization are under the control of ARC:</p>\n<ul>\n<li>objects of static, automatic, and temporary storage duration</li>\n<li>instance variables of Objective-C objects</li>\n<li>elements of arrays where the array object’s initialization and deinitialization are under the control of ARC</li>\n<li>fields of Objective-C struct types where the struct object’s initialization and deinitialization are under the control of ARC</li>\n<li>non-static data members of Objective-C++ non-union class types</li>\n<li>Objective-C++ objects and arrays of dynamic storage duration created with the new or new[] operators and destroyed with the corresponding delete or delete[] operator</li>\n</ul>\n<p>They are not followed automatically for these objects:</p>\n<ul>\n<li>objects of dynamic storage duration created in other memory, such as that returned by malloc</li>\n<li>union members</li>\n</ul>\n</blockquote>\n<p>i.e., almost all variables are actually automatically <code>nil</code>ed out by ARC by default to make them valid for use.</p>\n<p>So, <strong>no</strong>, you don't need to explicitly <code>nil</code> out a local variable defined this way because it will be done automatically (though it's typically good practice to give explicit default values to make the behavior more obvious), and <strong>no</strong>, it doesn't matter whether the object is a dispatch object, block, or a subclass of <code>NSObject</code> (because they are all Objective-C objects with the same behavior).</p>\n<p>You <em>would</em> need to be careful about properly zeroing out object pointers which are contained in a <code>union</code> or otherwise manually allocated using <code>malloc</code>, but these cases are <em>very</em> uncommon.</p>\n"^^ . "<p>You have two issues with your non-working code:</p>\n<ol>\n<li><p>You are not calling an appropriate <code>init</code> method on <code>CustomClass</code>. You need at least something like:</p>\n<pre><code>[[CustomClass alloc] init]\n</code></pre>\n</li>\n<li><p><code>addTarget</code> does not retain the object you pass to the <code>target</code> parameter. This is stated in the <a href="https://developer.apple.com/documentation/uikit/uicontrol/1618259-addtarget?language=objc" rel="nofollow noreferrer">documentation</a>:</p>\n<blockquote>\n<p>The control does not retain the object in the target parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a control.</p>\n</blockquote>\n<p>So you need to store the <code>CustomClass</code> instance in an instance variable of the class that is creating the <code>UISwitch</code> in addition to initializing the instance correctly.</p>\n</li>\n</ol>\n<p>For example, add an instance variable to the class that has the <code>UISwitch</code> and name it <code>_handler</code> (or whatever you want).</p>\n<pre class="lang-objectivec prettyprint-override"><code>@implementation SomeViewController {\n CustomClass *_handler;\n}\n</code></pre>\n<p>Then your switch code becomes something like:</p>\n<pre class="lang-objectivec prettyprint-override"><code>_handler = [[CustomClass alloc] init];\nUISwitch *uiSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(100, 100, 50, 50)];\n[uiSwitch addTarget:_handler action:@selector(test) forControlEvents:UIControlEventValueChanged];\n[self addSubview:uiSwitch];\n</code></pre>\n<hr />\n<p>Your working code works because no instance of <code>CustomClass</code> needs to be created to call the static <code>test</code> method.</p>\n<hr />\n<p>FYI - You wrote:</p>\n<blockquote>\n<p>But if the function is deallocated it gets called normally.</p>\n</blockquote>\n<p>What you mean is:</p>\n<blockquote>\n<p>But if the function is static, it gets called normally.</p>\n</blockquote>\n"^^ . . . . . "sslpinning"^^ . . . . . "1"^^ . . "<p><strong>macOS, IOBluetooth</strong> framework.<br />\nMy goal is to create a temporary <strong>SDP</strong> service. <a href="https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/Bluetooth/BT_Develop_BT_Apps/BT_Develop_BT_Apps.html#//apple_ref/doc/uid/TP30000997-CH216-BACIEJCA" rel="nofollow noreferrer">According to the documentation</a>, by default a temporary service is created (aka <strong>Persistent = NO</strong>), which is deleted after the application is closed. The documentation also mentions the <strong>IOBluetoothRemoveServiceWithRecordHandle</strong> function for forced removal of the service. This function is deprecated and is currently unavailable. I guesse that it has been replaced by the <strong>IOBluetoothSDPServiceRecord.removeServiceRecord</strong> method.<br />\nThe essence of the problem is that the server is not deleted either using <strong>removeServiceRecord</strong> or even after app closing. That is, if you create several services and try to delete them, they will remain alive. Only turning Bluetooth off and on in the OS helps. I tested all versions of macOS starting with <strong>Monteray</strong>. The same behavior.</p>\n<p><a href="https://i.sstatic.net/xsNe3ciI.png" rel="nofollow noreferrer">Example of requesting services from <strong>PacketLogger</strong>.</a></p>\n<p>Can someone confirm this behavior? And is there a solution?</p>\n<pre><code> for (int i = 0; i &lt; 10; i++) {\n service = [IOBluetoothSDPServiceRecord publishedServiceRecordWithDictionary:dictionary];\n if (!service) {\n NSLog(@&quot;Failed to create service&quot;);\n }\n else\n {\n [service getRFCOMMChannelID:&amp;channelID];\n [service getServiceRecordHandle:&amp;serverHandle];\n NSLog(@&quot;A new service has been created handle=%u, channelID=%hhu&quot;, serverHandle, channelID);\n if (service.removeServiceRecord != kIOReturnSuccess) {\n NSLog(@&quot;Failed to delete service&quot;);\n }\n //service.release;\n service = nil;\n }\n }\n</code></pre>\n<p>A minimal test example is available <a href="https://github.com/ViktorAkselrod/TestServiceSDP.git" rel="nofollow noreferrer">at the link</a>.</p>\n"^^ . . "0"^^ . . . "0"^^ . . "-1"^^ . "`WKOpenPanelParameters` knows the file types but it's private API. You can get them with `[parameters valueForKey:@"allowedFileExtensions"]`."^^ . "1"^^ . "0"^^ . "2"^^ . "How do I put a hyperlink into NSPasteboard that other apps recognize?"^^ . . . "cocoa"^^ . "1"^^ . . . "UISwitch addTarget fails to call an allocated function from a different class"^^ . . . . . . . . . . . . . "<p>I'm converting some code from <code>Objective-C</code> to <code>Swift</code> and I have a very simple function that reads text from a file into a string.</p>\n<pre><code>@implementation DecodeFile\n- (NSString * _Nullable)readFile:(nonnull NSURL *)selectedFile {\n NSString *utf8 = [[NSString alloc] initWithContentsOfURL:selectedFile encoding:NSUTF8StringEncoding error:nil];\n if (utf8) { return utf8; }\n NSString *ascii = [[NSString alloc] initWithContentsOfURL:selectedFile encoding:NSASCIIStringEncoding error:nil];\n if (ascii) { return ascii; }\n \n return nil;\n}\n@end\n</code></pre>\n<p>If <code>utf8</code> fails, it attempts <code>ascii</code>. This works perfectly fine, but my Swift implementation fails with an ASCII file that succeeds using Obj-C!</p>\n<pre><code>print(try? String(contentsOf: selectedFile, encoding: .utf8)) &lt;-- nil\nprint(try? String(contentsOf: selectedFile, encoding: .ascii)) &lt;-- nil\n\nprint(String(data: data, encoding: .utf8)) &lt;-- nil\nprint(String(data: data, encoding: .ascii)) &lt;-- nil\n\n// Obj-C implementation\nprint(DecodeFile().read(selectedFile)) &lt;-- WORKS\n</code></pre>\n<p>Why would this fail, and how can I get the same behaviour from Swift as Obj-C?</p>\n"^^ . "widgetkit"^^ . . . "I would suggest quitting Xcode and deleting the derived data and caches."^^ . "1"^^ . . "0"^^ . "<p>I have this Objective-C framework FooModule:</p>\n<pre class="lang-objectivec prettyprint-override"><code>// Foo2.h\n\n#import &lt;Foundation/Foundation.h&gt;\nNS_ASSUME_NONNULL_BEGIN\n\ntypedef void (^Reply)(id data);\ntypedef void (^Handler)(Reply reply);\n\n@interface Foo2 : NSObject\n- (id)initWithQueue: (dispatch_queue_t)queue;\n- (void)setupHandler: (Handler)handler;\n@end\nNS_ASSUME_NONNULL_END\n</code></pre>\n<pre class="lang-objectivec prettyprint-override"><code>// Foo2.m\n\n#import &quot;Foo2.h&quot;\n\n@implementation Foo2 {\n dispatch_queue_t _queue;\n}\n- (id)initWithQueue: (dispatch_queue_t)queue {\n if ((self = [super init])) {\n _queue = queue;\n }\n return self;\n}\n\n- (void)setupHandler:(Handler)handler {\n dispatch_async(_queue, ^{\n handler(^(id data){\n NSLog(@&quot;data is %@&quot;, data);\n });\n });\n}\n@end\n</code></pre>\n<p>Then in my app binary, I do</p>\n<pre class="lang-swift prettyprint-override"><code>@preconcurrency import FooModule\nfunc aGlobalFreeFunction() {\n\n let foo = Foo2(queue: .global())\n foo.setupHandler { reply in\n Task {\n reply(&quot;foo&quot;)\n }\n }\n}\n</code></pre>\n<p>This gives me error (not warning) in swift 6 mode:</p>\n<blockquote>\n<p>Passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure</p>\n</blockquote>\n<p>I wonder why @preconcurrency import doesn't silence the error.</p>\n<p>I tried out another non-closure type:</p>\n<pre class="lang-objectivec prettyprint-override"><code>@interface FooNonSendable : NSObject\n@property int foo;\n@end\n\n@implementation FooNonSendable\n@end\n</code></pre>\n<p>Then in my swift code, after using @preconcurrent import:</p>\n<pre class="lang-swift prettyprint-override"><code>\n\nfunc aGlobalFreeFunction() {\n let fooNonSendable = FooNonSendable()\n\n Task {\n Task { @MainActor in\n print(fooNonSendable)\n }\n }\n}\n</code></pre>\n<p>This code does not give any errors or warnings, meaning that @preconcurrency is able to silence error for fooNonSendable, but not <code>reply</code> closure.</p>\n"^^ . . . "1"^^ . . "Update Visible Range UITextView Method"^^ . "core-foundation"^^ . . "It's set to "Jump to definition", and it jumps for *my* classes etc., but not for *framework* classes."^^ . "Is it possible to run Webmin in a Cocoa Application written in Swift or Objective-C using a WKWebView?"^^ . . . . "0"^^ . . . . "0"^^ . "Apply a transform?"^^ . . . . "ios"^^ . . "0"^^ . . "0"^^ . "Mac AppStore local receipt validation using StoreKit AppTransaction from Swift - async problems"^^ . . "<p>You can write such a static property yourself, and update it as the key presses change, by overriding <code>pressesBegan</code>/<code>pressesEnded</code> in your app delegate/scene delegate (or anywhere else along the responder chain).</p>\n<pre><code>extension UIEvent {\n fileprivate(set) static var modifierKeys: UIKeyModifierFlags = []\n}\n\n// ...\n\noverride func pressesBegan(_ presses: Set&lt;UIPress&gt;, with event: UIPressesEvent?) {\n UIEvent.modifierKeys.formUnion(event?.modifierFlags ?? [])\n}\n\noverride func pressesEnded(_ presses: Set&lt;UIPress&gt;, with event: UIPressesEvent?) {\n UIEvent.modifierKeys.formIntersection(event?.modifierFlags ?? [])\n}\n\noverride func pressesCancelled(_ presses: Set&lt;UIPress&gt;, with event: UIPressesEvent?) {\n UIEvent.modifierKeys.formIntersection(event?.modifierFlags ?? [])\n}\n</code></pre>\n<hr>\n<p>The above cannot get you the current state of the caps lock key until your app receives a key press. The only way I found is through private IOKit APIs (inspired by <a href="https://stackoverflow.com/a/75870807/5133585">this answer</a>). This will likely get your app rejected from the App Store, but I will include it anyway as a proof of concept.</p>\n<pre class="lang-objectivec prettyprint-override"><code>// ---- Implementation ----\n\n#include &lt;IOKit/IOKitLib.h&gt;\n\n#define kIOHIDSystemClass &quot;IOHIDSystem&quot;\n#define kIOHIDParamConnectType 1\n#define kIOHIDCapsLockState 0x00000001\n\n// In macOS the above constants and IOHIDGetModifierLockState\n// are declared in IOKit/hid/IOHIDLib.h but that header is not in iOS.\n// Even so, IOHIDGetModifierLockState apparently *does* exist in iOS\n// so we can just declare its prototype and linking succeeds nonetheless\n\nextern kern_return_t\nIOHIDGetModifierLockState( io_connect_t handle, int selector, bool *state );\n\n@implementation ObjCClass\n \n+ (BOOL)getCapsLock {\n bool state = false;\n @autoreleasepool {\n io_service_t ioService = IOServiceGetMatchingService(kIOMainPortDefault, IOServiceMatching(kIOHIDSystemClass));\n io_connect_t ioConnect = 0;\n IOServiceOpen(ioService, mach_task_self_, kIOHIDParamConnectType, &amp;ioConnect);\n\n IOHIDGetModifierLockState(ioConnect, kIOHIDCapsLockState, &amp;state);\n\n IOServiceClose(ioConnect);\n }\n return state;\n}\n\n@end\n\n// ---- Swift Bridging Header ----\n\n@interface ObjCClass : NSObject\n \n+ (BOOL)getCapsLock;\n\n@end\n</code></pre>\n<p>You can then just do <code>ObjCClass.getCapsLock()</code>.</p>\n"^^ . . . . . . . . . "<p>The app's textView utilizes text kit 2. However the compiler reports it has to fall back to text kit 1 because text kit 1's layout manager was accessed, which was traced back to the code provided.\nWhen <code>NSLayoutManger</code> is not used, no warnings are reported. How can I refactor this method to resolve this issue?</p>\n<p>Here's the code:</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (NSRange)visibleRange {\n // Get the layout manager associated with the text view\n NSLayoutManager *layoutManager = self.scriptView.layoutManager;\n \n // Get the visible rectangle of the text view\n CGRect visibleRect = self.scriptView.bounds;\n \n // Convert the visible rectangle into a glyph range\n NSRange glyphRange = [layoutManager glyphRangeForBoundingRect:visibleRect\n inTextContainer:self.scriptView.textContainer];\n \n // Convert the glyph range into a character range and return it\n return [layoutManager characterRangeForGlyphRange:glyphRange actualGlyphRange:NULL];\n}\n</code></pre>\n<p>This code returns the viewable range of the textview when using Mac Catalyst.</p>\n"^^ . . . . "cgi"^^ . . . "0"^^ . "0"^^ . . . . "@Jack Update your question with your new code trying to implement my answer. You must be doing something incorrectly."^^ . "0"^^ . "I can't account for that."^^ . . . . . . . . . "@simd I don't think there is a way to do that on launch, and as far as I know, one can connect multiple keyboards to a mac and they can all have their own independent caps locks, so a static property isn't really as "obvious" as you think."^^ . . "1"^^ . . . . "I want to query current state of modifierFlags anywhere in the app, without observing the key presses manually. UIEvent has only modifierFlags only as instance property, NSEvent has modifierFlags as a static property as well for that - https://developer.apple.com/documentation/appkit/nsevent/modifierflags-swift.type.property?language=objc"^^ . . . "That was the answer I was afraid to hear about. I didn’t implement this myself but I understand why they did so and it still makes sense to a degree. Unfortunately, seems like we’re paying the debt for that decision now."^^ . . "0"^^ . "0"^^ . . "0"^^ . . "srgb"^^ . "1"^^ . "It seems that’s exactly what’s happened. Objective-C .ascii falls back to `.windowsCP1252`. So when UTF fails, the ASCII also fails but falls back to WinCP."^^ . "0"^^ . . "0"^^ . . "core-image"^^ . "react native - create location tracking library for iOS"^^ . . . . . . . . . . . . . . "0"^^ . . . . "0"^^ . "1"^^ . . . . . . "1"^^ . . . . "is the MyThreadSafeMutableDictionary thread safe。 if unsafe, what's the problem。"^^ . . . . "<p>I have a command line program to convert images to JPEG which works but is <em>very slow</em> at converting some HEIC images from an iPhone 16. For example, a 3MB (5712x4284) HEIC image takes 1.4s to process, whereas converting the same image saved as a 100MB TIFF only takes 0.25s. Is there any way to speed this up?</p>\n<p>(All the time is spent in <code>drawInRect</code>, actually compressing it to JPEG etc. only takes about 25ms.)</p>\n<pre><code>#import &lt;Foundation/Foundation.h&gt;\n#import &lt;AppKit/AppKit.h&gt;\n#include &lt;sys/xattr.h&gt;\n#include &lt;sys/time.h&gt;\n#include &lt;stdio.h&gt;\n\nlong currentTimeMillis()\n{\n struct timeval t;\n gettimeofday(&amp;t, NULL);\n return t.tv_sec*1000L + t.tv_usec/1000;\n}\n\nvoid convertToJPEG(const char* inf, const char* outf)\n{\n long t0 = currentTimeMillis();\n NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];\n NSString* str = [NSString stringWithUTF8String:inf];\n\n NSImage *image = [[NSImage alloc]initWithContentsOfFile:str];\n NSSize size = [image size];\n printf(&quot;+%ld origsize %g x %g\\n&quot;, currentTimeMillis()-t0, size.width, size.height);\n size.width /= 2;\n size.height /= 2;\n\n NSBitmapImageRep *rep = [[NSBitmapImageRep alloc]\n initWithBitmapDataPlanes:NULL\n pixelsWide:size.width\n pixelsHigh:size.height\n bitsPerSample:8\n samplesPerPixel:4\n hasAlpha:YES\n isPlanar:NO\n colorSpaceName:NSCalibratedRGBColorSpace\n bytesPerRow:0\n bitsPerPixel:0];\n\n [NSGraphicsContext saveGraphicsState];\n [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:rep]];\n printf(&quot;+%ld setup\\n&quot;, currentTimeMillis()-t0);\n\n // Draw scaled image into representation **** THIS STEP IS SLOW ****\n [image drawInRect:NSMakeRect(0, 0, size.width, size.height) fromRect:NSZeroRect operation:NSCompositingOperationCopy fraction:1.0];\n \n printf(&quot;+%ld drawInRect\\n&quot;, currentTimeMillis()-t0);\n [NSGraphicsContext restoreGraphicsState];\n\n // Compress representation to JPEG\n [rep setProperty:NSImageColorSyncProfileData withValue:nil];\n NSDictionary *imageProps = [NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:0.5] forKey:NSImageCompressionFactor];\n NSData* data = [rep representationUsingType:NSBitmapImageFileTypeJPEG properties:imageProps];\n printf(&quot;+%ld compressed\\n&quot;, currentTimeMillis()-t0);\n\n int length = [data length];\n void* bytes = malloc(length);\n [data getBytes:bytes length:length];\n \n FILE* out = fopen(outf, &quot;w&quot;);\n fwrite(bytes, 1, length, out);\n fclose(out);\n free(bytes);\n\n [rep release];\n [image release];\n [pool release];\n printf(&quot;+%ld finished\\n&quot;, currentTimeMillis()-t0);\n}\n\nint main(int argc, const char** argv)\n{\n convertToJPEG(argv[1], &quot;out.jpg&quot;);\n}\n</code></pre>\n<p>Compile with <code>gcc -o tojpeg tojpeg.mm -framework CoreServices -framework AppKit</code>. (Apologies for the ugly mishmash of technologies, that's partly historical and partly a consequence of stripping it down to a SSCCE.)</p>\n"^^ . . "0"^^ . . . "So do you happen to know what would be the problem in my code of Objective-c(not swift) UIwebview? Both objective-c and uiwebview are old but so is http basic auth, which should work in this environment as well."^^ . . "uislider"^^ . "Could you share the stacktrace when it crashes? Also, there is no error message in console? What's the method `notifyRunmefit` do you have code from that? Are you sure the callback is not called? Did you put a log at the start of the closure?"^^ . . . "crashlytics"^^ . . . . "0"^^ . . . "What's a point of adding `dynamic` property? You can add property in model and set it default value and get generated by xcode h,m files."^^ . . "0"^^ . "1"^^ . . "<p>is the MyThreadSafeMutableDictionary thread safe?</p>\n<p>actually, i get some NSDictionary crash issues,</p>\n<p>i just call\n[MyThreadSafeMutableDictionary objectForkey:@&quot;key&quot;]</p>\n<p>and\n[MyThreadSafeMutableDictionary removeAllObjects]\nin different thread.</p>\n<p>the call stack like:</p>\n<p>EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x000a00130008000c</p>\n<p>0</p>\n<p>libobjc.A.dylib\nobjc_msgSend + 8</p>\n<p>1</p>\n<p>CoreFoundation\n-[__NSDictionaryM objectForKey:] + 168</p>\n<p>2</p>\n<p>VSTThreadSafeMutableDictionary.m - line 154\n__47-[VSTThreadSafeMutableDictionary objectForKey:]_block_invoke + 154</p>\n<p>3</p>\n<p>libdispatch.dylib\n_dispatch_client_callout + 20</p>\n<p>4</p>\n<p>libdispatch.dylib\n_dispatch_sync_invoke_and_complete + 56</p>\n<p>5</p>\n<p>MyThreadSafeMutableDictionary.m</p>\n<ul>\n<li>line 153 -[VSTThreadSafeMutableDictionary objectForKey:] + 153</li>\n</ul>\n<p>MyThreadSafeMutableDictionary.m</p>\n<p>line 153 -[VSTThreadSafeMutableDictionary objectForKey:] + 153**</p>\n<pre><code>**the MyThreadSafeMutableDictionary.h source code as follows:**\n\n#import &quot;MyThreadSafeMutableDictionary.h&quot;\n\n@interface MyThreadSafeMutableDictionary ()\n\n@property (nonatomic, strong) NSMutableDictionary *mutableDictionary;\n\n@end\n\n@implementation MyThreadSafeMutableDictionary\n\n+ (NSString *)queueName {\n CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault);\n NSString *uuid = (NSString *)CFBridgingRelease(CFUUIDCreateString(kCFAllocatorDefault, uuidRef));\n CFRelease(uuidRef);\n \n NSString *queueName = [NSString stringWithFormat:@&quot;com.my.thread.safe.Dictionary.%@&quot;, uuid];\n return queueName;\n}\n\n+ (instancetype)dictionary {\n MyThreadSafeMutableDictionary *mutableDictionary = [MyThreadSafeMutableDictionary new];\n return mutableDictionary;\n}\n\n+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {\n MyThreadSafeMutableDictionary *mutableDictionary = [[MyThreadSafeMutableDictionary alloc] initWithCapacity:numItems];\n return mutableDictionary;\n}\n\n+ (instancetype)dictionaryWithDictionary:(NSDictionary *)dict {\n MyThreadSafeMutableDictionary *mutableDictionary = [self dictionary];\n [mutableDictionary addEntriesFromDictionary:dict];\n return mutableDictionary;\n}\n\n- (instancetype)init {\n return [self initWithCapacity:0];\n}\n\n- (instancetype)initWithDictionary:(NSDictionary *)otherDictionary {\n if (self = [self initWithCapacity:0]) {\n [self addEntriesFromDictionary:otherDictionary];\n }\n return self;\n}\n\n- (instancetype)initWithCapacity:(NSUInteger)numItems {\n if (self = [super init]) {\n if (numItems == 0) {\n _mutableDictionary = [NSMutableDictionary new];\n } else {\n _mutableDictionary = [NSMutableDictionary dictionaryWithCapacity:numItems];\n }\n _syncQueue = dispatch_queue_create([MyThreadSafeMutableDictionary.queueName UTF8String], DISPATCH_QUEUE_CONCURRENT);\n }\n return self;\n}\n\n- (void)removeObjectForKey:(id)aKey {\n dispatch_barrier_async(self.syncQueue, ^{\n [self.mutableDictionary removeObjectForKey:aKey];\n });\n}\n\n- (void)setObject:(id)anObject forKey:(id&lt;NSCopying&gt;)aKey {\n dispatch_barrier_async(self.syncQueue, ^{\n [self.mutableDictionary setObject:anObject forKey:aKey];\n });\n}\n\n- (void)setValue:(id)value forKey:(NSString *)key {\n dispatch_barrier_async(self.syncQueue, ^{\n [self.mutableDictionary setValue:value forKey:key];\n });\n}\n\n- (void)addEntriesFromDictionary:(NSDictionary *)otherDictionary {\n dispatch_barrier_async(self.syncQueue, ^{\n [self.mutableDictionary addEntriesFromDictionary:otherDictionary];\n });\n}\n\n- (void)removeAllObjects {\n dispatch_barrier_async(self.syncQueue, ^{\n [self.mutableDictionary removeAllObjects];\n });\n}\n\n- (void)removeObjectsForKeys:(NSArray *)keyArray {\n dispatch_barrier_async(self.syncQueue, ^{\n [self.mutableDictionary removeObjectsForKeys:keyArray];\n });\n}\n\n- (NSArray *)keysSortedByValueUsingComparator:(NSComparator NS_NOESCAPE)cmptr {\n __block NSArray *keysSortedArray = nil;\n dispatch_sync(self.syncQueue, ^{\n keysSortedArray = [self.mutableDictionary keysSortedByValueUsingComparator:cmptr];\n });\n return keysSortedArray;\n}\n\n- (NSArray *)keysSortedByValueWithOptions:(NSSortOptions)opts usingComparator:(NSComparator NS_NOESCAPE)cmptr {\n __block NSArray *keysSortedArray = nil;\n dispatch_sync(self.syncQueue, ^{\n keysSortedArray = [self.mutableDictionary keysSortedByValueWithOptions:opts usingComparator:cmptr];\n });\n return keysSortedArray;\n}\n\n- (NSArray *)allKeys {\n __block NSArray *allKeys = nil;\n dispatch_sync(self.syncQueue, ^{\n allKeys = [self.mutableDictionary allKeys];\n });\n return allKeys;\n}\n\n- (NSArray *)allValues {\n __block NSArray *allValues = nil;\n dispatch_sync(self.syncQueue, ^{\n allValues = [self.mutableDictionary allValues];\n });\n return allValues;\n}\n\n- (NSDictionary *)copy {\n __block NSDictionary *copyDictionary = nil;\n dispatch_sync(self.syncQueue, ^{\n copyDictionary = [self.mutableDictionary copy];\n });\n return copyDictionary;\n}\n\n- (NSMutableDictionary *)mutableCopy {\n __block NSMutableDictionary *mutableCopyDictionary = nil;\n dispatch_sync(self.syncQueue, ^{\n mutableCopyDictionary = [self.mutableDictionary mutableCopy];\n });\n return mutableCopyDictionary;\n}\n\n- (id)objectForKey:(id)aKey {\n __block id valueObject = nil;\n dispatch_sync(self.syncQueue, ^{\n valueObject = [self.mutableDictionary objectForKey:aKey];\n });\n return valueObject;\n}\n\n- (id)valueForKey:(NSString *)key {\n __block id valueObject = nil;\n dispatch_sync(self.syncQueue, ^{\n valueObject = [self.mutableDictionary valueForKey:key];\n });\n return valueObject;\n}\n\n- (NSUInteger)count {\n __block NSUInteger dictionaryCount = 0;\n dispatch_sync(self.syncQueue, ^{\n dictionaryCount = self.mutableDictionary.count;\n });\n return dictionaryCount;\n}\n\n@end\n\n</code></pre>\n"^^ . . . "1"^^ . . . "I just read that you can't modify the phone app source. Do you not have access to that source code? If it is provided by a 3rd party, perhaps you need to raise the issue with them?"^^ . "1"^^ . . . . . . . . . . . "Note that once you’ve got this positioning the cells correctly, since they overlap, you may want to set the `zIndex` to appropriate values for all the cells, so the more central cells are laid out over the less central ones."^^ . "Yes, you should use a delegation pattern. This will also avoid the tight-coupling of the two view controllers. VC-B shouldn't manipulate controls in VC-A directly. It should just tell its delegate that it is being dismissed and then the logic as to what to do is in the delegate."^^ . "<p>Here's my sample project: <a href="https://github.com/Tj3n/TestProject" rel="nofollow noreferrer">https://github.com/Tj3n/TestProject</a></p>\n<p>I'm trying to create a Swift framework to use in an Objective-C app, build works fine, configuration all keep to default, added the framework in the app, imported ok, but I cannot access the class written in Swift, which already marked with <code>@objc</code> and <code>public</code>, not sure if anyone have an idea where I did wrong</p>\n<p>Framework:</p>\n<pre><code>@objc(TVNFoo) @objcMembers public class Foo: NSObject {\n public static let shared = Foo()\n \n public func foo() {\n print(&quot;foo&quot;)\n }\n}\n</code></pre>\n<p>App:</p>\n<pre><code>@import TestFramework;\n\n[TVNFoo shared]; // Use of undeclared identifier 'TVNFoo'\n</code></pre>\n<p>Edit:\nBy default <code>Defines Module</code> and <code>Build Libraries for Distribution</code> are set to Yes</p>\n"^^ . "0"^^ . . "(Asking because it's not visible from the posted code.) Are you setting `LESSViewController` as `webview`'s `navigationDelegate`?"^^ . "Can you provide more code that demonstrates the problem? Are you storing a reference to the value returned by `[MPNowPlayingInfoCenter defaultCenter]` rather than always using the `defaultCenter` property directly?"^^ . . "xcode"^^ . . "0"^^ . . . . . "0"^^ . . . . . . "How to generate an Xcode project from a MAUI iOS project?"^^ . . "I did tried this option as well, but when trying to consume SPM package for another framework target, it cause duplicate symbol, but does not happen for static library/framework project."^^ . "@Willeke I've updated the question and put a mre on github: <https://github.com/persquare/DrawBug>"^^ . "1"^^ . . . "swiftui"^^ . "<p>I have a WKWebView running a website that supports login with pintrest. By clicking on It I am opening a new window to not render in same webview and simulate like we see in other browsers.</p>\n<pre><code>- (WKWebView *)webView:(WKWebView *)webView\ncreateWebViewWithConfiguration:(WKWebViewConfiguration *)configuration\nforNavigationAction:(WKNavigationAction *)navigationAction\n windowFeatures:(WKWindowFeatures *)windowFeatures {\n \n // if (navigationAction.targetFrame == nil) {\n NSWindow *newWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 100, 800, 600) // Adjust window size\n styleMask:(NSWindowStyleMaskTitled |\n NSWindowStyleMaskClosable |\n NSWindowStyleMaskResizable)\n backing:NSBackingStoreBuffered\n defer:NO];\n \n // Create a new WKWebView for this new window\n WKWebView *popupWebView = [[WKWebView alloc] initWithFrame:newWindow.contentView.bounds\n configuration:configuration];\n popupWebView.navigationDelegate = self;\n popupWebView.UIDelegate = self;\n \n // Load an initial URL (you can modify this URL as needed)\n NSURL *url = navigationAction.request.URL;\n\n NSURLRequest *request = [NSURLRequest requestWithURL:url];\n [popupWebView loadRequest:request];\n \n // Add the WKWebView to the window's content view\n [newWindow.contentView addSubview:popupWebView];\n \n [newWindow makeKeyAndOrderFront:nil];\n return popupWebView;\n // }\n</code></pre>\n<p>There pinterset support login with google as well, clicking on which same method is called and a new window is called.</p>\n<p>But the problem is that when google auth is successful, window is not getting closed with message</p>\n<blockquote>\n<p>&quot;TypeError: null is not an object (evaluating\n'window.opener.postMessage')&quot;.</p>\n</blockquote>\n<p><a href="https://i.sstatic.net/cZDqQZgY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/cZDqQZgY.png" alt="enter image description here" /></a></p>\n<p>I tried various form to check how to connect these 2 window and enable &quot;window.opener&quot; but nothing found.</p>\n<p>I need help in this.</p>\n"^^ . . . . "0"^^ . "0"^^ . "1"^^ . "swift"^^ . "In my application, I am already properly detecting in which direction I have to display the layout. `NSMenu.userInterfaceLayoutDirection` is just getter, not a setter."^^ . . "1"^^ . "FYI, I am not using localized strings, because my application is cross platform"^^ . "It’s generally a custom `UICollectionViewLayout`, not a `UICollectionViewFlowLayout`. See the second example in https://stackoverflow.com/questions/41837170/ios-uicollectionview-cells-with-circular-view-in-alternating-grid-alignment/41839446#41839446 for a Swift example. If you need me to translate to Objective-C, I can, but hopefully that illustrates the idea."^^ . . . . "0"^^ . . "What's your current output (visually)?"^^ . . . . . . "On macOS you can run out you memory only if your application is working wrong: have memory leaks everywhere, caching in memory BLOBs."^^ . . "0"^^ . . . . . . "0"^^ . . . "0"^^ . "0"^^ . . "<p>Here's how to implement Export in the vanilla document based project:</p>\n<ol>\n<li><p>Add the imported file types (with a description) to info.plist</p>\n</li>\n<li><p>Implement <code>writableTypes</code></p>\n</li>\n<li><p>Add a menu item &quot;Export…&quot; and connect it to the First Responder and action <code>saveDocumentTo:</code></p>\n</li>\n</ol>\n<p>I vaguely remember reading documentation about this somewhere, but I can't find it anymore.</p>\n"^^ . "1"^^ . . "webview"^^ . . "frameworks"^^ . "I've added now "webView.navigationDelegate = self" to my viewDidLoad and now it works. This question pointed me in the right direction. Thank you."^^ . . "0"^^ . "I just realized you have an `Objective-C` library. Consider writing a small project in `XCode` on a Mac, in an **Apple** language (Objective-C or Swift), to test calls into the library. You'll get better information there than from Visual Studio. Especially If you have the source code or debug symbols for that library. Microsoft .Net is a step removed from those languages. Once you are confident in usage of the library, in your c# project, make similar calls to the C# binding methods."^^ . "0"^^ . "What do you mean by localized app ? is this about an info in a plist"^^ . . . "mpnowplayinginfocenter"^^ . . "0"^^ . "CGImage to vImage buffer conversion leads to wrong colors"^^ . . . "core-data"^^ . . . . . "0"^^ . . "WOOOOW Thanks a lot !!!!!!! It magicaly works"^^ . . . . . . . "0"^^ . . . . . . . . . . . . . . . . "<p>I have the following header and implementation files where <code>NSURLMyObject</code> is a category of <code>NSURL</code>, and contains a readonly class property <code>myString</code>:</p>\n<h5>NSURL+MyClass.h</h5>\n<pre class="lang-objectivec prettyprint-override"><code>@interface NSURL (NSURLMyClass)\n\n@property(class, readonly) NSString* myString;\n\n@end\n</code></pre>\n<h5>NSURL+MyClass.mm</h5>\n<pre class="lang-objectivec prettyprint-override"><code>@implementation MyObject\n\nstatic NSString* _myString;\n\n+ (NSString*) myString \n{\n if (_myString == nil) {\n _myString = @&quot;Hello&quot;;\n }\n return _myString;\n}\n\n@end\n</code></pre>\n<p>I have seen <a href="https://stackoverflow.com/questions/4586516/readonly-properties-in-objective-c">other threads</a> where either:</p>\n<ul>\n<li>a property is re-declared <code>readwrite</code> in the implementation and then synthesised</li>\n<li>or the underscored member variable is accessed directly, but there is no discussion of <em>class</em> properties, nor of class properties of categories.</li>\n</ul>\n<p>I believe such class readonly properties are roughly equivalent to <code>static constexpr</code> member variables in modern C++, where initialising them is a one-liner in the header:</p>\n<h5>MyClass.hxx</h5>\n<pre class="lang-cpp prettyprint-override"><code>#include &lt;string&gt;\n\nusing std::literals;\n\nstruct MyClass \n{\n static constexpr auto myString = &quot;Hello&quot;s;\n};\n\n// access with, for example, `std::println(&quot;{}&quot;, MyClass::myString);`\n</code></pre>\n<p>Now on to my questions:</p>\n<ol>\n<li><p>Can <code>MyClass.myString</code> be initialised more compactly, similar to C++ without having to declare the <code>static</code> underscore-prefixed variable, the getter, and the test for nullity?</p>\n</li>\n<li><p>Should I declare an <code>+ (instancetype) init</code> method and then initialise <code>myString</code> inside it? Would this not override the provided <code>+init</code> method that <code>NSURL</code> already has?</p>\n</li>\n<li><p>Is there some other way altogether, i.e. subclass rather than category? I'm not intimately familiar with Objective-C semantics so I'm not sure if an <code>NSURL*</code> returned by some Foundation class can be straightforwardly cast to <code>MyClass*</code> where <code>@interface MyClass : NSURL</code>.</p>\n</li>\n</ol>\n"^^ . . "<p>I would like to create a temporary BOOL property in a custom NSManagedObject class to track whether an async download of a remote image is underway so as not to start a second download while the first is underway. This value would not be stored in Core Data and is not included in xcmodel. It is supposed to be short term state variable to prevent recursive downloads.</p>\n<p>In the past, I've often added properties to custom NSManagedObject class files with no problem. However, in this case, the managedobjects are being fetched with a FetchedResultsController into a tableview. Aalthough adding a BOOL to the class gets past the compiler it crashes at runtime.</p>\n<p>When I look at the custom class in the debugger, it appears the BOOL property is not listed. Could it be that when you fetch managed objects using a fetchedResultsController, it ignores any properties that are not in the xcmodeldata file?</p>\n<p>Here is the error message(abbreviated):</p>\n<blockquote>\n<p>CoreData: error: Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. -[Feed awaitingResponse]: unrecognized selector sent to instance 0x6000021d8910 with userInfo (null)<br />\n*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Feed awaitingResponse]: unrecognized selector sent to instance 0x6000021d8910'</p>\n</blockquote>\n<p>Here is my code.</p>\n<p>Feed.h</p>\n<pre><code>@property (nonatomic, assign) BOOL awaitingResponse;\n</code></pre>\n<p>Feed.m</p>\n<pre><code>@dynamic awaitingResponse;\n\n- (void)awakeFromInsert {\n self.awaitingResponse = NO;//Attempt to set a default value. Compiles okay.\n}\n</code></pre>\n<p>The crash occurs, although the following compiles, when I try to access the property from another class as follows:</p>\n<pre><code>@implementation FeedViewController\n\n- (void)configureCell:(FeedCell *)cell withFeed: (Feed *)aFeed {\n BOOL awaitingResponse = aFeed.awaitingResponse;//CRASH OCCURS HERE\n}\n</code></pre>\n<p>I would like to use this BOOL to condition remote fetches of data, however, I can't even try to access it without getting the crash at runtime.</p>\n<p>How can I get and set values of this property?</p>\n"^^ . "firebase"^^ . "Thanks, that worked, but I'm no wiser... I'm trying to modernize a pre 10.5 app that I haven't touched in 20 years, I guess a lot has happened since then. Any pointers to some good docs? Apple's documentation is somewhat confusing."^^ . "0"^^ . . . . . . . . . "I would recommend a general clean up: use solely SPM for your project. Divide your project into several packages. For libraries (or parts) in your project, where it is not possible to be built a _package_, try to create a XCFramework that includes all architectures, then wrap it into a package. Ensure all architectures can be built and are included in the binaries. Prefer static (the default) for build and linkage with SPM. In other words, avoid CocoaPods. Note, that in Xcode 16, the binaries for Preview and the regular built are the same."^^ . "0"^^ . . . "The code editted. [uiwebview loadrequest] is now deleted (at the end of the code) and some codes are added at the "good" (search the word in the code) to show the index.html on the webview. It shows the index.html. Still the webview, however, is not responding... wondering what is wrong? thanks!"^^ . "0"^^ . . . . "0"^^ . . . . "uipresentingcontroller"^^ . . . . . . . . . "1"^^ . . . . . "<p>I'm having an issue specifically with SwiftUI previews in my iOS project. The project builds and runs fine on devices and simulators (in Rosetta mode), but SwiftUI previews fail to load in both Rosetta and native arm64 simulator environments. The main error in the preview is related to the Alamofire dependency in my SiriKit Intents extension:</p>\n<pre><code>Module map file '[DerivedData path]/Build/Products/Debug-iphonesimulator/Alamofire/Alamofire.modulemap' not found\n</code></pre>\n<p>This error repeats for multiple Swift files within my SiriKit Intents extension. Additionally, I'm seeing:</p>\n<pre><code>Cannot load underlying module for 'Alamofire\n</code></pre>\n<p>Environment</p>\n<ol>\n<li>Xcode version: 16.2</li>\n<li>macOS version: Sonoma 14.7</li>\n<li>Swift version: 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)</li>\n<li>Dependency management: CocoaPods</li>\n<li>Alamofire version: 5.8</li>\n</ol>\n<p>My project is a large, older codebase that contains a mix of UIKit, Objective-C and Swift</p>\n<p>Architecture Issue:\nThe project only builds successfully in Rosetta mode for simulators. SwiftUI previews are failing in both Rosetta and native arm64 environments. This suggests there may be a fundamental issue with how the preview system interacts with the project's architecture configuration.\nWhat I've Tried\nI've attempted several solutions without success:</p>\n<ol>\n<li>Cleaning the build folder (⇧⌘K and Option+⇧⌘K)</li>\n<li>Deleting derived data</li>\n<li>Reinstalling dependencies</li>\n<li>Restarting Xcode</li>\n<li>Removing and re-adding Alamofire</li>\n</ol>\n"^^ . . . . . "0"^^ . . "0"^^ . "Get reference to View ControllerA from ViewControllerB to change property"^^ . . "How do I get a click reported in WKWebView?"^^ . . . . . "1"^^ . "<p>I am trying to link an Objective-C static library against my MAUI iOS app and be able to debug it from Xcode. In order to do that, I'd need to generate the Xcode project out of the MAUI one. I cannot find any relevant information under the MAUI docs, other than a reference to an open sourced project called <a href="https://github.com/dotnet/xcsync" rel="nofollow noreferrer">xcsync</a>.\nHowever, when I run the tool, the project gets generated but it won't event build. (Multiple targets producing Info.plist, and missing MAUI class references)</p>\n<pre><code>xcsync generate \\\n --project ./MyMauiApp.csproj \\\n --target-framework-moniker net9.0-ios -f \\\n --verbosity Detailed\n</code></pre>\n<p>Is generating the Xcode project even possible?</p>\n"^^ . "0"^^ . . . "1"^^ . . . "0"^^ . . . . . "0"^^ . "0"^^ . "0"^^ . . . . "1"^^ . . . "Oh, is there a difference on MacOS? I guess I was asking in a general sense, as I've seen this pattern in apps for both iOS and MacOS."^^ . "macOS Key Logger works in Terminal but not with launchd"^^ . . . . "0"^^ . . "MPNowPlayingInfoCenter being deallocated when disconnecting CarPlay despite still being used by phone app"^^ . . . . "mqtt"^^ . . . . . . "<p>I'm using lldb to debug an application and I have this breakpoint right before a call <a href="https://developer.apple.com/documentation/systemconfiguration/scnetworkreachability?language=objc" rel="nofollow noreferrer">SCNetworkReachability</a></p>\n<pre><code>imp___stubs__SCNetworkReachabilityCreateWithAddress:\n jmp qword [_SCNetworkReachabilityCreateWithAddress_10000c0c8] \n</code></pre>\n<p>right here the RDI register contains a sockaddr structure that I want to inspect, so I'm trying to somehow cast the address to this type to get further information,I've tried the following commands:</p>\n<pre><code>expr *((sockaddr *)$rsi) \nexpr *((sockaddr_in *)$rsi) \np *((sockaddr *)$rsi) \np *((sockaddr_in *)$rsi) \n</code></pre>\n<p>the problem is that lldb does not recognize this structure, I need to somehow import this symbol but how do I go about this?</p>\n<p>I also tried to manually import the structure:</p>\n<pre><code>expr struct $sockaddr { unsigned char sa_len; unsigned char sa_family; char sa_data[14]; }\n</code></pre>\n<p>and then cast it:</p>\n<pre><code>expr ($sockaddr)$rdi\n</code></pre>\n<p>but now LLDB gives a different error:</p>\n<pre><code>candidate constructor (the implicit copy constructor) not viable: \n\nno known conversion from 'unsigned long' to 'const $sockaddr' for 1st argument\n\n candidate constructor (the implicit move constructor) not viable: no known conversion from 'unsigned long' to '$sockaddr' for 1st argument\n\nandidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided\n</code></pre>\n"^^ . "0"^^ . . "0"^^ . "<p>I am researching on creating library for react native new arch. At the moment, I am dealing with <code>create-react-native-library</code> to create a location tracking lib for iOS for better customization.</p>\n<p>I am new to both Objective-C and Swift, so truly need your helps.</p>\n<p>My current version:</p>\n<ul>\n<li>create-react-native-library: 0.48.3</li>\n<li>react-native: 0.78.0</li>\n</ul>\n<p>My iOS project already has:</p>\n<ul>\n<li>background location tracking enable</li>\n<li>info.plist with:\n<ul>\n<li><code>NSLocationWhenInUseUsageDescription</code></li>\n<li><code>NSLocationAlwaysUsageDescription</code></li>\n<li><code>NSLocationAlwaysAndWhenInUseUsageDescription</code></li>\n</ul>\n</li>\n</ul>\n<p>On simulator, app settings:</p>\n<ul>\n<li>Location tracking set to <code>Always allow</code></li>\n<li>Checked on Maps app and the blue dot is moving.</li>\n</ul>\n<h2>Please find code below</h2>\n<p>MyLocationTracking.h</p>\n<pre><code>#import &quot;generated/RNMyLocationTrackingSpec/RNMyLocationTrackingSpec.h&quot;\n\n@interface MyLocationTracking : NativeMyLocationTrackingSpecBase &lt;NativeMyLocationTrackingSpec&gt;\n\n@end\n</code></pre>\n<p>MyLocationTracking.mm</p>\n<pre><code>#import &lt;CoreLocation/CoreLocation.h&gt;\n\n#import &quot;MyLocationTracking.h&quot;\n#import &quot;MyLocationTracking-Swift.h&quot;\n\n@implementation MyLocationTracking\nRCT_EXPORT_MODULE()\n\n- (void)setInfo:(nonnull NSString *)baseURL token:(nonnull NSString *)token pushGPSInterval:(double)pushGPSInterval pushGPSDistance:(double)pushGPSDistance integrationId:(nonnull NSString *)integrationId {\n \n MyLocationTrackingImpl *swiftInstance = [MyLocationTrackingImpl shared];\n \n [swiftInstance setInfo:baseURL\n rnToken:token\n rnPushGPSInterval:pushGPSInterval\n rnPushGPSDistance:pushGPSDistance\n rnIntegrationId:integrationId\n callback:^(NSDictionary *locationData) {\n [self emitOnLocationChanged:locationData];\n }];\n}\n\n- (nonnull NSNumber *)isProviderEnabled {\n return @1;\n}\n\n\n- (nonnull NSNumber *)isServiceRunning {\n return @1;\n}\n\n\n- (void)startWatchLocation {\n [[MyLocationTrackingImpl shared] startWatchLocation];\n}\n\n\n- (void)stopWatchLocation {\n [[MyLocationTrackingImpl shared] stopWatchLocation];\n}\n\n\n- (void)updateIntegrationId:(nonnull NSString *)integrationId {\n [[MyLocationTrackingImpl shared] updateIntegrationId:integrationId];\n}\n\n\n- (std::shared_ptr&lt;facebook::react::TurboModule&gt;)getTurboModule:\n(const facebook::react::ObjCTurboModule::InitParams &amp;)params\n{\n return std::make_shared&lt;facebook::react::NativeMyLocationTrackingSpecJSI&gt;(params);\n}\n\n@end\n</code></pre>\n<p>MyLocationTrackingImpl.swift: This is working as a bridge to connect the core Location Tracking with the Objective C</p>\n<pre><code>import Foundation\n\n@objc\npublic class MyLocationTrackingImpl: NSObject {\n \n private let myLocationTrackingCore = MyLocationTrackingCore()\n\n // Singleton instance\n @objc public static let shared = MyLocationTrackingImpl()\n \n // Private initializer to enforce singleton\n private override init() {\n super.init()\n print(&quot;=== MySingleton initialized! ===&quot;) \n }\n \n @objc public func setInfo(_ baseURL: String, rnToken token: String, rnPushGPSInterval pushGPSInterval: Double, rnPushGPSDistance pushGPSDistance: Double, rnIntegrationId integrationId: String, callback: @escaping ([String: Any]) -&gt; Void) {\n myLocationTrackingCore.setInfo(baseURL, rnToken: token, rnPushGPSInterval: pushGPSInterval, rnPushGPSDistance: pushGPSDistance, rnIntegrationId: integrationId, callback: callback)\n }\n\n @objc public func startWatchLocation() {\n myLocationTrackingCore.startWatchLocation()\n }\n \n @objc public func stopWatchLocation() {\n myLocationTrackingCore.stopWatchLocation()\n }\n \n @objc public func updateIntegrationId(_ integrationId: String) {\n print(&quot;Updated Integration ID: \\(integrationId)&quot;);\n }\n}\n</code></pre>\n<p>MyLocationTrackingCore.swift</p>\n<pre><code>import Foundation\nimport CoreLocation\n\nclass MyLocationTrackingCore: NSObject, CLLocationManagerDelegate {\n \n var locationManager : CLLocationManager = CLLocationManager()\n \n var BASE_URL : String = &quot;&quot;\n var token : String = &quot;&quot;\n var pushGPSInterval : Double = 10_000\n var pushGPSDistance : Double = 0\n var integrationId : String = &quot;{}&quot;\n \n var pushGPSTimer: Date = Date()\n \n var locationCallback: (([String: Any]) -&gt; Void)?\n \n func setInfo(_ baseURL: String, rnToken token: String, rnPushGPSInterval pushGPSInterval: Double, rnPushGPSDistance pushGPSDistance: Double, rnIntegrationId integrationId: String, callback: @escaping ([String: Any]) -&gt; Void) {\n print(&quot;= Initializing....&quot;);\n self.BASE_URL = baseURL\n self.token = token\n self.integrationId = integrationId\n \n // The minTime is in millisecond, here we need second\n self.pushGPSInterval = (pushGPSInterval == 0 ? 10_000 : pushGPSInterval) / 1_000\n self.pushGPSDistance = pushGPSDistance &lt; 0 ? 0 : pushGPSDistance\n \n // Callback\n self.locationCallback = callback\n \n print(&quot;Base url : \\(self.BASE_URL)&quot;);\n print(&quot;token : \\(self.token)&quot;);\n print(&quot;integrationId : \\(self.integrationId)&quot;);\n print(&quot;pushGPSInterval : \\(self.pushGPSInterval)&quot;);\n print(&quot;pushGPSDistance : \\(self.pushGPSDistance)&quot;);\n print(&quot;trigger callback :&quot;);\n \n // Callback: try send data\n if let locationCallback = self.locationCallback {\n let newLocationData: [String: Any] = [\n &quot;lat&quot;: 37.7859,\n &quot;lng&quot;: -122.4364,\n &quot;alt&quot;: 15.0,\n &quot;spd&quot;: 6.0,\n &quot;course&quot;: 45.0\n ]\n locationCallback(newLocationData)\n print(&quot;- Location Callback triggered&quot;)\n } else {\n print(&quot;= Location Callback is nil&quot;)\n }\n \n // Init Location Manager\n self.locationManager.delegate = self\n self.locationManager.distanceFilter = self.pushGPSDistance\n self.locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation\n self.locationManager.requestWhenInUseAuthorization()\n self.locationManager.requestAlwaysAuthorization()\n self.locationManager.allowsBackgroundLocationUpdates = true\n self.locationManager.pausesLocationUpdatesAutomatically = false\n self.locationManager.activityType = .automotiveNavigation\n \n print(&quot;= Initialized&quot;);\n }\n \n func startWatchLocation() {\n if CLLocationManager.locationServicesEnabled() {\n self.pushGPSTimer = Date().addingTimeInterval(0)\n self.locationManager.startUpdatingLocation()\n print(&quot;Start location Location&quot;);\n }\n }\n \n func stopWatchLocation() {\n if CLLocationManager.locationServicesEnabled() {\n self.locationManager.stopUpdatingLocation()\n self.locationManager.delegate = nil\n print(&quot;Stop location tracking&quot;)\n }\n }\n \n func locationManager(\n _ manager: CLLocationManager,\n didUpdateLocations locations: [CLLocation]\n ) {\n if let userLocation = locations.last {\n let latitude = String(userLocation.coordinate.latitude)\n let longitude = String(userLocation.coordinate.longitude)\n let altitude = String(userLocation.altitude)\n let speed = String(userLocation.speed)\n let course = String(userLocation.course)\n \n print(&quot;===============&quot;)\n print(&quot;user latitude = \\(latitude)&quot;)\n print(&quot;user longitude = \\(longitude)&quot;)\n print(&quot;user altitude = \\(altitude)&quot;)\n print(&quot;user speed = \\(speed)&quot;)\n print(&quot;user course = \\(course)&quot;)\n } else {\n print(&quot;===============&quot;)\n print(&quot;No valid location data received&quot;)\n }\n }\n \n func locationManager(\n _ manager: CLLocationManager,\n didFailWithError error: Error\n ) {\n print(&quot;===============&quot;)\n print(&quot;Error = \\(error)&quot;)\n }\n}\n</code></pre>\n<p>At the moment, the lib can:</p>\n<ul>\n<li>Call Swift's method from Objective-C correctly.</li>\n<li>when startWatchLocation in MyLocationTrackingCore.swift execute, there is a location tracking icon on the top left of iOS simulator</li>\n<li>when stopWatchLocation in MyLocationTrackingCore.swift execute, the icon is gone</li>\n</ul>\n<p>The issue is:</p>\n<ul>\n<li>func locationManager: <code>didUpdateLocations</code> and <code>didFailWithError</code> are not triggered, no <code>print</code> method is executed.</li>\n</ul>\n<p>Please let me know if you have any ideas about why the <code>didUpdateLocations</code> and <code>didFailWithError</code> are not triggered.</p>\n<p>If you need any information, please also let me know.</p>\n<p>Many thanks, guys!</p>\n"^^ . . "1"^^ . . "0"^^ . . . "1"^^ . . . . . "Are your updated properties using KVC-compliant accessors?"^^ . "0"^^ . . "<p>I would <em><strong>highly recommend</strong></em> writing a custom <code>UIControl</code> subclass, but, if you want to stick with the transformed <code>UISlider</code> ...</p>\n<p>1 - we can't limit begin tracking to only a touch inside the thumb</p>\n<p>2 - we need to track the start touch point and update the slide value based on the y-coordinate &quot;delta&quot; from start touch to continued touch</p>\n<p>Here's your class, with a few changes:</p>\n<p><strong>CDCFaderSlider.h</strong></p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &lt;UIKit/UIKit.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface CDCFaderSlider : UISlider\n\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<p><strong>CDCFaderSlider.m</strong> - note: you didn't provide your <code>CDCFaderValueView</code> class, so I just implemented a simple one at the top...</p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &quot;CDCFaderSlider.h&quot;\n\n@interface CDCFaderValueView : UIView\n@property (assign, readwrite) float value;\n@end\n@implementation CDCFaderValueView\n@end\n\n@interface CDCFaderSlider ()\n{\n double curVal;\n CGPoint startPT;\n}\n@property (strong, nonatomic) CDCFaderValueView *valueView;\n@property (assign, readwrite) NSInteger count;\n\n@end\n\n@implementation CDCFaderSlider\n\n- (id)initWithFrame:(CGRect)frame {\n self = [super initWithFrame: frame];\n \n if (self) {\n [self setOpaque: true];\n [self setTransform: CGAffineTransformMakeRotation((CGFloat)(M_PI * -0.5f))];\n [self constructSlider];\n }\n return self;\n}\n\n- (id)initWithCoder:(NSCoder *)aDecoder {\n self = [super initWithCoder: aDecoder];\n \n if (self) {\n [self setTransform: CGAffineTransformMakeRotation((CGFloat)(M_PI * -0.5f))];\n [self constructSlider];\n }\n return self;\n}\n\n#pragma mark - UIControl touch event tracking\n\n- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {\n // get touch point in superview\n CGPoint touchPoint = [touch locationInView: self.superview];\n\n // is the touch inside my frame?\n if (CGRectContainsPoint(self.frame, touchPoint)) {\n [self positionAndUpdateValueView];\n [self fadeValueViewInAndOut: true];\n // save start point\n startPT = touchPoint;\n // save current value\n curVal = self.value;\n return YES;\n }\n \n return [super beginTrackingWithTouch: touch withEvent: event];\n}\n\n- (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {\n // get touch point in superview\n CGPoint touchPoint = [touch locationInView: self.superview];\n \n // get the y-coordinate movement\n double yDelta = startPT.y - touchPoint.y;\n // update value to the saved value plus\n // the yDelta as a percentage of frame height\n self.value = curVal + (yDelta / self.frame.size.height);\n \n [self positionAndUpdateValueView];\n return YES;\n}\n\n- (void)cancelTrackingWithEvent:(UIEvent *)event {\n [self fadeValueViewInAndOut: false];\n [super cancelTrackingWithEvent: event];\n}\n\n- (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {\n [self fadeValueViewInAndOut: false];\n [super endTrackingWithTouch: touch withEvent: event];\n}\n\n- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {\n [self fadeValueViewInAndOut: false];\n [super touchesEnded: touches withEvent: event];\n}\n\n- (BOOL) pointInside:(CGPoint)point withEvent:(UIEvent*)event {\n CGRect bounds = self.bounds;\n bounds = CGRectInset(bounds, 0, -70);\n return CGRectContainsPoint(bounds, point);\n}\n\n#pragma mark - Helper methods\n\n- (void)constructSlider {\n self.valueView = [[CDCFaderValueView alloc] initWithFrame: CGRectZero];\n self.valueView.backgroundColor = UIColor.cyanColor;\n self.valueView.alpha = 0.0;\n self.valueView.transform = CGAffineTransformMakeRotation((CGFloat)(M_PI * 0.5));\n \n dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n [self addSubview: self.valueView];\n });\n}\n\n- (void)fadeValueViewInAndOut:(BOOL)aFadeIn {\n [UIView animateWithDuration: 0.5 animations:^{\n if (aFadeIn) {\n self.valueView.alpha = 0.8;\n } else {\n self.valueView.alpha = 0.0;\n }\n } completion:^(BOOL finished){\n }];\n}\n\n- (void)positionAndUpdateValueView {\n CGRect ThumbRect = self.thumbRect;\n CGRect popupRect = CGRectOffset(ThumbRect, (CGFloat)floor(ThumbRect.size.width * 0.2), (CGFloat) - floor(ThumbRect.size.height * 0.5));\n self.valueView.frame = CGRectInset(popupRect, -30, -10);\n //self.valueView.value = faderDBValues[(NSInteger)self.value];\n}\n\n#pragma mark - Property\n\n- (CGRect)thumbRect {\n CGRect trackRect = [self trackRectForBounds: self.bounds];\n CGRect thumbR = [self thumbRectForBounds: self.bounds trackRect: trackRect value: self.value];\n \n return thumbR;\n}\n\n- (void)sendAction:(SEL)action to:(id)target forEvent:(UIEvent *)event {\n if (self.count &gt; 4) {\n [super sendAction: action to: target forEvent: event];\n self.count = 0;\n } else {\n self.count++;\n }\n \n if (self.tracking == 0) {\n [super sendAction: action to: target forEvent: event];\n }\n}\n\n@end\n</code></pre>\n<p>Example controller:</p>\n<p><strong>SliderTestViewController.h</strong></p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &lt;UIKit/UIKit.h&gt;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface SliderTestViewController : UIViewController\n\n@end\n\nNS_ASSUME_NONNULL_END\n</code></pre>\n<p><strong>SliderTestViewController.m</strong></p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &quot;SliderTestViewController.h&quot;\n#import &quot;CDCFaderSlider.h&quot;\n\n@interface SliderTestViewController ()\n@property (strong, nonatomic) CDCFaderSlider *slider;\n@property (strong, nonatomic) UIView *outlineView;\n@end\n\n@implementation SliderTestViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n \n self.view.backgroundColor = UIColor.systemYellowColor;\n \n self.slider = [CDCFaderSlider new];\n self.slider.translatesAutoresizingMaskIntoConstraints = NO;\n [self.view addSubview:self.slider];\n \n UILayoutGuide *g = self.view.safeAreaLayoutGuide;\n \n [NSLayoutConstraint activateConstraints:@[\n [self.slider.widthAnchor constraintEqualToConstant:500.0],\n [self.slider.heightAnchor constraintEqualToConstant:150.0],\n [self.slider.centerXAnchor constraintEqualToAnchor:g.centerXAnchor],\n [self.slider.centerYAnchor constraintEqualToAnchor:g.centerYAnchor],\n ]];\n\n // because the slider get's transformed, let's add an &quot;outline view&quot;\n // to show the actual frame of the slider\n self.outlineView = [UIView new];\n self.outlineView.userInteractionEnabled = NO;\n self.outlineView.layer.borderColor = UIColor.redColor.CGColor;\n self.outlineView.layer.borderWidth = 1.0;\n}\n\n- (void)viewDidLayoutSubviews {\n [super viewDidLayoutSubviews];\n \n // only execute if outlineView has not already been added\n if (!self.outlineView.superview) {\n [self.view addSubview:self.outlineView];\n self.outlineView.frame = self.slider.frame;\n }\n}\n\n@end\n</code></pre>\n<p>Looks like this when running - the red outline shows the frame of the transformed slider:</p>\n<p><a href="https://i.sstatic.net/O9qE0lw1.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/O9qE0lw1.png" alt="running" /></a></p>\n<p>You can touch-drag anywhere in the red rectangle to move the thumb.</p>\n"^^ . . . "Custom UICollectionViewFlowLayout With Half Circle"^^ . . . "It's unclear, you call yourself URL with `NSURLConnection` (why not `NSURLSession`) and call at the same time `UIWebView` for the same request?"^^ . . . . . "0"^^ . "0"^^ . . "0"^^ . "1"^^ . . "jsonmodel"^^ . "<p>I am using Objective-C and using the <code>openURL</code> method to open a URL with scheme. This is the URL: <code>ms-word:https://website.com/WorFile.docx</code></p>\n<p>This works fine and opens the document in Microsoft Word app.</p>\n<p>But when the URL consists of commands: <code>ms-word:ofe|u|https://website.com/WorFile.docx</code>, it is not opening the document in the Word app.</p>\n<p>How to fix this?</p>\n<p>Code:</p>\n<pre class="lang-objectivec prettyprint-override"><code>void openUri(const char* uri) {\n NSString* nsUri = [NSString stringWithUTF8String:uri];\n NSURL* url = [NSURL URLWithString:nsUri];\n \n [[NSWorkspace sharedWorkspace] openURL:url];\n}\n</code></pre>\n"^^ . "cllocationcoordinate2d"^^ . . "<p>I'm trying to modernize a 20+ year old cocoa/objective-c application. It is document-based and it can read/write its own data to file, but the user can also choose saveAs… to export the document in standard formats (not read by the app).</p>\n<p>From the (somewhat confusing) documentation I got the impression that an accessory panel shouldn't be needed to achieve this, given the correct information in <code>Info.plist</code>.</p>\n<p>I was expecting the user to pick a file format in the save panel and that that selection would be passed as the type when <code>-dataOfType:error:</code> is invoked. However, type is always the document's native type, regardless of the choice in the save panel.</p>\n<p><a href="https://i.sstatic.net/WxihJ72w.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WxihJ72w.png" alt="enter image description here" /></a></p>\n<p>I'm trying this out on a toy project with a vanilla document based project with the following changes:</p>\n<h3>Info.plist</h3>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;\n&lt;plist version=&quot;1.0&quot;&gt;\n&lt;dict&gt;\n &lt;key&gt;CFBundleDocumentTypes&lt;/key&gt;\n &lt;array&gt;\n &lt;dict&gt;\n &lt;key&gt;CFBundleTypeRole&lt;/key&gt;\n &lt;string&gt;Editor&lt;/string&gt;\n &lt;key&gt;LSHandlerRank&lt;/key&gt;\n &lt;string&gt;Default&lt;/string&gt;\n &lt;key&gt;LSItemContentTypes&lt;/key&gt;\n &lt;array&gt;\n &lt;string&gt;net.sourceforge.foo&lt;/string&gt;\n &lt;/array&gt;\n &lt;key&gt;NSDocumentClass&lt;/key&gt;\n &lt;string&gt;Document&lt;/string&gt;\n &lt;/dict&gt;\n &lt;/array&gt;\n &lt;key&gt;UTExportedTypeDeclarations&lt;/key&gt;\n &lt;array&gt;\n &lt;dict&gt;\n &lt;key&gt;UTTypeConformsTo&lt;/key&gt;\n &lt;array&gt;\n &lt;string&gt;public.data&lt;/string&gt;\n &lt;/array&gt;\n &lt;key&gt;UTTypeIcons&lt;/key&gt;\n &lt;dict/&gt;\n &lt;key&gt;UTTypeIdentifier&lt;/key&gt;\n &lt;string&gt;net.sourceforge.foo&lt;/string&gt;\n &lt;key&gt;UTTypeTagSpecification&lt;/key&gt;\n &lt;dict&gt;\n &lt;key&gt;public.filename-extension&lt;/key&gt;\n &lt;array&gt;\n &lt;string&gt;foo&lt;/string&gt;\n &lt;/array&gt;\n &lt;/dict&gt;\n &lt;/dict&gt;\n &lt;/array&gt;\n &lt;key&gt;UTImportedTypeDeclarations&lt;/key&gt;\n &lt;array&gt;\n &lt;dict&gt;\n &lt;key&gt;UTTypeConformsTo&lt;/key&gt;\n &lt;array&gt;\n &lt;string&gt;public.plain-text&lt;/string&gt;\n &lt;/array&gt;\n &lt;key&gt;UTTypeDescription&lt;/key&gt;\n &lt;string&gt;Example Text&lt;/string&gt;\n &lt;key&gt;UTTypeIdentifier&lt;/key&gt;\n &lt;string&gt;com.example.plain-text&lt;/string&gt;\n &lt;key&gt;UTTypeTagSpecification&lt;/key&gt;\n &lt;dict&gt;\n &lt;key&gt;public.filename-extension&lt;/key&gt;\n &lt;array&gt;\n &lt;string&gt;exampletext&lt;/string&gt;\n &lt;/array&gt;\n &lt;/dict&gt;\n &lt;/dict&gt;\n &lt;dict&gt;\n &lt;key&gt;UTTypeConformsTo&lt;/key&gt;\n &lt;array&gt;\n &lt;string&gt;net.daringfireball.markdown&lt;/string&gt;\n &lt;/array&gt;\n &lt;key&gt;UTTypeIcons&lt;/key&gt;\n &lt;dict/&gt;\n &lt;key&gt;UTTypeIdentifier&lt;/key&gt;\n &lt;string&gt;com.example.mrkdwn&lt;/string&gt;\n &lt;key&gt;UTTypeTagSpecification&lt;/key&gt;\n &lt;dict&gt;\n &lt;key&gt;public.filename-extension&lt;/key&gt;\n &lt;array&gt;\n &lt;string&gt;mrkdwn&lt;/string&gt;\n &lt;/array&gt;\n &lt;/dict&gt;\n &lt;/dict&gt;\n &lt;/array&gt;\n&lt;/dict&gt;\n&lt;/plist&gt;\n</code></pre>\n<h3>Document.m</h3>\n<pre><code>+ (BOOL)autosavesInPlace {\n return NO;\n}\n\n+ (NSArray *)writableTypes {\n return @[\n @&quot;net.sourceforge.foo&quot;,\n @&quot;com.example.plain-text&quot;,\n @&quot;com.example.mrkdwn&quot;,\n @&quot;net.daringfireball.markdown&quot;\n ];\n}\n\n- (BOOL) prepareSavePanel:(NSSavePanel *) savePanel {\n savePanel.allowedContentTypes = @[\n [UTType typeWithIdentifier:@&quot;com.example.plain-text&quot;],\n [UTType typeWithIdentifier:@&quot;net.sourceforge.foo&quot;],\n [UTType typeWithIdentifier:@&quot;com.example.mrkdwn&quot;],\n ];\n savePanel.showsContentTypes = YES;\n return true;\n}\n\n- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError {\n NSLog(@&quot;typeName: %@&quot;, typeName);\n return nil;\n}\n</code></pre>\n<p>Obviously I'm doing something wrong. Either I´m interpreting the docs wrong (and this approach is totally insane) or there is something not quite right in the <code>Info.plist</code> and/or the code. Any hints to what is going on here would be much appreciated.</p>\n"^^ . . "Here is what I found: \n\nWhen Phone app is running and then CarPlay is connected and then CarPlay is disconnected, default center gets lost.\n\nWhen CarPlay app is running and then phone app gets ran and then CarPlay disconnects default center remains just fine. @Paulw11"^^ . . "0"^^ . "UISlider thumb to move without touching the thumb"^^ . "Related: [NSImage drawInRect is more than 10 times slower on a much faster MacBook Pro?](https://stackoverflow.com/questions/58855049/nsimage-drawinrect-is-more-than-10-times-slower-on-a-much-faster-macbook-pro)"^^ . . . . . "cloudkit"^^ . "@Larme I tried it, and it still crashes. It must have something to do with no data being sent. When I try to read other data from the device, the method is called, and it works perfectly. It only crashes when there is no data."^^ . . "0"^^ . "@YijueXu I was commenting on the answer. `applicationDidReceiveMemoryWarning` is specific to iOS (UIKit) and is not available for macOS (AppKit)."^^ . . "<p>I managed to resolve this by changing the nsmanagedobject parameter to a standard nsobject.</p>\n<p>There must have been an issue with the context I was using.</p>\n"^^ . . "When develop frameworks: use SPM and forged all you know about build settings, bridging headers and module maps: it's too low level knowledge where it easily make mistakes without root knowledges how binaries are build in one ready product."^^ . . "Have you tried replacing `NSImage` with `CGImage` or `CIImage`?"^^ . . "I'd detect with the delegate method when URL change, and redo the basic auth there if needed... https://stackoverflow.com/questions/2834946/get-notified-about-a-page-change-in-uiwebview After all, basic auth is just setting the needed info in the header"^^ . "Since you want WebView, I'd suggest you use `WKWebView` and its delegate `WKNavigationDelegate` See https://stackoverflow.com/questions/60508114/wkwebview-with-basic-auth"^^ . . "1"^^ . . "0"^^ . "0"^^ . . "0"^^ . . "Yeah. Thank you for your help. I rewrote the stuff completely to Objective-C, because the sdk also uses Objective-C and now it works. Even though the documentation said, that Swift should work. I am still planning to use swift in the future, but for now it works :)"^^ . "Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking."^^ . . . . "How to compactly initialise a class readonly property of a category in Objective-C?"^^ . "Thank you very much for your info. I thought this is it! It does not, however, change the situation, even though the delegate method is properly called. The code is put in the original post. Thank you very much! Have a nice weekend :)"^^ . . . . "<p>The best option is using <a href="https://www.hackingwithswift.com/forums/swift/some-help-with-delegate-pattern-kindly-guide/16785" rel="nofollow noreferrer"><strong>delegation</strong></a>. It prevents tight coupling between controllers and ensures clean, modular, and reusable code.</p>\n<p><code>CustomVC.h</code>:</p>\n<pre><code>@protocol CustomVCDelegate &lt;NSObject&gt;\n- (void)customVCDidFinish:(BOOL)enableButton;\n@end\n\n\n@interface CustomVC : UIViewController\n@property (nonatomic, weak) id&lt;CustomVCDelegate&gt; delegate;\n@end\n</code></pre>\n<p><code>FirstCustomVC.h</code>:</p>\n<pre><code>#import &quot;CustomVC.h&quot;\n\n@interface FirstCustomVC : UIViewController &lt;CustomVCDelegate&gt;\n@property (weak, nonatomic) IBOutlet UIButton *myButton;\n@end\n</code></pre>\n<p><code>FirstCustomVC.m</code>:</p>\n<pre><code>- (void)customVCDidFinish:(BOOL)enableButton {\n self.myButton.enabled = enableButton;\n}\n\n- (void)launchSecondVC {\n UIStoryboard *storyBoard = self.storyboard;\n CustomVC *myVC = [storyBoard instantiateViewControllerWithIdentifier:@&quot;myvc&quot;];\n \n myVC.delegate = self; // Назначаем делегата\n \n UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:myVC];\n [self presentViewController:nav animated:YES completion:nil];\n}\n\n</code></pre>\n<p><code>CustomVC.m</code>:</p>\n<pre><code>- (void)dismissAndSendData {\n if ([self.delegate respondsToSelector:@selector(customVCDidFinish:)]) {\n [self.delegate customVCDidFinish:YES]; // Сообщаем делегату включить кнопку\n }\n \n [self dismissViewControllerAnimated:YES completion:nil]; // Закрываем ViewController B\n}\n</code></pre>\n"^^ . "<p>I am working on an app which is a MQTT Client to io.Adafruit Broker. I subscribe to various of my feeds including an image feed. I can also Publish to the image feed from another Client camera by touching a button in my app.<br />\nMy problem is that sometimes when I start Publishing to the image feed I don't stop the Publishing before I put my app in the background. It is then continuously Publishing an image in the background until I open the app back up and manually stop the image Publishing.\nI would like to have the image Publish to stop when the app enters the background but i can't seem to be able to accomplish this.\nI have tried the following code in the app delegate.m.\nI initialize and start the communication in the main view controller and everything works fine.</p>\n<pre><code>- (void)applicationDidEnterBackground:(UIApplication *)application\n{\n NSLog(@&quot;Entering background&quot;);\n \n NSString *movie = @&quot;8&quot;;\n NSData* data = [movie dataUsingEncoding:NSUTF8StringEncoding];\n [session3 publishData:data onTopic:self.avideo retain:NO qos:1 publishHandler:nil];\n NSLog(@&quot;movie:%@&quot;, movie);\n \n [UIApplication sharedApplication].idleTimerDisabled = NO;\n \n}\n</code></pre>\n<p>I get a printout that I enter background and the value of &quot;movie&quot; but It does not publish the value to io.adafruit so the camera continues to Publish images to the image feed. How can I do this?</p>\n"^^ . "I tried your code and it works for me. Does your app have permission in the System Prefs and did you remove and add your app again? Does the frontmost app have a "Emoji & Symbols" menu item with Fn-E?"^^ . . "0"^^ . . . . . . "0"^^ . . "How I can detect when the screenshot tool is open so I can stop listening to CGEventSourceButtonState input?"^^ . . . . . . "Off topic: Calling the pid variable `psn` is confusing."^^ . . . . "0"^^ . . . . . . . . . "See [Localization](https://developer.apple.com/localization/) and [NSMenu.userInterfaceLayoutDirection](https://developer.apple.com/documentation/Xcode/localization/)."^^ . . . . "SwiftUI Preview Fails to Load While Project Builds and Runs Fine: Alamofire Module Map Issue"^^ . "2"^^ . . "@red_menace I don't think KVC-compliance is involved here as I'm replacing the entire model by calling document's `readFromData:`, see updated question."^^ . . . . "0"^^ . . . . "0"^^ . . . "0"^^ . "1"^^ . . . . . . . . "<p>Set the NSTableView property <code>allowsTypeSelect</code> to <code>NO</code>. Or if you use Interface Builder there is a <code>Type Select</code> checkbox.</p>\n"^^ . . . "1"^^ . . . . . "No, I don't know of any good docs. Apple's documentation is getting worse and worse, especially AppKit."^^ . "<p><img src="https://i.sstatic.net/51puip3H.png" alt="enter image description here" /></p>\n<p>I want to use <code>UICollection</code> to display the cards. Each card is a cell; maybe it needs a custom <code>UICollectionViewFlowLayout</code>. How can I do this?</p>\n<p>This is my code, But it can not switch cards.\nI log <code>self.collectionView.contentOffset.x</code>, it is <code>0</code>.\nWhat is wrong?</p>\n<pre><code>@interface ArcCollectionViewFlowLayout()\n\n@property (nonatomic, assign) NSInteger currentPage;\n@property (nonatomic, assign) CGSize topItemSize;\n\n@end\n\nstatic const int kFlowLayoutVisibleItemCount = 7;\n\n@implementation ArcCollectionViewFlowLayout\n\n- (void)prepareLayout {\n [super prepareLayout];\n}\n\n- (CGSize)collectionViewContentSize {\n return self.collectionView.frame.size;\n}\n\n- (NSArray&lt;__kindof UICollectionViewLayoutAttributes *&gt; *)layoutAttributesForElementsInRect:(CGRect)rect {\n NSInteger itemsCount = [self.collectionView numberOfItemsInSection:0];\n \n if (itemsCount &lt;= 0) {\n return nil;\n }\n \n NSInteger minVisibleIndex = MAX(self.currentPage, 0);\n NSInteger contentOffset = (int)self.collectionView.contentOffset.x;\n NSInteger collectionBounds = (int)self.collectionView.bounds.size.width;\n CGFloat offset = contentOffset % collectionBounds;\n CGFloat offsetProgress = offset / collectionBounds*1.0f;\n CGFloat offsetAngle = offsetProgress / self.itemSize.width * 30;\n NSInteger maxVisibleIndex = MAX(MIN(itemsCount - 1, self.currentPage + kFlowLayoutVisibleItemCount), minVisibleIndex);\n \n NSMutableArray *attributeArray = [NSMutableArray array];\n for (NSInteger i = minVisibleIndex; i&lt;= maxVisibleIndex; i++) { \n \n NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];\n UICollectionViewLayoutAttributes *attributes = [[self layoutAttributesForItemAtIndexPath:indexPath] copy];\n attributes.center = CGPointMake(collectionBounds/2.0, self.collectionView.bounds.size.height / 2.0);\n\n if (i == minVisibleIndex) {\n attributes.zIndex = 1000;\n [self rotate:attributes offsetAngle:-90+offsetAngle];\n } else if (i == minVisibleIndex + 1) {\n attributes.zIndex = 1000 + 1;\n [self rotate:attributes offsetAngle:-60+offsetAngle];\n } else if (i == minVisibleIndex + 2) {\n attributes.zIndex = 1000 + 2;\n [self rotate:attributes offsetAngle:-30+offsetAngle];\n\n } else if (i == minVisibleIndex + 3) {\n attributes.zIndex = 1000 + 3;\n [self rotate:attributes offsetAngle:0+offsetAngle];\n\n } else if (i == minVisibleIndex + 4) {\n attributes.zIndex = 1000 + 2;\n [self rotate:attributes offsetAngle:30+offsetAngle];\n\n } else if (i == minVisibleIndex + 5) {\n attributes.zIndex = 1000 + 1;\n [self rotate:attributes offsetAngle:60+offsetAngle];\n } else if (i == minVisibleIndex + 6) {\n attributes.zIndex = 1000;\n [self rotate:attributes offsetAngle:90+offsetAngle];\n }\n attributes.size = self.topItemSize;\n \n [attributeArray addObject:attributes];\n }\n \n return attributeArray;\n}\n\n- (void)rotate:(UICollectionViewLayoutAttributes *)attributes offsetAngle:(CGFloat)offsetAngle {\n CGAffineTransform t0 = CGAffineTransformMakeTranslation(0, -attributes.size.height / 2.0);\n\n CGAffineTransform t1 = CGAffineTransformMakeRotation(angleToRadian(offsetAngle));\n CGAffineTransform t2 = CGAffineTransformMakeTranslation(0, attributes.size.height / 2.0);\n \n CGAffineTransform t = CGAffineTransformConcat(CGAffineTransformConcat(t0, t1), t2);\n attributes.transform = t;\n}\n\n- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {\n return YES;\n}\n\n- (NSInteger)currentPage {\n return MAX(floor(self.collectionView.contentOffset.x / 100), 0);\n}\n\n- (CGSize)topItemSize {\n return CGSizeMake(100, 160);\n}\n</code></pre>\n<p>I want to implement a half circle <code>UICollectionView</code>.</p>\n"^^ . . . . . "http"^^ . "Access value of convenience property in custom NSManagedObject class in Objective-C causing crash"^^ . . "core-bluetooth"^^ . . "0"^^ . . . . . . . . "0"^^ . . . "0"^^ . . . . . . . . "0"^^ . . . . "<p>webView.navigationDelegate = self was missing in my viewDidLoad. Thanks to<br />\nlazarevzubov to ask the right question</p>\n"^^ . . "1"^^ . . . . . . . . . "0"^^ . . . . . . "1"^^ . . . "1"^^ . . . . . . . . . "0"^^ . "Align NSMenuItem title to right"^^ . . "0"^^ . "Why do you store a reference? Does the problem go away if you don't do that?"^^ . . "<p>CGImage supports a wide variety of content, including formats that are 16 bits per channel, and have non RGB colorspaces, half-float samples, etc. So the above code (second example) doesn’t necessarily handle these cases correctly. The vImage function will do conversions and such, but data provider doesn’t and it isn’t guaranteed that the source colorspace combined with a 32-bit four channel pixel make any sense. Also your assumptions about bytes per row may be invalid, but that isn’t the error you are reporting. Get the bytes per row from the data provider.</p>\n<p>More likely, it may just be you are visualizing the contents of the vImage buffer incorrectly. I would be especially cautious of endian problems. The image could be BGRA and you might be visualizing it as ARGB or RGBA, for example. As you can see for some of these cases the alpha and blue channels can be swapped and in those cases the mostly opaque alpha will become a mostly blue image, with some swapping also of red and green. Your description sounds most like BGRA &lt;-&gt; RGBA, which swaps blue and red and would cause cyan to become yellow. bGRA is alpha first, little endian 32. RGBA is big endian alpha last. BGRA is the default format for iOS.</p>\n<p><em>Although I’ve never seen it myself in a CGImage, this kind of color swizzle might also occur with 444 YUV content that somehow made it into a CGImage, perhaps due to an busted upstream conversion from a CVPixelBuffer. There is no colorspace description for YUV per se. instead you get a RGB colorspace and a separate conversion matrix that has to be applied outside of ColorSync. (There isn’t any YUV in ICC color profiles, which is the issue there)</em></p>\n<p>What is primarily missing in this problem description is how you are visualizing the vImage buffer. You also should go find out what the colorspace and CGBitmapInfo for the image are and report back to see how you should be visualizing it. The colorspace will self report its contents using the po command in the debugger. The CGBitmapInfo bit field may or may not resolve itself in the debugger but it is fairly simple to decode by hand. You could also take the unusual step of composing a VImageConverterRef (or whatever the vimageconvert_any2any uses) for the conversion and the using po or vImageConverter_Print(converter) to dump the conversion pipeline. This would be helpful if you think the conversion itself is in error.</p>\n"^^ . "NSView needsDisplay is ignored?"^^ . "0"^^ . . . . . . . . "1"^^ . . "1"^^ . "@RudolfsBundulis 1) The event is sent to the frontmost app (and its menus), not a window. 3) `CGEventPostToPSN` is deprecated in CGEvent.h. How do you get a psn nowadays?."^^ . . . . "0"^^ . . . "<p>macOS Key Capture App Works in Terminal but Not with launchd\nI have developed a macOS application in Golang that captures key presses. The application uses CGO to call Objective-C code for handling key events.</p>\n<pre><code>#cgo LDFLAGS: -framework Foundation -framework Foundation -framework Carbon\n#include &quot;keylogger.h&quot;\n\ntypedef enum State { Up, Down, Invalid } State;\n\nextern void handleButtonEvent(int k, State s);\n\nstatic inline void listen() {\n CGEventMask eventMask = {\n CGEventMaskBit(kCGEventKeyDown) |\n CGEventMaskBit(kCGEventKeyUp)\n };\n\n CFMachPortRef eventTap = CGEventTapCreate(\n kCGSessionEventTap, kCGHeadInsertEventTap, 0, eventMask, CGEventCallback, NULL\n );\n\n // Exit the program if unable to create the event tap.\n if(!eventTap) {\n fprintf(stderr, &quot;ERROR: Unable to create event tap.\\n&quot;);\n exit(1);\n }\n\n // Create a run loop source and add enable the event tap.\n CFRunLoopSourceRef runLoopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, eventTap, 0);\n CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopCommonModes);\n CGEventTapEnable(eventTap, true);\n\n CFRunLoopRun();\n}\n</code></pre>\n<p>It works correctly when I run the code inside my IDE.\nIt also works when I build the binary and run it directly from the terminal.\nHowever, when I run the application using launchd (added to /Library/LaunchAgents), it runs in the background under user permissions but fails to capture keyboard input.\nHow can I fix this issue?</p>\n"^^ . . "1"^^ . . . ".net"^^ . "0"^^ . . . . . "1"^^ . "0"^^ . . . "1"^^ . . "nsmenu"^^ . "0"^^ . "0"^^ . . "0"^^ . "Which method does "Save As…" call?"^^ . "0"^^ . . "2"^^ . . . "0"^^ . "appkit"^^ . . "background"^^ . . "nsdocument"^^ . "0"^^ . "0"^^ . . . . . . . . . "@HangarRash I see. It seems odd that the answer appears to be using Objective C code but links to Swift documentation."^^ . "<p>I recently updated my macOS to version 15.3 (24D60) and Xcode to version 16.2. After the update, I started encountering the following error in my project:</p>\n<blockquote>\n<p>Using bridging headers with module interfaces is unsupported</p>\n</blockquote>\n<p>This error occurs when I try to build my project, which includes a mix of Swift and Objective-C code. Previously, everything worked fine, but after the update, the build fails with this error.</p>\n<h3><strong>Details About My Project:</strong></h3>\n<ul>\n<li>My project is a framework that includes both Swift and Objective-C code.</li>\n<li>I was using a bridging header (<code>MyFramework-Bridging-Header.h</code>) to expose Objective-C code to Swift.</li>\n<li>The project was working perfectly before the update.</li>\n</ul>\n<h3><strong>What I’ve Tried:</strong></h3>\n<ol>\n<li><p>I checked the build settings and confirmed that the <code>Defines Module</code> setting is set to <code>YES</code>.</p>\n</li>\n<li><p>I tried cleaning the build folder (<code>Product &gt; Clean Build Folder</code>) and rebuilding, but the error persists.</p>\n</li>\n<li><p>I verified that the bridging header is correctly referenced in the <code>Objective-C Bridging Header</code> build setting.</p>\n</li>\n<li><p>I replaced the bridging header with a module map and umbrella header. Here’s my current setup:</p>\n<p><strong>Umbrella Header (<code>MyFrameworkName.h</code>):</strong></p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &lt;Foundation/Foundation.h&gt;\n\n// Public headers\n#import &quot;GeneratedPluginRegistrant.h&quot;\n#import &quot;Flutter.h&quot;\n#import &quot;FlutterPlugin.h&quot;\n</code></pre>\n<p><strong>Module Map (<code>module.modulemap</code>):</strong></p>\n<pre class="lang-none prettyprint-override"><code>framework module MyFrameworkName {\n umbrella header &quot;MyFrameworkName.h&quot;\n export *\n module * { export * }\n}\n</code></pre>\n<ul>\n<li>I removed the bridging header and added the <code>Module Map File</code> path in the build settings.</li>\n<li>The <code>Defines Module</code> setting is set to <code>YES</code>.</li>\n</ul>\n</li>\n<li><p>Despite these changes, I’m now encountering a new error:</p>\n<pre><code>flutter not found on AppDelegate\n</code></pre>\n</li>\n</ol>\n<h3><strong>Error Messages:</strong></h3>\n<ol>\n<li><p><strong>Original Error:</strong></p>\n<blockquote>\n<p>Using bridging headers with module interfaces is unsupported</p>\n</blockquote>\n</li>\n<li><p><strong>New Error After Changes:</strong></p>\n<blockquote>\n<p>flutter not found on AppDelegate</p>\n</blockquote>\n</li>\n</ol>\n<h3><strong>Questions:</strong></h3>\n<ol>\n<li>Why is the original error occurring after updating to macOS 15.3 and Xcode 16.2?</li>\n<li>How can I resolve the <code>flutter not found on AppDelegate</code> error while using a module map and umbrella header?</li>\n<li>Is there a recommended approach to replace the bridging header in a framework while ensuring Flutter dependencies are correctly integrated?</li>\n</ol>\n<h3><strong>Additional Information:</strong></h3>\n<ul>\n<li><strong>Xcode Version:</strong> 16.2</li>\n<li><strong>macOS Version:</strong> 15.3 (24D60)</li>\n<li><strong>Project Type:</strong> Framework (mixed Swift and Objective-C)</li>\n<li><strong>Flutter Integration:</strong> The project includes Flutter dependencies, and I’m using <code>GeneratedPluginRegistrant.h</code>.</li>\n</ul>\n<h3><strong>Steps to Reproduce:</strong></h3>\n<ol>\n<li>Create a framework with mixed Swift and Objective-C code.</li>\n<li>Use a bridging header to expose Objective-C code to Swift.</li>\n<li>Update to macOS 15.3 and Xcode 16.2.</li>\n<li>Replace the bridging header with a module map and umbrella header.</li>\n<li>Attempt to build the project.</li>\n</ol>\n<h3><strong>Code Snippets:</strong></h3>\n<p><strong>AppDelegate.m:</strong></p>\n<pre class="lang-objectivec prettyprint-override"><code>#import &lt;Flutter/Flutter.h&gt;\n#import &quot;GeneratedPluginRegistrant.h&quot;\n\n@implementation AppDelegate\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n FlutterViewController *controller = (FlutterViewController *)self.window.rootViewController;\n [GeneratedPluginRegistrant registerWithRegistry:controller];\n return [super application:application didFinishLaunchingWithOptions:launchOptions];\n}\n@end\n</code></pre>\n<p><strong>Build Settings:</strong></p>\n<ul>\n<li><code>Defines Module</code>: <code>YES</code></li>\n<li><code>Module Map File</code>: <code>$(SRCROOT)/path/to/module.modulemap</code></li>\n<li><code>Objective-C Bridging Header</code>: (empty)</li>\n</ul>\n<hr />\n<p>Any help or guidance on how to fix this issue would be greatly appreciated!</p>\n"^^ . "0"^^ . . "nsdictionary"^^ . "0"^^ . . . "<p>Okay, with a little help I have figured out what was going on. There were two issues:</p>\n<p>First, I needed to reset permissions. That is, I had to go to <strong>System Settings</strong> &gt; <strong>Privacy &amp; Security</strong> &gt; <strong>Accessibility</strong>, remove my app, then add it back again (toggling the switch was insufficient). In my app, calling <code>AXIsProcessTrusted()</code> returned <code>true</code> both before and after the reset. This seems to me to be a macOS bug.</p>\n<p>Second, I was not accounting for how <kbd>fn</kbd>+<kbd>e</kbd> works as compared to many other hotkeys. Many hotkeys are remapped when you switch keyboard layouts, but <kbd>fn</kbd>+<kbd>e</kbd> is not, meaning I need to send the key code for <em>the current layout's</em> <kbd>E</kbd> key. <code>kVK_ANSI_E</code> is the <em>virtual</em> key code that represents the ANSI keyboard layout's <kbd>E</kbd> key.</p>\n<p>So the solution was to figure out which <code>CGKeyCode</code> corresponds to the current keyboard layout's <kbd>E</kbd> key and use that instead of hard-coding <code>kVK_ANSI_E</code>. I used the <a href="https://github.com/Clipy/Sauce" rel="nofollow noreferrer">Sauce</a> library to do this.</p>\n"^^ . "<p>You will receive <code>applicationDidReceiveMemoryWarning</code> first. If you doesn't release release enough memory during low-memory conditions, the system may terminate it outright.</p>\n<p>So you don't need to care about possibility of failing to allocate memory: if it will be not enough just whole application will be terminated.</p>\n<p>You just need to consider new feature of Objective-C <code>nullability annotations</code>: Some initializers can return nullable result.</p>\n"^^ . "0"^^ . "@Willeke GetProcessForPID, and yeah they are deprecated, just mentioned those since they seem to work for me."^^ . . . . . . . "1"^^ . . . . . "0"^^ . . . "<p>I have a custom <code>UISlider</code> inside <code>UICollectionViewCell</code>. I would like to be able to move the slider thumb by touching anywhere on the cell (on the purple bit). For instance, if I was to put my finger on the top right corner of the cell and slide down, I would like the thumb to slide downwards from its current position (-19.0 in this case), instead of jumping up first.</p>\n<p><a href="https://i.sstatic.net/LhKD5Eed.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/LhKD5Eed.jpg" alt="enter image description here" /></a></p>\n<p>Here is my code:</p>\n<pre><code>@implementation CDCFaderSlider\n\n- (id)initWithFrame:(CGRect)frame {\n self = [super initWithFrame: frame];\n \n if (self) {\n [self setOpaque: true];\n [self setTransform: CGAffineTransformMakeRotation((CGFloat)(M_PI * -0.5f))];\n [self constructSlider];\n }\n return self;\n}\n\n- (id)initWithCoder:(NSCoder *)aDecoder {\n self = [super initWithCoder: aDecoder];\n \n if (self) {\n [self setTransform: CGAffineTransformMakeRotation((CGFloat)(M_PI * -0.5f))];\n [self constructSlider];\n }\n return self;\n}\n\n#pragma mark - UIControl touch event tracking\n\n- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {\n CGPoint touchPoint = [touch locationInView: self];\n \n if (CGRectContainsPoint(CGRectInset(self.thumbRect, -12.0, -12.0), touchPoint)) {\n [self positionAndUpdateValueView];\n [self fadeValueViewInAndOut: true];\n }\n return [super beginTrackingWithTouch: touch withEvent: event];\n}\n\n- (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {\n [self positionAndUpdateValueView];\n return [super continueTrackingWithTouch: touch withEvent: event];\n}\n\n- (void)cancelTrackingWithEvent:(UIEvent *)event {\n [self fadeValueViewInAndOut: false];\n [super cancelTrackingWithEvent: event];\n}\n\n- (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {\n [self fadeValueViewInAndOut: false];\n [super endTrackingWithTouch: touch withEvent: event];\n}\n\n- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {\n [self fadeValueViewInAndOut: false];\n [super touchesEnded: touches withEvent: event];\n}\n\n- (BOOL) pointInside:(CGPoint)point withEvent:(UIEvent*)event {\n CGRect bounds = self.bounds;\n bounds = CGRectInset(bounds, 0, -70);\n return CGRectContainsPoint(bounds, point);\n}\n\n#pragma mark - Helper methods\n\n- (void)constructSlider {\n self.valueView = [[CDCFaderValueView alloc] initWithFrame: CGRectZero];\n self.valueView.backgroundColor = UIColor.clearColor;\n self.valueView.alpha = 0.0;\n self.valueView.transform = CGAffineTransformMakeRotation((CGFloat)(M_PI * 0.5));\n \n dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n [self addSubview: self.valueView];\n });\n}\n\n- (void)fadeValueViewInAndOut:(BOOL)aFadeIn {\n [UIView animateWithDuration: 0.5 animations:^{\n if (aFadeIn) {\n self.valueView.alpha = 0.8;\n } else {\n self.valueView.alpha = 0.0;\n }\n } completion:^(BOOL finished){\n }];\n}\n\n- (void)positionAndUpdateValueView {\n CGRect ThumbRect = self.thumbRect;\n CGRect popupRect = CGRectOffset(ThumbRect, (CGFloat)floor(ThumbRect.size.width * 0.2), (CGFloat) - floor(ThumbRect.size.height * 0.5));\n self.valueView.frame = CGRectInset(popupRect, -30, -10);\n self.valueView.value = faderDBValues[(NSInteger)self.value];\n}\n\n#pragma mark - Property\n\n- (CGRect)thumbRect {\n CGRect trackRect = [self trackRectForBounds: self.bounds];\n CGRect thumbR = [self thumbRectForBounds: self.bounds trackRect: trackRect value: self.value];\n \n return thumbR;\n}\n\n- (void)sendAction:(SEL)action to:(id)target forEvent:(UIEvent *)event {\n if (self.count &gt; 4) {\n [super sendAction: action to: target forEvent: event];\n self.count = 0;\n } else {\n self.count++;\n }\n \n if (self.tracking == 0) {\n [super sendAction: action to: target forEvent: event];\n }\n}\n\n@end\n</code></pre>\n"^^ . "Thanks. I tried that and I thought this was fixed with your suggestion, but then I kept on testing my app and the issue happened again. This is a weird issue because it seems to work sometimes ( which is better than when it was never working). It may be noteworthy, that when it does not work, another usage of default center takes over ( such as Spotify) or the phone app simply just loses control over the default center ( as if it was deallocated)."^^ . . . "This is a fantastic and detailed answer, thanks very much. You asked: `For example, does myString necessarily need to be associated with NSURL?` Strictly speaking, no. `myString` and others are a bunch of named constants that are used everywhere, and falling back to the C-style `extern const` is a good idea and what I ended up using."^^ . . . . "ms-word"^^ . "0"^^ . . . . . . . "<p>I'm using things like <strong>CGEventSourceButtonState</strong> or <strong>CGEventSourceKeyState</strong> to detect input in my game.</p>\n<p>I call them every frame to check if there was an event and so far it works fine.</p>\n<p>I also check if the cursor is on top of the window or if the window is focused to know if I should ignore or not the input update</p>\n<pre><code>// check if window is focused\nwindow.focused = nswindow.isKeyWindow;\n</code></pre>\n<pre><code>// check if mouse is on_top of window\nstatic bool cursor_on_top = false;\n\n@interface Content_View : NSView\n@end\n@implementation Content_View\n- (void)updateTrackingAreas {\n [super updateTrackingAreas];\n\n for (NSTrackingArea *tracking_area in [self trackingAreas]) {\n [self removeTrackingArea:tracking_area];\n }\n\n NSTrackingAreaOptions options =\n NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways | NSTrackingInVisibleRect;\n\n NSTrackingArea *tracking_area = [[NSTrackingArea alloc]\n initWithRect:self.bounds\n options:options\n owner:self\n userInfo:nil\n ];\n [self addTrackingArea:tracking_area];\n}\n\n- (void)mouseEntered:(NSEvent *)event {\n cursor_on_top = true;\n}\n\n- (void)mouseExited:(NSEvent *)event {\n cursor_on_top = false;\n}\n@end\n</code></pre>\n<p>The problem is that when I press command+shift+4 the system screenshot tool opens but that won't make <code>window.focused</code> or <code>cursor_on_top</code> false with the code above.</p>\n<p>Because of this I get the events that are supposed to be for screenshot tool inside my game, since the left click will trigger camera movement.</p>\n<p><a href="https://i.sstatic.net/AJoBRxU8.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AJoBRxU8.gif" alt="screenshot tool input gets mixed with game input" /></a></p>\n<p>It tried searching but there seems to not be a way of properly detecting if the screenshot tool has the input focus?</p>\n"^^ . "You should consume SPM package with SPM and it will solve duplicate symbol problem."^^ . . . . . . "vimage"^^ . . "<p>I started picking up Objective-C and noticed most of the code I'd seen, when handling errors, eventually calls:\n[NSError errorWithDomain:domain code:code userInfo:@{NSLocalizedDescriptionKey : desc}];\n, but it never checks for the possibility of failing to allocate memory for the NSError. Do we need to worry about that, or do we just assume it always succeeds (or rarely fails)? And if we do consider the possibility of an NSError creation failure, what should we return? In C, we'd typically just log the error and return an integer error code, but in Objective-C, creating an error object itself requires memory, I find it to be sort of a chicken-and-egg problem</p>\n"^^ . "keylogger"^^ . "0"^^ . . . "@HangarRash why did you remove the [tag:swift] tag? OP intentionally asked about Swift as well as Objective C and accepted an answer in Swift."^^ . . "1"^^ . . . . "<p><strong>tl;dr:</strong></p>\n<ol>\n<li><p>If you don't need <code>myString</code> to be associated with the <code>NSURL</code> class specifically, and <code>myString</code> is a string literal, the most succinct way to express this would be</p>\n<pre class="lang-objectivec prettyprint-override"><code>// MyString.h\nextern NSString * const myString;\n\n// MyString.mm\nNSString * const myString = @&quot;Hello&quot;;\n\n// OtherFile.mm\nNSString *someThing = myString; // accessed like a global var\n</code></pre>\n</li>\n<li><p>If you do want or need this to be associated with <code>NSURL</code> and <code>myString</code> is a string literal, you can avoid the intermediate storage:</p>\n<pre class="lang-objectivec prettyprint-override"><code>+ (NSString *)myString {\n return @&quot;Hello&quot;;\n}\n</code></pre>\n</li>\n<li><p>If <code>myString</code> is not a string literal, or would otherwise need to be computed, then the existing pattern you've seen with <code>_myString</code> storage and initialization is the most common and succinct way to do it</p>\n</li>\n</ol>\n<hr />\n<blockquote>\n<p>I believe such class readonly properties are roughly equivalent to <code>static constexpr</code> member variables in modern C++, where initialising them is a one-liner in the header:</p>\n</blockquote>\n<p>This isn't quite right. In Objective-C, properties are a way to succinctly synthesize <em>methods</em>, and offer an alternative syntax for calling those methods. In general, a property called <code>foo</code>:</p>\n<ol>\n<li>Creates a <code>foo</code> getter method and a <code>setFoo:</code> setter method, which</li>\n<li>Then allows for calling those methods as <code>x.foo</code> ≍ <code>[x foo]</code> and <code>x.foo = f</code> ≍ <code>[x setFoo:f]</code></li>\n</ol>\n<p>This is the same for both instance properties and class properties — though the storage semantics are a little different for class properties by default.</p>\n<p>The approximate C++ equivalent to your example would be generating something like</p>\n<pre class="lang-cpp prettyprint-override"><code>#include &lt;string&gt;\n\nusing std::literals;\n\nstruct MyClass \n{\n static constexpr auto myString() {\n return &quot;Hello&quot;s;\n }\n};\n</code></pre>\n<p>and the <em>very</em> rough equivalent to your Objective-C code would be something like</p>\n<pre class="lang-cpp prettyprint-override"><code>struct MyClass\n{\n static auto myString() {\n if (!myString_) {\n myString_ = &quot;Hello&quot;;\n }\n \n return *myString_;\n }\n \nprivate:\n static const char *myString_;\n};\n</code></pre>\n<p>Depending on what you're actually trying to do here, this can both be wasteful, and unnecessary.</p>\n<blockquote>\n<p>Can MyClass.myString be initialised more compactly, similar to C++ without having to declare the static underscore-prefixed variable, the getter, and the test for nullity?</p>\n</blockquote>\n<p>Depending on what you're trying to do, you may be able to avoid a property altogether. For example, does <code>myString</code> necessarily need to be associated with <code>NSURL</code>? If not, this is perfectly valid in Objective-C (and the common way to declare string constants):</p>\n<pre class="lang-objectivec prettyprint-override"><code>// MyString.h\nextern NSString * const myString;\n\n// MyString.mm\nNSString * const myString = @&quot;Hello&quot;;\n</code></pre>\n<p>If you <em>do</em> want to reference this data via <code>NSURL.myString</code>, and if the string is a constant, then you can also avoid having to store it altogether:</p>\n<pre class="lang-objectivec prettyprint-override"><code>+ (NSString *)myString \n{\n return @&quot;Hello&quot;;\n}\n</code></pre>\n<p>Literal <code>NSString</code>s are already stored in your binary in a constant location; if <code>myString</code> never changes, there's no need to add <code>static</code> storage and store a pointer to it there. If the value of <code>myString</code> were <em>computed</em> then it would make sense to store it to avoid recreating the value on every call, but that doesn't sound like what you're looking for.</p>\n<p>With more details, it'll be possible to give a more specific recommendation here.</p>\n<blockquote>\n<p>Should I declare an + (instancetype) init method and then initialise myString inside it? Would this not override the provided +init method that NSURL already has?</p>\n</blockquote>\n<p>This would be atypical:</p>\n<ol>\n<li><code>+init</code> would declare a method named <code>init</code> on your <em>class</em>, and <code>init</code> is typically only called on <em>instances</em> of a type to initialize them; calling <code>[NSURL init]</code> would be very out of place</li>\n<li>This isn't a common pattern in Objective-C at all: like you've seen, values like this are typically computed as needed and stored on the first call; it's rare to need to explicitly initialize class values like this — what if you forget to call <code>+init</code> and try to access the value?</li>\n</ol>\n<blockquote>\n<p>Is there some other way altogether, i.e. subclass rather than category? I'm not intimately familiar with Objective-C semantics so I'm not sure if an NSURL* returned by some Foundation class can be straightforwardly cast to MyClass* where @interface MyClass : NSURL.</p>\n</blockquote>\n<p>This is likely straying even further from what you're looking for — you <em>could</em> subclass <code>NSURL</code>, but subclassing is a mechanism for affecting existing behavior on subtypes, but this doesn't win you anything here. You're not looking to customize anything about <code>NSURL</code> or its instances, just add an additional bit of data to the type.</p>\n<p>Since you're looking to add a <em>class</em> method, instances wouldn't come into play here: if a method returns an <code>NSURL</code> object to you, you won't be able to call <code>myString</code> on it anyway, because <code>myString</code> belongs to the class, not the instance.</p>\n"^^ . . "0"^^ . . . . . . . . . "1"^^ . . . . "create-react-native-library"^^ . . . . . "Hmm. I think I found the problem, overriding `+isNativeType:` to return `true` works. I was assuming (and still suspect) that this property should be obtained from `Info.plist`, but that is a problem for later."^^ . . . . . . . . . . "nsnotifications"^^ . . . "0"^^ . "I have not used bindings in Maui, but if it is similar to older binding solutions, the result is a small c# file that has one c# declaration per library's public member. In VS, you can place a `breakpoint` on any of those lines. Thus pausing when that member is called. To learn about debugging native code, I think start [here](https://learn.microsoft.com/en-us/visualstudio/debugger/how-to-debug-in-mixed-mode?view=vs-2022#enable-mixed-mode-for-managed-calling-app-c-or-visual-basic). I have not done this, so you might need to search for other information."^^ . . . . . "1"^^ . "Without the code of that method it's hard to tell what's wrong..."^^ . "0"^^ . "0"^^ . "I don't want to get the layout direction, I want to set it."^^ . . "Thank you very much for your reply. This is an old project and it has 4 views, two out of which have a (UI)webview. I think mixing UIwebview and wkwebview in a project is not a good idea. Note: the code above is a minimum testable code. Thank you very much!"^^ . "0"^^ . . . "App data update issue thru Core data sync to CloudKit"^^ . . "NSImage is very slow with HEIC images"^^ . . . . "This assumes the OP is asking about an iOS app. The question isn't clear on that point."^^ . . . "authentication"^^ . . . . . "1"^^ . . "1"^^ . . . . "0"^^ . "0"^^ . "0"^^ . . "I don't get it. Why do you want to enable a button within a dismissed controller? Maybe the delegation pattern works here? Let's say VC A -> present VC B and holds a weak ref delegate of VC B -> VC B delegate back to A to enable the button."^^ . . . . . . "How do I send MQTT feed data when app enters background?"^^ . . . . . "Issue in google oauth login usingWkwebview in Macos"^^ . "<p>I'm late, I know. But now I have to update an old app in objective c and replace UIWebView with WKWebView. That's largely done and works fine – with one exception:</p>\n<p>I have to react to clicked links. But my routine for this is not called. What do I have to do to get the following snippet to be called when a link is clicked?</p>\n<pre><code>- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {\n\n NSURLRequest *request = navigationAction.request;\n\n // Do whatever you want with the request\n\n decisionHandler(WKNavigationActionPolicyAllow);\n}\n</code></pre>\n<p>The Interface in my ViewController is this:</p>\n<pre><code>@interface LESSViewController : UIViewController &lt;WKNavigationDelegate&gt; {\n WKWebView *webview;\n ScriptAppDelegate *appDelegate;\n ...\n}\n@property (nonatomic, retain) IBOutlet WKWebView *webview;\n@property (nonatomic, retain) ScriptAppDelegate *appDelegate;\n\n@end\n</code></pre>\n<p>What is missing or wrong here? Any tip in objective c is welcome.</p>\n"^^ . "Yes there are several things that might be off:\n1) is the receiving window focused (you are taking the frontmost window, but just outlining that out of focus windows will not receive the event)\n2) having the Accessibility (not sure about Automation) permissions enabled for the app, you can actually verify the Accessibility permissions from within the app via AXIsProcessTrusted\n3) Try sending the event via CGEventPostToPSN (and using the serial number) instead of pid and CGEventPostToPid"^^ . . . . . "0"^^ . "0"^^ . "bridging-header"^^ . . "1"^^ . . "<p>There's a crash from our Firebase Crashlytics dashboard that I cannot replicate no matter what and I'm quite cluless. The stacktrace that I have does not specify where it happens specifically:\n<a href="https://i.sstatic.net/rUoe0txk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rUoe0txk.png" alt="firebase stacktrace" /></a></p>\n<p>The logs &amp; breadcrumbs as well are not that helpful since it does not show a common pattern.</p>\n<p>Right now what I'm trying is to check the leaks through Instruments. What could be the reason for this crash? Or what are the ways to easily debug this?</p>\n"^^ . . . . "objective-c"^^ . . "0"^^ . . . . "How to configure Swift framework to works in Objective-c app?"^^ . "1"^^ . "<p>The sockaddr structure most likely doesn't fit in a single register, so $rdi holds a pointer to the structure, and you have to cast it as such:</p>\n<pre><code>(lldb) expr *($sockaddr *)$rdi\n</code></pre>\n"^^ . . "0"^^ . . . . "App crashes when BLE SDK callback is not executed with missing data"^^ . . "You're absolutely right for pointing this out. I am storing a reference to the value returned by `[MPNowPlayingInfoCenter defaultCenter]` rather than always using the `defaultCenter` property directly. I'll update my question accordingly. Thank you @paulw11"^^ . "0"^^ . . "Going from `UIWebView` to `WKWebview` isn't too much work, and since you only have 4 views, it should be quick enough..."^^ . . "<p>It's not supported. You are not able to generate an Xcode project from a MAUI iOS project.</p>\n<p>Note: If you want to link the Objective-C static library into your MAUI project, you have to make a .net-ios binding project.</p>\n<p>Please see <a href="https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/native-library-interop/" rel="nofollow noreferrer">Native Library Interop - .NET MAUI Community Toolkit - Community Toolkits for .NET | Microsoft Learn</a></p>\n<p><a href="https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/native-library-interop/get-started" rel="nofollow noreferrer">Getting Started with Native Library Interop - Community Toolkits for .NET | Microsoft Learn</a></p>\n<p><a href="https://devblogs.microsoft.com/dotnet/native-library-interop-dotnet-maui/" rel="nofollow noreferrer">Creating Bindings for .NET MAUI with Native Library Interop - .NET Blog</a></p>\n"^^ . . . . . "<p>I have setup push notifications and updates in CK are updating UI well.\nThe issue I have is Syncing between Core Data and CK.</p>\n<p>It's set to use NSPersistentCloudKitContainer with NSMergeByPropertyObjectTrumpMergePolicy option.</p>\n<p>Its a very simple CD managed object for Player including lastUpdated field - I have private dB with equivalent CD_Player record type and fields paired with the Core Data entities.</p>\n<pre><code>- (void)savePlayerToCoreData:(Player *)player {\n NSLog(@&quot; savePlayerToCoreData&quot;);\n \n NSManagedObjectContext *context = self.persistentContainer.viewContext;\n \n [context performBlock:^{\n // Fetch the existing player using playerId\n NSFetchRequest *fetchRequest = [Player fetchRequest];\n fetchRequest.predicate = [NSPredicate predicateWithFormat:@&quot;playerId == %@&quot;, player.playerId];\n fetchRequest.fetchLimit = 1;\n \n NSError *fetchError = nil;\n NSArray *results = [context executeFetchRequest:fetchRequest error:&amp;fetchError];\n\n Player *managedPlayer = results.firstObject;\n\n if (managedPlayer) {\n NSLog(@&quot; Fetched Player: %@ (playerId: %@, objectID: %@)&quot;,\n managedPlayer.nickName,\n managedPlayer.playerId,\n managedPlayer.objectID);\n } else if (!managedPlayer) {\n NSLog(@&quot;❌ Player not found in Core Data. Aborting update to prevent duplicate CloudKit records.&quot;);\n return;\n }\n\n // ✅ Update existing player\n managedPlayer.nickName = player.nickName;\n managedPlayer.avatarHexRgbColor = player.avatarHexRgbColor;\n managedPlayer.gamesWon = player.gamesWon;\n managedPlayer.gamesLost = player.gamesLost;\n managedPlayer.matchesWon = player.matchesWon;\n managedPlayer.matchesLost = player.matchesLost;\n managedPlayer.organizationKey = player.organizationKey;\n managedPlayer.strengths = player.strengths;\n managedPlayer.weaknesses = player.weaknesses;\n managedPlayer.lastUpdated = [NSDate date]; \n\n if (player.avatar) {\n managedPlayer.avatar = player.avatar;\n }\n\n if (![managedPlayer hasChanges]) {\n NSLog(@&quot;⚠️ No changes detected in Core Data. CloudKit sync may not trigger.&quot;);\n } else {\n NSLog(@&quot;✅ Changes detected. Saving to trigger sync...&quot;);\n }\n\n NSError *saveError = nil;\n if ([context save:&amp;saveError]) {\n NSLog(@&quot;✅ Core Data context saved. CloudKit Sync should trigger.&quot;);\n } \n NSLog(@&quot; After Update: %@ (playerId: %@, objectID: %@)&quot;, managedPlayer.nickName, managedPlayer.playerId, managedPlayer.objectID);\n }];\n}\n</code></pre>\n<p>When the user makes an update on the device, Core Data saves the context and looking at the logs within CK, I see a RecordSave event. My activity in on the device is coming through. All appears fine including the RecordId assignment on the basic logging I have added within my code..</p>\n<p>The only issue is - simple test of updating single value for the nickName field is just not updating - it is not reflected in the CK portal view at all.</p>\n<p>What could be the reason?</p>\n"^^ . . . "Posting key-press CGEvent fails in macOS 15 Sequoia"^^ . . "0"^^ . . . . . "Sorry, wrong link: [NSMenu.userInterfaceLayoutDirection](https://developer.apple.com/documentation/appkit/nsmenu/userinterfacelayoutdirection?language=objc) is not read only. Try `menu.userInterfaceLayoutDirection = NSUserInterfaceLayoutDirectionRightToLeft;`"^^ . . . . . "<p>In my application, I am creating a simple <code>NSMenu</code> with <code>NSMenuItem</code>s. The title of the <code>NSMenuItem</code>s are adapted to the system language. So, when the system language is an RTL language (right to left), I want my <code>NSMenuItem</code> to be aligned at the right.</p>\n<p>I can't see anyone talking about this, or any option that could make me achieve that easily.</p>\n<pre class="lang-objectivec prettyprint-override"><code>NSMenuItem* item1;\nNSMenuItem* item2;\n\nitem1 = [[NSMenuItem alloc] init];\nitem2 = [[NSMenuItem alloc] init];\n\nitem1.title = &quot;foo&quot;;\nitem2.title = &quot;bar&quot;;\n\nitem1.action = @selector(fooAction);\nitem2.action = @selector(barAction);\n\nNSMenu *menu = [[NSMenu alloc] init];\n[menu addItem:item1];\n[menu addItem:item2];\n</code></pre>\n"^^ . . . . . "0"^^ . . . . "lldb"^^ . . . . . . "0"^^ . . "Objective-C handling class instantiation failure"^^ . . . . "0"^^ . "@Willeke Thank you! Using CGImage (CGImageSourceCreateWithURL, CGImageSourceCreateImageAtIndex, then NSBitmapImageRep initWithCGImage) works and is an order of magnitude quicker!"^^ . . . "1"^^ . . "<p>I am developing ios app implementing basic auth with objective-c.\n(it is an old app).</p>\n<p>This was a good reference and asynchronous code was used for my app.\n<a href="https://stackoverflow.com/questions/1973325/nsurlconnection-and-basic-http-authentication-in-ios">NSURLConnection and Basic HTTP Authentication in iOS</a></p>\n<p>The code is shown below.\nIt works and shows a html file in a webview.\nThe problem is that webview is not responding after it shows the page.\nNamely it has a link to a certain site,\nbut it does not follow the link.</p>\n<p>How can I fix the code?\nThank you very much.\nHave a nice weekend :)</p>\n<pre><code>- (void)viewDidLoad {\n [super viewDidLoad];\n NSString *urlString = @&quot;https://test.com/test/&quot;; \n \n //username and password value\n NSString *username = @&quot;test1&quot;;\n NSString *password = @&quot;test1&quot;;\n\n \n //HTTP Basic Authentication\n NSString *authenticationString = [NSString stringWithFormat:@&quot;%@:%@&quot;, username, password] ;\n NSData *authenticationData = [authenticationString dataUsingEncoding:NSASCIIStringEncoding];\n NSString *authenticationValue = [authenticationData base64Encoding];\n \n //Set up your request\n NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlString]];\n [request setHTTPMethod:@&quot;GET&quot;];\n \n // Set your user login credentials\n [request setValue:[NSString stringWithFormat:@&quot;Basic %@&quot;, authenticationValue] forHTTPHeaderField:@&quot;Authorization&quot;];\n \n // Send your request asynchronously\n [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *responseCode, NSData *responseData, NSError *responseError) {\n\n NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) responseCode;\n NSLog(@&quot;response status code: %ld&quot;, (long)[httpResponse statusCode]);\n // do stuff\n \n if ([responseData length] &gt; 0 &amp;&amp; responseError == nil){\n //logic here\n NSLog(@&quot;good!&quot;);\n\n //logic here and added.\n NSLog(@&quot;good!: %@&quot;, responseData); //[NSString stringWithFormat:@&quot;ID %@&quot;, DevID];\n\n NSString *html = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];\n NSLog(@&quot;%@&quot;, html);\n NSURL *url = [NSURL URLWithString:urlString];\n [self-&gt;_webView loadHTMLString:html baseURL:url];\n\n\n }else if ([responseData length] == 0 &amp;&amp; responseError == nil){\n NSLog(@&quot;data error: %@&quot;, responseError);\n UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@&quot;Error accessing the data&quot; delegate:nil cancelButtonTitle:@&quot;Close&quot; otherButtonTitles:nil];\n [alert show];\n //[alert release];\n }else if (responseError != nil &amp;&amp; responseError.code == NSURLErrorTimedOut){\n NSLog(@&quot;data timeout: %@&quot;, NSURLErrorTimedOut);\n UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@&quot;connection timeout&quot; delegate:nil cancelButtonTitle:@&quot;Close&quot; otherButtonTitles:nil];\n [alert show];\n //[alert release];\n }else if (responseError != nil){\n NSLog(@&quot;data download error: %@&quot;, responseError);\n /*\n UIAlertViewController *alert = [[UIAlertView alloc] initWithTitle:nil message:@&quot;data download error&quot; delegate:nil cancelButtonTitle:@&quot;Close&quot; otherButtonTitles:nil];\n [alert show];\n //[alert release];\n */\n NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)responseCode;\n int code = [httpResponse statusCode];\n\n int statusCode;\n if (responseError.code == kCFURLErrorUserCancelledAuthentication) statusCode = 401;\n \n if (statusCode==401)\n {\n UIAlertController* alert =\n [UIAlertController alertControllerWithTitle:[NSString stringWithFormat:@&quot;%d: Auth Error&quot;, statusCode] message:[NSString stringWithFormat:@&quot;user: %@, pwd:%@\\n&quot;, username, password]\n preferredStyle:UIAlertControllerStyleAlert];\n \n UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@&quot;OK&quot; style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {}];\n \n [alert addAction:defaultAction];\n [self presentViewController:alert animated:YES completion:nil];\n \n }else\n {\n UIAlertController* alert = [UIAlertController alertControllerWithTitle:\n [NSString stringWithFormat:@&quot;%d: Data Download Error&quot;, code]\n message: [NSString stringWithFormat:@&quot;user: %@, pwd:%@\\n, ErrorCode: %@\\n, Error: %@&quot;, username, password, responseCode, responseError]\n preferredStyle:UIAlertControllerStyleAlert];\n \n UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@&quot;OK&quot; style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {}];\n \n [alert addAction:defaultAction];\n [self presentViewController:alert animated:YES completion:nil];\n }\n }\n }];\n\n // This is deleted.\n //[_webView loadRequest:request];\n\n \n}\n\n</code></pre>\n<p>The contents of <a href="https://test.com/test/index.html" rel="nofollow noreferrer">https://test.com/test/index.html</a>\n(234 bytes)</p>\n<pre><code>&lt;html&gt;\n &lt;head&gt;&lt;title&gt;test&lt;/title&gt;&lt;/head&gt;\n &lt;body&gt;\n test\n &lt;UL&gt;\n &lt;li&gt;&lt;a href=https://www.google.com/&gt;https://www.google.com/&lt;/a&gt;\n &lt;/UL&gt;\n\n &lt;UL&gt;\n &lt;li&gt;&lt;a href=./index2.html&gt;index2.html&lt;/a&gt;\n &lt;/UL&gt;\n&lt;/body&gt;\n&lt;/html&gt;\n\n</code></pre>\n<p>Update: Use of a session.</p>\n<p>Tried to use a session.But the situation does not change; There are two links on the index.html; one is google (no restricted area) and the other is under the current directory which is the area where the basic auth is necessary. The page transition to google was successful now, but that to the restricted area is not.</p>\n<p>Any hints would be appreciated!Thank you very much!</p>\n<pre><code>- (void)viewDidLoad {\n [super viewDidLoad];\n // Do any additional setup after loading the view.\n\n NSString *urlString = @&quot;https://test.com/test/&quot;;\n \n //username and password value\n NSString *username = @&quot;test1&quot;;\n NSString *password = @&quot;test1&quot;;\n\n //HTTP Basic Authentication\n NSString *authenticationString = [NSString stringWithFormat:@&quot;%@:%@&quot;, username, password] ;\n NSData *authenticationData = [authenticationString dataUsingEncoding:NSASCIIStringEncoding];\n NSString *authenticationValue = [authenticationData base64Encoding];\n \n //Set up your request\n NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlString]];\n [request setHTTPMethod:@&quot;GET&quot;];\n //[request setHTTPMethod:@&quot;POST&quot;];\n\n [request setValue:[NSString stringWithFormat:@&quot;Basic %@&quot;, authenticationValue] forHTTPHeaderField:@&quot;Authorization&quot;];\n \n NSURLSession *session = [NSURLSession sharedSession];\n [[session dataTaskWithRequest:request\n completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {\n if (!error) {\n NSLog(@&quot;good!: %@&quot;, data); //[NSString stringWithFormat:@&quot;ID %@&quot;, DevID];\n\n NSString *html = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];\n NSLog(@&quot;%@&quot;, html);\n NSURL *url = [NSURL URLWithString:urlString];\n [self-&gt;_webView loadHTMLString:html baseURL:url];\n\n }\n }] resume];\n\n}\n</code></pre>\n<p>Update2: a delegate method shouldStartLoadWithRequest: is now implemented and it is called according to NSLog(). It does not, however, change the situation.</p>\n<pre><code>#import &quot;ViewController.h&quot;\n\n@interface ViewController () &lt;UIApplicationDelegate, UIWebViewDelegate&gt;\n@end\n\n@implementation ViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n // Do any additional setup after loading the view.\n _webView.delegate = self;\n \n NSString *urlString = @&quot;https://test.com/test/&quot;;\n \n //username and password value\n NSString *username = @&quot;test1&quot;;\n NSString *password = @&quot;test1&quot;;\n\n //HTTP Basic Authentication\n NSString *authenticationString = [NSString stringWithFormat:@&quot;%@:%@&quot;, username, password] ;\n NSData *authenticationData = [authenticationString dataUsingEncoding:NSASCIIStringEncoding];\n NSString *authenticationValue = [authenticationData base64Encoding];\n \n //Set up your request\n NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlString]];\n [request setHTTPMethod:@&quot;GET&quot;];\n //[request setHTTPMethod:@&quot;POST&quot;];\n\n [request setValue:[NSString stringWithFormat:@&quot;Basic %@&quot;, authenticationValue] forHTTPHeaderField:@&quot;Authorization&quot;];\n \n //[request setValue:@&quot;application/json&quot; forHTTPHeaderField:@&quot;Content-Type&quot;];\n\n /*\n NSString *authStr = [NSString stringWithFormat:@&quot;%@:%@&quot;, login, password];\n NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding];\n NSString *authValue = [NSString stringWithFormat:@&quot;Basic %@&quot;, [authData base64EncodedStringWithOptions:0]];\n [request setValue:authValue forHTTPHeaderField:@&quot;Authorization&quot;];\n */\n\n NSURLSession *session = [NSURLSession sharedSession];\n [[session dataTaskWithRequest:request\n completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {\n if (!error) {\n /*\n NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&amp;error];\n NSLog(@&quot;%@&quot;,responseDictionary);\n */\n NSLog(@&quot;good!: %@&quot;, data); //[NSString stringWithFormat:@&quot;ID %@&quot;, DevID];\n\n NSString *html = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];\n NSLog(@&quot;%@&quot;, html);\n NSURL *url = [NSURL URLWithString:urlString];\n [self-&gt;_webView loadHTMLString:html baseURL:url];\n\n }\n }] resume];\n\n\n //[_webView loadRequest:request];\n}\n\n- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {\n NSString *URLString = [[request URL] absoluteString];\n NSLog(@&quot;next URL: %@&quot;, URLString);\n if (![URLString isEqualToString:@&quot;http://www.example.com/step3.htm&quot;]) {\n // The user reached step 3!\n //HTTP Basic Authentication\n //username and password value\n NSLog(@&quot;Setting Basic Auth info&quot;);\n\n NSString* username = @&quot;test1&quot;;\n NSString* password = @&quot;test1&quot;;\n\n NSString *authenticationString = [NSString stringWithFormat:@&quot;%@:%@&quot;, username, password] ;\n NSData *authenticationData = [authenticationString dataUsingEncoding:NSASCIIStringEncoding];\n NSString *authenticationValue = [authenticationData base64Encoding];\n \n\n [(NSMutableURLRequest*)request setValue:[NSString stringWithFormat:@&quot;Basic %@&quot;, authenticationValue] forHTTPHeaderField:@&quot;Authorization&quot;];\n\n }\n return YES;\n}\n\n@end\n\n</code></pre>\n"^^ . . . "0"^^ . . . . . . . . . . . "0"^^ . . . "0"^^ . . "0"^^ . "<p>It is because of the thread. After checking, I realize that my Swift code is running on the other thread, not the main thread.</p>\n<p>I am able to receive the location update data after making it run on the main thread.</p>\n<h2>Below is the code</h2>\n<pre><code>import Foundation\nimport CoreLocation\n\nclass MyLocationTrackingCore: NSObject, CLLocationManagerDelegate {\n \n var locationManager : CLLocationManager?\n \n var BASE_URL : String = &quot;&quot;\n var token : String = &quot;&quot;\n var pushGPSInterval : Double = 10_000\n var pushGPSDistance : Double = 0\n var integrationId : String = &quot;{}&quot;\n \n var pushGPSTimer: Date = Date()\n \n var locationCallback: (([String: Any]) -&gt; Void)?\n \n func setInfo(_ baseURL: String, rnToken token: String, rnPushGPSInterval pushGPSInterval: Double, rnPushGPSDistance pushGPSDistance: Double, rnIntegrationId integrationId: String, callback: @escaping ([String: Any]) -&gt; Void) {\n \n DispatchQueue.main.async {\n print(&quot;= Initializing....&quot;)\n \n self.BASE_URL = baseURL\n self.token = token\n self.integrationId = integrationId\n \n // The minTime is in millisecond, here we need second\n self.pushGPSInterval = (pushGPSInterval == 0 ? 10_000 : pushGPSInterval) / 1_000\n self.pushGPSDistance = pushGPSDistance &lt; 0 ? 0 : pushGPSDistance\n \n // Callback\n self.locationCallback = callback\n \n print(&quot;Base url : \\(self.BASE_URL)&quot;);\n print(&quot;token : \\(self.token)&quot;);\n print(&quot;integrationId : \\(self.integrationId)&quot;);\n print(&quot;pushGPSInterval : \\(self.pushGPSInterval)&quot;);\n print(&quot;pushGPSDistance : \\(self.pushGPSDistance)&quot;);\n print(&quot;trigger callback :&quot;);\n \n // Callback: try send data\n if let locationCallback = self.locationCallback {\n let newLocationData: [String: Any] = [\n &quot;lat&quot;: 37.7859,\n &quot;lng&quot;: -122.4364,\n &quot;alt&quot;: 15.0,\n &quot;spd&quot;: 6.0,\n &quot;course&quot;: 45.0\n ]\n locationCallback(newLocationData)\n print(&quot;- Location Callback triggered&quot;)\n } else {\n print(&quot;= Location Callback is nil&quot;)\n }\n \n print(&quot;= Initialized&quot;);\n }\n }\n \n func updateIntegrationId(_ integrationId: String) {\n DispatchQueue.main.async {\n print(&quot;Integration ID: \\(self.integrationId)&quot;)\n self.integrationId = integrationId\n print(&quot;Updated Integration ID: \\(self.integrationId)&quot;)\n }\n }\n \n func startWatchLocation() {\n if CLLocationManager.locationServicesEnabled() {\n DispatchQueue.main.async {\n // Init Location Manager\n self.locationManager = CLLocationManager()\n \n if let manager = self.locationManager {\n self.pushGPSTimer = Date().addingTimeInterval(0)\n \n manager.delegate = self\n manager.distanceFilter = self.pushGPSDistance\n manager.desiredAccuracy = kCLLocationAccuracyBestForNavigation\n manager.requestWhenInUseAuthorization()\n manager.requestAlwaysAuthorization()\n manager.allowsBackgroundLocationUpdates = true\n manager.pausesLocationUpdatesAutomatically = false\n manager.activityType = .automotiveNavigation\n\n manager.startUpdatingLocation()\n\n print(&quot;Start location Location&quot;);\n }\n }\n }\n }\n \n func stopWatchLocation() {\n if CLLocationManager.locationServicesEnabled() {\n DispatchQueue.main.async {\n if let manager = self.locationManager {\n manager.stopUpdatingLocation()\n manager.delegate = nil\n print(&quot;Stop location tracking&quot;)\n }\n }\n }\n }\n \n func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {\n DispatchQueue.main.async {\n if let userLocation = locations.last {\n let latitude = String(userLocation.coordinate.latitude)\n let longitude = String(userLocation.coordinate.longitude)\n let altitude = String(userLocation.altitude)\n let speed = String(userLocation.speed)\n let course = String(userLocation.course)\n \n print(&quot;===============&quot;)\n print(&quot;user latitude = \\(latitude)&quot;)\n print(&quot;user longitude = \\(longitude)&quot;)\n print(&quot;user altitude = \\(altitude)&quot;)\n print(&quot;user speed = \\(speed)&quot;)\n print(&quot;user course = \\(course)&quot;)\n } else {\n print(&quot;===============&quot;)\n print(&quot;No valid location data received&quot;)\n }\n }\n }\n \n func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {\n DispatchQueue.main.async {\n print(&quot;===============&quot;)\n print(&quot;Error = \\(error)&quot;)\n }\n }\n}\n</code></pre>\n"^^ . "0"^^ . . . . . "0"^^ . . "0"^^ . "react-native"^^ . . . . . . "1"^^ . . . . "0"^^ . "<p>Finally found the fix, for some reason the build setting <code>SWIFT_INSTALL_OBJC_HEADER</code> is responsible for copying the generated header to the built framework, but by default it's being set to <code>No</code>. Change to <code>Yes</code> and it can find the symbols now.</p>\n"^^ . . "1"^^ . . . "uikit"^^ . . . . . "1"^^ . "0"^^ . . . "0"^^ . . . "nssavepanel"^^ . . "<p>After updating <code>firebase_messaging</code> from <code>^14.6.9</code> to <code>^15.0.0</code> and <code>firebase_core</code> from <code>^2.17.0</code> to <code>^3.0.0</code>, the issue was resolved. There was no need to add a module interface, and the project build successfully.</p>\n"^^ . . . . "LLDB - how do I import a symbol so I can access a struct definition?"^^ . "You can use unwind segues and in `prepareForSegue` enable button"^^ . "0"^^ . "0"^^ . . . . "thread-safety"^^ . . . . . "0"^^ . "Crashed: com.apple.network.connections EXC_BAD_ACCESS KERN_INVALID_ADDRESS from Crashlytics"^^ . . "<p>I have a Mac menubar app that tries to show/hide the Emoji picker (Character palette) in the frontmost app via a menu item.</p>\n<p>The best way I found to do this was to trigger the Emoji picker's system keyboard shortcut — <code>fn-E</code> (Globe-E) — via simulated key press sent to the frontmost app:</p>\n<pre class="lang-objectivec prettyprint-override"><code>pid_t psn = NSWorkspace.sharedWorkspace.frontmostApplication.processIdentifier;\n\nCGEventRef keyup, keydown;\nCGEventFlags flags = kCGEventFlagMaskSecondaryFn;\n\nkeydown = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)kVK_ANSI_E, true);\nCGEventSetFlags(keydown, flags);\n\nkeyup = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)kVK_ANSI_E, false);\nCGEventSetFlags(keyup, flags);\n\nCGEventPostToPid(psn, keydown);\nCGEventPostToPid(psn, keyup);\n\nCFRelease(keydown);\nCFRelease(keyup);\n</code></pre>\n<p>This no longer works in macOS 15 Sequoia. The code above simply fails without error.</p>\n<p>I found <a href="https://stackoverflow.com/questions/79003342/cgevent-not-working-with-mouse-macos-15-1-sequoia-beta">one similar question on StackOverflow</a>, with a suggestion from @Rudolfs-Bundulis to set timestamps on the events before posting them, e.g. add these lines:</p>\n<pre class="lang-objectivec prettyprint-override"><code>CGEventSetTimestamp(keydown, clock_gettime_nsec_np(CLOCK_UPTIME_RAW));\nCGEventSetTimestamp(keyup, clock_gettime_nsec_np(CLOCK_UPTIME_RAW));\n</code></pre>\n<p>This still doesn't work. I also tried creating an NSEvent key event with a timestamp and windowId, but that also doesn't work. Am I doing something wrong with the timestamps, or is there something else I'm missing?</p>\n"^^ . . . "uti"^^ . "0"^^ . "0"^^ . . "macos-sequoia"^^ . . . . "0"^^ . "Using bridging headers with module interfaces is unsupported" error after updating to macOS 15.3 (24D60) and Xcode 16.2"^^ . . . "0"^^ . "Thank you very much for your reply. so either one of [uiwebview loadrequest], NSURLConnection or NSURLSession is enough? It means my code makes http get requests two times? I would like to make it sure and check the server log (/var/log/apache2/access.log) but it seems there is only one "get" log in the log. why? (is the response cached? )"^^ . "objective-c++"^^ . "0"^^ . . . . . "wkwebview"^^ . . . . "uiviewcontroller"^^ . "How is the data displayed? Post a [mre] please."^^ . . "<p>I struggle to understand what I'm doing wrong here.</p>\n<p>In my document-based app the document's model is modified in a notification. The model is correctly updated with the new content and I just want to tag the view as needing update.</p>\n<p>To my surprise, nothing happened until I manually resized the window which led me to the following workaround-wart (a dummy change to the window size):</p>\n<pre><code> NSWindow *window = document.window;\n#if false\n window.contentView.needsDisplay = YES;\n#else\n NSSize sz = document.model.canvasSize;\n [window setContentSize:NSMakeSize(0,0)];\n [window setContentSize:sz];\n#endif\n [window makeKeyAndOrderFront:self];\n</code></pre>\n<p>Obviously, that's not how it's supposed to be done, but I'm at my wits end here.</p>\n<p>The inital model renders perfectly, but any changes to the model are ignored.<br />\nI tried dispatching <code>needsDisplay</code> on the main thread using <code>performSelectorOnMainThread</code> but that didn't seem to matter.</p>\n<p>Any clues to what goes on here would be greatly appreciated.</p>\n<hr />\n<h2>Update</h2>\n<p>I've created a minimal(?) example showing the same behaviour available on github: <a href="https://github.com/persquare/DrawBug" rel="nofollow noreferrer">https://github.com/persquare/DrawBug</a></p>\n<p>Most of the functionality is in AppDelegate.m:</p>\n<pre><code>@interface AppDelegate ()\n{\n Document *_documentRef;\n}\n@end\n\n@implementation AppDelegate\n\n- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {\n [[NSDistributedNotificationCenter defaultCenter] addObserver:self\n selector:@selector(notificationHandler:)\n name:@&quot;foo&quot;\n object:nil];\n [[NSNotificationCenter defaultCenter] addObserver:self\n selector:@selector(notificationHandler:)\n name:@&quot;foo&quot;\n object:nil];\n}\n\n- (void)applicationWillTerminate:(NSNotification *)aNotification {\n [[NSDistributedNotificationCenter defaultCenter] removeObserver:self];\n [[NSNotificationCenter defaultCenter] removeObserver:self];\n}\n\n- (Document *)document\n{\n Document *doc = _documentRef;\n NSLog(@&quot;_documentRef: %@&quot;, _documentRef);\n if (doc == nil) {\n Document *doc = [[Document alloc] init];\n NSLog(@&quot;Created document: %@&quot;, doc);\n _documentRef = doc;\n NSDocumentController *docController = NSDocumentController.sharedDocumentController;\n [docController addDocument:doc];\n [doc makeWindowControllers];\n }\n\n return _documentRef;\n}\n\n- (void)notificationHandler:(NSNotification *)notification {\n NSString *newModel = notification.userInfo[@&quot;newModel&quot;];\n NSData *newModelData = [newModel dataUsingEncoding:NSUTF8StringEncoding];\n Document *document = [self document];\n NSLog(@&quot;document: %@&quot;, document);\n NSLog(@&quot;Document before update: %@&quot;, document.model);\n Boolean success = [document readFromData:newModelData ofType:@&quot;foo&quot; error:nil];\n NSLog(@&quot;Document after update: %@&quot;, document.model);\n \n NSWindow *window = document.window;\n window.contentView.needsDisplay = YES;\n [window makeKeyAndOrderFront:self];\n}\n\n\n- (IBAction)localNotification:(id)sender {\n NSString *dateString = [NSDateFormatter localizedStringFromDate:[NSDate date]\n dateStyle:NSDateFormatterShortStyle\n timeStyle:NSDateFormatterShortStyle];\n NSString *newModel = [NSString stringWithFormat:@&quot;Local: %@&quot;, dateString];\n [[NSNotificationCenter defaultCenter] postNotificationName:@&quot;foo&quot;\n object:@&quot;bar&quot;\n userInfo:@{@&quot;newModel&quot;: newModel}];\n}\n\n- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app {\n return NO;\n}\n\n- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender {\n return NO;\n}\n\n- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)hasVisibleWindows {\n return NO;\n}\n\n\n@end\n</code></pre>\n<p>Document.m is as small as they get:</p>\n<pre><code>@implementation Document\n\n- (instancetype)init {\n self = [super init];\n if (self) {\n _model = @&quot;Initial value&quot;;\n }\n return self;\n}\n\n- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError {\n self.model = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];\n return (self.model != nil);\n}\n\n- (NSWindow *)window {\n return [self.windowControllers[0] window];\n}\n\n@end\n</code></pre>\n<p>and finally the view (MyView.m):</p>\n<pre><code>@implementation MyView\n\n- (void)drawRect:(NSRect)dirtyRect {\n [super drawRect:dirtyRect];\n NSString *model = [[[self.window windowController] document] model];\n [model drawAtPoint:NSMakePoint(50.0, self.bounds.size.height/2.0) withAttributes:nil];\n}\n\n@end\n</code></pre>\n<p>To send a local notification I hooked up an action from Help -&gt; Notify to <code>localNotification:</code>, and to create a distributed notification there is a (non-sandboxed) &quot;Sender&quot; target in Xcode creating a simple tool:</p>\n<pre><code>int main(int argc, const char * argv[]) {\n @autoreleasepool {\n NSString *dateString = [NSDateFormatter localizedStringFromDate:[NSDate date]\n dateStyle:NSDateFormatterShortStyle\n timeStyle:NSDateFormatterShortStyle];\n NSString *newModel = [NSString stringWithFormat:@&quot;Remote: %@&quot;, dateString];\n \n [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@&quot;foo&quot;\n object:@&quot;bar&quot;\n userInfo:@{@&quot;newModel&quot;: newModel}\n deliverImmediately:YES];\n\n }\n return 0;\n}\n</code></pre>\n<p>Running the app and sending some notifications yields the following log output:</p>\n<pre><code>_documentRef: (null)\nCreated document: &lt;Document: 0x600003436450&gt;\ndocument: &lt;Document: 0x600003436450&gt;\nDocument before update: Initial value\nDocument after update: Local: 2025-03-14, 11:22\n_documentRef: &lt;Document: 0x600003436450&gt;\ndocument: &lt;Document: 0x600003436450&gt;\nDocument before update: Local: 2025-03-14, 11:22\nDocument after update: Remote: 2025-03-14, 11:22\n_documentRef: &lt;Document: 0x600003436450&gt;\ndocument: &lt;Document: 0x600003436450&gt;\nDocument before update: Remote: 2025-03-14, 11:22\nDocument after update: Local: 2025-03-14, 11:22\n</code></pre>\n<p>but only the first notification cause the view to update.</p>\n<p>FWIW, resizing the window doesn't invoke the view's <code>drawRect:</code> method (the y-position of the text should be in the middle of the view)</p>\n<p>I'm pretty sure I'm missing something basic here...</p>\n"^^ . . . . . "Cocoa app refuses to save document in user selected file format (export)"^^ . . . . . "0"^^ . . "It calls `-saveDocumentAs:`, the full call sequence is `saveDocumentAs: -> writableTypes -> prepareSavePanel: -> dataOfType:` with type showing up as `net.sourceforge.foo` regardless of selection."^^ . . . . "0"^^ . . . "nsfetchedresultscontroller"^^ . . . "0"^^ . . . . . . . . . "1"^^ . "0"^^ . . "-1"^^ . "0"^^ . "macos"^^ . "`window.contentView` redraws but it isn't the `MyView`. If you want `MyView` to redraw then set `needsDisplay` of `MyView`."^^ . "@TylerH Because the code in the question is only Objective-C and nothing in the question is about Swift."^^ . "<p>I am converting a <code>UIImage</code> to a <code>vImage_Buffer</code>.<br />\nThe code looks as follows:</p>\n<pre><code> CGImageRef originalImageRef = [image CGImage];\n CGColorSpaceRef originalColorSpace = CGImageGetColorSpace(originalImageRef);\n CGColorRenderingIntent intent = CGImageGetRenderingIntent(originalImageRef);\n \n vImage_CGImageFormat inputImageFormat =\n {\n .bitsPerComponent = (uint32_t) CGImageGetBitsPerComponent(originalImageRef),\n .bitsPerPixel = (uint32_t) CGImageGetBitsPerComponent(originalImageRef) * (uint32_t)(CGColorSpaceGetNumberOfComponents(originalColorSpace) + (kCGImageAlphaNone != CGImageGetAlphaInfo(originalImageRef))),\n .colorSpace = originalColorSpace,\n .bitmapInfo = CGImageGetBitmapInfo(originalImageRef),\n .version = 0,\n .decode = NULL,\n .renderingIntent = kCGRenderingIntentDefault\n };\n \n vImage_Error error = vImageBuffer_InitWithCGImage(inputImageBuffer, &amp;inputImageFormat, NULL, originalImageRef, kvImageNoFlags);\n if (error == kvImageNoError) {\n NSLog(@&quot;image to vimage buffer conversion complete&quot;);\n } else {\n NSLog(@&quot;image to vimage buffer conversion failed&quot;);\n }\n</code></pre>\n<p>But the resulting buffer colors are all different. All the <strong>Blue tones change into Yellow</strong> and so on.</p>\n<p>I tried the following code as well:</p>\n<pre><code> CGImageRef sourceRef = [image CGImage];\n NSUInteger sourceWidth = CGImageGetWidth(sourceRef);\n NSUInteger sourceHeight = CGImageGetHeight(sourceRef);\n\n CGDataProviderRef provider = CGImageGetDataProvider(sourceRef);\n CFDataRef bitmapData = CGDataProviderCopyData(provider);\n\n unsigned char *sourceData = (unsigned char*)calloc(sourceHeight * sourceWidth * 4, sizeof(unsigned char));\n NSUInteger bytesPerPixel = 4;\n NSUInteger sourceBytesPerRow = bytesPerPixel * sourceWidth;\n\n CFDataGetBytes(bitmapData, CFRangeMake(0, CFDataGetLength(bitmapData)), sourceData);\n\n vImage_Buffer v_image = {\n .data = (void *)sourceData,\n .height = sourceHeight,\n .width = sourceWidth,\n .rowBytes = sourceBytesPerRow\n };\n\n CFRelease(bitmapData);\n</code></pre>\n<p>But this also seems to have same problem.</p>\n<p>Any help in this regard is highly appreciated.</p>\n"^^ . . "0"^^ . . . . "The app did have Analytics permission. Removing and adding the app from permissions actually fixed the issue on my Mac but *not* my customer's Mac (we both have US keyboard layout and macOS 15.3.2 so I'm not sure what the difference is). The frontmost app does have an "Emoji & Symbols" menu item and we tested pressing Fn-E manually, which works. I tried with CGEventPostToPSN but no change."^^ . "uicollectionviewlayout"^^ . "0"^^ . . . "0"^^ . "0"^^ . . . . . "0"^^ . "0"^^ . . "0"^^ . "Disable or intercept keyboard navigation in NSTableView"^^ . . . "1"^^ . "0"^^ . . "@Larme Thank you for your answer. Yes I did put a log at the start which doesn't get logged. The notifyRunmefit is a method of a third party SDK (.framework) which I have to use. And no sadly there is no message in the console, when the app crashes. I added the stacktrace to the question, because it is too long. I am a complete swift beginner, so any help is appreciated."^^ . "0"^^ . . . "1"^^ . . "0"^^ . . . . . "2"^^ . . . "0"^^ . . "0"^^ . . . "Update:  There are two links on the index.html; one is google (no restricted area) and the other is under the current directory which is the area where the basic auth is necessary. The page transition to google was successful now, but that to the restricted area is not. Would it be solved if a session is used to maintain user and pwd info?"^^ . . "<p>I have a custom ViewController A with an instance variable or property that I want to change from a second custom view controller launched by a navigation controller for ViewControllerA.</p>\n<p>Here is my code to launch ViewController B from within A</p>\n<p>In FirstCustomVC:</p>\n<pre class="lang-objectivec prettyprint-override"><code>- (void) launchSecondVC {\n UIStoryboard *storyBoard = self.storyboard;\n \n CustomVC * myVC =\n [storyBoard instantiateViewControllerWithIdentifier:@&quot;myvc&quot;];\n UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController: CustomVC;\n [self presentViewController:nav animated:YES completion:nil];\n} \n</code></pre>\n<p>After ViewController B is launched and the user does something, I want to dismiss ViewController B and enable a button back in ViewController A. I can dismiss VCB but I am having trouble grabbing a reference to A in order to enable the button.</p>\n<p>The following successfully dismisses VCB. However, the presenting ViewController is a navigation controller and does not have the property I need so it crashes if I try to access the property.</p>\n<pre class="lang-objectivec prettyprint-override"><code>[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];//dismisses successfully\nself.presentingViewController.myButton.enabled = YES;//crashes as the property is on the VC, not the nav\n</code></pre>\n<p>I've tried various methods to get the topViewController but can only get a generic UIViewController rather than the custom one with the button property.</p>\n<p>How can I grab a reference to the custom VC that is actually displayed on the screen?</p>\n"^^ . "Objective-c http basic auth asynchronously (with no specific library)"^^ . . . . . . . . . "According to the stacktrace, it seems that the call back is called... Unsure why it crashes. If you remove all your code in the callback and just put a log, does it prints? Does it still crashes? I'm wondering if the issue is not on the SDK code, but that would might need a ticket on their end if it's private..."^^ . . . . "<p>Problem\nI'm integrating the Runmefit SDK into my React Native app using Expo Modules API to communicate with a BLE device. When the device doesn't send any data (e.g., empty exercise history), my app crashes with Thread 1: EXC_BAD_ACCESS (code=1, address=0x0) because the callback in the SDK method notifyRunmefit is never executed.</p>\n<p>My implementation\nHere's how I set up the Bluetooth delegate and call the SDK method:</p>\n<pre class="lang-swift prettyprint-override"><code>// Set up the peripheral delegate\npublic func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {\n print(&quot;Connected to \\(peripheral.name ?? &quot;unknown device&quot;)&quot;)\n self.peripheral = peripheral\n peripheral.delegate = self // Setting the delegate here\n peripheral.discoverServices([CBUUID(string: UUID_Service)])\n}\n\n// Handling discovered service and characteristics\npublic func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {\n guard let services = peripheral.services else { return }\n for service in services {\n peripheral.discoverCharacteristics([CBUUID(string: UUID_Write_Char), CBUUID(string: UUID_Notify_Char)], for: service)\n }\n}\n\npublic func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {\n guard let characteristics = service.characteristics else { return }\n \n for characteristic in characteristics {\n if characteristic.uuid.uuidString == UUID_Write_Char {\n self.writeCharacter = characteristic\n } else if characteristic.uuid.uuidString == UUID_Notify_Char {\n peripheral.setNotifyValue(true, for: characteristic)\n }\n }\n}\n\n// Problem occurs in this delegate method\npublic func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {\n print(&quot;Received: \\(String(describing: characteristic.value))&quot;)\n \n guard let writeCharacter = writeCharacter else {\n print(&quot;No write characteristic found&quot;)\n return\n }\n \n let nsError = error as NSError? ?? NSError(domain: &quot;&quot;, code: 0, userInfo: nil)\n \n STBlueToothData.sharedInstance().notifyRunmefit(\n peripheral,\n writeCharacter: writeCharacter,\n characteristic: characteristic,\n error: nsError,\n complete: { (error, revType, errorType, responseObject) in\n // This code is never executed when no data is available\n // Leading to EXC_BAD_ACCESS crash\n \n let nsError = error as NSError\n if nsError.code != 0 {\n print(&quot;Error: \\(error)&quot;)\n } else {\n let dict: [String: Any] = [\n ST_RevType_Key: NSNumber(value: revType.rawValue),\n ST_ErrorType_Key: NSNumber(value: errorType.rawValue)\n ]\n \n NotificationCenter.default.post(\n name: NSNotification.Name(Nof_Revice_Data_Key),\n object: responseObject,\n userInfo: dict\n )\n }\n }\n )\n}\n</code></pre>\n<p>SDK Method Definition</p>\n<pre class="lang-objectivec prettyprint-override"><code>-(void)notifyRunmefit:(CBPeripheral *)peripheral\n WriteCharacter:(CBCharacteristic *)writeCharacter\n Characteristic:(CBCharacteristic *)characteristic\n Error:(NSError *)error\n Complete:(void(^)(NSError *error, REV_TYPE revType, ERROR_TYPE errorType, id responseObject))complete;\n</code></pre>\n<p>What I've observed\nThe app works normally when the device sends data\nWhen no data is available (e.g., empty exercise history), the app crashes with <code>Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)</code>\nThe callback is never executed in this case - not even with an error\nThe SDK demo code doesn't seem to implement any protection against this scenario\nWhat I've tried:</p>\n<ul>\n<li>Adding null checks for nearly everything</li>\n<li>Attempting to replace the SDK call with a direct implementation</li>\n</ul>\n<p>Question:\nHow can I modify my Swift implementation to prevent crashes when the SDK callback isn't executed due to missing data? Is there a way to implement a timeout or fallback solution to handle this gracefully?</p>\n<pre><code>* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)\n frame #0: 0x000000019897e1f0 libswiftCore.dylib`swift_getObjectType + 40\n frame #1: 0x000000010ab9d420 FitKickLiga.debug.dylib`thunk for @escaping @callee_guaranteed (@guaranteed Error?, @unowned REV_TYPE, @unowned ERROR_TYPE, @in_guaranteed Any) -&gt; () at &lt;compiler-generated&gt;:0\n * frame #2: 0x000000010b7c5478 FitKickLiga.debug.dylib`-[STBlueToothData notifyRunmefit:WriteCharacter:Characteristic:Error:Complete:](self=0x0000000300a2f9c0, _cmd=&quot;notifyRunmefit:WriteCharacter:Characteristic:Error:Complete:&quot;, peripheral=0x0000000300629ad0, writeCharacter=0x00000003019cde60, characteristic=0x00000003019cdec0, error=domain: &quot;BLEErrorDomain&quot; - code: 0, complete=0x000000010ab9d390) at STBlueToothData.m:325:17\n frame #3: 0x000000010ab9c2e4 FitKickLiga.debug.dylib`STBleManager.peripheral(peripheral=0x0000000300629ad0, characteristic=0x00000003019cdec0, error=nil) at STBleManager.swift:328:42\n frame #4: 0x000000010ab9d504 FitKickLiga.debug.dylib`@objc STBleManager.peripheral(_:didUpdateValueFor:error:) at &lt;compiler-generated&gt;:0\n frame #5: 0x00000001c2e9fb1c CoreBluetooth`-[CBPeripheral handleAttributeEvent:args:attributeSelector:delegateSelector:delegateFlag:] + 188\n frame #6: 0x00000001c2e9fc4c CoreBluetooth`-[CBPeripheral handleCharacteristicEvent:characteristicSelector:delegateSelector:delegateFlag:] + 100\n frame #7: 0x00000001c2e9c79c CoreBluetooth`-[CBPeripheral handleMsg:args:] + 632\n frame #8: 0x00000001c2e67b08 CoreBluetooth`-[CBCentralManager handleMsg:args:] + 152\n frame #9: 0x00000001c2e67a34 CoreBluetooth`-[CBManager xpcConnectionDidReceiveMsg:args:] + 228\n frame #10: 0x00000001c2e678e0 CoreBluetooth`__30-[CBXpcConnection _handleMsg:]_block_invoke + 48\n frame #11: 0x000000010525088c libdispatch.dylib`_dispatch_call_block_and_release + 32\n frame #12: 0x0000000105252578 libdispatch.dylib`_dispatch_client_callout + 20\n frame #13: 0x000000010525a454 libdispatch.dylib`_dispatch_lane_serial_drain + 840\n frame #14: 0x000000010525b290 libdispatch.dylib`_dispatch_lane_invoke + 460\n frame #15: 0x0000000105262cd0 libdispatch.dylib`_dispatch_main_queue_drain + 780\n frame #16: 0x00000001052629b4 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 44\n frame #17: 0x0000000199fd2bcc CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16\n frame #18: 0x0000000199fcf1c0 CoreFoundation`__CFRunLoopRun + 1996\n frame #19: 0x000000019a021284 CoreFoundation`CFRunLoopRunSpecific + 588\n frame #20: 0x00000001e728d4c0 GraphicsServices`GSEventRunModal + 164\n frame #21: 0x000000019cb6a674 UIKitCore`-[UIApplication _run] + 816\n frame #22: 0x000000019c790e88 UIKitCore`UIApplicationMain + 340\n frame #23: 0x000000010a1047c0 FitKickLiga.debug.dylib`main(argc=1, argv=0x000000016b6c74a8) at main.m:7:12\n frame #24: 0x00000001c0279de8 dyld`start + 2724\n</code></pre>\n"^^ . . . . . . . . . "-1"^^ . "0"^^ . . . . . . "1"^^ . "0"^^ . . . "0"^^ . . "0"^^ . . . . . . "0"^^ . . "1"^^ . "cocoa"^^ . . . "0"^^ . . . "1"^^ . . . . . "<p>I am using <code>JSONModel</code> (<a href="https://github.com/jsonmodel/jsonmodel" rel="nofollow noreferrer">https://github.com/jsonmodel/jsonmodel</a>) to turn my objects into JSON. One of my objects is a Waypoint object that contains a <code>CLLocationCoordinate2D</code> property. I have created a ValueTransformer:</p>\n<pre><code>- (id)CLLocationCoordinate2DFromNSDictionary:(NSDictionary *)dictionary {\n \n CLLocationDegrees latitude = [dictionary[@&quot;latitude&quot;] doubleValue];\n CLLocationDegrees longitude = [dictionary[@&quot;longitude&quot;] doubleValue];\n \n CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(latitude, longitude);\n if (CLLocationCoordinate2DIsValid(coordinate)) {\n \n return [NSValue valueWithMKCoordinate:coordinate];\n \n }\n \n coordinate = kCLLocationCoordinate2DInvalid;\n \n return [NSValue valueWithMKCoordinate:coordinate];\n \n}\n\n- (NSDictionary *)JSONObjectFromCLLocationCoordinate2D:(CLLocationCoordinate2D)coordinate {\n \n NSDictionary *dict = @{\n @&quot;latitude&quot;: [NSNumber numberWithDouble:coordinate.latitude],\n @&quot;longitude&quot;: [NSNumber numberWithDouble:coordinate.longitude]\n };\n \n return dict;\n \n}\n</code></pre>\n<p>This works fine, but it seems like the value is getting set as the <code>NSValue</code> object rather than unwrapping and providing the <code>CLLocationCoordinate2D</code> struct.</p>\n<p>Somehow I need to have <code>JSONModel</code> use <code>CLLocationCoordinate2D coordinate = [value MKCoordinateValue];</code> to get the coordinate.</p>\n<p>Is this possible?</p>\n"^^ . "Thanks! I will try the binding approach. Will I be able to debug the native code after adding the binding?"^^ . "maui"^^ . . "0"^^ . . . "Is your app localized? Is `NSMenu.userInterfaceLayoutDirection` what you're looking for?"^^ . . "1"^^ . "0"^^ . . . . "0"^^ . "0"^^ . . "carplay"^^ . . . . "0"^^ . . . . . . . "How to open a URL with scheme and commands in macOS?"^^ . . "ios"^^ . . . . "0"^^ . . "0"^^ . . "JSONModel ValueTransformer not working with CLLocationCoordinate2D"^^ . . . "Thank you very much for your message. It probably is for me. I would not like to risk any inconsistency to move to wkwebview now. (at least it is not now.) I would do things one by one. if you do multiple things at the same time, there would be hard to say what is the problem. (And this basic auth thing is the last portion of the project.)"^^ . "-1"^^ . . "cgimage"^^ . . "<p>MacOS app. I have a window with a <code>NSTableView</code> on it. Whenever the window is active, when a key is pressed that corresponds to the initial letter of a table item text, the table selects that item. <strong>How do I disable or intercept that behavior?</strong> I want my app to react to key presses, but in more ways than just selecting a table item.</p>\n<p>Tried setting <code>refusesFirstResponder</code> on the table view and on the item template - doesn't help. Tried creating menu items in the main menu with a respective <code>keyEquivalent</code> - they only fire sometimes (see below), it looks like the table gets the first dibs on keyboard events.</p>\n<p>In addition, the table view has a keyboard navigation timeout - if one presses keys in quick succession, only the first one leads to a selection change, the subsequent ones produce a click and the action of the menu item for that key fires. I don't want the timeout, or the clicks.</p>\n<p>If this can be done without subclassing system classes (views, <code>NSWindow</code>) that are normally not meant to be subclassed - even better.</p>\n"^^ . "debugging"^^ . "Use SPM for building frameworks and it will manage all options for you."^^ . . . . . "<h2>Problem</h2>\n<p>I'm developing an app that has both a CarPlay and phone interface. My CarPlay app uses MPNowPlayingInfoCenter defaultCenter through a NowPlaying Template. However, I have another module which uses the default center in the phone app scene (not the CarPlay scene).\nWhen disconnecting from CarPlay, the singleton shared instance of <code>[MPNowPlayingInfoCenter defaultCenter]</code> gets deallocated along with my NowPlayingTemplate, despite the phone app still requiring it. This causes issues with my audio playback state.\nThis problem only occurs on a physical CarPlay device - in the CarPlay device simulator, my code works fine with a proxy class implementation.</p>\n<h2>What I've tried</h2>\n<p>Implementing a proxy class (works in simulator but not on physical device)\nVarious forms of method swizzling\nI cannot modify the third-party library code that calls <code>[MPNowPlayingInfoCenter defaultCenter]</code> in the phone app</p>\n<h2>Environment</h2>\n<p>iOS version: 18.1.1\nCarPlay framework version: iOS 18 CarPlay framework\nXcode version: Version 16.2 (16C5032a)</p>\n<h2>Questions</h2>\n<p>How can I prevent MPNowPlayingInfoCenter defaultCenter from being deallocated when disconnecting from CarPlay while ensuring it remains available for the phone app? Is there a recommended approach for sharing the now playing info between CarPlay and phone interfaces?</p>\n<h2>Code Example</h2>\n<pre><code>@interface CarPlayCoordinator : NSObject\n\n@property (nonatomic, strong) CPNowPlayingTemplate *nowPlayingTemplate;\n\n- (void)setupNowPlayingTemplate;\n\n@end\n\n@implementation CarPlayCoordinator\n\n- (void)setupNowPlayingTemplate {\n self.nowPlayingTemplate = [NowPlayingTemplate shared];\n // Configure template and then..\n // MPNowPlayingInfoCenter is used in the template's lifecycle\n}\n\n@end\n</code></pre>\n<pre><code>#import &lt;AVFoundation/AVFoundation.h&gt;\n#import &lt;CarPlay/CarPlay.h&gt;\n#import &lt;MediaPlayer/MediaPlayer.h&gt;\n\n@interface NowPlayingTemplate () &lt;CPNowPlayingTemplateObserver&gt;\n@property(nonatomic, strong) CPInterfaceController *interfaceController;\n// This reference gets deallocated\n@property(nonatomic, strong) MPNowPlayingInfoCenter *infoCenter;\n@end\n\n@implementation NowPlayingTemplate\n\n+ (instancetype)shared {\n static NowPlayingTemplate *sharedInstance = nil;\n static dispatch_once_t onceToken;\n dispatch_once(&amp;onceToken, ^{\n sharedInstance = [[self alloc] init];\n });\n return sharedInstance;\n}\n\n- (instancetype)init {\n if (self = [super init]) {\n self.nowPlaying = [CPNowPlayingTemplate sharedTemplate];\n [self.nowPlaying addObserver:self];\n \n // Store a reference to the singleton - this is the key issue\n self.infoCenter = [MPNowPlayingInfoCenter defaultCenter];\n \n // Setup code\n }\n return self;\n}\n\n// Implementation of template management and playback control with usage of self.infoCenter...\n\n- (void)dealloc {\n // This happens during CarPlay disconnect\n NSLog(@&quot;NowPlayingTemplate being deallocated&quot;);\n \n // After this, somehow the MPNowPlayingInfoCenter defaultCenter \n // also gets deallocated, which shouldn't happen for a singleton\n}\n\n@end\n</code></pre>\n<p>Regarding the third-party code, it's a commercial SDK that we're integrating with our app. I don't have access to modify their source code. Also, I am aware that they don't explicitly deallocate the default center when CarPlay disconnects. They're using [MPNowPlayingInfoCenter defaultCenter] directly in their code, but when CarPlay disconnects, the singleton appears to be deallocated and all of the previous now playing info and connectivity to the default center gets cleared. When restarting the app everything works again.</p>\n<p>I'm wondering if this is an iOS bug or expected behavior. Any assistance with this issue would be greatly appreciated.</p>\n"^^ . "1"^^ . . "info.plist"^^ . "1"^^ . "1"^^ . . . . . . "agent"^^ . . . . "1"^^ . "0"^^ . . . . . . . . . . "objective-c-category"^^ . . "There was a discussion of a similar issue at https://stackoverflow.com/questions/64880406/problem-opening-office-uri-scheme-urls-in-office-js-on-mac-safari . I do not know if it is possible or easy to translate that into objective-c"^^ .