Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do

Mikey-San posted:

In the meantime, perhaps you could have a helper method that automated Settings.app to change the time/date in your tests.

Settings.app doesn't allow us to change the date/time in the simulator is the thing. Arguably, we could run the tests on actual devices (gasp!), though we've run into other issues with trying to do that on our CI box (which may actually be a VM in a data center somewhere), such as dealing with device updates and that sort of thing.

I also filed 32697021 for "make it easy to delete the app in UI tests", which is something we can do manually, but it'd be nice to have a quick way to do it. Another pie-in-the-sky, especially because we have a working workaround (especially now that it's not quite all private API in Xcode 9).


Mikey-San posted:

Notifications: Basically the same answer as above.

I'll see if I can put an example together some time this week.

This in particular would be awesome, because part of the "adjust date/time" functionality is having local notifications that ping things like "your file is going to be deleted in 2 days!" where tapping the notification does particular things, and again, we have to manually test it. So having access to the local notifications both in terms of "checking what it says" and "tapping it goes to the right place" would be huge. Though I suppose I can go write a radar for that sort of thing from an awesome API perspective anyway, but if we have a good workaround, that would really help.

Edit: Radar 32697117 filed.


I know it sounds like my application does a lot, but it's more because I'm responsible for a couple of different applications that are almost all apps internal to our enterprise client, and they sometimes have weird requirements. So I'm kind of munging them to say "my application". But you know, clients.

Axiem fucked around with this message at 04:28 on Jun 11, 2017

Adbot
ADBOT LOVES YOU

Mikey-San
Nov 3, 2005

I'm Edith Head!

Axiem posted:

Settings.app doesn't allow us to change the date/time in the simulator is the thing. Arguably, we could run the tests on actual devices (gasp!), though we've run into other issues with trying to do that on our CI box (which may actually be a VM in a data center somewhere), such as dealing with device updates and that sort of thing.

Ah yes, the simulator is a wrench in the workflow here. (The problem is really more of a simulator thing, but I know that's not really an important distinction for test authors.) In general, when there's a lack of parity in testing capability between device and simulator, we consider that an area of potential improvement.

Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do

Mikey-San posted:

(The problem is really more of a simulator thing, but I know that's not really an important distinction for test authors.)

Though I can appreciate that it's an important distinction among y'all who build these things. I've worked in the "multiple teams all building parts of what to the users appears to be more or less a monolithic application" sort of team before, and it's lots of fun with the coordination, and dealing with users who don't really know whom to ask to do what, so things get confusing :)

At least I have the radar in, and hopefully it can get routed to the right team (sounds like the Simulator team in this case) to take a look.

I appreciate all the work y'all are doing, even though I sometimes get grumpy when things aren't working very well.

CuddlyZombie
Nov 6, 2005

I wuv your brains.

I'm following an old 2014 tutorial on Reactive Cocoa with Obj-C, and the tutorial says to input the text
code:

RACSignal *signUpActiveSignal =
    [RACSignal combineLatest:@[validUsernameSignal, validPasswordSignal]
                      reduce:^id(NSNumber *usernameValid, NSNumber *passwordValid) {
                          return @([usernameValid boolValue] && [passwordValid boolValue]);
                      }];
    
    [signUpActiveSignal subscribeNext:^(NSNumber *signupActive) {
        self.signInButton.enabled = [signupActive boolValue];
    }];

But earlier, it says that using the RAC macro is more elegant. I tried replacing it with
code:

RAC(self.signInButton, enabled) =
    [RACSignal combineLatest:@[validUsernameSignal, validPasswordSignal]
                      reduce:^id(NSNumber *usernameValid, NSNumber *passwordValid){
                          return @([usernameValid boolValue] && [passwordValid boolValue]);
                      }];

and that seems to work just as well, but I was wondering if someone who knows more about RAC could confirm if these are truly identical. (I wasn't sure if returning a bool wrapped in an object would work without somehow unwrapping it, but it appears that it did.)

Doctor w-rw-rw-
Jun 24, 2008
Gaining knowledge on RAC is more like "brain damage" than "learning". With ReactiveCocoa, the only right answer is to run away screaming.

It's rather easy to make a mistake and do UI stuff on a background thread or mutate state in what is *intended* to be a functional pipeline, and I'm actively trying not to remember how RAC works right now.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
RAC() sets the value via KVC, which is why assigning the boxed value to a primitive property works.

If validUsernameSignal or validPasswordSignal are retained by self then your first version has a retain cycle, while using RAC() does not retain the object it's setting values on (and automatically removes the subscription if the object is deallocated), which is the main functional advantage of it.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Mikey-San posted:

Ah yes, the simulator is a wrench in the workflow here. (The problem is really more of a simulator thing, but I know that's not really an important distinction for test authors.) In general, when there's a lack of parity in testing capability between device and simulator, we consider that an area of potential improvement.

I believe SpringBoard owns Control Center.

The date/time thing is a limit of the current architecture. In Xcode 9 the Simulator is a separate user space running on the macOS kernel so when you ask the kernel for the time we have no good way to lie about that. There is an interposition layer where we can hijack syscalls but it would be a very leaky abstraction.

edit: To expand on that, there are several ways to ask for the current time, plus side-effects (like file creation times) that we can't possibly hide. We felt like having a half-assed implementation would be worse than none.

Simulated fucked around with this message at 06:50 on Jun 12, 2017

Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do

Simulated posted:

edit: To expand on that, there are several ways to ask for the current time, plus side-effects (like file creation times) that we can't possibly hide. We felt like having a half-assed implementation would be worse than none.

That's fair, and I figured it was something like that. It still remains something that we'd love to have :)

ulmont
Sep 15, 2010

IF I EVER MISS VOTING IN AN ELECTION (EVEN AMERICAN IDOL) ,OR HAVE UNPAID PARKING TICKETS, PLEASE TAKE AWAY MY FRANCHISE
I was was working on a storyboard in the XCode 9 beta, and trying to connect a delegate outlet for a UITextView to one of my view controllers.

...but instead of a "delegate" outlet I was seeing something like pasteDelegate and 2 other more specific delegates, with no "delegate" option.

I was able to work around this just by setting the delegate relationship up in code, but is there some documentation I'm missing (I can't find anything relevant through googling)?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Does your view controller conform to UITextViewDelegate?

ulmont
Sep 15, 2010

IF I EVER MISS VOTING IN AN ELECTION (EVEN AMERICAN IDOL) ,OR HAVE UNPAID PARKING TICKETS, PLEASE TAKE AWAY MY FRANCHISE

pokeyman posted:

Does your view controller conform to UITextViewDelegate?

Yes (after adding the view controller as a delegate in code, everything works as expected; all the methods of UITextViewDelegate are optional, so it's just declaring that you are one), but I'm not even getting that far. In this screenshot, I've got the UITextView selected, and you can see I have 3 outlet choices and none of them is just plain "delegate":

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Oh right you mentioned it works in code. My bad.

Seems like a bug to me.

Mikey-San
Nov 3, 2005

I'm Edith Head!

Axiem posted:

Along these lines: can this functionality be used to open up Control Center? Or interact with local notifications? Again in the realm of "tests we have to do manually and would love to automate", but I don't know if the current (expanded) functionality solves the problem.

Sorry it took me a while to get back to you about this. Here are examples of automating Control Center and Notification Center alert windows.

code:
- (void)testControlCenter
{
    // Control Center is owned by Springboard.
    XCUIApplication *springboard = [[XCUIApplication alloc] initWithBundleIdentifier:@"com.apple.springboard"];
    XCUIApplication *app = [[XCUIApplication alloc] init];
    [app launch];
    
    // Pull up from the bottom edge of the screen to bring up the Control Center window.
    XCUICoordinate *bottomEdge = [app coordinateWithNormalizedOffset:CGVectorMake(0.5, 1.0)];
    XCUICoordinate *destination = [app coordinateWithNormalizedOffset:CGVectorMake(0.5, 0.8)];
    [bottomEdge pressForDuration:0.0 thenDragToCoordinate:destination];
    
    // Manipulate controls inside Control Center.
    [springboard.buttons[@"flashlight"] tap];
}

- (void)testNotification
{
    // Rough outline:
    //
    //    1. Tap a button in our app that delivers a notification.
    //    2. Back out to the home screen and wait for the notification window to appear.
    //    3. Tap the notification to reopen our app.
    
    // Notification windows (and the pull-down panel) are owned by Springboard.
    XCUIApplication *springboard = [[XCUIApplication alloc] initWithBundleIdentifier:@"com.apple.springboard"];
    XCUIApplication *app = [[XCUIApplication alloc] init];
    
    // Launch our little demo app and press a button that schedules a local notification for 5 seconds from now.
    [app launch];
    [app.buttons[@"smash"] tap];
    
    // Jump back to the home screen so the notification window appears.
    [XCUIDevice.sharedDevice pressButton:XCUIDeviceButtonHome];
    
    // Notification windows are owned by Springboard. Here's what they look like, as seen via the .debugDescription property:
    //
    // Window, 0x60800018b2c0, traits: 8589934592, Main Window, {{0.0, 0.0}, {375.0, 667.0}}
    //   Other, 0x60800018b390, traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}}
    //     Other, 0x60800018b460, traits: 35192962023424, {{8.0, 8.0}, {359.0, 659.0}}, label: 'Notification'
    //       ScrollView, 0x60800018b530, traits: 8589934592, {{8.0, 8.0}, {359.0, 659.0}}
    //         Other, 0x60800018b600, traits: 8589934592, {{8.0, 8.0}, {359.0, 87.0}},
    //                   identifier: 'NotificationShortLookView', label: 'MYDEMOAPP, now, Hey Now, You're an all-star'
    //
    // If you're pretty confident your setup will have just one window, you could locate the element via its identifier:
    //
    //     [springboard.otherElements[@"NotificationShortLookView"]
    //
    // But this example will use something more specific, and match against the actual text in the notification label.
    XCUIElement *notification = springboard.otherElements[@"MYDEMOAPP, now, Hey Now, You're an all-star"];
    XCTAssertTrue([notification waitForExistenceWithTimeout:15], @"Expected all-star notification window to appear");
    [notification tap];
    
    // Tapping the notification reopens our app. Because we didn't call -activate or -launch, we should wait for it to become foreground.
    NSPredicate *statePredicate = [NSPredicate predicateWithFormat:@"state == %d", XCUIApplicationStateRunningForeground];
    XCTNSPredicateExpectation *stateExpectation = [[XCTNSPredicateExpectation alloc] initWithPredicate:statePredicate object:app];
    [self waitForExpectations:@[ stateExpectation ] timeout:10];
    
    // More test code here.
}

edit: slightly less table breakage, test method rename, assert the existence of the notification window

Mikey-San fucked around with this message at 22:08 on Jun 16, 2017

CuddlyZombie
Nov 6, 2005

I wuv your brains.

Plorkyeran posted:

RAC() sets the value via KVC, which is why assigning the boxed value to a primitive property works.

If validUsernameSignal or validPasswordSignal are retained by self then your first version has a retain cycle, while using RAC() does not retain the object it's setting values on (and automatically removes the subscription if the object is deallocated), which is the main functional advantage of it.

Thanks, I think I understand that. Mostly. In that case, I'll stick with the macro to avoid the risk of retain cycles.

Doctor w-rw-rw- posted:

Gaining knowledge on RAC is more like "brain damage" than "learning". With ReactiveCocoa, the only right answer is to run away screaming.

It's rather easy to make a mistake and do UI stuff on a background thread or mutate state in what is *intended* to be a functional pipeline, and I'm actively trying not to remember how RAC works right now.

Yeah that echoes my past experience trying to learn RAC by being shown a legacy project using it absolutely everything. :geno:

Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do

Mikey-San posted:

Sorry it took me a while to get back to you about this. Here are examples of automating Control Center and Notification Center alert windows.

This is super awesome, and no worries on the delay. Thanks so much; this will be a huuuuuuuge help.

Mikey-San
Nov 3, 2005

I'm Edith Head!

Axiem posted:

This is super awesome, and no worries on the delay. Thanks so much; this will be a huuuuuuuge help.

Sure. I updated the example to assert the result of -waitForExistenceWithTimeout:, to signal failure earlier and more descriptively.

If anyone's wondering where that method came from, it's new in Xcode 9.

Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do

Mikey-San posted:

If anyone's wondering where that method came from, it's new in Xcode 9.

Which thankfully means I can get rid of our custom implementation for it :D

I switch from working on one app to another today (I hate being responsible for a half-dozen apps, but what can you do?), and was doing it in Xcode 9 (because the editor is so much nicer for real), and when I went to run it on an iOS simulator, it failed miserably because one of the frameworks wasn't signed I think?

I didn't investigate (didn't have the time), but it's possible that CocoaPods didn't get something set right, or that we don't have a setting or something. Are there new rules around signing even when going to the simulator, in iOS 11 / Xcode 9?

PRADA SLUT
Mar 14, 2006

Inexperienced,
heartless,
but even so
If I have a project in Visual Studio (using Microsofts online version control), is there a way I can link Xcode in to using that, such that I can modify the project using either Xcode or Visual Studio?

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Axiem posted:

Which thankfully means I can get rid of our custom implementation for it :D

I switch from working on one app to another today (I hate being responsible for a half-dozen apps, but what can you do?), and was doing it in Xcode 9 (because the editor is so much nicer for real), and when I went to run it on an iOS simulator, it failed miserably because one of the frameworks wasn't signed I think?

I didn't investigate (didn't have the time), but it's possible that CocoaPods didn't get something set right, or that we don't have a setting or something. Are there new rules around signing even when going to the simulator, in iOS 11 / Xcode 9?

Most of this was in Xcode 8 but yes: the Simulator now enforces entitlements and code signing, though the signing certificate can be invalid IIRC. We just check that it has a signature. This is to help you catch problems quicker.

Doc Block
Apr 15, 2003
Fun Shoe

PRADA SLUT posted:

If I have a project in Visual Studio (using Microsofts online version control), is there a way I can link Xcode in to using that, such that I can modify the project using either Xcode or Visual Studio?

Kinda, but not the way you're thinking. AFAIK neither Xcode nor Visual Studio can read each other's project files.

What you can do is use something like CMAKE. CMAKE is able to generate project files for Xcode, Visual Studio, and a few others. You tell CMAKE what your source code files are, what settings they need, what the project settings should be, and then you can generate the necessary project files for Xcode and VS.

If you add/remove files, you add/remove them from CMAKE and then regenerate the project files. If you want to change build settings, change them in CMAKE and regenerate the project files. Etc. etc. etc.

Moogs
Jan 25, 2004

Proceeds the Weedian... Nazareth
I'm very new to development, so I'm probably using some wrong terms here, but I'm am trying to make an iMessage app with essentially three separate views -- compact (first image, when App is as big as they keyboard), expanded (second image) and a different view when the user touches a message (third image).



I'm trying to change didBecomeActive to account for the possible states... is this the right approach? Am I making any drat sense?

code:

    override func didBecomeActive(with conversation: MSConversation) {

        let presentationStyle: MSMessagesAppPresentationStyle
        
        if presentationStyle == compact { // how do I check the current presentationStyle?
            presentVC(presentationStyle: .compact, for: conversation)
        } else {
            presentVC(presentationStyle: .expanded, for: conversation)
        }
        
    }

dc3k
Feb 18, 2003

what.
That's how our app does it. If you are subclassing `MSMessagesAppViewController` (I think you have to? IDK, I didn't write this code) `presentationStyle` will be set to the correct value at that point so you don't need to `let presentationStyle = something`. You also should override `willTransition(to presentationStyle: MSMessagesAppPresentationStyle)` to adjust for changes.

dc3k fucked around with this message at 02:08 on Jun 21, 2017

lord funk
Feb 16, 2004

So, has everyone just given up on po in the debugger? poo poo has gone from bad to worse since Swift every single update.

Print a local variable? AHHHH WHAT?? IMPOSSIBLE CAN'T

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

lord funk posted:

So, has everyone just given up on po in the debugger? poo poo has gone from bad to worse since Swift every single update.

Print a local variable? AHHHH WHAT?? IMPOSSIBLE CAN'T

The LLDB team is hiring.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

lord funk posted:

So, has everyone just given up on po in the debugger? poo poo has gone from bad to worse since Swift every single update.

It worked for you in Swift at some point?

Dirk Pitt
Sep 14, 2007

haha yes, this feels good

Toilet Rascal

lord funk posted:

So, has everyone just given up on po in the debugger? poo poo has gone from bad to worse since Swift every single update.

Print a local variable? AHHHH WHAT?? IMPOSSIBLE CAN'T

I still sometimes do this, then I go get a cup of coffee while waiting.

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

Simulated posted:

The LLDB team is hiring.

Hire documentation writers first please

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

hackbunny posted:

Hire documentation writers first please

That team is also hiring right now.

Doctor w-rw-rw-
Jun 24, 2008
Or join Facebook, where we also contribute to clang/llvm/lldb/etc, and we have better benefits and a good culture :P

Kallikrates
Jul 7, 2002
Pro Lurker
Does apple recruit people that will live outside commuting distance to the UFO? I would apply but I like my cheap NYC rents and culture.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
We don't usually hire people to work remotely or allow them to move away, no. Exceptions have been made in the past on both counts, but there's no regular policy of allowing it after a certain amount of service or whatever.

For what it's worth, I don't know what stereotypes people have about Apple or Silicon Valley, but the Xcode team at least is a standard professional environment where everyone has an office (admittedly a shared one) and people work normal hours and there is a general culture of collaboration and respect and nobody gets to be a rockstar who doesn't have to follow the rules.

Doc Block
Apr 15, 2003
Fun Shoe
So does that mean if I have separate day/night phones, and the ringtone turned off so I'm always on the offensive, that I can't work on the Xcode team? ;)

Kallikrates
Jul 7, 2002
Pro Lurker
It was more a comment on the culture of the city I live in, than company culture; no shade intended. I'm sure a mature company like apple tries to get a handle on the good trends in tech and culture and moves in their direction.

The weather would be a upgrade but I play second fiddle to my +1's career so companies without an NYC office or remote are not an option.

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

Simulated posted:

That team is also hiring right now.

I hope so! Correct me if I'm wrong but the bulk of the lldb documentation is still that "gdb to lldb" cheat sheet

Doc Block
Apr 15, 2003
Fun Shoe

Kallikrates posted:

It was more a comment on the culture of the city I live in, than company culture; no shade intended. I'm sure a mature company like apple tries to get a handle on the good trends in tech and culture and moves in their direction.

I figured as much. I just can't ever pass up an opportunity to take potshots at alpha male tech bros (the "no ringtone" thing is from the Path CEO IIRC).

Doc Block fucked around with this message at 19:31 on Jul 2, 2017

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Kallikrates posted:

I play second fiddle to my +1's career so companies without an NYC office or remote are not an option.

Trust me, I completely understand. :)

Doctor w-rw-rw-
Jun 24, 2008

Kallikrates posted:

Does apple recruit people that will live outside commuting distance to the UFO? I would apply but I like my cheap NYC rents and culture.
Facebook's got a major engineering office in NYC.

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

rjmccall posted:

For what it's worth, I don't know what stereotypes people have about Apple or Silicon Valley, but the Xcode team at least is a standard professional environment where everyone has an office (admittedly a shared one) and people work normal hours and there is a general culture of collaboration and respect and nobody gets to be a rockstar who doesn't have to follow the rules.

Yeah, it's really nice, and it's been like this for a long time too.

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

rjmccall posted:

For what it's worth, I don't know what stereotypes people have about Apple or Silicon Valley, but the Xcode team at least is a standard professional environment where everyone has an office (admittedly a shared one) and people work normal hours and there is a general culture of collaboration and respect and nobody gets to be a rockstar who doesn't have to follow the rules.

The most recent article I saw (can't remember where) seemed to say there was a large degree of competitiveness and you should probably be a marathon runner or something to fit in because most people have some sort of competitive hobby outside of work. They reported that long hours weren't the norm, but high levels of productivity were expected.

That's just my recollection though.

Adbot
ADBOT LOVES YOU

Kallikrates
Jul 7, 2002
Pro Lurker

Doctor w-rw-rw- posted:

Facebook's got a major engineering office in NYC.

I know, I got rejected from the prescreen interview about 2 years ago. I got tripped up on the base cases of a tree traversal algorithm problem on a whiteboard. Today I don't think I would apply, or accept.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply