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
Doctor w-rw-rw-
Jun 24, 2008

pokeyman posted:

There’s a bunch of third-party libraries that will do that for you, but nothing built-in.
Not at a computer to check, but does queryItems + NSURLComponents.percentEncodedQuery work for form-urlencoded POST bodies?

NSURLQueryItem has been around since iOS 8.

Adbot
ADBOT LOVES YOU

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Doctor w-rw-rw- posted:

Not at a computer to check, but does queryItems + NSURLComponents.percentEncodedQuery work for form-urlencoded POST bodies?

NSURLQueryItem has been around since iOS 8.

Unfortunately not; application/x-www-form-urlencoded wants spaces turned into + but percentEncodedQuery turns them into %20. And I didn't want to just blindly replace all %20 with + because I didn't think very hard about whether that's a safe thing to do and this seemed easier somehow.

TheReverend
Jun 21, 2005

Hey goons,

I need to be able override the system position that's reported by CoreLocation.

I know this isn't possible by default, but I know of at least two apps on the appstore that do this. They are both by GPS hardware manufacturers with MFI licenses so I'm not entirely sure what the process is.

I have an MFI enabled account, but we are new to this and don't know where to start.

Any tips?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
You can go into one of these apps, press a button, then switch to Maps.app and it shows you at not your actual current location? How is that useful in a production app?

Anyway it probably won’t help, but with Xcode you can pick a simulated location when you build and run. Maybe the mechanism you seek is related to that? Or documented nearby?

lord funk
Feb 16, 2004

iOS 11 beta has made my iPad stop appearing in iTunes, so I can't restore. System Preferences completely locks up every time I open it. God I hate beta season, which is now 6 months out of every year.

edit: I'm not actually mad at the beta; it's a beta. I'm just super annoyed at Apple's new trend of Alert Popup For Everything! and 6-way Group Hug Authentication! and it's put me in a foul mood.

lord funk fucked around with this message at 19:13 on Aug 27, 2017

TheReverend
Jun 21, 2005

pokeyman posted:

You can go into one of these apps, press a button, then switch to Maps.app and it shows you at not your actual current location? How is that useful in a production app?

Anyway it probably won’t help, but with Xcode you can pick a simulated location when you build and run. Maybe the mechanism you seek is related to that? Or documented nearby?

No it's more like you're using a tool that lets you use location services to map out public right of ways. However the iPhone accuracy isn't as good as it could be (though perfectly acceptable for most applications) and you want to be able to get a highly accurate position from a dedicated GPS/GNSS receiver.

That's the plan, at least.

Dog on Fire
Oct 2, 2004

How are other developers' experiences with 3rd party Lightning cables? I need to buy a handful for the company.

I guess this one seems to be okay: https://www.amazon.com/AmazonBasics-Apple-Certified-Lightning-Cable/dp/B010S9M3L6/

They are also going to be used for keeping the devices plugged into the wall, so I really don't want to risk getting some crappy ones. I'd gladly just get the original Apple ones, but the AmazonBasics ones are three times cheaper so I'm at least interested in trying them out.

lord funk
Feb 16, 2004

Dog on Fire posted:

I'd gladly just get the original Apple ones, but the AmazonBasics ones are three times cheaper so I'm at least interested in trying them out.

drat well if you do please give us a trip report. I need to replenish around here too.

TheReverend
Jun 21, 2005

Amazon Basics are all fine and good. I prefer them to OEM for some reason.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Using an Amazon Basics right this second. Doesn't seem to fit quite as snugly into my phone and sometimes I get it just right so my phone constantly alternates between charging and depleting every second. Otherwise seems fine.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
On second thought I don't think the cable is my problem. Works great.

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

TheReverend posted:

Hey goons,

I need to be able override the system position that's reported by CoreLocation.

I know this isn't possible by default, but I know of at least two apps on the appstore that do this. They are both by GPS hardware manufacturers with MFI licenses so I'm not entirely sure what the process is.

I have an MFI enabled account, but we are new to this and don't know where to start.

Any tips?

I would reach out to your MFi rep or open an MFi tech support incident. I don't think any of this is public API.

Dog on Fire
Oct 2, 2004

Thanks, all, for the info on Amazon Basics. I sent the request to order a batch to the necessary people and one of them had had experience with a company named Aukey so it was in turn recommended that we'd order theirs. Some nylon braided things. And yeah, they did seem to be sturdier. Will try to remember to write how they are once they get here.

Doh004
Apr 22, 2007

Mmmmm Donuts...

Dog on Fire posted:

Some nylon braided things. And yeah, they did seem to be sturdier. Will try to remember to write how they are once they get here.

If they're anything like these: https://www.amazon.com/gp/product/B06WW31B11/ref=oh_aui_search_detailpage?ie=UTF8&psc=1 don't do it.

I ordered some just for home (needed the long distance for charging my phone at night) and two of them kinked at the connection and died within the first week. This wasn't from hard use or anything.

Dog on Fire
Oct 2, 2004

Doh004 posted:

If they're anything like these: https://www.amazon.com/gp/product/B06WW31B11/ref=oh_aui_search_detailpage?ie=UTF8&psc=1 don't do it.

I ordered some just for home (needed the long distance for charging my phone at night) and two of them kinked at the connection and died within the first week. This wasn't from hard use or anything.

Nope, they are these: https://www.amazon.co.uk/Anker-Lightning-Connector-Certified-Ultra-High-Space-Gray/dp/B00UBLOJJG/

Also, just noticed that they are Anker, not Aukey, apparently.

Doh004
Apr 22, 2007

Mmmmm Donuts...

Dog on Fire posted:

Nope, they are these: https://www.amazon.co.uk/Anker-Lightning-Connector-Certified-Ultra-High-Space-Gray/dp/B00UBLOJJG/

Also, just noticed that they are Anker, not Aukey, apparently.

Ah okay, good! Anker makes great stuff.

Froist
Jun 6, 2004

Dog on Fire posted:

Nope, they are these: https://www.amazon.co.uk/Anker-Lightning-Connector-Certified-Ultra-High-Space-Gray/dp/B00UBLOJJG/

Also, just noticed that they are Anker, not Aukey, apparently.

Aukey make reasonably good gear in my experience too, though I've never tried either company's lightning cables.

SaTaMaS
Apr 18, 2003
I'm working on an AR app using Vuforia/OpenGL. Is it possible to move between ViewControllers to swap out UI/Trackers while leaving the video background unchanged? The video image is rendered to a texture and drawn in OpenGL.

edit: Actually I think I found something that might do it: https://www.cleveroad.com/blog/playing-blurred-video-in-background-with-gpuimage

SaTaMaS fucked around with this message at 02:41 on Sep 8, 2017

Lestion
May 4, 2015

Anyone in here playing with Visual Studio for Mac and .NET Standard 2.0? Currently Xamarin.iOS is crushing my dreams of sharing code across platforms.

Doh004
Apr 22, 2007

Mmmmm Donuts...
iPhone X looks great. Definitely curious about the curved edges as well as the UIStatusBar up top having to deal with the new middle sensor bar thing!

LP0 ON FIRE
Jan 25, 2006

beep boop
AppleScript/Automator thingy.. I got a script to navigate to a list of URLs, but I want it to perform some JavaScript clicking. (It says subscribe button, but it's really the edit button when you're logged in)

It navigates to the URLs, but it doesn't seem to click, so I tried adding a console.log, and I see nothing in the inspector.

code:
on run {input, parameters}
	read (item 1 of input)
	set ps to paragraphs of the result
	set tot to count ps
	tell application "Safari"
		reopen
		activate
	end tell
	repeat with i from 1 to tot
		set p to item i of ps
		if p is not "" then
			try
				tell application "Safari"
					tell front window
						set r to make new tab with properties {URL:p}
						set current tab to r
						delay 1
						do JavaScript "console.log('test this log')"
						do JavaScript "document.getElementsById('subscribe-button').click()"
						if i = tot then exit repeat
						repeat
							delay 1
							get URL of r
						end repeat
					end tell
				end tell
			end try
		end if
	end repeat
end run
I also tried increasing the delay above the JavaScript all the way up to 17, but the JS still doesn't seem to be running.

brap
Aug 23, 2004

Grimey Drawer

Lestion posted:

Anyone in here playing with Visual Studio for Mac and .NET Standard 2.0? Currently Xamarin.iOS is crushing my dreams of sharing code across platforms.

Sounds like your problems are probably more build system than IDE but I encourage you to try Rider EAP 2017.2. I found VS for Mac to be kind of a dumpster fire.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
What are y'all using for logging? Do you like what you're using?

Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do
We use CocoaLumberjack at work. It's serviceable, but we've run into a host of problems with it (some of which are more likely caused by Cocoapods and people being over-specific about what versions of libraries things need). It feels like Swift support is half-baked, though, which is a drat shame. And its documentation mentions that some features exist (tags, for instance) but doesn't actually provide any actual documentation or explanation.

Your mileage may vary.

GenJoe
Sep 15, 2010


Rehabilitated?


That's just a bullshit word.
If you use the Apple-provided os_log, it dumps your logs and all other system logs to a unified place, and it'll stream those logs to Console.app if you're connected to the device (the old ASL system does a similar thing if you're pre-iOS 10 I think).

Support isn't super great in Swift though, and if you have a strong need to automatically collect customer logs by uploading their log files or whatever then it might not be the best choice, because the user has to initiate a sysdiagnose to get their logs to you. It's a good option if you need good logs from QA reports, though, because sysdiagnoses capture much more information than your app has access to.

Dirk Pitt
Sep 14, 2007

haha yes, this feels good

Toilet Rascal
Hey guys I wanted to say the new simulators and new Xcode are very good and nice. Please keep making tools for us!

Dog on Fire
Oct 2, 2004

Apple has released some new videos on supporting the new crazy screen of iPhone X: https://developer.apple.com/videos/fall2017/

Does anyone know of any resources on iPhone X that web developers can use? I know minimally about web development, but I'd like to know what they have to keep in mind regarding iPhone X. I'm talking about setting the background color so that this doesn't happen, etc: https://twitter.com/thomasfuchs/status/907764896829452288

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I saw this getting passed around, not sure how helpful it is: https://github.com/w3c/csswg-drafts/issues/1693

Doc Block
Apr 15, 2003
Fun Shoe
Not strictly related to iOS development, but since iOS 11 isn’t public yet: anybody else encounter an issue where the screen slowly gets more and more washed out over the span of a few minutes?

At first I thought it was just a weird Tweetbot bug (really noticeable in dark mode), but it seems to persist after closing Tweetbot, so the home screen icons & background also start to appear washed out.

Doesn’t seem be the screen brightness adjusting, since it happens while sitting in the same place with the same lighting condistions. And the screen itself isn’t getting brighter, just the dark colors get lighter.

Almost like some kind of tone mapping gone awry...

This is on iPhone 7 running the iOS 11 GM seed.

Doc Block
Apr 15, 2003
Fun Shoe
Screenshots don’t show it. And this didn’t happen on the same device running iOS 10 as of Monday.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
Suddenly I understand why all of my logic to manipulate UINavigationBar sizing broke in iOS 11. At least we have a decent lead time before the Xs ship.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
I noticed some kind of .. weird item when presenting a UISearchController in the iPhone X simulator.

https://giant.gfycat.com/ImmaculatePlushCockatiel.webm

So I checked it out in slow motion mode.

https://giant.gfycat.com/UnfortunateAbsoluteDogwoodclubgall.webm


I... uhhhhh... what?


edit: The face is the new emoji keyboard icon on iPhone X. I'm not entirely sure why it falls from the sky, but it only happens when the simulator is set to hardware keyboard attached. Interesting.

ManicJason fucked around with this message at 05:16 on Sep 15, 2017

Dog on Fire
Oct 2, 2004

pokeyman posted:

I saw this getting passed around, not sure how helpful it is: https://github.com/w3c/csswg-drafts/issues/1693

Alright, thanks, I think that's very helpful. I don't really know if the safe area stuff has made it to anywhere in the HTML world and I certainly don't have time at the moment to find out, but I'll pass this info along to our web guys. Then even if they can't use this stuff yet, they will have seen the context of it and they'll recognize it in the future.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
The version of iOS running in the Xcode GM Simulator is slightly behind what will ship on iPhone X devices so there are a few bugs and differences; it is close enough to start working on support for it though.

Per Apple policy I can't comment on future release plans but you can probably guess what will happen.

Moogs
Jan 25, 2004

Proceeds the Weedian... Nazareth
I moved to the Xcode 9 GM and am now having an issue with my Falldown watch app. This code (which probably sucks) worked in Xcode 8, but now I can't get it to recognize crown movements.

code:

class InterfaceController: WKInterfaceController, WKCrownDelegate {
    
    private var game: GameScene!

    @IBOutlet var skInterface: WKInterfaceSKScene!
    
    override func awake(withContext context: Any?) {
        super.awake(withContext: context)
        
        crownSequencer.delegate = self
        crownSequencer.focus()
        
        if let scene = GameScene(fileNamed: "GameScene") {
            
            // Set the scale mode to scale to fit the window
            scene.scaleMode = .aspectFill
            
            game = scene
            
            // Present the scene
            self.skInterface.presentScene(scene)
            
            crownSequencer.delegate = self
            crownSequencer.focus()
            
        }
    }

    func crownDidRotate(_ crownSequencer: WKCrownSequencer?, rotationalDelta: Double) {
        
        if rotationalDelta > 0 {
            print("crown moved")
            game.moveBallRight()
            
        } else if rotationalDelta < 0 {
            print("crown moved")
            game.moveBallLeft()
        }
    }
}

Doc Block
Apr 15, 2003
Fun Shoe
Ugh. So Apple killed the ability to modify a CGImage's data and have that reflected the next time it's drawn in High Sierra.

On Sierra (and earlier) you could manually allocate a pixel buffer, create a custom data provider that just handed over the pointer to this data, and use that to create a CGImage. Then, if you modified the pixel data you could just redraw the CGImage and it would reflect your changes. Nice for plotting individual pixels etc.

Now this doesn't work. Instead CGImageCreate... seems to create its own private copy of the provided pixel data :\

Doctor w-rw-rw-
Jun 24, 2008
How are you drawing it? It's not unreasonable for them to cache backing stores and ask you to not rely on potentially undefined behavior of the buffer being bound by the graphics API. If it has to re-copy the buffer or something, that's a potential perf win.

Not saying it's not a bug or even if it's not, that it can't be supported, but some more details would help.

Doc Block
Apr 15, 2003
Fun Shoe
I'm just drawing it in a view's -drawRect: method, something like
code:
alterPixelBufferData();
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
//set some options, like no interpolation
CGContextDrawImage(context, self.bounds, myImage);
The image is created with a custom direct data provider. My understanding is that direct data providers are supposed to let you do stuff like this, by just having your provider hand CoreGraphics a pointer to your pixel data. On Sierra and earlier, it requested the byte pointer every time the image was drawn, but in High Sierra it seems to request it once and then make a private copy of the data.

edit: under Sierra, this test project worked, drawing a little blip that moved across the window. It doesn't work under High Sierra.

edit 2: what I wound up doing is creating a CGBitmapContext, which lets you supply a pointer to a pixel buffer. The idea is that you can use it as a destination for Core Graphics drawing commands and then save the result or whatever, but it also works in reverse. The only down side is that you have to create a CGImage from it and then draw that into your view's CGContext every frame.

edit 3: the point of all this was to avoid unnecessarily copying the pixel data multiple times per frame.

Doc Block fucked around with this message at 20:52 on Sep 23, 2017

Doctor w-rw-rw-
Jun 24, 2008
Not at a computer so I can't check, but setting a CALayer's backing store directly (.contents = ) might be something to try.

Adbot
ADBOT LOVES YOU

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

Doc Block posted:

I'm just drawing it in a view's -drawRect: method, something like
code:
alterPixelBufferData();
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
//set some options, like no interpolation
CGContextDrawImage(context, self.bounds, myImage);
The image is created with a custom direct data provider. My understanding is that direct data providers are supposed to let you do stuff like this, by just having your provider hand CoreGraphics a pointer to your pixel data. On Sierra and earlier, it requested the byte pointer every time the image was drawn, but in High Sierra it seems to request it once and then make a private copy of the data.

edit: under Sierra, this test project worked, drawing a little blip that moved across the window. It doesn't work under High Sierra.

edit 2: what I wound up doing is creating a CGBitmapContext, which lets you supply a pointer to a pixel buffer. The idea is that you can use it as a destination for Core Graphics drawing commands and then save the result or whatever, but it also works in reverse. The only down side is that you have to create a CGImage from it and then draw that into your view's CGContext every frame.

edit 3: the point of all this was to avoid unnecessarily copying the pixel data multiple times per frame.


Create an IOSurface. Lock it whenever you need to modify the contents from the CPU, unlock when finished. Set the surface as the contents property of a CALayer. No extra copying will be done; the surface is composited directly into the framebuffer.

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