|
How to store C Arrays as a Property or iVar?
The time to read and unwrap an integer from an NSArray is probably under a microsecond, so it's unlikely to be a performance problem. But there's nothing wrong with using a C array. It's what I'd do,
The time to read and unwrap an integer from an NSArray is probably under a microsecond, so it's unlikely to be a performance problem. But there's nothing wrong with using a C array. It's what I'd do,
|
By
Jens Alfke
· #208
·
|
|
How to store C Arrays as a Property or iVar?
No one said this was a property. It's just an instance variable. Also, it's fine for properties to be C types — after all, there are plenty of integer or boolean properties, and UIKit and AppKit have
No one said this was a property. It's just an instance variable. Also, it's fine for properties to be C types — after all, there are plenty of integer or boolean properties, and UIKit and AppKit have
|
By
Jens Alfke
· #218
·
|
|
Compiling Conditionally depending on OS
TARGET_OS_MAC is incorrect — for some reason that evaluates to true on all Apple platforms. You want TARGET_OS_OSX instead. Here's the full list as documented in <TargetConditionals.h>, which is the h
TARGET_OS_MAC is incorrect — for some reason that evaluates to true on all Apple platforms. You want TARGET_OS_OSX instead. Here's the full list as documented in <TargetConditionals.h>, which is the h
|
By
Jens Alfke
· #226
·
|
|
How to store C Arrays as a Property or iVar?
NSData.bytes is a property of type "void*". And NSPointerFunctions even has a property whose type is a C function pointer: @property (nullable) BOOL (*isEqualFunction)(const void *item1, const void*it
NSData.bytes is a property of type "void*". And NSPointerFunctions even has a property whose type is a C function pointer: @property (nullable) BOOL (*isEqualFunction)(const void *item1, const void*it
|
By
Jens Alfke
· #227
·
|
|
How to store C Arrays as a Property or iVar?
I answered that yesterday. —Jens
I answered that yesterday. —Jens
|
By
Jens Alfke
· #228
·
|
|
Difference between NSPoint, NSSize, NSRect and the CG Versions
Historical reasons. AppKit predates Core Graphics (it predates Apple's acquisition of NeXT.) —Jens
Historical reasons. AppKit predates Core Graphics (it predates Apple's acquisition of NeXT.) —Jens
|
By
Jens Alfke
· #288
·
|
|
Difference between NSPoint, NSSize, NSRect and the CG Versions
I don't see how they could be incompatible if they're the same size. The only 4-byte floating point type is 'float', so if the CG and NS types are using the same-size values, how can they be different
I don't see how they could be incompatible if they're the same size. The only 4-byte floating point type is 'float', so if the CG and NS types are using the same-size values, how can they be different
|
By
Jens Alfke
· #290
·
|
|
NSAllowsArbitraryLoads
You can't edit your Info.plist, or change settings like these; the app bundle is immutable. At WWDC this year Apple said that they're getting stricter about App Transport Security exemptions like this
You can't edit your Info.plist, or change settings like these; the app bundle is immutable. At WWDC this year Apple said that they're getting stricter about App Transport Security exemptions like this
|
By
Jens Alfke
· #301
·
|
|
qsort_b in Swift
The compiler probably inlines the call to the comparison function, as opposed to qsort_b which has (of course) already been compiled so it has to make a regular function call. That makes a big differe
The compiler probably inlines the call to the comparison function, as opposed to qsort_b which has (of course) already been compiled so it has to make a regular function call. That makes a big differe
|
By
Jens Alfke
· #309
·
|
|
WKWebView does not load images
WKWebView has more security, so it probably disallows filesystem access. Or at least you may need to configure something about the “origin” or “security domain” to enable it. Or setting the baseURL to
WKWebView has more security, so it probably disallows filesystem access. Or at least you may need to configure something about the “origin” or “security domain” to enable it. Or setting the baseURL to
|
By
Jens Alfke
· #326
·
|
|
WKWebView does not load images
Another thing that just occurred to me — since there is no base URL, there’s nothing to resolve the path relative to. (Yes it’s an absolute path, but that’s still a relative URL.) Try using “file:///p
Another thing that just occurred to me — since there is no base URL, there’s nothing to resolve the path relative to. (Yes it’s an absolute path, but that’s still a relative URL.) Try using “file:///p
|
By
Jens Alfke
· #329
·
|
|
Sandboxed WkWebView
Yup. This doesn’t even require messing with symlinks; it’s a supported option in the GUI: - Open Users & Groups system pref - Unlock - Ctrl/right-click a user in the list - Select “Advanced Options” f
Yup. This doesn’t even require messing with symlinks; it’s a supported option in the GUI: - Open Users & Groups system pref - Unlock - Ctrl/right-click a user in the list - Select “Advanced Options” f
|
By
Jens Alfke
· #352
·
|
|
Sandboxed WkWebView
It sounds like the framework is being too eager to check for this entitlement. It’s definitely worth filing a bug report with Apple! —Jens
It sounds like the framework is being too eager to check for this entitlement. It’s definitely worth filing a bug report with Apple! —Jens
|
By
Jens Alfke
· #357
·
|
|
Objective-C: What is the current preferred method of declaring constants without a .pch?
Wait, what? I never got the memo on this. I put constants in the headers for the classes/APIs they are used with. If you look at Cocoa headers you can see Apple does the same thing. Also, this is a se
Wait, what? I never got the memo on this. I put constants in the headers for the classes/APIs they are used with. If you look at Cocoa headers you can see Apple does the same thing. Also, this is a se
|
By
Jens Alfke
· #363
·
|
|
Objective-C: What is the current preferred method of declaring constants without a .pch?
Yup. When the target you’re building has enough of its own header files to affect compilation speed, it becomes useful to precompile them. There are also a lot of C and C++ headers in the OS (and in e
Yup. When the target you’re building has enough of its own header files to affect compilation speed, it becomes useful to precompile them. There are also a lot of C and C++ headers in the OS (and in e
|
By
Jens Alfke
· #367
·
|
|
Cancelling dispatch_after?
I think ARC copies the block automatically if you assign it to a variable instead of just having it as a parameter of a function/method call. (A block really only gets copied once; it’s more like “det
I think ARC copies the block automatically if you assign it to a variable instead of just having it as a parameter of a function/method call. (A block really only gets copied once; it’s more like “det
|
By
Jens Alfke
· #395
·
|
|
Cancelling dispatch_after?
No, because then blocks would always be copied to the heap, even in common cases where they don’t escape, like calling NSDictionary’s -enumerateKeysAndValues: method. That would make these a lot more
No, because then blocks would always be copied to the heap, even in common cases where they don’t escape, like calling NSDictionary’s -enumerateKeysAndValues: method. That would make these a lot more
|
By
Jens Alfke
· #397
·
|
|
Simple iOS App with Foundation InputStream and OutputStream...
Consider using NSURLSessionStreamTask; it’s higher-level with IMHO a better API, and it supports proxies. If you’re using an NSURL for this, I don’t think you’re doing it correctly. URLs have schemes,
Consider using NSURLSessionStreamTask; it’s higher-level with IMHO a better API, and it supports proxies. If you’re using an NSURL for this, I don’t think you’re doing it correctly. URLs have schemes,
|
By
Jens Alfke
· #411
·
|
|
Simple iOS App with Foundation InputStream and OutputStream...
Just take a look at the header. It’s only the older version that takes an NSHost that’s deprecated: @interface NSStream (NSSocketStreamCreationExtensions) + (void)getStreamsToHostWithName:(NSString *)
Just take a look at the header. It’s only the older version that takes an NSHost that’s deprecated: @interface NSStream (NSSocketStreamCreationExtensions) + (void)getStreamsToHostWithName:(NSString *)
|
By
Jens Alfke
· #414
·
|
|
Xcode: Installing components
Shared libraries for talking to iOS devices. Possibly debugger & profiler infrastructure (stuff for getting access to other processes.) Etc. Xcode has been installing this stuff since at least version
Shared libraries for talking to iOS devices. Possibly debugger & profiler infrastructure (stuff for getting access to other processes.) Etc. Xcode has been installing this stuff since at least version
|
By
Jens Alfke
· #421
·
|