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
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.

Glimm posted:

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

That worked! Thanks for the simple solution.

Adbot
ADBOT LOVES YOU

Glimm
Jul 27, 2005

Time is only gonna pass you by

Blakles posted:

That worked! Thanks for the simple solution.

Glad it worked ☺. Simple solutions are my favorite!

NoDamage
Dec 2, 2000
Has anyone played around with OCR libraries on iOS? Last time I looked a few years ago they weren't very good, wondering if things have since improved.

Froist
Jun 6, 2004

NoDamage posted:

Has anyone played around with OCR libraries on iOS? Last time I looked a few years ago they weren't very good, wondering if things have since improved.

I tried Tesseract a few months ago and it was next to useless for my use case (reading UK driving licenses). Given the time constraints I couldn't find any other easy to use free solutions, and all the commercial versions required a payment up front before finding out whether they could actually read the license. I'd be interested if you have any success though!

NoDamage
Dec 2, 2000

Froist posted:

I tried Tesseract a few months ago and it was next to useless for my use case (reading UK driving licenses). Given the time constraints I couldn't find any other easy to use free solutions, and all the commercial versions required a payment up front before finding out whether they could actually read the license. I'd be interested if you have any success though!
Just tried out Tesseract on OS X via MacPorts and it seemed to work reasonably well on a picture of a recipe taken with an iPhone 5S. Not perfect by any means, and it will probably require the user to hand edit the resulting text to get it right, but it turned out better than I expected. Not sure if the performance will be similar on the device itself, but I'll certainly keep it in mind for the future. Thanks.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
Edit: Removed job posting

ManicJason fucked around with this message at 02:33 on Jan 9, 2014

lord funk
Feb 16, 2004

lord funk posted:

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.

I just grabbed OpenEars and in 5 minutes had exactly what I needed. I love it when that happens.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Does anybody know of remote logging libraries and services for iOS? As in, I want all of my clients to aggregate logging in one single location over the network. I could use Parse or one of the other BAAS for this, but I'm wondering if there's a product out there that's specific to this one task.

Kallikrates
Jul 7, 2002
Pro Lurker
Don't know if you are looking for something you can use out of the box or something you can build on but:

http://helios.io/ and https://github.com/mattt/Antenna

Might be worth looking at.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Antenna looks pretty neat, thank you for the referral, still open to more ideas though!

HookShot
Dec 26, 2005
I have a question for you guys, this isn't really a programming question but is iOS developer account related so I hope this is still the right place to post:

I have a registered sole proprietorship which for the interests of making this easy I will call my registered name.

I want to open an iOS developer account using this name, but talking to Apple support they're saying I can only open an individual developer account under my real name, since they don't include sole proprietorships under company accounts.

However, I know from when I opened my account that allowed me to submit books to Apple that I contacted their contracts department and they simply changed the publisher name from my personal name to my registered name once I sent them the documentation that proved that the registered name was a legit registered sole proprietorship.

Do any of you have experience with whether they'll actually do the same thing with a developer account? I just don't want to open an account under my personal name, then find out that I can't do that and have to incorporate and jump through all the hoops involved in changing my developer account from individual to company.

Thanks!

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

HookShot posted:

I have a question for you guys, this isn't really a programming question but is iOS developer account related so I hope this is still the right place to post:

I have a registered sole proprietorship which for the interests of making this easy I will call my registered name.

I want to open an iOS developer account using this name, but talking to Apple support they're saying I can only open an individual developer account under my real name, since they don't include sole proprietorships under company accounts.

However, I know from when I opened my account that allowed me to submit books to Apple that I contacted their contracts department and they simply changed the publisher name from my personal name to my registered name once I sent them the documentation that proved that the registered name was a legit registered sole proprietorship.

Do any of you have experience with whether they'll actually do the same thing with a developer account? I just don't want to open an account under my personal name, then find out that I can't do that and have to incorporate and jump through all the hoops involved in changing my developer account from individual to company.

Thanks!


As far as I am aware, they will not do this for developer accounts.

Also be aware that they no longer accept simple state registration documents. You need an actual DUNS registration number and Dun & Bradstreet only pull from state records every so often, so if you want to speed the process up you have to pay D&B for them to add you to the database before Apple will even consider setting up a corporate account for you. If you contact Apple dev support, they can send you a special link that lets you bypass some of the waiting and get registered with D&B for free or really cheap (I can't remember).

Why Apple can't just let us use our DBA names like any sane company/person I have no idea… It's good enough for the bank to print on my checks but apparently Apple has different standards.

kitten smoothie
Dec 29, 2001

Ender.uNF posted:

As far as I am aware, they will not do this for developer accounts.

Also be aware that they no longer accept simple state registration documents. You need an actual DUNS registration number and Dun & Bradstreet only pull from state records every so often, so if you want to speed the process up you have to pay D&B for them to add you to the database before Apple will even consider setting up a corporate account for you. If you contact Apple dev support, they can send you a special link that lets you bypass some of the waiting and get registered with D&B for free or really cheap (I can't remember).

Why Apple can't just let us use our DBA names like any sane company/person I have no idea… It's good enough for the bank to print on my checks but apparently Apple has different standards.

My LLC has been incorporated with the state for 15 years and is still not in D&B's database, according to their "do you already have a DUNS number" lookup. I am glad I got my developer account before this changeover.

Is this the same sort of stringency involved in some of the higher classes of organization-validated SSL certs (the sort where you pay a few hundred bucks more for the cert and your full legal company name shows up in the address bar)?

I guess Apple wants to avoid the flood of impostor companies you see on Google Play, but this is just overboard for any indie developer with a cool idea.

HookShot
Dec 26, 2005
Thanks guys, that's too bad.

I agree, especially since they let me do it as an author absolutely no problem, it was like 2 emails to their contracts department and the seller name was changed. But oh well, I'm going to wait until the New Year to incorporate I guess, that way I don't have to deal with the extra tax work for an extra 12 months.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
Just ran into a hilarious EXC_BAD_ACCESS due to a Zombie object. "But wait, aren't you using ARC?" Yes, yes I am. That's why it is hilarious.

I am using a block-based delegate proxy for SKProductRequestDelegate. Fairly simple… a class static holds a list of instances (because SKProductRequest.delegate is specified weak as expected) ensuring the proxies stay alive. When productsRequest:didReceiveResponse: is called, I invoke the actual block I care about, then remove self from the class static list. That is the last reference, so in theory the object is deallocated and the request.delegate value is nil'd out.

The procedure inside the block creates a __strong MyClass* ref = weakSelf to capture a retained strong reference to self. That should be keeping the proxy object alive. The object dealloc will destroy the block currently executing, *but* the block runtime should be keeping the block alive until execution finishes, which in turn keeps self alive until the method returns. Once the block method removes itself from the class static, it immediately returns, thus the block is done and gets destroyed, triggering the proxy to get destroyed, triggering the request.delegate reference to become nil.

In reality, the supposedly zeroing-weak-reference is still alive and it crashes as SKProductRequest is trying to ask the delegate if it respondsToSelector. With zombies turned on, I can see that removing the proxy from the class static list removes the last reference, but the next jump is into disassembly for SKProductRequest's internal helper block and I have no idea what that is doing.

You would think that SKProductRequest's helper block is taking a strong reference to the delegate, keeping the object alive long enough not to hit this kind of race condition, or the weak ref goes nil and it just acts like it has no delegate.


edit: And moving the class static removal to requestDidFinish: fixed the problem. I think SKProductRequest isn't taking a local strong reference like it should, allowing the delegate to get destroyed underneath it.

edit2: Radar #15488910 filed. I don't often bother filing them because it takes an hour to write up a concise, clear bug report, but I think Apple should scan their codebase to check how weak references are being used. In fact I think Clang ought to detect any direct reference of a weak property (other than assigning it to a strong reference or clearing it) as a warning. As far as I know, the compiler doesn't automatically convert the weak reference into a local strong one for the duration of method execution though I am starting to think that would be a fantastic addition. Anything doing "if(obj.weakProp != nil) [obj.weakProp doStuff]" is destined for failure or a fun multi-threaded heisenbug.




P.S. I thought life was great when Apple added the ability to use StoreKit in the simulator, but they took it back for some unknown reason, so it's back to testing IAP on device.

Also, why the hell does my phone lock itself, thus disabling the ability to debug and/or launch my app while connected and Xcode is open? Since I have TouchID enabled, it means I can't even set it to only lock after an hour or whatever, it always locks immediately so I have to put my finger on the home button almost every single time I hit "Run".

Simulated fucked around with this message at 20:30 on Nov 17, 2013

duck monster
Dec 15, 2004

Anyone know when apps dev site is back up? I just had a *very* embarassing meeting with a client (on a job I'm stupidly late with already) where we where going to upload an app to the app store, and sort out all the various bits and pieces except the whole thing shat it self and now it says "Down for maintainance".

Oh and I'm losing money hand over fist because as today is commissioning day, I lose 5% per day its overdue and theres no provision for third-party contract frusturation because I suck at contracts.

I wish apple would at least email us warnings about this sort of crap.

edit: Ok, it came back and its all uploaded. Allah willing, apple won't gently caress me around in review.

duck monster fucked around with this message at 15:50 on Nov 17, 2013

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

duck monster posted:

Anyone know when apps dev site is back up? I just had a *very* embarassing meeting with a client (on a job I'm stupidly late with already) where we where going to upload an app to the app store, and sort out all the various bits and pieces except the whole thing shat it self and now it says "Down for maintainance".

Oh and I'm losing money hand over fist because as today is commissioning day, I lose 5% per day its overdue and theres no provision for third-party contract frusturation because I suck at contracts.

I wish apple would at least email us warnings about this sort of crap.

edit: Ok, it came back and its all uploaded. Allah willing, apple won't gently caress me around in review.

You are dealing with Apple. I always recommend you include contract provisions that exclude "Acts of Apple", such as downtime, changed/removed features, review delays, etc.

ModeSix
Mar 14, 2009

I was wondering if someone who works with Cocos2D can step in here and help me identify why a particular piece of code isn't working.

What I am trying to do is read a piece of data, "exit1" from a plist that is contained within a dictionary, 1, that is in a plist. I want to take this data and use it to fetch the next piece of data "exit1" stored in dictionary 2 within the same plist.

It works fine for the first iteration. When I press the button that I have put the data exit1 into it works fine and switches the scene and loads the appropriate data from dictionary 2. When I press the button again with this new data I get an exception and crash.

Here is the code I am using:



code:
-(void)pressedButtonOne:(id)sender {
    NSString *dictName = [[DataModel sharedInstance] getLanguage];
    
    NSString *myListPath = [[NSBundle mainBundle] pathForResource:dictName ofType:@"plist"];
    
    NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfFile:myListPath];
    
    
    roomNumber = [[DataModel sharedInstance] getCurrentRoom];
    CCLOG(@"Current Room is: %@", roomNumber);
    NSDictionary *roomInfo = [dictionary objectForKey:roomNumber];
    
    NSString *newRoom = [roomInfo objectForKey:@"exit1"];
    CCLOG(@"Next Room Is: %@", newRoom);
    [[DataModel sharedInstance] setCurrentRoomToValue:newRoom];
    
    
    [[CCDirector sharedDirector] pushScene:[CCTransitionFade transitionWithDuration:1.0 scene:[RoomScene scene] withColor:ccGRAY]];
   

    CCLOG(@"Pressed Button One");
}
I am reloading the same scene with new data [RoomScene scene] is the current scene and it is evoking itself in this event. Works fine the first time, crashes the 2nd time with no error output to the console.

The language is previously set and stored at the language selection screen and is working properly as it is calling the English dictionary information.

Here is the code I am using in the DataModel singleton to pass the information between the scenes:

DataModel header declarations:

code:
@interface DataModel : NSObject {
    
    NSString *current_room;
    NSString *previous_room;
    NSString *language;
    
    
}

+(DataModel *)sharedInstance;

-(NSString *)getCurrentRoom;
-(void)setCurrentRoomToValue:(NSString *)newCurrentRoom;

-(NSString *)getPreviousRoom;
-(void)setPreviousRoomToValue:(NSString *)newPreviousRoom;

-(NSString *)getLanguage;
-(void)setLanguage:(NSString *)newLanguage;

@end
DataModel methods:

code:
-(NSString *)getCurrentRoom {
    // returns room value set previously
    CCLOG(@"Room Data in the DataModel is: %@", current_room);
    return current_room;
    
}

-(void)setCurrentRoomToValue:(NSString *)newCurrentRoom {
    // sets previous_room to value of current room before updating current room
    [self setPreviousRoomToValue:current_room];
    CCLOG(@"Room has been set in the DataModel to: %@", newCurrentRoom);
    current_room = newCurrentRoom;
}

-(NSString *)getLanguage {
    if (!language) {
        [self setLanguage:@"none"];
    }
    return language;
}
Any insight as to why this works on the first iteration and not the 2nd would be great.

ModeSix fucked around with this message at 16:56 on Nov 18, 2013

haveblue
Aug 15, 2005



Toilet Rascal
Can you post the exception stack?

ModeSix
Mar 14, 2009

haveblue posted:

Can you post the exception stack?



This is all the output I am getting, it's not throwing any exceptions to the console log, hence why I am having such a problem with this.

Edit:

It appears it is having problems returning the current_room from the DataModel on the 2nd iteration upon.

ModeSix fucked around with this message at 17:10 on Nov 18, 2013

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.
It seems to me that in the setCurrentRoomToValue method you need to copy the string to current_room with a new string object instead of just copying the pointers (or create a @property with "copy" and a custom get/set). Is this using ARC?

ModeSix
Mar 14, 2009

^^^^

I'm not using ARC, and I found the problem being that I was trying to change an immutable string in the DataModel, which as we all know (or at least should) can't be done.

ModeSix posted:

It appears it is having problems returning the current_room from the DataModel on the 2nd iteration upon.

Found my problem, in my DataModel method I was using NSString when I needed to use NSMutableString as follows:

code:
-(void)setCurrentRoomToValue:(NSMutableString *)newCurrentRoom {
    // sets previous_room to value of current room before updating current room
    [self setPreviousRoomToValue:current_room];
    
    current_room = [[NSMutableString alloc] initWithString:newCurrentRoom];
    //newCurrentRoom;
    CCLOG(@"Room has been set in the DataModel to: %@", current_room);
}
Works perfectly now.

Posted this in case someone else has a similar problem.

haveblue
Aug 15, 2005



Toilet Rascal
Yeah, at a glance the room number is coming out of an autoreleased dictionary (from dictionaryWithContentsOfFile) so by the time it gets checked a second time it is a zombie. You need to change DataModel to have it retain the string in setCurrentRoomToValue.


e: Or you can do that, but there's ways to just have it not delete the original string rather than making a whole new one, and whether it's mutable or not wasn't part of the issue.

ModeSix
Mar 14, 2009

haveblue posted:

Yeah, at a glance the room number is coming out of an autoreleased dictionary (from dictionaryWithContentsOfFile) so by the time it gets checked a second time it is a zombie. You need to change DataModel to have it retain the string in setCurrentRoomToValue.


e: Or you can do that, but there's ways to just have it not delete the original string rather than making a whole new one, and whether it's mutable or not wasn't part of the issue.

Oh, well Hm, so what you are saying is that I should retain my NSDictionary in my RoomScene?

Doc Block
Apr 15, 2003
Fun Shoe
What he is saying is that, since you aren't using ARC, you need to retain the room number strings yourself, and call release on the old ones when you change them.

Read up on Objective C manual memory management.

Doc Block fucked around with this message at 18:36 on Nov 18, 2013

Toady
Jan 12, 2009

I'm using NSXPCConnection to parse a series of lines of data in an XPC service. Occasionally, my reply block is getting called out of order--the results I'm receiving in the block aren't in the same order that I call the service. I've verified that I'm retrieving the data in my main application in the correct order and that I'm calling the service in the correct order. The call to the service looks like this:
code:
NSXPCConnection *fooParserService = [[NSXPCConnection alloc] initWithServiceName:@"com.ExampleApp.FooParserService"];
parserService.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(FooDataParser)];
[parserService resume];
    
[[fooParserService remoteObjectProxy] parseData:data withReply:^(FooResult *result) {
    [[NSOperationQueue mainQueue] addOperationWithBlock:^{
        // Do something with the result.
    }];
    [fooParserService invalidate];
}];
Anyone have an idea I could investigate?

Doc Block
Apr 15, 2003
Fun Shoe
I'm posting from Awful.app on my phone or else I'd check myself, but do the docs actually say they'll be called in order? Or is NSXPC supposed to guarantee in-order execution?

Toady
Jan 12, 2009

Doc Block posted:

I'm posting from Awful.app on my phone or else I'd check myself, but do the docs actually say they'll be called in order? Or is NSXPC supposed to guarantee in-order execution?

I wondered that myself since I couldn't imagine XPC being as useful if it wasn't serial in nature. I didn't find an explicit statement about order of execution, but Apple's SandboxedFetch uses XPC to download a file and update a progress bar in the interface, and the documentation says XPC uses a private serial queue. My XPC service is a simple string parser that uses no concurrency, so I'm stumped as to why the reply block is sometimes getting called in an unexpected order.

Doc Block
Apr 15, 2003
Fun Shoe
Also, your getters/setters are nonstandard. It would be better to use properties and follow the naming conventions, so you'd have something like
Objective-C code:
// DataModel.h

@interface DataModel : NSObject

// We're using copy because if somebody passes in a subclass of NSString (such as
// NSMutableString) we don't want the underlying string data changed without our knowledge,
// so for NSString properties it's a good idea to use copy. This doesn't waste memory since
// on plain old immutable NSString's -copy just calls -retain; only on NSMutableString
// will this result in an actual unique copy of the object and its data. Note that you
// only get this special behavior on Foundation classes.

@property (nonatomic, copy) NSString *currentRoom;
@property (nonatomic, copy) NSString *previousRoom;
@property (nonatomic, copy) NSString *language;

// We use (instancetype) instead of (DataModel *) so that the correct type still gets
// returned if DataModel gets subclassed.
+ (instancetype)sharedInstance;

@end

// DataModel.m

@implementation DataModel

#pragma mark - Setters & getters

// We only need to write a custom setter for currentRoom and a custom getter for language,
// because they do additional things. For everything else we let the compiler auto-synthesize
// the getters & setters for us.

- (void)setCurrentRoom:(NSString *)currentRoom
{
	if(currentRoom == _currentRoom) {
		return;
	}
	
	self.previousRoom = _currentRoom;
	
	[_currentRoom release];
	_currentRoom = [currentRoom copy];
}

- (NSString *)language
{
	if(language == nil) {
		self.language = @"none";
	}
	
	return language;
}

+ (instancetype)sharedInstance
{
	static id sharedInstance = nil;
	static dispatch_once_t onceToken;
	dispatch_once(&onceToken, ^{
		// Again, if we're using a DataModel subclass then we want to make an instance of
		// the subclass, which is why we're doing it this way.
		sharedInstance = [[self class] init];
	});
	
	return sharedInstance;
}

@end
which allows you to access them like any other property.

ModeSix posted:

I was wondering if someone who works with Cocos2D can step in here and help me identify why a particular piece of code isn't working.

What I am trying to do is read a piece of data, "exit1" from a plist that is contained within a dictionary, 1, that is in a plist. I want to take this data and use it to fetch the next piece of data "exit1" stored in dictionary 2 within the same plist.

It works fine for the first iteration. When I press the button that I have put the data exit1 into it works fine and switches the scene and loads the appropriate data from dictionary 2. When I press the button again with this new data I get an exception and crash.

Here is the code I am using:



code:
-(void)pressedButtonOne:(id)sender {
    NSString *dictName = [[DataModel sharedInstance] getLanguage];
    
    NSString *myListPath = [[NSBundle mainBundle] pathForResource:dictName ofType:@"plist"];
    
    NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfFile:myListPath];
    
    
    roomNumber = [[DataModel sharedInstance] getCurrentRoom];
    CCLOG(@"Current Room is: %@", roomNumber);
    NSDictionary *roomInfo = [dictionary objectForKey:roomNumber];
    
    NSString *newRoom = [roomInfo objectForKey:@"exit1"];
    CCLOG(@"Next Room Is: %@", newRoom);
    [[DataModel sharedInstance] setCurrentRoomToValue:newRoom];
    
    
    [[CCDirector sharedDirector] pushScene:[CCTransitionFade transitionWithDuration:1.0 scene:[RoomScene scene] withColor:ccGRAY]];
   

    CCLOG(@"Pressed Button One");
}
I am reloading the same scene with new data [RoomScene scene] is the current scene and it is evoking itself in this event. Works fine the first time, crashes the 2nd time with no error output to the console.

The language is previously set and stored at the language selection screen and is working properly as it is calling the English dictionary information.

Here is the code I am using in the DataModel singleton to pass the information between the scenes:

DataModel header declarations:

code:
@interface DataModel : NSObject {
    
    NSString *current_room;
    NSString *previous_room;
    NSString *language;
    
    
}

+(DataModel *)sharedInstance;

-(NSString *)getCurrentRoom;
-(void)setCurrentRoomToValue:(NSString *)newCurrentRoom;

-(NSString *)getPreviousRoom;
-(void)setPreviousRoomToValue:(NSString *)newPreviousRoom;

-(NSString *)getLanguage;
-(void)setLanguage:(NSString *)newLanguage;

@end
DataModel methods:

code:
-(NSString *)getCurrentRoom {
    // returns room value set previously
    CCLOG(@"Room Data in the DataModel is: %@", current_room);
    return current_room;
    
}

-(void)setCurrentRoomToValue:(NSString *)newCurrentRoom {
    // sets previous_room to value of current room before updating current room
    [self setPreviousRoomToValue:current_room];
    CCLOG(@"Room has been set in the DataModel to: %@", newCurrentRoom);
    current_room = newCurrentRoom;
}

-(NSString *)getLanguage {
    if (!language) {
        [self setLanguage:@"none"];
    }
    return language;
}
Any insight as to why this works on the first iteration and not the 2nd would be great.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Has anyone poked around with XCTest beyond the basic level? I'm trying to generate tests at runtime and get Xcode to actually say "Tests failed" when the tests fail. The tests run, the log indicates failure, Xcode seems to think that xctest exited with a nonzero return code, but it insists that "tests succeeded". The test navigator is similarly worthless; while I didn't really expect it to show runtime-generated tests, I wonder if their absence is related to Xcode's shoddy reporting.

The whole thing is worth about as much as the XCTest documentation, which I could estimate for you if I could actually find any.

Seriously what the hell is this poo poo? Here's the project if you want to have a look, the failing tests are in HTMLTokenizerTests and HTMLTreeConstructionTests.

Only registered members can see post attachments!

Kallikrates
Jul 7, 2002
Pro Lurker
I've done some xctest testing but none with creating xctestsuite instances at runtime. Maybe creating them at runtime is causing some counter to be off. The framework seems to track doneness with counters and observers maybe those are getting thrown off.

For your errors: have you tried not creating a XCTestSuite for a collection of tests? Maybe try running them just as a collection through a set of helpers. Maybe you need to add some functionality to xctestobservers to see the runtime created tests.

I like the features of xctest but I'll agree that the documentation is not there. There aren't even good blog posts (nothing new). The testing story on the project I am on is so bad that just using default test classes is already a huge improvement.

kitten smoothie
Dec 29, 2001

Is there any way to stream WWDC videos on an iOS device without having to use the WWDC app? It has not let me sign in for weeks and it is a real pain in the rear end syncing the videos over from iTunes.

PoopShipDestroyer
Jan 13, 2006

I think he's ready for a chair
I'm probably overthinking this, but hopefully someone can sanity check me here:

I'm trying to make sure any UIAlertView created in this project I'm working on gets presented in the main thread, so I created a quick little static method that should take care of it for me:

code:
+(void)showAlertOnMainThread : (UIAlertView *) alert
{
    if([NSThread isMainThread])
        [alert show];
    else
        [alert performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:NO];
}
The part I'm slightly worried about is "alert performSelectorOnMainThread". Is it safe to call performSelectorOnMainThread on an object like that? Everyone else I see online creates their own showAlert method within the calling class and call [self performSelectorOnMainThread:@selector(showAlert) ...] instead.

lord funk
Feb 16, 2004

kitten smoothie posted:

Is there any way to stream WWDC videos on an iOS device without having to use the WWDC app? It has not let me sign in for weeks and it is a real pain in the rear end syncing the videos over from iTunes.

I think you can just go to the WWDC session videos webpage:
https://developer.apple.com/wwdc/videos/

Doctor w-rw-rw-
Jun 24, 2008

RiggenBlaque posted:

I'm probably overthinking this, but hopefully someone can sanity check me here:

I'm trying to make sure any UIAlertView created in this project I'm working on gets presented in the main thread, so I created a quick little static method that should take care of it for me:

code:

+(void)showAlertOnMainThread : (UIAlertView *) alert
{
    if([NSThread isMainThread])
        [alert show];
    else
        [alert performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:NO];
}

The part I'm slightly worried about is "alert performSelectorOnMainThread". Is it safe to call performSelectorOnMainThread on an object like that? Everyone else I see online creates their own showAlert method within the calling class and call [self performSelectorOnMainThread:@selector(showAlert) ...] instead.
Don't do this. Dispatch_async to the main queue instead.

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

lord funk posted:

I think you can just go to the WWDC session videos webpage:
https://developer.apple.com/wwdc/videos/

Beaten like a stepchild. I believe only the most recent year or two of WWDC videos are available this way. Previously you had to sign in and it took you through iTunesU to get them.


Doctor w-rw-rw- posted:

Don't do this. Dispatch_async to the main queue instead.

drat, beaten again!

code:
    dispatch_async(dispatch_get_main_queue(), ^{ 
         //awesome crap
    });

Froist
Jun 6, 2004

Doctor w-rw-rw- posted:

Don't do this. Dispatch_async to the main queue instead.

Any reason why this is the case? I used to use performSelectorOnMainThread and more recently have started using dispatch_get_main_queue, but I don't really know the details of what makes them different.

PoopShipDestroyer
Jan 13, 2006

I think he's ready for a chair
Yeah, I didn't realize that performSelectorOnMainThread wasn't a good idea. Is that always the case?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
performSelectorOnMainThread is higher overhead (it uses a timer on the main thread rather than libdispatch), is less flexible, and the default run loop modes stuff is often not actually what you want. It's not totally awful, but you should default to using GCD unless you have a compelling reason to do otherwise.

Adbot
ADBOT LOVES YOU

Doh004
Apr 22, 2007

Mmmmm Donuts...
If I still need to support iOS 6 but want to use AFNetworking, am I better off sticking with 1.X and not 2.0? I need to handle the authentication challenges which used to be handled in the AFHTTPClient, but are now handled in the AFURLSession (if I'm not mistaken) which is only iOS 7.0 +.

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