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
Doh004
Apr 22, 2007

Mmmmm Donuts...
Should I just make some sort of publicly accessible endpoint on my end that determines if we can hit our API? If a request fails, see if we can hit that instead? Because this sucks.

Adbot
ADBOT LOVES YOU

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Someone wrote an XCode plugin to integrate our newly-released Infer stuff, which I thought might be of interest to this thread: https://github.com/markohlebar/XInfer

Doh004 posted:

Should I just make some sort of publicly accessible endpoint on my end that determines if we can hit our API? If a request fails, see if we can hit that instead? Because this sucks.

If you do this (which does suck, and to which people do resort) make sure you validate the response. Captive portals will often happily give you back an HTTP 200 when serving up their interception page.

wwb
Aug 17, 2004

Doh004 posted:

Should I just make some sort of publicly accessible endpoint on my end that determines if we can hit our API? If a request fails, see if we can hit that instead? Because this sucks.

We typically do this with most APIs. To make it useful we use it as the auth tester / version indicator so you get those features too.

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

Subjunctive posted:

Someone wrote an XCode plugin to integrate our newly-released Infer stuff, which I thought might be of interest to this thread: https://github.com/markohlebar/XInfer


If you do this (which does suck, and to which people do resort) make sure you validate the response. Captive portals will often happily give you back an HTTP 200 when serving up their interception page.

If you have a better solution please do share.

Reachability just tells you that DNS was able to resolve the name and one or more of the returned IPs matches a route for an available network interface. It does not prove the service is actually reachable at all.

If we have errors then we do try to download truth.txt from our HTTPS server thing and validate the body is correct. It's the only way to be sure. The bullshit captive portals pull to lie is amazingly awful (because their unique snowflake login page doesn't work in the normal minibrowser apparently). I hate those assholes with a burning passion.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Doing a simple https fetch of a static file is best I think, yeah.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
Or you can do certificate/SSL pinning (do this anyway plz) and your https connections should spew errors if the certs from the connection aren't yours.

edit: For example, in what you've described, rear end in a top hat wifi networks/an attacker could serve up truth.txt on their own and keep loving you up. Using just https without pinning proves very little about what server you're hitting.

ultramiraculous fucked around with this message at 23:58 on Jun 22, 2015

Doctor w-rw-rw-
Jun 24, 2008

ultramiraculous posted:

Or you can do certificate/SSL pinning (do this anyway plz) and your https connections should spew errors if the certs from the connection aren't yours.

edit: For example, in what you've described, rear end in a top hat wifi networks/an attacker could serve up truth.txt on their own and keep loving you up. Using just https without pinning proves very little about what server you're hitting.

Assuming your server SSL is properly configured, don't the new iOS 9.0 SSL policies take care of this?

Doc Block
Apr 15, 2003
Fun Shoe
Even if it does, it's gonna be a while before there are few enough pre-iOS 9 users that you can just drop them and rely solely on the iOS 9 SSL stuff.

Data Graham
Dec 28, 2009

📈📊🍪😋



Hey, iOS custom keyboard extension question.

Anybody know whether there is some reason why CBCentralManager would not work within an extension? I'm trying to init a scan for peripherals and it's coming back with ble.CM.state == 2.

Is there something I need to enable?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

lord funk posted:

Yay app release day!

http://www.bitshapesoftware.com/instruments/tc-performer/

TC-Performer. Free synth, universal, patch pack IAP.

I was just messing around with this and not only is it awesome, but my wife is super excited to show it to and try it out with some of her kids at work who need / use music therapy (she deals with a wide range of autism spectrum kids). Also a good reminder for me to pick up TC-11, because I don't want to get any work done this summer!

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Doctor w-rw-rw- posted:

Assuming your server SSL is properly configured, don't the new iOS 9.0 SSL policies take care of this?

It makes pinning less necessary because it requires TLS 1.2, which won't fall back to HTTP, among other things. AFAIK pinning is still a good idea in that case (and seriously not that hard). TLS still assumed that the known Certificate Authorities in the iOS install are universally trustworthy. Pinning lets you tighten up that filter down to public keys you trust.

Gonna stop saying things because I'm worried pr0zac is gonna show up and yell at me...

Data Graham
Dec 28, 2009

📈📊🍪😋



Data Graham posted:

Hey, iOS custom keyboard extension question.

Anybody know whether there is some reason why CBCentralManager would not work within an extension? I'm trying to init a scan for peripherals and it's coming back with ble.CM.state == 2.

Is there something I need to enable?

Following up—I read this https://developer.apple.com/library...014214-CH16-SW3

And I enabled RequestsOpenAccess, but I guess Bluetooth/CBCentralManager isn't included in this?

Am I just wasting my time?

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Pinning is not without risk; it's not a checklist item that everyone show take care of as a matter of course. Pinning people to the wrong site suuuuuuuucks.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Data Graham posted:

Following up—I read this https://developer.apple.com/library...014214-CH16-SW3

And I enabled RequestsOpenAccess, but I guess Bluetooth/CBCentralManager isn't included in this?

Am I just wasting my time?

It's quite possible. While that document is very unhelpful for trying to make it through App Review, it seems to exhaustively list the possible capabilities of a custom keyboard.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

pokeyman posted:

While that document is very unhelpful for trying to make it through App Review

:glomp:

Doc Block
Apr 15, 2003
Fun Shoe
The part of App Transport Security where you can enable it or disable it for certain servers (or turn it off entirely) just by adding keys to Info.plist seems ripe for exploitation.

Doctor w-rw-rw-
Jun 24, 2008

Doc Block posted:

The part of App Transport Security where you can enable it or disable it for certain servers (or turn it off entirely) just by adding keys to Info.plist seems ripe for exploitation.

Not necessarily; Info.plist is signed.

https://developer.apple.com/library...0005929-CH3-SW3

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Subjunctive posted:

Pinning is not without risk; it's not a checklist item that everyone show take care of as a matter of course. Pinning people to the wrong site suuuuuuuucks.

Yeah, Iiiiii guess you're right. It's easy to set up, but you have to be really thoughtful about what you pin to or, yeah, I can imagine cases where you ship an app that is/will eventually be broken.

Doc Block
Apr 15, 2003
Fun Shoe

Sure, but my understanding is that code signing is trivially easy to get around on jailbroken devices.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Doc Block posted:

Sure, but my understanding is that code signing is trivially easy to get around on jailbroken devices.

Sure, but the point of ATS is to protect the user from other attackers. If they want to subvert that protection for themselves, :shrug:

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Doc Block posted:

Sure, but my understanding is that code signing is trivially easy to get around on jailbroken devices.

If you're at the point where the device is jailbroken, changing plists is probably more of a pain than just monkey-patching out the ATS checks entirely.

lord funk
Feb 16, 2004

Lumpy posted:

I was just messing around with this and not only is it awesome, but my wife is super excited to show it to and try it out with some of her kids at work who need / use music therapy (she deals with a wide range of autism spectrum kids).

Awesome! If she ever takes any pictures please send them to me. :)

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

React Native playground app was accepted: https://rnplay.org/

You can make and share snippets like a jsfiddle or Swift playground, and then click to launch them in the harness app to see it in action. It is a killer experience.

Doctor w-rw-rw-
Jun 24, 2008
Alternatively: Exponent http://exp.host/

lord funk
Feb 16, 2004

Three apps, and a total of about 10 releases and now one of them gets rejected for something it's had all along. Roll the dice! It's app review time! Big money no whammies!

shodanjr_gr
Nov 20, 2007
I got a contrived Cocoa (OS X) question. Assume that I have a single column NSTableView that's populated via a data source (not through binding via a controller). The data source returns strings and the string value is bound to each cell through "objectValue". Is there a way I can properly configure the Sort attributes for the NSTableColumn in such a way so that I can just pass them to sortedArrayUsingDescriptors? There's obviously the hack-y workaround of wrapping the array contents into dictionaries and then setting the sort key value to the appropriate dictionary key but I keep thinking there must be a more straightforward way.

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?

shodanjr_gr posted:

I got a contrived Cocoa (OS X) question. Assume that I have a single column NSTableView that's populated via a data source (not through binding via a controller). The data source returns strings and the string value is bound to each cell through "objectValue". Is there a way I can properly configure the Sort attributes for the NSTableColumn in such a way so that I can just pass them to sortedArrayUsingDescriptors? There's obviously the hack-y workaround of wrapping the array contents into dictionaries and then setting the sort key value to the appropriate dictionary key but I keep thinking there must be a more straightforward way.

Just use a key of "self" in your sort descriptor.

Also eventually you'll want to use real objects for this stuff so why not do so now? (Not just a dictionary…)

shodanjr_gr
Nov 20, 2007

eschaton posted:

Just use a key of "self" in your sort descriptor.

Could have sworn i tried that last night and for some reason it wasn't working. Seems to work fine today :haw:. Thanks :).

quote:

Also eventually you'll want to use real objects for this stuff so why not do so now? (Not just a dictionary…)

Yeah that's what I'm doing but I was trying to figure out the contrived edge case.

Kobayashi
Aug 13, 2004

by Nyc_Tattoo
I'm super new to Xcode. Is there a way to conditionally run some script during the compile phase? For instance, when I'm compiling and running on the simulator, I don't need to do anything. But when running on an actual device, I need to run some command line scripts. I don't even know what to search for on Google for something like this.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
You want to add a Run Script build phase to your target, and then you want to just hit build once and look at the log in the log navigator to see what environment variables are available for you. Hopefully you'll find one that easily allows you to check if you're building for simulator or device. You'll probably find some other helpful ones here too. Then you can build out your script from there.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
If it's helpful, I'm almost certain there's an ENV flag I've used for this. You should be able to check for IS_IOS_SIMULATOR at the top of your build script before you do anything.

Kobayashi
Aug 13, 2004

by Nyc_Tattoo

pokeyman posted:

You want to add a Run Script build phase to your target, and then you want to just hit build once and look at the log in the log navigator to see what environment variables are available for you. Hopefully you'll find one that easily allows you to check if you're building for simulator or device. You'll probably find some other helpful ones here too. Then you can build out your script from there.

ultramiraculous posted:

If it's helpful, I'm almost certain there's an ENV flag I've used for this. You should be able to check for IS_IOS_SIMULATOR at the top of your build script before you do anything.

Thanks! Got it working with the following script:

code:
if [[ "${SDKROOT}" != *Simulator* ]]
then
    ...
    exit 0
fi

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
I find it highly amusing (in a sympathetic way) that the official Swift blog crashes mobile Safari.

Data Graham
Dec 28, 2009

📈📊🍪😋



Apropos of nothing, when that Apple Music artist-payments-during-the-first-3-months backpedal thing happened, CNN had a headline up of "Apple backs down from Swift".

Talk about a double-take

stuffed crust punk
Oct 8, 2004

by LITERALLY AN ADMIN

Data Graham posted:

Apropos of nothing, when that Apple Music artist-payments-during-the-first-3-months backpedal thing happened, CNN had a headline up of "Apple backs down from Swift".

Talk about a double-take

Glad someone else noticed this

mrbass21
Feb 1, 2009
I'm playing with an iOS 9 device and Xcode-Beta and am running into some trouble with my SSL connections. The server does make a TLS 1.2 connection (verified with latest OpenSSL binaries on Windows), but the certificate is self signed.

I'm using NSURLConnection and the delegate to authenticate against the protection space in didReceiveAuthenticationChallenge with

[[challenge sender] useCredential:[NSURLCredential credentialForTrust:[protectionSpace serverTrust]] forAuthenticationChallenge:challenge];

But I'm getting back the error:

Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo=0x165ce0c0 {NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorCodeKey=-9802, NSErrorFailingURLStringKey=https://SERVER_URL/, _kCFStreamErrorDomainKey=3, NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x165b7c90>, NSUnderlyingError=0x165c01e0 "An SSL error has occurred and a secure connection to the server cannot be made.", NSErrorFailingURLKey=SERVER_URL/}

Anyone have any ideas?


Edit: I'm dumb and didn't realize that the traffic was being interpreted differently since we aren't using the standard 443 port. So now I can see the SSL handshake traffic. With the global exclusion in the plist, I have a successful TLS 1.2 session. Without the global exclusion it gets to the Server Key Exchange step and the connection is terminated (The next step of client key exchange never happens). I think it's because the certificate isn't trusted, even though I'm telling NSURLConnection to trust it.

Edit 2: Maybe what's happening is that the certificate is signed and references a CA that has an IPv4 address instead of a domain name?

mrbass21 fucked around with this message at 21:18 on Jul 1, 2015

Doctor w-rw-rw-
Jun 24, 2008
Have you tried whitelisting the domain in your Info.plist? Google for NSAppTransportSecurity.

EDIT: nm

TheReverend
Jun 21, 2005

I'm trying to programmatically add cells to a UITableView that has static cells via a storyboard.

Is there any way I can do this?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

TheReverend posted:

I'm trying to programmatically add cells to a UITableView that has static cells via a storyboard.

Is there any way I can do this?

Override the relevant UITableViewDataSource methods in your view controller subclass?

edit: Also I'd like to humbly suggest that you're mixing two things that probably won't taste great together. But I'm guessing it can be done if you try hard enough.

pokeyman fucked around with this message at 17:54 on Jul 1, 2015

Adbot
ADBOT LOVES YOU

TheReverend
Jun 21, 2005

Yeah that's what I feared :(

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