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
lord funk
Feb 16, 2004

Is there a reason for using the user's Documents folder? Do you want the user to have access to the files through iTunes File Sharing? or can they add their own? If not I think just keeping the files in the application bundle should be fine.

Anyone noticed UISliders acting poorly in iOS 8? If you tap on a slider that is at 100%:

---------0

it moves the handle to the left:

-------0--

and keeps doing so until the handle is in the middle.

Adbot
ADBOT LOVES YOU

HaB
Jan 5, 2001

What are the odds?

lord funk posted:

Is there a reason for using the user's Documents folder? Do you want the user to have access to the files through iTunes File Sharing? or can they add their own? If not I think just keeping the files in the application bundle should be fine.


Oh. I guess I'm confused. The user should NOT have access to these files at all. I guess I was thinking there was some sort of App Data folder which only the app itself had access to.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

HaB posted:

Oh. I guess I'm confused. The user should NOT have access to these files at all. I guess I was thinking there was some sort of App Data folder which only the app itself had access to.

That would be the "Library/Application Support" folder. Read more here.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
I had one stupid, nagging issue with auto layout still. I have a UILabel that I want rotated 90 degrees. I had all kinds of issues where auto layout would make the label do very odd things (go off screen, rotate back around, disappear entirely) when animating constraint changes to the parent view. I was chasing my tail by trying to compensate for all of these during the layout subview process. I finally got it mostly working, but it involved checking the major iOS version and changing the timing in seemingly arbitrary ways depending on the result. That is horrible and couldn't stick.

In a moment of desperation, I removed the UILabel from my .xib and replaced it with a UIView placeholder in the correct, rotated dimensions. Manually putting the UILabel in there still doesn't work right all the time.

Instead, now every time the label text is changed, I create a temporary UILabel, render it into a rotated CG context, yoink the CG context into a image, make a UIImageView, and smack that UIImageView into the center of my placeholder view.

That was... fun. At least all of my weird layout problems regarding that label behaving differently across iOS versions now seem resolved.


Remember, kids, auto layout does not play nicely with transforms.

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

Notifications can only use sounds in your app bundle so I hope you are prepared to ship all IAPs from the beginning, which it appears you are.

There is no point in copying the files around, that's just a waste of space. Give them unique names and include them in your project. You can play them from there as well as use them for notifications. When you ask for bundle path to resource you're just getting a path into the filesystem... bundles are just directories.

dc3k
Feb 18, 2003

what.
Who was it in this thread that was working for Facebook on iOS? I got an email out of the blue from them about a position and although I'm not actively looking for work, I'm a bit curious to say the least.

Doctor w-rw-rw-
Jun 24, 2008

status posted:

Who was it in this thread that was working for Facebook on iOS? I got an email out of the blue from them about a position and although I'm not actively looking for work, I'm a bit curious to say the least.

Is it me you're looking for? I'm ex-Facebook, sorta. Facebook has the best iOS developers outside of Apple, and the company is structured such that you can cast a wide net when you need the expertise (i.e. stuff that Stack Overflow wouldn't cover, ranging from intermediate to pretty darn advanced).

It also enables you to be a Silicon Valley man-child, if you want, whose every need is taken care of*. This frees up you and your high salary to compete with your coworkers to see who can buy the best drone with the highest-quality camera and gimbal apparatus, which you will invariably fly around campus and post on your timeline (or on Instagram. Bonus points: Hyperlapse) for your Facebook friends to see, and your non-Facebook friends to be jealous of – you hope, because that drone didn't come cheap.

* I jest, but it's really quite great.

EDIT: You might also want to talk to Subjunctive, who's a true-blue Facebooker, or ultramiraculous, who recently joined

EDIT 2: Also unrelated, but I missed this a couple of pages ago:

Nipplebox posted:

The documented convention is that, when passed nil, -isEqual: returns NO and -isEqualTo*: throws an exception, but this isn't consistent across all of Cocoa.
One of those triggers a EXC_BAD_ACCESS. Not exactly expected behavior!

Doctor w-rw-rw- fucked around with this message at 06:37 on Sep 25, 2014

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Doctor w-rw-rw- posted:

It also enables you to be a Silicon Valley man-child

Hey!!!!!!! Cool it with that poo poo :argh:

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



What is wrong here:

pre:
In file included from /Volumes/raid/Development/IndexTranscriber/opencv-3.0.0-alpha/platforms/osx/opencv2.framework/Headers/core.hpp:1232:
/Volumes/raid/Development/IndexTranscriber/opencv-3.0.0-alpha/platforms/osx/opencv2.framework/Headers/core/utility.hpp:461:10: error: expected member name or ';' after declaration specifiers
    bool check() const;
    ~~~~ ^
I have no idea about anything c++

Kallikrates
Jul 7, 2002
Pro Lurker
So post initial iOS8 release it's time to clean up some cruft.

Is there an easy way to share config settings, or plist settings between two targets in the same project? Basically our use case right now is that an extension needs to know certain bundle information about the containing app and vice versa, we also have different values for these based on the configured environment (debug/adhoc/stage..).

The solution so far has been custom config fields in each target but ideally we would just load some common file in both targets, having to make sure a string is the correct value in multiple places is error prone. I'm guessing a project wide UserSetting is the answer?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Kallikrates posted:

So post initial iOS8 release it's time to clean up some cruft.

Is there an easy way to share config settings, or plist settings between two targets in the same project? Basically our use case right now is that an extension needs to know certain bundle information about the containing app and vice versa, we also have different values for these based on the configured environment (debug/adhoc/stage..).

The solution so far has been custom config fields in each target but ideally we would just load some common file in both targets, having to make sure a string is the correct value in multiple places is error prone. I'm guessing a project wide UserSetting is the answer?

I think you want .xcconfig files. You can extract common build settings into a single xcconfig then base each target's configuration from that xcconfig. I forget the details for configuring Xcode but that should give you something to look up.

xcconfig files can include one another and interpolate other build settings, you can get a lot done with them.

Kallikrates
Jul 7, 2002
Pro Lurker
.xcconfig looks like it might be exactly what I want.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

status posted:

Who was it in this thread that was working for Facebook on iOS? I got an email out of the blue from them about a position and although I'm not actively looking for work, I'm a bit curious to say the least.

I used to manage iOS at FB (I do other stuff at FB now). PM me, I'm happy to chat.

Doh004
Apr 22, 2007

Mmmmm Donuts...
Have people started using Swift in their preexisting projects? I'm curious as to what the general sentiment is with using the language and bridging over the Obj-C (without having to rewrite it all) but then having two languages in the same project.

master of the sea
Apr 16, 2003

*skweeeeeee*
So I just tried to enroll in the iOS developer program, but when I click the "Buy now" button I get redirected to the apple store updating page. No money has been withdrawn from my account, anyone seen this before?

lord funk
Feb 16, 2004

Doh004 posted:

Have people started using Swift in their preexisting projects? I'm curious as to what the general sentiment is with using the language and bridging over the Obj-C (without having to rewrite it all) but then having two languages in the same project.

I haven't. Although I bet it isn't that painful, I can't bother spending any energy dealing with bridging the two languages between files. Like I could make one new view area with Swift, but if it needed to communicate / pull information from existing Obj-C areas there would be those moments where I'd have to stop and think. And god knows stopping and thinking has never been on my agenda.

Kallikrates
Jul 7, 2002
Pro Lurker

Doh004 posted:

Have people started using Swift in their preexisting projects? I'm curious as to what the general sentiment is with using the language and bridging over the Obj-C (without having to rewrite it all) but then having two languages in the same project.

Our iPhone app has swift in production right now if anyone has questions. I wrote our extension all in it and some of the signaling code back and forth to the main app.

Getting unit tests to work with a mishmash of swift and objc was complicated and I had to fall back to a really hacky way to do it. Seems apple wants your swift to be compiled into a module you can use from obj-c, but I just use it raw from my obj-c and vice versa and this caused issues with generated bridging headers.

lord funk
Feb 16, 2004

We're trying to get Xcode working in a computer lab with non-admin users. We have a script that elevates permissions for Xcode projects / simulator to run, but it does not work for playgrounds. Does anyone know where I might look for where playgrounds need their elevated permissions?

dc3k
Feb 18, 2003

what.
So who wants to tell me how Hangouts and Messenger are managing their keyboards?

They're using interactive dismiss so you can drag down to hide the keyboard, but the text entry view moves with it. We were able to mostly replicate this by adding an empty inputAccessoryView to our textfield, and observing its superview's frame changes so we could match the movement of the textfield with the keyboard. This doesn't work on iOS8. The observation of the superview does absolutely nothing, so when the keyboard comes up, our text entry view stays put, and when we drag to dismiss, it doesn't move either. I'm able to find the keyboard view through other means, but KVO still isn't giving me anything.

Also, how the gently caress are they doing interactive setting of first responder? When the keyboard is hidden, I can pan up from the textfield and the keyboard slides up as I do. I have no idea how they did this without some sort of private fuckery.

It's hurting my brain.

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

status posted:

They're using interactive dismiss so you can drag down to hide the keyboard, but the text entry view moves with it. We were able to mostly replicate this by adding an empty inputAccessoryView to our textfield, and observing its superview's frame changes so we could match the movement of the textfield with the keyboard. This doesn't work on iOS8. The observation of the superview does absolutely nothing, so when the keyboard comes up, our text entry view stays put, and when we drag to dismiss, it doesn't move either. I'm able to find the keyboard view through other means, but KVO still isn't giving me anything.

We don't use drag down to hide, but we do follow the keyboard's animation when resizing our messaging window. It's a little complicated:

Objective-C code:
static
UIViewAnimationOptions UIViewAnimationOptionsFromCurve(UIViewAnimationCurve curve) {
    switch (curve) {
        case UIViewAnimationCurveEaseInOut:
            return UIViewAnimationOptionCurveEaseInOut;
        case UIViewAnimationCurveEaseIn:
            return UIViewAnimationOptionCurveEaseIn;
        case UIViewAnimationCurveEaseOut:
            return UIViewAnimationOptionCurveEaseOut;
        case UIViewAnimationCurveLinear:
            return UIViewAnimationOptionCurveLinear;
        default:
            return 0;
    }
}

- (void)keyboardFrameWillChange:(NSNotification *)notification
{
    [notification.userInfo[UIKeyboardFrameEndUserInfoKey] getValue:&keyboardFrame];
    BOOL keyboardIsVisible = CGRectIntersectsRect([UIScreen mainScreen].bounds, keyboardFrame);
    
    UIViewAnimationCurve animationCurve;
    NSTimeInterval animationDuration;
    [notification.userInfo[UIKeyboardAnimationCurveUserInfoKey] getValue:&animationCurve];
    [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] getValue:&animationDuration];

    [UIView animateWithDuration:animationDuration
                          delay:0
                        options:(UIViewAnimationOptionsFromCurve(animationCurve) | UIViewAnimationOptionBeginFromCurrentState)
                     animations:^{
                         if (keyboardIsVisible) {
                             self.fullHeader.hidden = YES;
                             self.compactHeader.hidden = NO;
                             self.header = self.compactHeader;
                         }
                         else {
                             self.fullHeader.hidden = NO;
                             self.compactHeader.hidden = YES;
                             self.header = self.fullHeader;
                         }

                         [self updateHeader];

                         [self dynamicLayout];
                     }
                     completion:nil];
}
-keyboardFrameWillChange is a handler for the UIKeyboardWillChangeFrameNotification notification. keyboardFrame is a CGRect ivar that's initialized to CGRectNull; -dynamicLayout moves the subviews around according to keyboardFrame

dc3k
Feb 18, 2003

what.
Yeah we were doing something similar before to have it move in time with the automatic animation via the notifications, but now that we're doing interactive dismiss, it's not working out. iOS8 broke it all and made me sad :(

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?

lord funk posted:

We're trying to get Xcode working in a computer lab with non-admin users. We have a script that elevates permissions for Xcode projects / simulator to run, but it does not work for playgrounds. Does anyone know where I might look for where playgrounds need their elevated permissions?

Are you running DevToolsSecurity -enable and then making the users who need to run Xcode members of the local _developer group? Playgrounds and the Swift REPL both use LLDB extensively, and you can't debug a process without being a member of _developer.

lord funk
Feb 16, 2004

eschaton posted:

Are you running DevToolsSecurity -enable and then making the users who need to run Xcode members of the local _developer group? Playgrounds and the Swift REPL both use LLDB extensively, and you can't debug a process without being a member of _developer.

Yeah, and this does get them through Xcode project building. But Playgrounds still complain. I'll try and get the exact wording next time I'm in the lab.

brap
Aug 23, 2004

Grimey Drawer
iOS question: I have a table view being populated based on the results of an HTTP GET. I'm using dataTaskWithURL(NSURL, completionHandler) and in my completion handler I'm refreshing data on the table view.

code:
class BusStopsTableViewController : UITableViewController {
    var stops: [BusStop]?
    override func viewDidLoad() {
        var session = NSURLSession.sharedSession()
        session.dataTaskWithURL(url
            completionHandler: {
                (data, response, error) -> Void in
                if (error != nil) {
                    println(error.description)
                }
                
                var jsonError: NSError?
                var stopJson = NSJSONSerialization.JSONObjectWithData(data,
                    options: NSJSONReadingOptions.AllowFragments,
                    error: &jsonError)?.objectForKey("stops") as NSArray as [[String : AnyObject]]
                
                if (jsonError != nil) {
                    println(jsonError?.description)
                }
                
                self.stops = stopJson.map() { dict -> BusStop in BusStop(json: dict) }
                self.tableView.reloadData()
                self.view.setNeedsDisplay()
        }).resume()
    }
    
    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }
    
    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        if let value = stops {
            return value.count
        }
        return 0
    }
    
    override func tableView(tableView: UITableView,
        cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        var cell = tableView.dequeueReusableCellWithIdentifier("TableViewCell") as? UITableViewCell
        
        if (cell == nil) {
            cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "TableViewCell")
        }
        
        if let value = stops {
            cell?.textLabel?.text = value[indexPath.row].Name
        }
        return cell!
    }
I have tried calling a few different methods that seem to be intended to refresh the view, but I can't get the new data to actually show until I swipe on the screen. Any ideas for what to try?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Make your view calls on the main thread.

Doc Block
Apr 15, 2003
Fun Shoe
Yeah, use dispatch_async() to call reloadData on the main queue. You don't need the setNeedsDisplay call.

brap
Aug 23, 2004

Grimey Drawer
Hell yeah! Thanks guys. Finally feeling like I'm getting a little momentum in iOS development.

Hughlander
May 11, 2005

Has anyone heard or seen anything about Xcode 6 failing with incremental builds? Maybe of large C++ projects. Someone at work is convinced that it's unusable if you edit a header 'bad things happen.' And other teams have been on it since day of GM seed without seeing anything odd.

Kallikrates
Jul 7, 2002
Pro Lurker

Hughlander posted:

Has anyone heard or seen anything about Xcode 6 failing with incremental builds? Maybe of large C++ projects. Someone at work is convinced that it's unusable if you edit a header 'bad things happen.' And other teams have been on it since day of GM seed without seeing anything odd.

I have noticed weird behavior with projects that include built dependencies, and swift. Doing fuxcode, and clean builds way more often now.

Kallikrates
Jul 7, 2002
Pro Lurker

fleshweasel posted:

iOS question: I have a table view being populated based on the results of an HTTP GET. I'm using dataTaskWithURL(NSURL, completionHandler) and in my completion handler I'm refreshing data on the table view.

I have tried calling a few different methods that seem to be intended to refresh the view, but I can't get the new data to actually show until I swipe on the screen. Any ideas for what to try?

Unrelated to your question but double check you aren't creating a retain cycle in that completion handler.

Also prefer tableView:cellForRowAtIndexPath: over dequeueReusableCellWithIdentifier: the former will remove the need to nil check since it will always return a cell

Fate Accomplice
Nov 30, 2006




Kallikrates posted:

clean builds way more often now.

I am doing clean builds nearly every time I change more than one file at a time.

lord funk
Feb 16, 2004

iOS 8 is just dragging me down. Every nook and cranny of my app is twisted and mangled from the iOS 7 version.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Kallikrates posted:

Also prefer tableView:cellForRowAtIndexPath: over dequeueReusableCellWithIdentifier: the former will remove the need to nil check since it will always return a cell

The former is a UITableViewDataSource method, the latter is a UITableView method.

Doh004
Apr 22, 2007

Mmmmm Donuts...
I was under the impression that dequeueReusableCellWithIdentifier:forIndexPath: no longer returned nil, and the checking for nil was just old, leftover practices?

Doc Block
Apr 15, 2003
Fun Shoe
If that's true then how do you specify which built-in style of cell to use? Or are people really building their own cell types for every single table view?

Doctor w-rw-rw-
Jun 24, 2008

Doh004 posted:

I was under the impression that dequeueReusableCellWithIdentifier:forIndexPath: no longer returned nil, and the checking for nil was just old, leftover practices?
Yep. Isn't that pretty standard by now?

Doc Block posted:

If that's true then how do you specify which built-in style of cell to use? Or are people really building their own cell types for every single table view?

Sure, why not? It makes it easier to bind cells logically (in terms of their functionality) to the view controller (presumably where the meat of the behavioral code lives), instead of bloating said view controller with a lot of gesture recognizers or accesses to random owned views to modify state. (Or in other words, encapsulation)

Doctor w-rw-rw- fucked around with this message at 19:43 on Sep 27, 2014

brap
Aug 23, 2004

Grimey Drawer
What does inheriting from UITableViewDataSource empower you to do? Do you still have to implement UITableView to get anything done?

Doc Block
Apr 15, 2003
Fun Shoe

Doctor w-rw-rw- posted:

Yep. Isn't that pretty standard by now?


Sure, why not? It makes it easier to bind cells logically (in terms of their functionality) to the view controller (presumably where the meat of the behavioral code lives), instead of bloating said view controller with a lot of gesture recognizers or accesses to random owned views to modify state. (Or in other words, encapsulation)

My thing is, what if you don't need any of that stuff? Just a table view of text and maybe some images that does something when you tap on a row? Why would I waste time recreating one of the standard table view cell styles for that?

Doc Block
Apr 15, 2003
Fun Shoe

fleshweasel posted:

What does inheriting from UITableViewDataSource empower you to do? Do you still have to implement UITableView to get anything done?

UITableViewDataSource is a protocol that your table view's data source has to conform to, not a class you inherit from.

Adbot
ADBOT LOVES YOU

Doh004
Apr 22, 2007

Mmmmm Donuts...

Doc Block posted:

My thing is, what if you don't need any of that stuff? Just a table view of text and maybe some images that does something when you tap on a row? Why would I waste time recreating one of the standard table view cell styles for that?

You don't have to if you don't want to! But it's neither hard not time consuming to subclass a UITableViewCell (hell, even put it within the same file as the VC :ssh:) and put whatever subviews you want in there.

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