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

pokeyman posted:

If/when the app goes through App Store review, consider leaving a quick note explaining why the assets are in the Documents folder (e.g. so users can customize sounds). I've been rejected before simply because I lacked an explanation.

Long distance high five, but it looks like I'll be putting all my preset documents in the user documents folder for easy editing / saving / deleting. Good to know that I should leave a note to the reviewers.

Adbot
ADBOT LOVES YOU

Mikey-San
Nov 3, 2005

I'm Edith Head!

lord funk posted:

Long distance high five, but it looks like I'll be putting all my preset documents in the user documents folder for easy editing / saving / deleting. Good to know that I should leave a note to the reviewers.

What makes it necessary to copy all the files during launch?

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
Apple bought Testflight...finally.

Pseudo-God
Mar 13, 2006

I just love oranges!
Can apps in the App Store get content updates from the developer's servers? I understand that usually you have to go through Apple for in app purchases and the like, but if I want to offer user-created content to people, such as custom maps for my game, can I do that without going through Apple? I intend to offer everything for free, so Apple cannot object to me cutting out their profits, since there will be no profits anyway.

haveblue
Aug 15, 2005



Toilet Rascal

Pseudo-God posted:

Can apps in the App Store get content updates from the developer's servers? I understand that usually you have to go through Apple for in app purchases and the like, but if I want to offer user-created content to people, such as custom maps for my game, can I do that without going through Apple? I intend to offer everything for free, so Apple cannot object to me cutting out their profits, since there will be no profits anyway.

Apple doesn't host anything beyond the base app package. Even if you did want to offer IAP, all Apple will do is confirm that the purchase occurred- if it relies on external files you'd still have to host them yourself.

Pseudo-God
Mar 13, 2006

I just love oranges!

haveblue posted:

Apple doesn't host anything beyond the base app package. Even if you did want to offer IAP, all Apple will do is confirm that the purchase occurred- if it relies on external files you'd still have to host them yourself.
What I want to do is make a second app, a map maker, that could allow users to create their own content and publish it to the first app. Can Apple get in the way of this? My understanding is that they are not cool with stuff like this, but I would like to get your experiences on this.

lord funk
Feb 16, 2004

Mikey-San posted:

What makes it necessary to copy all the files during launch?

Just the first time it's launched. How else are they supposed to get there?

My app is a synth with patch files the user can edit and save. It comes with a bunch of preset patches, but I'm allowing the user to save and delete them just like the custom patches they make. I figured there were two ways to do this:

1) Store the presets separately, mix together in code
2) Throw them in with the user's patches

A lot of time has gone into a system that scans the patches in the Documents folder for tags, so the user can search and organize their patches. What I was facing with (1) was having to keep track of whether or not the presets were replaced by user patches or deleted, when saving, renaming, ahhhhh. In the end, it's easier to treat them the way I designed them: just like user patches. Heck, if you want to clear out all the presets I made and just go hog wild with your own, you could just delete them all in iTunes File Sharing.

Good-Natured Filth
Jun 8, 2008

Do you think I've got the goods Bubblegum? Cuz I am INTO this stuff!


And not surprisingly, support for Android ends on March 21st. Not great for a cross-platform development team that just started to get comfortable with TestFlight...

Doh004
Apr 22, 2007

Mmmmm Donuts...

Good-Natured Filth posted:

And not surprisingly, support for Android ends on March 21st. Not great for a cross-platform development team that just started to get comfortable with TestFlight...

We've been using TestFlight for our iOS app for the past year. We just got support to start our Android app and I pushed hard to get them to use TestFlight.

Whoops :derp:

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.
Is NSHTTPCookieStorage not sandbox local? Goddamn it Apple, there's exactly what I need but it only exists on Snow Leopard for some unknowable reason.

kitten smoothie
Dec 29, 2001

Considering TestFlight 86'd their iOS SDK too, it looks like this is a case of them starting to wind down the service altogether, not just jettisoning Android. They're obviously just cutting Android off first because Apple.

That's a shame, because I really loved the SDK's crash reporting feature that linked stackdumps with the actual tester/device and automatically symbolicated them.

Doctor w-rw-rw-
Jun 24, 2008

kitten smoothie posted:

Considering TestFlight 86'd their iOS SDK too, it looks like this is a case of them starting to wind down the service altogether, not just jettisoning Android. They're obviously just cutting Android off first because Apple.

That's a shame, because I really loved the SDK's crash reporting feature that linked stackdumps with the actual tester/device and automatically symbolicated them.

On the other hand, it may signal Apple will finally implement a beta program in the coming months. I expect this to be announced at WWDC if so. Other services will probably pop up to fill TestFlight's role for whatever Apple shuts down.

ptier
Jul 2, 2007

Back off man, I'm a scientist.
Pillbug
So the internets found out why that security update for iOS 7 came out. Comes with free gloating about bracing your if statements.

tl:dr apple engineer didn't brace an if statement and fails through a bunch of SSL checks in the algorithm.

Also subtle bugs suck balls.

ptier fucked around with this message at 19:53 on Feb 22, 2014

Doc Block
Apr 15, 2003
Fun Shoe
Don't use goto statements either, if you can avoid it at all. I'd have just done a big "if...else if...else" thing with the failure code in an else block at the end, which would've had the added bonus that the compiler would've caught the bug, since there would've been (from the compiler's perspective) a wild "else if" statement.

Doctor w-rw-rw-
Jun 24, 2008
GOTOs are a perfectly valid C-level error handling mechanism when used to jump short distances to failure handling code or unwind errors. Jumping within a very small block is well-defined behavior and in line with the assembly that a less transparent if-else chain might generate (not that having an if-else chain is not a valid solution). The problem here was the lack of braces causing a logic error, not the GOTOs.

Doc Block
Apr 15, 2003
Fun Shoe
I know it wasn't the GOTOs causing the problem. I was just pointing out that using a string of if-else statements would've made the code fail to compile instead of have a subtle bug.

Hughlander
May 11, 2005

Doc Block posted:

Don't use goto statements either, if you can avoid it at all. I'd have just done a big "if...else if...else" thing with the failure code in an else block at the end, which would've had the added bonus that the compiler would've caught the bug, since there would've been (from the compiler's perspective) a wild "else if" statement.

Compiler did catch the bug. Warning: Unreachable code.

Which would be a process failure that the warning was ignored in shipped code.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
Either that warning is off by default in Xcode or one of my coworkers did an odd thing. Ask me how I know!

kitten smoothie
Dec 29, 2001

Doctor w-rw-rw- posted:

On the other hand, it may signal Apple will finally implement a beta program in the coming months. I expect this to be announced at WWDC if so. Other services will probably pop up to fill TestFlight's role for whatever Apple shuts down.

We're switching to HockeyApp for Android and maybe iOS too, we're grandfathered into TestFlight as it were so maybe we can stick it out until Apple gets their own thing out there.

If Apple were to chew up TestFlight and spit out some other product, I wish they'd basically just take TestFlight but let you enroll named beta users using Apple IDs instead of device UUIDs, distribute betas to named users via the App Store, and keep everything else the same.

ptier
Jul 2, 2007

Back off man, I'm a scientist.
Pillbug


Hughlander posted:

Compiler did catch the bug. Warning: Unreachable code.

Which would be a process failure that the warning was ignored in shipped code.

In the article it was -Wunreachable-code did but it won't if -Wall is just used. Why that isn't part of Apple's process / why doesn't -Wall do -Wunreachable-code is another question.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
gcc can't add things to -Wall because that breaks all the terrible projects that have -Werror in their default CFLAGS and the users throw a shitstorm. Clang might be able to get away with it due to that there's a lot less legacy code being compiled with it.

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.

Plorkyeran posted:

gcc can't add things to -Wall because that breaks all the terrible projects that have -Werror in their default CFLAGS and the users throw a shitstorm. Clang might be able to get away with it due to that there's a lot less legacy code being compiled with it.

Why is having -Werror in your CFLAGS bad? If you are releasing code that triggers warnings when it is compiled, you should be drawn and quartered/thrown off a cliff/add -Wno-specific-warning to the specific file with the issue if it is unfixable.

ptier
Jul 2, 2007

Back off man, I'm a scientist.
Pillbug

Plorkyeran posted:

gcc can't add things to -Wall because that breaks all the terrible projects that have -Werror in their default CFLAGS and the users throw a shitstorm. Clang might be able to get away with it due to that there's a lot less legacy code being compiled with it.

Ahh ok, that makes complete sense. Still shouldn't stop Apple from testing against unreachable code. But a technical reason why not just dumping it into -Wall and calling it a day.

Plorkyeran
Mar 22, 2007

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

Sinestro posted:

Why is having -Werror in your CFLAGS bad? If you are releasing code that triggers warnings when it is compiled, you should be drawn and quartered/thrown off a cliff/add -Wno-specific-warning to the specific file with the issue if it is unfixable.

Your compiler may not produce warnings in the exact same situations as the compiler used by someone who just wants to use your software. Enabling -Werror by default is going out of your way to make your software less portable.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Plorkyeran posted:

gcc can't add things to -Wall because that breaks all the terrible projects that have -Werror in their default CFLAGS and the users throw a shitstorm. Clang might be able to get away with it due to that there's a lot less legacy code being compiled with it.

The -Weverything is hip and relevant LLVM compiler flag to get all the warnings turned on.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
The design for these things is that you occasionally do test runs with -Weverything or whatever and then selectively add stuff that you think is useful to your actual builds. Setting -Weverything in a build that somebody else might reasonably do with a random compiler release is still rude.

We also regularly enable new warnings in the Xcode project templates but not in existing projects when we think something is best practice but maybe not worth foisting on everyone. Relatedly, it's a good idea to audit the set of newly available warnings whenever your project officially moves to a new Xcode.

HiriseSoftware
Dec 3, 2004

Two tips for the wise:
1. Buy an AK-97 assault rifle.
2. If there's someone hanging around your neighborhood you don't know, shoot him.
Not sure if this would help anybody but I discovered an OpenGL ES mipmap generation bug for A7 devices (5S, etc). Apparently using the standard OpenGL calls to generate mipmaps with non-square textures is causing problems. I was wondering why my particle engine was spitting out particles that looked much different between my 5S and my 4... it was only in GLES 2.0 that this was a problem - 1.1 was fine. At first I thought it was shader precision (because there's a change in "lowp" for A7) and I was hashing the data going into glTexImage2D between the devices just to make sure the data was the same. There were fleeting moments that the particles looked correct so I turned off mipmapping and everything went back to normal. I googled for this and the only thing I found was a thread on TouchArcade that said someone had to fix a bug in their game because A7 mipmapping generation for non-square textures wasn't working:

quote:

Issue resolved. Obscure change in A7 64bit OpenGL ES implementation meant that any non-square texture could not get mipmaps generated with the normal OpenGL ES calls. Performing my own reduction solved the issue.

Apple's documentation had nothing about this issue.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
Can someone familiar with XNU/Darwin confirm that the 32 bit kernel does not map kernel address space into user processes, so every ring 0 call requires flushing TLBs? And thus a 32 bit process has the entire address space available, as opposed to 2/3GB?

I always wondered how the hell the 32 bit kernel could host 64 bit user processes and that finally made it click for me. Since everything has to be remapped anyway, I guess it was no big deal to just remap all the pointers.

I know 64 bit Darwin does the standard thing Windows and Linux do: the kernel is mapped into the same region of every process' address space, so calling a kernel function doesn't require swapping page tables and data passed back and forth doesn't need to be mapped into separate address spaces (yes, yes I know).

Doctor w-rw-rw-
Jun 24, 2008

Ender.uNF posted:

Can someone familiar with XNU/Darwin confirm that the 32 bit kernel does not map kernel address space into user processes, so every ring 0 call requires flushing TLBs? And thus a 32 bit process has the entire address space available, as opposed to 2/3GB?

I always wondered how the hell the 32 bit kernel could host 64 bit user processes and that finally made it click for me. Since everything has to be remapped anyway, I guess it was no big deal to just remap all the pointers.

I know 64 bit Darwin does the standard thing Windows and Linux do: the kernel is mapped into the same region of every process' address space, so calling a kernel function doesn't require swapping page tables and data passed back and forth doesn't need to be mapped into separate address spaces (yes, yes I know).

Someone I know might know. I'll ask and post if I get a useful response.

I don't know what it means to make a ring 0 call, but if it's system call you're talking about, they're done through libsystem, which determines whether to make a BSD or a Mach syscall, and the behavior is different between 32 and 64-bit. I forget exactly how, but it should be in one of the earlier chapters of the Mac OS X and iOS Internals book.

Apple employee posted:

At least on iOS, the kernel gets a fixed 1GB mapping, leaving 3GB for user processes (though I believe it's limited to 2GB in practice for reasons I don't remember).

Some other guy posted:

iOS devices have a static kernel mapping, mapping RAM at VirtBase for 1GB. There can be no more than 1GB of RAM max on iOS device due to limitations in arm_vm_init. Higher memory above is kernel managed. The only /reason/ as for the static kernel mapping is for things such as internal pmap operations, for example, converting between physical -> virtual addresses for allocated TTEs. Linux does something like this too, to a certain extent.

The kernel pmap is globally mapped across all processes using TTBR1, TLB invalidation will not really do anything. Only the lower 0x40000000/0x80000000 (as of iOS 6) will be user-usable.

iOS on ARM64 is different, it's much like x86_64. Kernel range starts at 0xffffff80'00202000 or something like that and is slidden by the ASLR offset.

On i386, there's some differences of course. XNU always decides to run in IA32e mode, if supported, I believe. Use the '-legacy' boot-arg to force older behavior.

Kernel pmap can have user accessible pages too! See commpage at 0xFFFF1000 (iOS 6/7) or 0x40000000 (iOS 4)

Now, here's the thing, as of iOS 6, there's this feature that /unmaps/ the current user TTB on calls into FLEH handlers, you can see this in an iOS 6/7 style kernel or something. Copyin/copyout maps the user TTB back, i0n1c posted something about this too. It's just a matter of setting c2,c0,1 (TTBR0) and CONTEXTIDR (for the ASID mapping). No need to invalidate entire uTLB.

So.... it all comes down to a simple.... 'it does not do that'.

There you go.

Doctor w-rw-rw- fucked around with this message at 17:30 on Feb 25, 2014

FlashBangBob
Jul 5, 2007

BLAM! Internet Found!
I'm having a bit of trouble trying to use unwind segues. Here's what I've got

VC1 -> VC2 -> VC3

On VC3 there is a button that when pressed, should return to the view controller that called it. However, VC1 or VC2 could have called an instance of VC3. The button only allows me to pick one exit method to unwind to.

My code calls the
code:
[self performSegueWithIdentifier:sender:];
call, but since I can't create a second exit segue from the same button I can only unwind to one or the other right now. I'm wondering how I can approach this.

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

Doctor w-rw-rw- posted:

Someone I know might know. I'll ask and post if I get a useful response.

I don't know what it means to make a ring 0 call, but if it's system call you're talking about, they're done through libsystem, which determines whether to make a BSD or a Mach syscall, and the behavior is different between 32 and 64-bit. I forget exactly how, but it should be in one of the earlier chapters of the Mac OS X and iOS Internals book.

There you go.



quote:

At least on iOS, the kernel gets a fixed 1GB mapping, leaving 3GB for user processes (though I believe it's limited to 2GB in practice for reasons I don't remember).


Presumably because device IO is memory mapped so you lose some of the address space? It sounds like iOS at least uses the traditional scheme.

This all started when I wanted to figure out how the hell a 32 bit kernel could possibly support 64 bit user mode software since calls into 32 bit kernel land can't read any data via 64 bit pointers, since the transition kicks back down to 32 bit mode. The solution would be to map that 64 bit virtual address into the kernel's 32 bit address space so you have both a 32 and 64 bit pointer to the same physical memory. How that would work practically is unknown though.

In the process of reading about that, I saw multiple references to a Mac 32 bit process being able to allocate 4GB of memory and thought that couldn't possibly be correct because the address space is split between a permanent kernel mapping and the user mapping that gets swapped to the currently executing process. But it would appear that is not the case, and a 32 bit Mac app does have free reign over the whole address space. The penalty is that any transition to kernel mode has to ... You guessed it, map the same physical page to a new address space... Which happens to conveniently dovetail with the requirements for running 64 bit processes on a 32 bit kernel, something no other major OS ever attempted.


I could be completely wrong about all of this but I try to understand the kernel, MMU, etc at least to some basic level. I think it makes you a better developer, even if you treat it as a black box most of the time.

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

Ender.uNF posted:

This all started when I wanted to figure out how the hell a 32 bit kernel could possibly support 64 bit user mode software since calls into 32 bit kernel land can't read any data via 64 bit pointers, since the transition kicks back down to 32 bit mode. The solution would be to map that 64 bit virtual address into the kernel's 32 bit address space so you have both a 32 and 64 bit pointer to the same physical memory. How that would work practically is unknown though.

It's not impossible, just very tricky. IIRC what happens is that all traps to the kernel save the register state, switch to the kernel's separate address space and into 32-bit mode, and then continue on with kernel operations. All kernel-to-user memory access is mediated through the 'copyin' and 'copyout' kernel functions (man 9 copyin), which can remap the relevant user memory into a temporary mapping in the kernel so it can be copied into a kernel buffer. The 32-bit kernel still has to understand 64-bit userspace pointers, but it never actually dereferences them. It's not essential to have the kernel reserve some part of the user address space, it's just more efficient to do it that way so you don't have to do the remapping dance.

:eng101:

Doctor w-rw-rw-
Jun 24, 2008

Ender.uNF posted:

But it would appear that is not the case, and a 32 bit Mac app does have free reign over the whole address space.
FYI, free rein is when you have extra available rein (i.e. when riding a horse) which gives you flexibility. Free reign is a corruption of that phrase.

Ender.uNF posted:

I could be completely wrong about all of this but I try to understand the kernel, MMU, etc at least to some basic level. I think it makes you a better developer, even if you treat it as a black box most of the time.
http://www.amazon.com/Mac-OS-iOS-Internals-Apples/dp/1118057651
I think Chapter 8 might have some related info. If you want to understand OS X the book's probably a good place to start (still working through it myself).

lord funk
Feb 16, 2004

The correct usage is 'free rain,' as in, rain you do not pay for.

'He had free rain to water his garden.'

See?

lord funk
Feb 16, 2004

In other news I managed to submit a correctly provisioned archive in under ten builds today. A small victory.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
PSA: -[UIViewControllerAnimatedTransitioning animateTransition:] is a terrible time to ask a view controller for its -bottomLayoutGuide, at least when presenting modally. If that view controller hosts a scroll view, its contentSize is immediately set to {0, 0}.

Hooray!

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news
Yo, I'm writing a thing that loads a couple webpages, then when it hits a specific page, throws up a barcode scanner thing, gets a string, then returns to the WebView, inserts it using JS into the page, and lets the user interact with the webpage (basically setting up a web app with a barcode scan in there too).

I'm having issues doing the JS stuff, however. Whenever I'm calling it, I'm getting a "WTFCrash" error, due to trying to modify the webpage (the JS poo poo) while it's not in the foreground.

pre:
"2014-02-28 11:34:23.795 myApp[1665:1803] bool _WebTryThreadLock(bool), 0x155c6e00:
Tried to obtain the web lock from a thread other than the main thread or the web thread.
This may be a result of calling to UIKit from a secondary thread. Crashing now...
1   0x377145d3 WebThreadLock
I'm struggling to find the correct place to call my method that modifies the webpage using JS.

Currently, the BarcodeScannerViewController segues back to the (subclassed) WebViewController, and in the WebViewController's viewWillAppear method (or viewDidAppear - the behaviour is the same), I call the code to gently caress with the webpage using JS. However, it's not in the foreground, so I still get the WTFCrash.

Is there somewhere else in the view heirachy code that's better to call it from that will get called once my WebView returns to being in the foreground?

Or should I do some async method fuckery (hacky async sleep then modify original webviewcontroller lol)?
Or not use JS to fill my form and do it a different way?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
-viewWillAppear: and -viewDidAppear: should be called on the main thread. Seeing some code would be helpful here, if you can share. Or the backtrace.

You can check if you're on the main thread with +[NSThread isMainThread]. Maybe assert that in a couple places and see if it's what you expect.

haveblue
Aug 15, 2005



Toilet Rascal

Mr SuperAwesome posted:

Or should I do some async method fuckery (hacky async sleep then modify original webviewcontroller lol)?
Or not use JS to fill my form and do it a different way?

Can't you dispatch the part that submits JS to the webview onto the main thread?

Adbot
ADBOT LOVES YOU

lord funk
Feb 16, 2004

I am so sick of reusable views it's beyond description.

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