Re: Using CFSTR() with const char * variable
That’s not going to work. __builtin___CFStringMakeConstantString is a special compiler function that requires a constant string to work in the first place, as it tells the compiler to generate CFString literal. I doubt the compiler will accept anything else as parameter. Le 7 juin 2015 à 03:39, Steve Christensen puns...@mac.com a écrit : In my prefix file that is used to build precompiled headers, I include the following after #import-ing all the framework headers. It replaces the standard definition with a version that doesn't insert quotes around an unquoted string literal. #undef CFSTR//(cStr) #ifdef __CONSTANT_CFSTRINGS__ #define CFSTR(cStr) ((CFStringRef) __builtin___CFStringMakeConstantString(cStr)) #else #define CFSTR(cStr) __CFStringMakeConstantString(cStr) #endif On Jun 5, 2015, at 8:02 PM, Carl Hoefs newsli...@autonomy.caltech.edu wrote: If I use CFSTR() in the following way: CFStringRef mystr = CFSTR( This is a string ); there is no problem. However, if I use a variable instead of “string” Xcode flags this as an error: const char *mystring = This is a string; CFStringRef mystr = CFSTR( mystring ); ^ — Expected ) In CFString.h, CFSTR is defined as: #define CFSTR(cStr) __CFStringMakeConstantString( cStr ) Is it possible to use CFSTR() with a const char * variable? Xcode 6.3.2 -Carl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/mailing%40xenonium.com This email sent to mail...@xenonium.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: why is this Swift initializer legal
On 8 Jun 2015, at 06:14, Greg Parker gpar...@apple.com wrote: On Jun 6, 2015, at 2:43 AM, Roland King r...@rols.org wrote: public class RDKBLEService : NSObject { let peripheral : CBPeripheral public init( peripheral: CBPeripheral ) { self.peripheral = peripheral } } It’s a designated initialiser, there’s a superclass (NSObject) but the initialiser doesn’t call a designated initialiser of the superclass. According to the rules I was just re-re-re-reading about Swift initialisation, it’s required to call a superclass designated initialiser from your derived class. I was looking to see if I could find an exception to the rule which this fell under but can’t. There is an exception in the designated initializer rule: if your superclass is NSObject then you may omit the call to -[NSObject init]. The compiler knows that -[NSObject init] does nothing, so it allows this as a performance optimization. NSObject Class Reference: The init method defined in the NSObject class does no initialization; it simply returns self. There is lots of existing code that would break if we changed that, so we can't even if we wanted to. Seems not to matter if it’s NSObject or not, appears to be subclassing any class with one and only one no-arg initializer gets one implicitly synthesized in for you. This is Swift we’re talking about in this case, not obj C by the way. eg this compiles too even though Y’s init doesn’t have a super.init() call in it per the documented Swift rules. import Cocoa class X { let i : Int init() { i = 123 } } class Y : X { let j : Int init( jj : Int ) { j = jj } } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: why is this Swift initializer legal
On Jun 6, 2015, at 2:43 AM, Roland King r...@rols.org wrote: public class RDKBLEService : NSObject { let peripheral : CBPeripheral public init( peripheral: CBPeripheral ) { self.peripheral = peripheral } } It’s a designated initialiser, there’s a superclass (NSObject) but the initialiser doesn’t call a designated initialiser of the superclass. According to the rules I was just re-re-re-reading about Swift initialisation, it’s required to call a superclass designated initialiser from your derived class. I was looking to see if I could find an exception to the rule which this fell under but can’t. There is an exception in the designated initializer rule: if your superclass is NSObject then you may omit the call to -[NSObject init]. The compiler knows that -[NSObject init] does nothing, so it allows this as a performance optimization. NSObject Class Reference: The init method defined in the NSObject class does no initialization; it simply returns self. There is lots of existing code that would break if we changed that, so we can't even if we wanted to. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
SKPaymentTransaction, and Receipt on OS X
In my delegate: -(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions I call: (to make sure we are on the main thread): case SKPaymentTransactionStatePurchased: [self performSelectorOnMainThread:@selector(completeTransaction:) withObject:transaction waitUntilDone:YES]; break; Then in: -(void)completeTransaction:(SKPaymentTransaction *)transaction { [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; // At this point the receipt is not always updated with the purchase... Sometimes I have to quit the app and relaunch it. } How can I ensure the receipt is updated so that I can perform a check on it to determine the subscription status? This is Mac OS X - NOT iOS. Trygve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com