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
pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Also maybe try not pointlessly copying the array? Just take the array returned by -componentsSeparatedByString:

Adbot
ADBOT LOVES YOU

Doc Block
Apr 15, 2003
Fun Shoe

NoDamage posted:

Um, Core Data or plists seem like overkill to me. You just need something that can read your text files one line at a time, instead of reading the entire string at once and then splitting it. Like this.

Somehow I missed the part where there was only one number per line. I just sort of glossed over it and thought he had multiple numbers per line and that's why he was splitting it up.

Either way, reading from a plist isn't really overkill; it only takes one line to load it, and if you have so much data that it would take a long time or too much memory then you should be using something like Core Data anyway.

pokeyman posted:

Also maybe try not pointlessly copying the array? Just take the array returned by -componentsSeparatedByString:

This is good advice too ;)

lord funk, how big are these files?

Hughlander
May 11, 2005

duck pond posted:

I'm beginning to get a little burned out on Xcode, has anyone had any luck working with iOS projects in Sublime Text 2 or JetBrains AppCode?

Both actually. I've used Sublime Text almost exclusively for the last few months while working on Android/iOS code bases, and this past weekend set up AppCode in preparation for some hardcore refactoring that Xcode just can't handle. Do you have any specific questions or just seeing if it's possible?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Hughlander posted:

Both actually. I've used Sublime Text almost exclusively for the last few months while working on Android/iOS code bases, and this past weekend set up AppCode in preparation for some hardcore refactoring that Xcode just can't handle. Do you have any specific questions or just seeing if it's possible?

I have a question. How do you install apps on the device and fire up lldb when using Sublime? Are you stuck with Xcode for that, or is there some command line/plugin niceness?

Ditto AppCode actually, how much can you really get done without leaving?

Plorkyeran
Mar 22, 2007

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

pokeyman posted:

Also JSON. No idea if it's faster than an XML plist but it's less bulky.

NSJSONSerialization is much faster than reading an XML plist and similar in speed to reading a binary plist.

NoDamage
Dec 2, 2000

Doc Block posted:

Either way, reading from a plist isn't really overkill; it only takes one line to load it, and if you have so much data that it would take a long time or too much memory then you should be using something like Core Data anyway.
I don't have anything against plists, but the overkill bit is because he would have to convert his files into plists, and repeat the conversion whenever his files need to be updated. Seems more sensible to just read the text files more efficiently to begin with and skip the conversion step entirely.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

NoDamage posted:

I don't have anything against plists, but the overkill bit is because he would have to convert his files into plists, and repeat the conversion whenever his files need to be updated. Seems more sensible to just read the text files more efficiently to begin with and skip the conversion step entirely.

Xcode can help you out a bit here with the Run Script build phase. You can add files to the "Input Files" and "Output Files" sections, and the script only gets run when any input files are newer than any output files. But I'm with you in general, if you can find a pleasing format for both scenarios that's ideal.

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

kitten smoothie posted:

Yeah, I am really wondering what the hell goes on in a review that it can be "In Review" for half a day and they don't even open the app once.

It is already well known that you can sneak stuff past them if you get lucky but you'll get caught eventually. That's enough to keep most of the Android-type nonsense out of the store.

The automated tests check for immediate crashing, private API usage, and some other tricks. Sometimes the review is in-depth, checking every feature. Often it is a quick review (especially for established apps doing small updates), and sometimes when the queue is really full they'll let some updates by without a test. I think they also take the apps popularity into account but I don't know for certain.

If you get caught breaking the rules on purpose be prepared to have your app pulled and dev account suspended. I wouldn't recommend attempting it.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I think the release notes can be taken into consideration by the reviewers too. Which can be used both for good and bad. I remember accusations of apps sneaking major new features into their "update for iPhone 5 screen size".

lord funk
Feb 16, 2004

Doc Block posted:

lord funk, how big are these files?

Tiny - 10k at most. It's always exactly 1024 floats. And in the end, I'm skipping NSArrays entirely and loading them into a C array for drawing speed. I made a quick NSObject that loads them in -init, and I instantiate one of them when the app loads. It adds about 380ms to the app loading time, but that's okay.

Here's the function I used to load them. I'm actually surprised that the actual reading file >> _cWaveformArrays[i][j]; takes as long as it does.

code:
#include <iostream>
#include <string>
#include <fstream>

@implementation TCWaveformPreBuild

- (id)init {
    if (self = [super init]) {
        
        Names *_sharedNames = [Names sharedNames];
        for (int i=0; i<_sharedNames.lfoWaveformNames.count; i++) {
            
            NSString *title = _sharedNames.lfoWaveformNames[(int)fminf(i, _sharedNames.lfoWaveformNames.count - 1)];
            NSString *filePath = [[NSBundle mainBundle] pathForResource:title ofType:@"txt"];
            std::ifstream file([filePath UTF8String]);
            if(file.is_open()) {
                for(int j = 0; j < 1024; ++j) {
                    file >> _cWaveformArrays[i][j];
                }
            }
        }
    }
    return self;
}

@end
Finally, if you're curious, all this was for drawing these waveforms. There was a half-second delay when loading the popover with its 76 waveforms. It's gone now.

lord funk
Feb 16, 2004

pokeyman posted:

Also maybe try not pointlessly copying the array?
This is good advice, and there was no reason the data had to be read each time a popover was created.

Toady
Jan 12, 2009

pokeyman posted:

I think the release notes can be taken into consideration by the reviewers too. Which can be used both for good and bad. I remember accusations of apps sneaking major new features into their "update for iPhone 5 screen size".

I like to write more detailed explanations of the release notes in that text box for notes intended for the reviewer. "Performance improvements" might become "Result of so-and-so calculation now cached in /tmp/<UUID>".

Doc Block
Apr 15, 2003
Fun Shoe

lord funk posted:

Tiny - 10k at most. It's always exactly 1024 floats. And in the end, I'm skipping NSArrays entirely and loading them into a C array for drawing speed. I made a quick NSObject that loads them in -init, and I instantiate one of them when the app loads. It adds about 380ms to the app loading time, but that's okay.

Here's the function I used to load them. I'm actually surprised that the actual reading file >> _cWaveformArrays[i][j]; takes as long as it does.

code:
#include <iostream>
#include <string>
#include <fstream>

@implementation TCWaveformPreBuild

- (id)init {
    if (self = [super init]) {
        
        Names *_sharedNames = [Names sharedNames];
        for (int i=0; i<_sharedNames.lfoWaveformNames.count; i++) {
            
            NSString *title = _sharedNames.lfoWaveformNames[(int)fminf(i, _sharedNames.lfoWaveformNames.count - 1)];
            NSString *filePath = [[NSBundle mainBundle] pathForResource:title ofType:@"txt"];
            std::ifstream file([filePath UTF8String]);
            if(file.is_open()) {
                for(int j = 0; j < 1024; ++j) {
                    file >> _cWaveformArrays[i][j];
                }
            }
        }
    }
    return self;
}

@end
Finally, if you're curious, all this was for drawing these waveforms. There was a half-second delay when loading the popover with its 76 waveforms. It's gone now.



With so few floats, this would actually be a good candidate for stuffing them all into a .h/.m. 1024 floats would only add 4k. And you wouldn't have any load times at all.

Doctor w-rw-rw-
Jun 24, 2008
Yeah, if it's just 1024 floats, just have a constant C array that gets compiled into the app binary. Or take the preprocessing step after all, declare the header with an extern qualifier, then define it in your generated .m file. Maybe add an assert that it's exactly 1024 values long and trigger a build error somehow if it's not, for extra certainty.

That or literally just stuff them into a binary file and load that memory directly into the array.

Hughlander
May 11, 2005

pokeyman posted:

I have a question. How do you install apps on the device and fire up lldb when using Sublime? Are you stuck with Xcode for that, or is there some command line/plugin niceness?

Ditto AppCode actually, how much can you really get done without leaving?

Afraid not as much as you'd like to hear. With Sublime text the primary development was for Android and the iOS portion was mostly building/running unittests on simulator to ensure that nothing broke. Appcode will push to the device and run lldb on 10.8 (I assume 10.9 but I'm holding off on upgrading just now.) but I can't recall if I actually ran it on a device or not yet.

Basically we have a set of really robust scripts that will handle builds and running things on simulators that we use for Jenkins all the time and I just triggered them on the dev box.

I'll poke around a bit this morning running things on the device through AppCode and lldb and get back to you.

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.
If I use iCloud key-value storage in my app (everything setup, entitlements, etc) but don't listen for the NSUbiquitousKeyValueStoreDidChangeExternallyNotification, would I ever get those notifications at a later time? I'm trying to figure out how games allow you to disable/enable iCloud from within the app itself - what exactly are they disabling? There's no "initialization" of iCloud in the code per se, you just start listening for notifications. If I disable the notification observer, then decide to enable it later, will I get any notifications that occurred during that time where it was disabled? Or should I keep listening for the notification and just put that changed data aside until the user wants to sync again?

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

HiriseSoftware posted:

If I use iCloud key-value storage in my app (everything setup, entitlements, etc) but don't listen for the NSUbiquitousKeyValueStoreDidChangeExternallyNotification, would I ever get those notifications at a later time? I'm trying to figure out how games allow you to disable/enable iCloud from within the app itself - what exactly are they disabling? There's no "initialization" of iCloud in the code per se, you just start listening for notifications. If I disable the notification observer, then decide to enable it later, will I get any notifications that occurred during that time where it was disabled? Or should I keep listening for the notification and just put that changed data aside until the user wants to sync again?

If you don't listen for the notifications they are gone. Use it or lose it.

With a game, I'd imagine you read the current value on startup (if present) and check whether your local value is higher* and take the max. As you advance in the game, do the same, checking and storing the max. If iCloud is disabled, just use the local value. When it is enabled, just do the same max check again. People don't want to sit around and wait for sync so in theory you might miss a bit but when they finish the next level you might see some further levels unlocked since the changes were pulled while playing.

*Where higher is furthest level, most points, date last played, or whatever makes sense for your app.

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.

Ender.uNF posted:

If you don't listen for the notifications they are gone. Use it or lose it.

With a game, I'd imagine you read the current value on startup (if present) and check whether your local value is higher* and take the max. As you advance in the game, do the same, checking and storing the max. If iCloud is disabled, just use the local value. When it is enabled, just do the same max check again. People don't want to sit around and wait for sync so in theory you might miss a bit but when they finish the next level you might see some further levels unlocked since the changes were pulled while playing.

*Where higher is furthest level, most points, date last played, or whatever makes sense for your app.

It sounds like I should do the last question I posed then - keep listening for notifications but put the incoming data into a staging area to do that "max check" with later. If I disabled syncing in-app and completed level 1 locally, but still received a "level 3 complete" from a notification (because I had syncing enabled on another device and completed level 3 there), I should keep the "level 3 complete" somewhere else and only check it against the local data when I re-enabled syncing.

Should I still bother with URLForUbiquityContainerIdentifier (and whatever the similar thing is for 6.0) if I'm just using key-value storage, or is that more a document sync thing? Apple examples don't seem to care about it with regard to key-value.

admiraldennis
Jul 22, 2003

I am the stone that builder refused
I am the visual
The inspiration
That made lady sing the blues
Does Apple approve apps to the store that are only useful for a private audience?

I'm working on an app-as-an-art-project that will only be usable during the course of a single evening's event, and I'd love for some way to distribute it to attendees that doesn't require TestFlight or acquiring everybody's UDIDs beforehand.

Technically, reading through the enumerated guidelines, I don't see this breaking any of the rules. Except maybe "or do not provide any lasting entertainment value may be rejected" but I could possibly work around that.

Anybody have any experience with / know of precedents around this sort of thing?

admiraldennis fucked around with this message at 07:26 on Nov 3, 2013

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!
I've been to conferences where they published an official app just for that one event. Sounds pretty close to what you're up to.

lord funk
Feb 16, 2004

Here's an odd one. I've been using CGRectGetMin / Mid / Max more frequently lately (probably because of the NYTimes Obj-C style guide). But I ran into an issue where they will return NaN for some views that have not yet appeared on screen, even if the frame property has been set. Switching to .frame.origin fixed the issue, but it doesn't explain anything.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

lord funk posted:

Here's an odd one. I've been using CGRectGetMin / Mid / Max more frequently lately (probably because of the NYTimes Obj-C style guide). But I ran into an issue where they will return NaN for some views that have not yet appeared on screen, even if the frame property has been set. Switching to .frame.origin fixed the issue, but it doesn't explain anything.

What kind of view? If it's a custom view, you're calling super in any overridden methods as appropriate and calling super's designated initializer?

No idea if it's relevant but the CGRect* functions will standardize their input rects before doing anything (which is why you should use them). Maybe see what CGRectStandardize returns?

lord funk
Feb 16, 2004

pokeyman posted:

What kind of view? If it's a custom view, you're calling super in any overridden methods as appropriate and calling super's designated initializer?

No idea if it's relevant but the CGRect* functions will standardize their input rects before doing anything (which is why you should use them). Maybe see what CGRectStandardize returns?

Didn't know about the standardizing thing. I'll check and see. The view is inside of a CollectionViewCell that is created but scrolled past the bottom of the screen. When you scroll into view it hits this error. The odd thing is it only happens on one of the 12 nearly identical cells (which believe me, I'm looking for that one little difference...)

Different question entirely: anyone done any voice recognition? I need keyword recognition for the numbers 0-127 and the word 'stop,' and that's it.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
Thank you jesus for this beta XCode. The simulator hang thing was really getting old.

lord funk
Feb 16, 2004

ultramiraculous posted:

Thank you jesus for this beta XCode. The simulator hang thing was really getting old.

Came here to post this. Hoping I won't have to reboot my iPad every 10 minutes now.

Jam2
Jan 15, 2008

With Energy For Mayhem
Came across an app called Knock today. It seems to use the Core Bluetooth API to let you unlock your Mac.

Are there any other interesting, new APIs in iOS 7?

Carthag Tuek
Oct 15, 2005

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



Jam2 posted:

Are there any other interesting, new APIs in iOS 7?

NSHipster had a rundown recently of a few of his faves: http://nshipster.com/ios7/

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Jam2 posted:

Are there any other interesting, new APIs in iOS 7?

It's daunting but sit down with the API diffs and the Foundation release notes. There's a ton of stuff that gets added and has little to no documentation.

Blakles
Mar 10, 2008

I have lived a great deal among grown-ups. I have seen them intimately, close at hand. And that hasnt much improved my opinion of them.
Does anyone know how to have an image appear at the top of every view within a storyboard app (including appearing ABOVE the navigation bar when present)?

I am working on an app that uses storyboards and starts in a tab bar controller that connects to several view controllers and navigation controllers. Is there a way I can add a view with an image to the window and then resize everything inside the tab bar controller including the navigation bar?

I've googled this, but what few results come up are really old don't seem to work for me.

shodanjr_gr
Nov 20, 2007
Any of you guys managed to create a QGLWidget with a 4.1 context in Mavericks yet? It seems to be ignoring the QGLformat and just initializing a 2.1 legacy context instead for me...this is with QT 4.8.

Glimm
Jul 27, 2005

Time is only gonna pass you by

Blakles posted:

Does anyone know how to have an image appear at the top of every view within a storyboard app (including appearing ABOVE the navigation bar when present)?

I am working on an app that uses storyboards and starts in a tab bar controller that connects to several view controllers and navigation controllers. Is there a way I can add a view with an image to the window and then resize everything inside the tab bar controller including the navigation bar?

I've googled this, but what few results come up are really old don't seem to work for me.

Have your initial VC be one with your image and then a container view with the tab controller embedded?

LP0 ON FIRE
Jan 25, 2006

beep boop
I want to edit a file in my Xcode project, but I come to find that it's completely indestructible!

I type something into it and this comes up:



and when I click unlock..




•I tried opening a text editor and pasting it into a new file and saving it over the old one, but it doesn't let me save over the old one.

•I checked the permissions in Terminal and nothing appears unusual: -rw-r--r--@

•I also cannot seem to delete the drat file!

Glimm
Jul 27, 2005

Time is only gonna pass you by

LP0 ON FIRE posted:

I want to edit a file in my Xcode project, but I come to find that it's completely indestructible!

I type something into it and this comes up:



and when I click unlock..




•I tried opening a text editor and pasting it into a new file and saving it over the old one, but it doesn't let me save over the old one.

•I checked the permissions in Terminal and nothing appears unusual: -rw-r--r--@

•I also cannot seem to delete the drat file!

Have you tried chowning it to your user, chmod 777 maybe?

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

I'd also try verify/repair your disk, maybe something happened to the file in the filesystem.

haveblue
Aug 15, 2005



Toilet Rascal
Is the file under version control?

LP0 ON FIRE
Jan 25, 2006

beep boop

Glimm posted:

Have you tried chowning it to your user, chmod 777 maybe?

Yes, just tried this.


carry on then posted:

I'd also try verify/repair your disk, maybe something happened to the file in the filesystem.

Repaired permissions. No changes.


haveblue posted:

Is the file under version control?

Nope.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
Have you tried unlocking the file outside of XCode, either by"Get Info"-ing the file or using the terminal? Doing a "sudo chflags nouchg FILE" might be what you need. Locking problems usually aren't fixed with chmod because it's an OSX/BSD flag.

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

LP0 ON FIRE posted:


Repaired permissions. No changes.


Not permissions. "Repair Disk" on the right.

Lyesh
Apr 9, 2003

LP0 ON FIRE posted:

I want to edit a file in my Xcode project, but I come to find that it's completely indestructible!

I type something into it and this comes up:



and when I click unlock..




•I tried opening a text editor and pasting it into a new file and saving it over the old one, but it doesn't let me save over the old one.

•I checked the permissions in Terminal and nothing appears unusual: -rw-r--r--@

•I also cannot seem to delete the drat file!

This happened to me the other day. The problem is probably that you have an ACL on the file in the extended attributes (that @). Go into terminal and run xattr -c -r the directory the file is in since there's probably other files that are like that in the directory.

Adbot
ADBOT LOVES YOU

lord funk
Feb 16, 2004

I just realized something stupendously dumb. I had a tableview popover where the cell set its highlight color to my app's window tintColor property. But the first time you popped it open, it would be a light gray. The second time it would be the proper color.

What I just realized is that popover dimming of the screen also changes tinted items' colors to gray. So the dimming must actually change the tintColor property to accomplish this, and the popover would catch this in the act and mess up the color setting.

This is why when I started storing the tint color in my app delegate, the problem went away.

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