Re: Can an use introspection to determine if its a production app from the App Store?
I just hope that was meant with a wink. If not... Why would the library itself need to be in swift? https://developer.apple.com/library/ios/documentation/swift/conceptual/buildingcocoaapps/MixandMatch.html Just use it from swift. On Thu, Oct 30, 2014 at 7:38 PM, David Hoerl dho...@mac.com wrote: Looks great, but I cannot read Objective C anymore - where is the Swift version??? On 10/30/14, 2:28 PM, Torsten Curdt wrote: You could also inspect the provisioning profile: https://github.com/tcurdt/TCMobileProvision cheers, Torsten On Thu, Oct 30, 2014 at 6:44 PM, David Brittain websi...@paperetto.com mailto:websi...@paperetto.com wrote: The following seems to work from experimentation... For an application installed through TestFlight Beta the receipt file is named StoreKit\sandboxReceipt vs the usual StoreKit\receipt. Using [NSBundle appStoreReceiptURL] you can look for sandboxReceipt at the end of the URL. NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL]; NSString *receiptURLString = [receiptURL path]; BOOL isRunningTestFlightBeta = ([receiptURLString rangeOfString:@sandboxReceipt].location != NSNotFound); sandboxReceipt is also the name of the receipt file when running builds locally. On Thu, Oct 30, 2014 at 10:38 AM, David Hoerl dho...@mac.com mailto:dho...@mac.com wrote: Can an iOS app examine some property to determine if its been installed as a development style app (ie Test Flight, or Xcode, etc), or was installed via the App Store. [I support a library where the app is suppose to pass a flag, but clients are making errors...] David ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com mailto: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 http://lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/ websites%40paperetto.com This email sent to websi...@paperetto.com mailto:websi...@paperetto.com -- David Brittain da...@paperetto.com mailto:da...@paperetto.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com mailto: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 http://lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/tcurdt%40vafer.org This email sent to tcu...@vafer.org mailto:tcu...@vafer.org ___ 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: Can an use introspection to determine if its a production app from the App Store?
My day job is programming in C# for Windows computers. I was really excited when Swift came out because it’s so similar to other languages I know well and use and admire. But it turns out that for me, the language is not at all the hurdle for learning Cocoa programming. Apple’s incredibly frustrating UI objects such as NSTableView are the same no matter what language you use. (Frustrating for newbies, at least. I’m sure there are those among you who have no trouble getting tables to do what you want…) Even buying Xamarin so I could code in my familiar C# would do nothing to make creating my app any easier. Switching from Obj-C to Swift only added new frustrations for me because Swift optionals proved to be a great pain, and the way Xcode admonishes you that an argument name is extraneous if you type it in but missing if you leave it off is comically annoying. The IDE will get better and hopefully the language will change to make optionals less of a burden. But for now it seems to me that coding in Swift just adds more friction to an already difficult task. (It’s easy to see that the things which make Swift painful for me are necessary for interoperation with Objective-C. If Apple gets to the point they can leave Obj-C behind and banish it from all libraries, optionals and named arguments could be deprecated and Swift would then be an easier and better language to use. That’s going to be Apple’s challenge, to get “everybody” to use Swift instead of Obj-C despite the rough edges caused by legacy Obj-C.) — Charles Jenkins On Thursday, October 30, 2014 at 18:57, Graham Cox wrote: On 31 Oct 2014, at 5:38 am, David Hoerl dho...@mac.com (mailto:dho...@mac.com) wrote: Looks great, but I cannot read Objective C anymore - where is the Swift version??? Obj-C isn't going anywhere soon, and Swift isn't yet ready for hardcore commercial use. I can't see the transition taking any less than five years, so what are you going to do in that time? Just twiddle your thumbs, or get on with building your apps? --Graham ___ 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: When I rotate the MKMapView with transform, setCenter not working.
Hi, I have solved this problem. Do not change the frame of map view when it’s transform does not equal to CGAffineTransformIdentity. Best Regards, Sunny Lee 在 2014年10月31日,上午12:54,sonofsky2...@gmail.com 写道: Hi all, I rotate the MKMapView with setting the rotation transform. When I use setCenter method to change the center coordinate of the map, the location of this coordinate not in the center. Does anyone know what happened, and how to solve this problem? Below is the code snipt. - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. static CLLocationCoordinate2D aircraftCoordinate = {22.531474, 113.943516}; CGFloat width = self.view.bounds.size.width; CGFloat height = self.view.bounds.size.height; CGFloat newSize = sqrt(width* width + height * height); UIView *tmpView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, height)]; [self.view insertSubview:tmpView atIndex:0]; self.containorView = tmpView; MKMapView *tmpMapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, newSize, newSize)]; [self.containorView addSubview:tmpMapView]; self.mapView = tmpMapView; [tmpMapView setCenter:self.containorView.center]; self.annotation = [[DJITestAnnotation alloc] init]; _annotation.coordinate = aircraftCoordinate; [self.mapView addAnnotation:self.annotation]; self.mapView.delegate = self; [self.mapView setTransform:CGAffineTransformMakeRotation(90 * M_PI_4 / 180)]; } - (IBAction)location:(id)sender { self.mapView.camera.centerCoordinate = _annotation.coordinate; } Best Regards, Sunny Lee ___ 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: When I rotate the MKMapView with transform, setCenter not working.
On 31 Oct 2014, at 11:43, sonofsky2...@gmail.com wrote: Hi, I have solved this problem. Do not change the frame of map view when it’s transform does not equal to CGAffineTransformIdentity. This is a general rule about UIView. Once the transform is anything other than identity, .frame becomes undefined and should be left alone. ___ 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: Can an use introspection to determine if its a production app from the App Store?
Am 31.10.2014 um 12:40 schrieb Charles Jenkins cejw...@gmail.com: optionals and named arguments could be deprecated and Swift would then be an easier and better language to use. Even though it doesn't look like it, I really hope you were joking ... Andreas ___ 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: Can an use introspection to determine if its a production app from the App Store?
On 31 Oct 2014, at 6:40 AM, Charles Jenkins cejw...@gmail.com wrote: My day job is programming in C# for Windows computers. I was really excited when Swift came out because it’s so similar to other languages I know well and use and admire. I’ll take this as the root theme of your message. Many of your objections amount to being unhappy that Cocoa, OS X, and their tools are not C# on Windows. C# and Windows are worth knowing, but most things that are worth knowing are neither C# nor Windows. They are that way for thoughtful reasons, and not as duct tape over their falling short of being C#. Even if you never use any other tool or environment again, knowing about others will make you a better C# developer. Named arguments and strict typing are found in many modern languages. Smart people differ on the merits, but many smart people think they are good ideas. An out-of-band value for “no result” has been a feature of programming languages since SQL’s NULL at least; as late as the 1980s, the biggest horror stories of computing centered on collection proceedings for utility bills of $99,999.99. Some such languages use it inconsistently, and stick developers with the pain of debugging it. It is rational to provide an out-of-band value; to make it uniform; to take advantage of modern computers’ ability to detect fatal errors in its use; and to force developers, the only ones able to abate such errors, to abate them. The compiler pelts you with ! and ? gotchas precisely because you hadn’t noticed the pitfalls. I infer you don’t like the Delegate design pattern used in (NS|UI)TableView and elsewhere. The Delegate pattern has been documented as sound OO practice for twenty years, and not just in ObjC/NeXTStep. Even critics allow it is one of Cocoa’s strengths. It will never go away. See Wikipedia. “Banish[ing] Objective-C from all libraries” would be like superseding every C# library with a total redesign: conceivable, pointless, will never happen. On the other side: When I am feeling especially cynical, it seems Swift syntax has a lot of sugar that makes it less intimidating in a 30-minute presentation, but harder to write.* The impedance mismatch with Cocoa is artfully minimized and is improving, but it makes Swift much more complicated. The error messages are often inscrutable, or can be scruted only by reference to API that for now is mostly unpublished.** Welcome to tech. What can get better has been getting better. * (For some of this — maybe most — I’m held back because I haven’t developed the instincts I have for ObjC and Ruby. Bang-suffixed types and `??` are sugar for things that could be clearer if expanded, but I wouldn’t give them up.) ** (Unless you add `import swift` to a .swift file and command-click `swift`. I wish I could properly credit the humanitarian I learned this from — NSHipster?) — F ___ 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: Can an use introspection to determine if its a production app from the App Store?
Sent from my iPad On 31 oct. 2014, at 18:22, Fritz Anderson fri...@manoverboard.org wrote: On 31 Oct 2014, at 6:40 AM, Charles Jenkins cejw...@gmail.com wrote: My day job is programming in C# for Windows computers. I was really excited when Swift came out because it’s so similar to other languages I know well and use and admire. (Snip) An out-of-band value for “no result” has been a feature of programming languages since SQL’s NULL at least; And of course, C#'s Nullable, which seems similar enough to Swift optionals (apart from only being necessary for value types) that I'm quite curious to know what makes optionals more objectionable. I also use C# in my day job and was happy to see Swift had some of its nicer features (nullables included) although I have to admit that part of the reason I liked C# in the first place was that it had some Objective-C-like features I liked. Is the problem just that when working with Objective-C frameworks, you have to use optionals more often than you usually would? Or is it that you have to explicitly state when reference types are Nullable, whereas in C# they always are? ___ 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
NSStatusItem launches twice when checking launch at login
I have an NSStatusItem app that I’ve had to migrate to a sandboxed app for release in the MAS. In its preferences window, there is a checkbox for “Launch at login”. If I launch the app with no preferences set (i.e. defaults delete my.bundle.identifier, rm ~/Library/Container/my.bundleIdentifier), open the preferences and check the login checkbox. the app behaves as expected in that the checkbox gets checked and if I logout/login, the app is launched. If I open the app’s preferences now, the checkbox is checked as it should be, but if I uncheck it and then check it again, I get a second instance of my app in the menu bar. Clearing the preferences again, starts the cycle over. The really odd thing is that I’ve only noticed this on a brand new MB Pro 15”. I also have an iMac that is ~2010 and another MB Pro ~2008, neither of which exhibit this behavior. All machines are running Yosemite. I’ve yet to test this on older OS’s. I never get more than two instances no matter how many times I uncheck/check the checkbox. Now there are actually two separate processes, Top shows two different PID’s. I thought Launch Services was supposed to prevent this. Since this is a sandboxed app, I added a helper app to the project which launches the app depending on if the checkbox was checked. I’ve added code to that helper to check if the app is already running. (look through NSRunningApplications and check for my bundle identifier). This doesn’t prevent the second instance from occurring. So anyone have any ideas why this might be happening? On a side note. how does one debug the helper app within the context of the main application? I can launch the helper app through its subproject and step through it with the debugger. If I have the main app already running when I do this, the helper quits without attempting to launch another instance of the main app. But I don’t even get NSLogs from the helper when its running from the main app. Here is the code in the window controller for the preferences window: (IBAction)toggleLoginStatus:(NSButton*)sender{ if(!SMLoginItemSetEnabled((__bridge CFStringRef)@“my.bundle.Identifier, (BOOL)[sender state])){ NSLog(@“Crap!); } } Here is the code for the helper app: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { NSString * path; BOOL alreadyRunning = NO; NSArray *running = [[NSWorkspace sharedWorkspace] runningApplications]; for (NSRunningApplication *app in running) { if ([[app bundleIdentifier] isEqualToString:@“my.bundle.Identifier]) { alreadyRunning = YES; } } if(!alreadyRunning){ path = [[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] stringByDeletingLastPathComponent] stringByDeletingLastPathComponent] stringByDeletingLastPathComponent]; [[NSWorkspace sharedWorkspace] launchApplication:path]; } [NSApp terminate:nil]; } - (And a slight rant: The LSSharedFileList method worked just perfectly to create a startup item. Such a shame I had to dump perfectly good working code because of sandboxing.) Thanks ___ 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: Can an use introspection to determine if its a production app from the App Store?
On Friday, October 31, 2014 at 13:22, Fritz Anderson wrote: On 31 Oct 2014, at 6:40 AM, Charles Jenkins cejw...@gmail.com (mailto:cejw...@gmail.com) wrote: My day job is programming in C# for Windows computers. I was really excited when Swift came out because it’s so similar to other languages I know well and use and admire. I’ll take this as the root theme of your message. Many of your objections amount to being unhappy that Cocoa, OS X, and their tools are not C# on Windows. C# and Windows are worth knowing, but most things that are worth knowing are neither C# nor Windows. They are that way for thoughtful reasons, and not as duct tape over their falling short of being C#. This is not my position at all, and what follows in your message are straw-man arguments in response to assertions I never made. I get paid well to screw around with Windows, but I switched to the Mac back in 2000 and I prefer it over Windows in every way. I don’t want you to lead anyone to think I’m a Windows apologist come to cast aspersions on the Mac platform. If I were complaining that Swift isn’t C#, why would I feel that Obj-C offers less friction to me as a Cocoa newbie even though it is far more different from C# than Swift? For one thing, I love out-of-band values. Receiving a clear null-reference exception at the point in your code where something should have a value but doesn’t is a very, very good thing. Swift encourages using the ? operator to hide bugs and make the eventual failure harder to correct; or cluttering your code with nested “if let” statements which probably have the same effect unless you go to the trouble of adding even more code to create an exception in the “else”; or adding the noise of ! operators. Let’s say I have a variable called “phoneNumber” which may have a value or be nil. I’d like to be able to write code like phoneNumber?.dial() or if let pn = phoneNumber { pn.dial() } in areas where I don’t care whether phoneNumber is nil, where the rest of the code can continue working. But where it matters and phoneNumber must not be nil, I want to write code like phoneNumber.dial() and receive an exception. Adding ! is just noise, and in cases where execution shouldn’t continue, ? or if let are noise that can make things worse. But the choice which in my personal opinion is best is not allowed by the compiler. And as for the table view, isn’t it notoriously difficult for noobs to learn and work with? I’m merely stating what I think is a known fact. That’s not the same as complaining about delegation or any other Cocoa pattern. ___ 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: Can an use introspection to determine if its a production app from the App Store?
On Oct 31, 2014, at 12:50 PM, Charles Jenkins cejw...@gmail.com wrote: On Friday, October 31, 2014 at 13:22, Fritz Anderson wrote: On 31 Oct 2014, at 6:40 AM, Charles Jenkins cejw...@gmail.com (mailto:cejw...@gmail.com) wrote: My day job is programming in C# for Windows computers. I was really excited when Swift came out because it’s so similar to other languages I know well and use and admire. I’ll take this as the root theme of your message. Many of your objections amount to being unhappy that Cocoa, OS X, and their tools are not C# on Windows. C# and Windows are worth knowing, but most things that are worth knowing are neither C# nor Windows. They are that way for thoughtful reasons, and not as duct tape over their falling short of being C#. This is not my position at all, and what follows in your message are straw-man arguments in response to assertions I never made. I get paid well to screw around with Windows, but I switched to the Mac back in 2000 and I prefer it over Windows in every way. I don’t want you to lead anyone to think I’m a Windows apologist come to cast aspersions on the Mac platform. If I were complaining that Swift isn’t C#, why would I feel that Obj-C offers less friction to me as a Cocoa newbie even though it is far more different from C# than Swift? For one thing, I love out-of-band values. Receiving a clear null-reference exception at the point in your code where something should have a value but doesn’t is a very, very good thing. Swift encourages using the ? operator to hide bugs and make the eventual failure harder to correct; or cluttering your code with nested “if let” statements which probably have the same effect unless you go to the trouble of adding even more code to create an exception in the “else”; or adding the noise of ! operators. Let’s say I have a variable called “phoneNumber” which may have a value or be nil. I’d like to be able to write code like phoneNumber?.dial() or if let pn = phoneNumber { pn.dial() } in areas where I don’t care whether phoneNumber is nil, where the rest of the code can continue working. But where it matters and phoneNumber must not be nil, I want to write code like phoneNumber.dial() and receive an exception. I think this is your real philosophical issue, and has little to do with Obj-C vs Swift, since in both cases the answer in these languages is “check for nil before calling dial”. As a rule Apple frameworks choose to use exceptions for programmer errors only, not for runtime errors or flow control. Thats an issue entirely orthogonal to optionals, and why they would likely still exist in Swift even without Obj-C having come before. Adding ! is just noise, and in cases where execution shouldn’t continue, ? or if let are noise that can make things worse. But the choice which in my personal opinion is best is not allowed by the compiler. And as for the table view, isn’t it notoriously difficult for noobs to learn and work with? I’m merely stating what I think is a known fact. That’s not the same as complaining about delegation or any other Cocoa pattern. ___ 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/david.duncan%40apple.com This email sent to david.dun...@apple.com -- David Duncan ___ 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: Can an use introspection to determine if its a production app from the App Store?
On 1 Nov 2014, at 6:50 am, Charles Jenkins cejw...@gmail.com wrote: as for the table view, isn’t it notoriously difficult for noobs to learn and work with? Just to pick up on this point, I think the answer, unenlighteningly, is it depends. When I was a Cocoa noob, I found NSTableView to be straightforward to use for straightforward needs (e.g. simple lists). Coming from the classic Mac OS and the dreadful List Manager, it was a breath of fresh air. As time has passed, NSTableView has become very complicated. But I think it has remained true to its original purpose - easy enough for simple needs. You can ignore all the added stuff if you want. I would have preferred NSTableView to have devolved into multiple classes, maybe NSViewTableView, but because it is subclassed for NSOutlineView, I can see that would lead to further complications keeping the two classes in step feature-wise. --Graham ___ 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: NSStatusItem launches twice when checking launch at login
Sorry I’m not helping with your main question. Just a couple comments on sideshow issues. On 2014 Oct 31, at 15:07, Lorenzo Thurman lore...@thethurmans.com wrote: Now there are actually two separate processes, Top shows two different PID’s. I thought Launch Services was supposed to prevent this. No, it only does that if you doubleclick a document. But I don’t even get NSLogs from the helper when its running from the main app. Look in the system console by running /Applications/Utilities/Console.app. ___ 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