Re: can we have own application logo for ad-hoc release.

2010-06-22 Thread Bryan Henry
A legitimate distribution channel with a max of 100 users per year? That's a 
pretty limited market. Ad hoc exists or beta testing, app reviewer copies 
(along with promo codes), and other such things. Apple had taken steps in the 
past to limit the utility of Ad Hoc as a distribution mechanism that 
circumvents the App Store, for obvious reasons.

- Bryan

Sent from my iPhone

On Jun 22, 2010, at 1:16 PM, Dave Carrigan  wrote:

> 
> On Jun 22, 2010, at 10:05 AM, Matt Neuburg wrote:
> 
>> On Mon, 21 Jun 2010 23:05:37 -0700 (PDT), Kalyanraju M
>>  said:
>>> Hi,when loading the Ad-Hoc release into iTunes, there is a generic icon 
>>> shown
>> in the Apps section. Additionally, the label shows "Unknown genre". Can i 
>> have
>> my own image and my own label at label "Unknown genre".
>> 
>> (1) Since it's just ad hoc, who cares? Only beta testers will see it this
>> way.
> 
> Um, no. Ad hoc is a legitimate distribution channel that just doesn't happen 
> to go through the App Store.


> -- 
> Dave Carrigan
> d...@rudedog.org
> Seattle, WA, USA
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com
> 
> This email sent to bryanhe...@mac.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Memory management on returning nil in init

2010-06-21 Thread Bryan Henry
Yes, you would want to call [self release]; before returning nil in your 
initializer. That's the common pattern. Otherwise you do leak the allocated 
(but improperly initialized) object.

- Bryan

Sent from my iPhone

On Jun 21, 2010, at 10:43 AM, Eiko Bleicher  wrote:

> One of my initializers can fail and thus it should return nil. Consider the 
> following example:
> 
> -(id) initWithBool:(BOOL)ok
> {
>   if (self = [super init])
>   {
>  if (!ok) {
> return nil; // Point of interest
>  }
>   }
>   return self;
> }
> 
> Does this code leak? I am inclined to think I need to call [self release] 
> before returning nil, but I am yet to see a piece of example code for this. 
> Or is my approach stupid? :-)
> 
> Running in no-GC environment here.
> 
> Thanks,
> Eiko
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com
> 
> This email sent to bryanhe...@mac.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSNumber stringValue

2009-12-11 Thread Bryan Henry
You should not compare floating point numbers for equality in most cases. This 
is true of any language on any platform.

See 
http://www.cygnus-software.com/papers/comparingfloats/Comparing%20floating%20point%20numbers.htm

- Bryan

On Dec 10, 2009, at 10:02:23 PM, RedleX Support wrote:

> Hi,
> 
> I need to output a double into a text file and then read it back with 100% 
> accuracy, will using NSNumber stringValue and then using NSString doubleValue 
> give me good results?
> 
> For example, if I write the following:
> 
> double a,b;
> 
> a=some number;
> 
> b=[[[NSNumber numberWithDouble:a] stringValue] doubleValue];
> 
> will a==b
> 
> TIA
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com
> 
> This email sent to bryanhe...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Does NSData rearrange the order of bits?

2009-12-02 Thread Bryan Henry
Your log messages show that the NSData's bytes are stored completely correctly, 
you're just interpreting it incorrectly.

NSData's description method will list the bytes in order, so you see 
"510600f0". On the other hand, you used the %x format specifier to create your 
string, which will print the first byte last, so you get "f651". That's 
exactly the same infomation-wise, the order of bytes is just flipped.

If you want to create an NSString from the bytes of an NSData where the lower 
bytes are ordered first, you can use this:

NSUInteger len = [theToken length];
const unsigned char *bytes = [theToken bytes];
NSMutableString *tokenStr = [NSMutableString stringWithCapacity:len*2];
for (NSUInteger i = 0; i < len; ++i) {
[tokenStr appendFormat:@"%02x", bytes[i]];
}

- Bryan

(Original reply to Brad directly resubmitted to list at request)

On Nov 30, 2009, at 2:27:55 PM, Brad Gibbs wrote:

> Hi,
> 
> I'm doing bit-packing via a C function.  Logging the bits of the C function 
> shows the expected result.  If I create a string with a hex value format, I 
> get the correct hex string, but, if I try to put the bytes into an NSData 
> object with [NSData dataWithBytes: length], the order of the bits changes.  
> All of the right elements are there, but they're in the wrong order (target 
> data should be f651, as shown in the Target string is ... log).
> 
> My code:
> 
> 
>   // get the target int from the text field
>   unsigned int tgtValue = [self.tgtTF intValue];
>   
>   // use the target int and type to pack the bits into an int
>   uint32_t tgtBinary = setAnalogValueForIndex(cid, tgtValue);
>   NSString *tgtString = [NSString stringWithFormat:@"%x", tgtBinary];
>   NSData *tgtData = [NSData dataWithBytes: &tgtBinary length: 
> sizeof(tgtBinary)];
>   NSLog(@"Target data is %...@.  Target string is %@", tgtData, 
> tgtString);
> 
> 
> The logs:
> 
> 011001010001
> 2009-11-30 11:02:26.126 CertTest[11959:a0f] Target data is <510600f0>.  
> Target string is f651
> 2009-11-30 11:02:26.204 CertTest[11959:a0f] After adding target, cmdData is 
> <510600f0>
> 
> If NSData is rearranging the bits, is there some way to prevent this?
> 
> 
> Thanks.
> 
> Brad
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com
> 
> This email sent to bryanhe...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Unable to disassemble objc_assign_strongCast

2009-11-02 Thread Bryan Henry


Here's the normal way to do it:

NSError *saveError;
[importContext save:&saveError];



Important nitpick:

NSError *saveError = nil;
[importContext save:&saveError];

Methods that follow the NSError** convention are not required to  
actually assign a value to the saveError pointer, so you'll want to  
make sure to initialize saveError to nil since its a local variable.  
Wouldn't want to be checking against undefined garbage later,  
especially if you have something like a "if (saveError)" check.


- Bryan
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: objectAtIndex

2009-11-01 Thread Bryan Henry
That line alone does not indicate any memory leaks occurring due to  
over-retaining objects. You'll need to provide more context (the  
surrounding code, etc).


The object returned by -[NSArray objectAtIndex:] is the actual object  
(ie. pointer to the actual object's space in memory) stored in the  
array, not a copy. When you add objects to an array, as well, the  
object stored in the array is not a copy but the object itself.


- Bryan

On Nov 1, 2009, at 2:44:07 PM, Nava Carmon wrote:


Hi,

When I ran Build and Analyze on my code, it has pointed as a  
possible leak the following statement:


NSObject *anObject = [anArray objectAtIndex:i];

anObject wasn't released and here's the question: whether anObject  
is a copy of actual object, that is a member of anArray or it's the  
object itself?


Should I release it?

Thanks,
Nava
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [iPhone] Why so many calls?

2009-10-27 Thread Bryan Henry
Have you tried a table with 99 sections to see whether that scaling is  
really the case?


While I agree that some of those are likely unnecessary calls that  
could be optimized away, this is all more the subject of an  
enhancement report for Radar than anything else.


- Bryan

On Oct 27, 2009, at 8:22:29 PM, Phil Curry wrote:


But can anyone explain all the other duplicate calls?


Why does it matter?  If you have eight or nine sections it makes
perfect sense.  Or you could have one section and it needs to draw
multiple times, and whoever designed the API didn't want to go  
through

the expense of a KVO observation, instead asking the delegate for the
header/footer each time it needed it.

But none of that matters.

Kyle-

But, as I thought I explained in the original post, the table only  
has 2 sections, 1 with 2 rows and 1 with 1 row.

The table is only being loaded once. So why does it take:

9 tableView:titleForHeaderInSection: calls for 2 sections
8 tableView:titleForFooterInSection: calls for 2 sections
2 numberOfSectionsInTableView: calls for a single load

In a table of this size, you're right - "Why does it matter".
But what if my real table has 99 sections? Why should I get bogged  
down with 800-900 calls for section header titles and section footer  
titles.
Seems like an incredible waste of effort. Just curious if anyone  
knows why this happens. If you don't know why, just say so.


I happen to live in a world of disturbing images. What can I say?
-Phil
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Professional Error Handling

2009-10-22 Thread Bryan Henry
Regarding your second case specifically, I usually define an error  
domain and error codes using an extern NSString* const plus an enum on  
a per-class basis.


// This for the header
extern NSString *const ExpressionProcessorErrorDomain;
enum {
  EPUnmatchedParenthesesError   = 21,
  EPRadixPointOnlyError = 22,
  EPSuccessiveOperatorsError= 23,
  EPSuccessiveRadixPointsError  = 24,
  EPSuccessiveNegativeSignsError= 25,
  EPOperatorAtExpressionStartError  = 26,
  EPOperatorAtExpressionEndError= 27,
  EPInvalidExponentialError = 28,
  EPInvalidPowerOfUnitError = 29,
  EPInvalidPlaceholderIndexError= 30,
  EPInvalidPlaceholderObjectError   = 31
};

// And adding, of course, the value of ExpressionProcessorErrorDomain  
in the .m file
NSString *const ExpressionProcessorErrorDomain =  
@"ExpressionProcessorErrorDomain";


I'm not sure whether this is a Cocoa convention or not, or whether a  
convention exists, but this is what I use to ensure that my domains  
are consistent and that error codes are self-documenting (at least in  
the code) as well as ensuring that error code duplication doesn't occur.


- Bryan

On Oct 22, 2009, at 7:40:46 PM, Squ Aire wrote:

2) The error is originated in my own code. This case I'm unsure of.  
The way I do it currently is something like this:

NSString *desc = @"Unable to set up image view.";
NSString *info = @"Image does not exist at the specified path.";
NSDictionary *d = [NSDictionary dictionaryWithObjectsAndKeys:
   desc,NSLocalizedDescriptionKey,
  info,NSLocalizedFailureReasonErrorKey,nil];
*anError = [NSError  
errorWithDomain:@"com.mycompany.GreatApp.ErrorDomain" code:43  
userInfo:d];


And then of course return NO or nil from the method. Is this how the  
professionals would do it? The first, and only obvious, problem I  
can see with this is that I'm putting a magic number 43 in there. I  
determine this magic number by doing a manual project find for  
"GreatApp.ErrorDomain" and adding one to the greatest error number  
that already exists. The second problem is of the error domain  
string. To me it currently feels like good enough to just have one  
error domain for the whole app since the app is not huge. The only  
question is where on earth I would put a constant for that string. I  
have no idea, since this string can occur in various model objects,  
so I just manually copy-paste this string every time it's needed.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Does Core Data have reserved Entity names?

2009-09-30 Thread Bryan Henry
As a general rule, you want to avoid attempting to name classes with  
such generic names. It makes you very much more likely to end up with  
a class name conflict somewhere, especially in large projects.  
Classname prefixes are usually what's used to help ensure there are no  
such conflicts.


- Bryan

On Sep 30, 2009, at 1:11:06 PM, Alex Reynolds wrote:


On Sep 30, 2009, at 4:04 AM, I. Savant wrote:

Whatever the answer, the simple solution is to change your entity's  
name.


Unfortunately, that simple solution means parting ways with the  
naming scheme of the source I'm pulling data from and changing the  
naming scheme for all my other entities/classes, too, which I was  
hoping to avoid. But thanks to all for the confirmation.


-Alex

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Predicate matching for entire to-many relationship

2009-09-24 Thread Bryan Henry

Hey list -

I'm trying to determine what the best approach for writing a Core Data  
fetch predicate to match objects with a specific set for a to-many  
relationship is, so I'd appreciate some guidance.


A portion of my Core Data model looks like so --> http://is.gd/3Dyp4

I am attempting to fetch all Type objects with a coreExponents  
relationship that equals a specific comparison set of Exponents. This  
comparison set is essentially just an NSDictionary with integer keys  
corresponding to the "coreType.index" key path of the Exponent entity,  
and integer values corresponding to the "magnitude" key path of the  
Exponent entity. This NSDictionary could be turned into an NSSet of  
Exponent objects (that would not be tied to a context and would not be  
saved to a store, of course) if necessary for the predicate comparison.


For example, if I have a type with a coreExponents relationship that  
looks like so:

coreExponents = {(
{ coreType.index = 0, magnitude = 2 },
{ coreType.index = 1, magnitude = -1 },
{ coreType.index = 4, magnitude = 1 }
)}

And I want to fetch that Type object based on a dictionary structured  
as such (of course the pairs are unordered in reality):

{
0 = 2,
1 = -1,
4 = 1
}

What would be the best approach to take for designing my  
NSFetchRequest's predicate?


Thanks!
- Bryan
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: singleton pattern in cocoa

2009-09-14 Thread Bryan Henry
This question usually gets asked at least a couple times a month. I  
suggest you look up the previous responses on CocoaBuilder (http://www.cocoabuilder.com/ 
), which archives responses on this mailing list if you want an  
exhaustive response, since all solutions have been mentioned somewhere  
here before.


- Bryan

On Sep 10, 2009, at 4:07:36 PM, Manuel Grau wrote:


Hi all,

As I come from java world, I was trying to implement the singleton  
pattern, very usual in java. After searching in internet I found  
this code from wikipedia:


@interface MySingleton : NSObject
{
}

+ (MySingleton *)sharedSingleton;
@end

@implementation MySingleton

static MySingleton *sharedSingleton;

+ (MySingleton *)sharedSingleton
{
 @synchronized(self)
 {
   if (!sharedSingleton)
 [[MySingleton alloc] init];

   return sharedSingleton;
 }
}

+(id)alloc
{
 @synchronized(self)
 {
   NSAssert(sharedSingleton == nil, @"Attempted to allocate a second  
instance of a singleton.");

   sharedSingleton = [super alloc];
   return sharedSingleton;
 }
}

@end

What do you think about this implementation? I'm newbie with cocoa  
and I'm not sure.


Thanks.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: (no subject)

2009-09-07 Thread Bryan Henry
According to the memory management rules, yes, you own the object  
returned by that method and you should therefore release it.


"You take ownership of an object if you create it using a method whose  
name begins with “alloc” or “new” or contains “copy” (for example,  
alloc,newObject, or mutableCopy), or if you send it a retain message.  
You are responsible for relinquishing ownership of objects you own  
using releaseor autorelease. Any other time you receive an object, you  
must not release it."


Also note the documentation for that method:
"An initialized collection view item with the specified object and the  
appropriate view set. The collection view item should not be  
autoreleased."


- Bryan

On Sep 7, 2009, at 6:23:30 PM, Colin Deasy wrote:




Does the returned obj from this method:
- (NSCollectionViewItem *)newItemForRepresentedObject:(id)object
require a release?
ThanksColin
_
Share your memories online with anyone you want.
http://www.microsoft.com/ireland/windows/windowslive/products/photos-share.aspx?tab=1___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: When do I need to override hash?

2009-08-20 Thread Bryan Henry
Yes, but the problem with a hash based on the pointer is that it  
limits your isEqual implemenation from being based on anything more  
than the pointer, or you violate the "If objects are equal, they must  
have the same hash" rule.


(Earlier email was a brain fart on my part.)

- Bryan

Sent from my iPhone

On Aug 20, 2009, at 4:37 PM, Kyle Sluder  wrote:


On Thu, Aug 20, 2009 at 1:33 PM, Clark Cox wrote:

-isEqual: is how Cocoa collections define equality. Saying that two
objects are "equal" means, by definition, that -[obj1 isEqual: obj2]
returns true.


This has nothing to do with -hash.

P: Two objects are equal.
Q: They have the same hash.

P -> Q.

Note that Q does not imply P.

--Kyle Sluder

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: When do I need to override hash?

2009-08-20 Thread Bryan Henry
Why do you say that? I haven't noticed any documented requirement that  
ties the implementation details of -hash and -isEqual together.


- Bryan

Sent from my iPhone

On Aug 20, 2009, at 4:27 PM, Clark Cox  wrote:

On Thu, Aug 20, 2009 at 12:33 PM, David  
Duncan wrote:

On Aug 20, 2009, at 12:00 PM, Seth Willits wrote:


Returning 0 is certainly simpler :p



It is, but you can generally do better than just returning 0,  
usually by

just extracting some bits from 'self', ala

-(NSUInteger)hash
{
   uintptr_t hash = (uintptr_t)self;
   return (hash >> 4);
}

This satisfies the condition of hash (two equal objects will have  
the same

hash code)


No it doesn't. Writing the hash method like that basically prevents
you from having an isEqual that does anything other than a pointer
comparison.

--
Clark S. Cox III
clarkc...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Force crash a cocoa app for Crash Reporter testing

2009-08-20 Thread Bryan Henry

[[NSArray array] objectAtIndex:0]; if you want an exception.

- Bryan

Sent from my iPhone

On Aug 20, 2009, at 1:04 PM, aaron smith > wrote:



Hey All, I'm trying to do some testing with Smart Crash Reporter,
which integrates with Crash Reporter. So I'm trying to write some code
to force crash my app. But it won't crash. hahaha.

Anyone have any code I can use to do this?

I've been trying to just do some extra releases on an object, but no  
go.


Thanks
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Coding with VM limitation on the iPhone?

2009-08-18 Thread Bryan Henry
Oh, I forgot to add - specifically you can either override - 
[UIViewController didReceiveMemoryWarning] or listen for the (this is  
from memory, so verify it with the docs)  
UIApplicationDidReceiveMemoryWarningNotification notification if you  
need to do something in other than a view controller.


- Bryan

Sent from my iPhone

On Aug 18, 2009, at 7:37 PM, Bryan Henry  wrote:

The proper way to manage large objects that can be easily reloaded  
as needed is to make sure and respond to memory warnings. The exact  
amount of memory available to your application depends on both the  
device (which could vary greatly in terms of hardware resources) and  
other processes running in the background (like MobileMail, for  
instance). Luckily for you, the OS handles determining when you're  
running low on memory and sends notifications to that affect (as  
well as doing other things).


- Bryan

Sent from my iPhone

On Aug 18, 2009, at 7:34 PM, Jonathon Kuo > wrote:


I'm writing an app for the iPhone, but I need to be mindful how  
much virtual memory there is available to the app when it runs, so  
I can manage allocing and deallocing some large arrays. I'm  
guessing that the OS runs in a small amount (100MB?) of flash  
memory compared to the 16GB or 32GB of general storage memory?  
Also, is there a system call I can invoke from within my app to  
determine how large it is getting?


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Coding with VM limitation on the iPhone?

2009-08-18 Thread Bryan Henry
The proper way to manage large objects that can be easily reloaded as  
needed is to make sure and respond to memory warnings. The exact  
amount of memory available to your application depends on both the  
device (which could vary greatly in terms of hardware resources) and  
other processes running in the background (like MobileMail, for  
instance). Luckily for you, the OS handles determining when you're  
running low on memory and sends notifications to that affect (as well  
as doing other things).


- Bryan

Sent from my iPhone

On Aug 18, 2009, at 7:34 PM, Jonathon Kuo > wrote:


I'm writing an app for the iPhone, but I need to be mindful how much  
virtual memory there is available to the app when it runs, so I can  
manage allocing and deallocing some large arrays. I'm guessing that  
the OS runs in a small amount (100MB?) of flash memory compared to  
the 16GB or 32GB of general storage memory? Also, is there a system  
call I can invoke from within my app to determine how large it is  
getting?


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [iphone] displaying multiple images

2009-08-18 Thread Bryan Henry
Sounds like a rather simple combination of UIScrollView with it's  
pagingEnabled property set to YES and some UIImageViews.


- Bryan

Sent from my iPhone

On Aug 18, 2009, at 7:22 PM, Dragos Ionel  wrote:

Is there any control that would allow to load multiple images at  
once and to
navigate from one to another by swipe gesture (in the same way one  
navigates

from one screen to another on the iPhone applications screens)?
Thanks a lot,
Dragos
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CoreData many-to-many Relationship Question

2009-07-26 Thread Bryan Henry
Yes, as long as you object graphic consistency for you. You should  
look at the Core Data Programming Guide, which this excerpt is from:


"Since Core Data takes care of the object graph consistency  
maintenance for you, you only need to change one end of a relationship  
and all other aspects are managed for you. This applies to to-one, to- 
many, and many-to-many relationships."


- Bryan

On Jul 24, 2009, at 12:23 PM, Jean-Nicolas Jolivet wrote:

I'm using a many-to-many relationship with CoreData and I was  
wondering if I

have to set or unset the relationshop both ways?
For example, let's say I have a many-to-many relationship between an
Employee entity and a Manager entity...if I do the following:

[anEmployee addManagersObject:aManager];

I add the Manager to the Employee's Managers... but is the Employee  
added to

the Manager's Employee automatically (in other words, is the inverse
relationshop created automatically for me, or do I also have to do:
[aManager addEmployeesObject:anEmployee];)

Same for removeManagersObject and removeEmployeesObject... can I  
only delete

one side of the relationship or do I have to delete both?

Hopefully my question is clear, if not let me know I'll try to  
explain it

better...

Jean-Nicolas Jolivet
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: IMEI Codes?

2009-07-13 Thread Bryan Henry
You can get the unique device identifier (UDID) for a device, which is  
a hash of different hardware identifiers (like the serial number) -  
look at UIDevice. Its not really clear for what purposes you need the  
identifier for, though, so whether or not you really need that or  
something else isn't clear.


If you plan to use it in the context of the push notification  
provider, keep in mind that the UDID and the push device token do not  
behave in the same ways. The UDID is based on hardware identifiers, so  
it doesn't ever change for a single device - even if that device is  
wiped, given to someone else, restored from backup, etc. The device  
token, on the other hand, does change when the device is wiped.


- Bryan

On Jul 13, 2009, at 1:17 PM, Rick Langschultz wrote:



Is there any way to get the IMEI code programatically? Or does a  
device token the only unique identifier able to be generated.


Sent from my iPhone
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: State of the Union videos?

2009-06-12 Thread Bryan Henry
Last year's session videos were posted to ADC on iTunes in February of  
this year, so I wouldn't hold your breath for seeing them anytime soon.


ADC on iTunes: http://developer.apple.com/adconitunes

- Bryan

On Jun 12, 2009, at 10:32 AM, Todd Heberlein wrote:

Does anyone know if/when Apple will post the "State of the Union"  
presentations from WWDC 09?


Todd

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using non-id sender in IBAction methods

2009-06-07 Thread Bryan Henry
I hope you aren't suggesting that he use assertions in production code  
- that's much worse practice than specifying a non-id parameter for an  
action method.


As someone already said, if your action method is specific enough to  
the type of sender object where specifying it's type keeps you from  
casting, it's unlikely that you're going to have sender objects of  
different types.


- Bryan

Sent from my iPhone

On Jun 7, 2009, at 4:05 PM, Uli Kusterer  
 wrote:



Am 07.06.2009 um 08:45 schrieb Marc Liyanage:
With the new dot notation I sometimes use explicit types in my  
IBAction methods:


- (IBAction)doSomething:(UIButton *)button ...

instead of

- (IBAction)doSomething:(id)sender ...

so I don't have to downcast "sender" to be able to use the dot  
notation.


Do others do this too? Is this discouraged for some reason?



Not a good idea. The sender can be pretty much any object. It might  
not be right now, but IBActions are often hooked up to several  
objects, like a toolbar item, a pushbutton and a menu item. Hence  
the definition as "id". By leaving it as "id" and then typecasting,  
the assumption becomes explicit in the code. By having it as another  
type right away, you're kind of masking the issue.


I recommend you write it as:

-(IBAction) doSomething: (id)sender
{
   NSAssert( [sender isKindOfClass: [UIButton class]] );
   UIButton*senderBtn = (UIButton*)sender;

   // use btn here...
}

Or at least put an assert in there if you feel you need an IBAction  
with a non-ID parameter type. The details of the assert are not as  
important. In fact, if you can, use [sender respondsToSelector:  
@selector(whateverYouAreCalling:)] or so instead of -isKindOfClass:.  
The point of the assert is to make your code fail in a noticeable  
way when someone breaks the assumptions it makes.


Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSString and decoding HTML Entities

2009-04-05 Thread Bryan Henry
The HTML entities that Stuart is talking about aren't "percent  
escapes", and aren't replaced by - 
stringByReplacingPercentEscapesUsingEncoding:.


- Bryan

On Apr 5, 2009, at 4:19 PM, Jack Carbaugh wrote:


Why don't you just use the features of NSString ?

stringByReplacingPercentEscapesUsingEncoding:

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#/ 
/apple_ref/doc/uid/2154-BCIECHFE


On Apr 5, 2009, at 3:56 PM, Stuart Malin wrote:

I need to convert strings that contain HTML entities (e.g.,  
’  or &#gt;).  I can't seem to find an NSString method to do  
so (not that I sometimes don't easily miss the obvious).  So, I  
created a category on NSString and made two trivial methods that  
take advantage of toll-free bridging between NSString and  
CFStringRef by using CFXMLCreateStringByEscapingEntities and  
CFXMLCreateStringByUnescapingEntities.  Is there a better way?

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/intrntmn%40aol.com

This email sent to intrn...@aol.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Looking for [NSNumber numberWithString:]

2009-04-01 Thread Bryan Henry
There is no -numberWithString:, no. You'd need to do something like  
[NSNumber numberWithDouble:[someStr doubleValue]].


- Bryan

On Apr 1, 2009, at 9:17 PM, Greg Robertson wrote:


I would like to convert an NSString to an NSNumber. Is there a direct
method for this or should I go NSString to double and then double to
NSNumber?

Thanks

Greg
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSMutableArray is null?

2009-03-31 Thread Bryan Henry
You declared a pointer to an instance of NSMutableArray as an instance  
variable of Example_Class (its in no way global) there, but you didn't  
create an instance of NSMutableArray. Did you do something like this  
at some point?


globalVariable = [[NSMutableArray alloc] init];

- Bryan

On Mar 31, 2009, at 10:12 PM, Pierce Freeman wrote:


Whoops, sorry I didn't put that in...

@interface Example_Class : NSObject {

   IBOutlet NSTableView *tableView;
   NSMutableArray *globalVariable;
}


On 3/31/09 7:09 PM, "I. Savant"  wrote:



  We *can't* assume anything. You left out the most relevant part of
your code: how are you creating "globalVariable"?

--
I.S.



On Mar 31, 2009, at 10:05 PM, Pierce Freeman wrote:


Hi everyone:

I am having a strange problem with NSMutableArray which is that it
doesn't
seem to work with addObjectsFromArray.  I try setting this for a
"global
variable" (forget what they are called in Cocoa) and it just
returned null.
Here is my code (assuming that global Variable is the global
variable which
is a NSMutable Array):

NSArray *testing = [NSArray arrayWithObjects:@"testing", @"testing",
nil];
[globalVariable addObjectsFromArray:testing];

Thanks for any help.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/idiotsavant2005%40gmail.com

This email sent to idiotsavant2...@gmail.com





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Do I need to relase @"string" ??

2009-03-02 Thread Bryan Henry
Assuming that the setter is copying the value passed in (which it  
should be, considering setCurrentMiles: should accept a single  
NSString*), yes James, you should release currentMiles in your - 
(void)dealloc implementation for that class. The release won't affect  
the constant strings, but to be correct and prevent leaks in the case  
where setCurrentMiles: may be passed an non-constant string, you need  
to do that.


Quick note:
If you're using properties and synthesized accessors, NSString*  
properties should be copy and not retain unless you have a good reason  
otherwise.
If you're writing the setter and getter yourself, use -copy and not - 
retain when its an NSString*.


The reason being that, for immutable objects, -copy will be  
effectively the same as -retain...but if setCurrentMiles: is passed an  
NSMutableString* it actually creates a new immutable instance.


Bryan

On Mar 2, 2009, at 4:21 PM, Dave DeLong wrote:

My understanding was that he was referring to the setter in his  
AppDelegate class.  Since the only thing (apparently) getting passed  
into the setter was an NSConstantString, it would seem that he  
wouldn't need to worry about releasing that property.  (Assuming the  
setter was retaining it)


Dave

On Mar 2, 2009, at 2:18 PM, Kyle Sluder wrote:

On Mon, Mar 2, 2009 at 3:58 PM, James Cicenia   
wrote:

DO I HAVE TO WORRY ABOUT RELEASING currentMiles somewhere?


YOU MIGHT WANT TO WORRY about releasing your Shift key.  ;-)

Just follow the memory management guides.  You didn't use +alloc,
+new, or -copy to make the object, so you don't own it.  Therefore  
you

don't have to worry about releasing it.

--Kyle Sluder

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: alloc/release confusion

2009-02-13 Thread Bryan Henry
When you call -show, the UIAlertView is retained elsewhere (somewhere  
in SpringBoard's internals).


It does look a bit odd, and understandably so, but the -release is  
correct there because you still want to relinquish your ownership of  
the object...the ownership you took when you sent the -alloc message.  
That release doesn't actually deallocate the object because it was  
retained by some part of -show's implementation.


Bryan

Sent from my iPhone

On Feb 13, 2009, at 6:02 PM, Boon Chew  wrote:


Hi all,

I am very new to Cocoa programming (but have programmed in C/C++  
before) and there is one thing I don't understand with alloc and  
release.  Sometimes I see code that alloc an object and release it  
within the same method, even though it's clear that the object is  
still live and well.


For example:

-(IBAction)onButtonPressed
{
 UIAlertView *alert = [[UIAlertView alloc] initWithTitle...];
 [alert show];
 [alert release];
}

Why is the code decrementing the ref count even though the alert  
window is still up?


Also, how do you know when you are decrementing ref count too soon?  
How do you know which object method you call might increase the ref  
count of the object in question?


Thanks!

- boon







___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iphone and images issues

2009-02-07 Thread Bryan Henry
Keep in mind that if you do this, though, Xcode's PNG optimization  
operations (switching RGBA -> GBRA and premultiplying the alpha) won't  
occur if you have any PNGs in that folder - it'll just copy the folder  
whole.


How is having a "messy" bundle any problem? Its not like it actually  
effects anything, and users certainly don't ever see the contents of  
your bundle.


Bryan

On Feb 7, 2009, at 8:19 PM, Sherm Pendley wrote:


On Feb 7, 2009, at 8:10 PM, Emmanuel Pinault wrote:

So I dragged and dropped an image folder into my iphone app under  
the ressources. I specified to copy it.
Now when I build the application, it seems that apple underlying  
just put all the file in a flat structure.


If you don't want the folder structure to be flattened, choose the  
"Create Folder References" option instead of the "Recursively create  
groups" option when you add the folder to your project in Xcode.


sherm--

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Simple memory problem

2009-02-06 Thread Bryan Henry
It sounds to me like you want to use garbage collection, not manual  
memory management.


Does C automatically free() memory when pointers get replaced? No,  
obviously not. Doing so would be silly, and its even more silly to  
want such behavior with Objective-C.


This:

inputString = [NSString string];
inputString = [inputString myMethod];

would crash once the local autorelease pool was emptied using the  
behavior you described. You can't just willy nilly release objects. If  
you reassign the pointer. Or, what about this:


inputString = [[NSString alloc] init];
someIvar = inputString;
inputString = [inputString myMethod];

Oops! someIvar now points to deallocated memory, and of course it  
doesn't point to the "new" inputString.


The behavior you propose suggests a very narrow and underdeveloped  
view on memory and memory management - there is no special connection  
between an object and the variables that are pointers to that object,  
and it seems to me that you think this on some level. Manual memory  
management is just that - manual - you don't want to compiler  
automatically releasing stuff for you.


Bryan

On Feb 6, 2009, at 5:24 AM, harry greenmonster wrote:

I cant help but think the preferable way Objective C should would is  
to send  a release automatically to the receiver of a product of  
itself.


inputString = [inputString myMethod];

Its fairly clear in this situation that the original 'inputString'  
is not wanted and needs to die, and would seem like a more sensible  
way for the compiler to work as I struggle to think of a situation  
where the old value serves any perpose, being that it is now  
orphaned and useless.


Hence my confusion on the matter.


On 6 Feb 2009, at 03:17, Scott Ribe wrote:


So, how do I keep a copy hanging around AND kill the mysterious new
copy then (which shares the same name as the old one presumably)?


2 pointer variables...

--
Scott Ribe
scott_r...@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Memory management question in Objective-C 2.0 @property notation

2009-02-05 Thread Bryan Henry
No, you do need to release it. You should release the ivars for any  
retain or copy-type properties in your -dealloc implementation. Is  
your property was just an assign property, then you would not need to  
release it in -dealloc.


Also - a common mistake when using properties is to set the ivar, but  
not use the property setter.


This:   name = [NSString string];
is very different from this:self.name = [NSString string];
as the latter is equivalent to: [self setName:[NSString string]];

Bryan

P.S. Why isn't cocoa-dev@lists.apple.com set as the Reply-To header  
for emails to the list? I know other people must make the mistake of  
hitting Reply instead of Reply All.


On Feb 5, 2009, at 3:21 AM, Devraj Mukherjee wrote:


Thanks again both of you.

assuming that I do self.name = [NSString string] and since it the
NSString helper message, I shouldn't have to release that in my
dealloc implementation.

Or am I understanding this incorrectly.

On Thu, Feb 5, 2009 at 5:01 PM, Kiel Gillard  
 wrote:

On 05/02/2009, at 4:20 PM, Chris Suter wrote:

On Thu, Feb 5, 2009 at 4:10 PM, Kiel Gillard  
 wrote:


However, doing this will yield a memory leak:

self.name = [[NSString alloc] init];

...because the property definition tells the compiler the methods it

synthesizes should retain the value.

You're right that it will leak in that case but you've given the  
wrong

reason as to why. Memory management rules are covered by Apple's
documentation.

Regards,

Chris

Thanks for your reply, Chris.
I suggest that the code quoted above will yield a memory leak  
because the

NSString instance allocated will have a retain count of two after the
setName: message has be sent to self. To correct this error, I  
suggest that

the code should read:
self.name = [[[NSString alloc] init] autorelease];
Under the heading of "Setter Semantics"
of ,
I can see that Apple's documentation clearly states that the  
implementation
of a property declared with a retain attribute will send a retain  
message to

the value given in the right hand side of the assignment.
I'm confused as to why else the memory would be leaking? Can you  
please

identify my error?
Thanks,
Kiel





--
"The secret impresses no-one, the trick you use it for is everything"
- Alfred Borden (The Prestiege)
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to bryanhe...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Returning a value from a function

2008-04-08 Thread Bryan Henry
Also, according to your code at the bottom here, you want to return  
a value from a METHOD not a function.


Mike.


That's splitting hairs just a little. Most people use the terms  
interchangeably, at least informally, and trying to introduce the  
distinction just for the sake of it has the potential to confuse things.


Bryan

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: Returning a value from a function

2008-04-08 Thread Bryan Henry

On Apr 8, 2008, at 4:36 AM, Mike R. Manzano wrote:
BTW, it's customary for argument names to start with a lowercase;  
i.e., valueThree:(double)valueThree.


Just to add on something else here, its also customary to start class  
names (your convertValues class) with an uppercase character, so  
ConvertValues for a class name.


Bryan

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: Returning a value from a function

2008-04-08 Thread Bryan Henry
Change your function definition to - 
(NSString*)convertFunctionWithValues:(NSString*)etc and just add  
"return retVal;"


Also, its not really necessary but in the interest of good coding  
practices you may want to consider passing an array (NSArray of  
NSNumber or whatever) to -[convertValues  
convertFunctionWithValues:ValueTwo:ValueThree:ValueFour:ValueFire:ValueSix:ValueSeven:ValueEight:Pecision 
:] since as I'm sure you can tell that's quite the doozy of a function  
name.


You also don't need the = @"" part from your NSString declaration.

Bryan

On Apr 7, 2008, at 4:59 PM, Stuart Green wrote:


Hi,

I've currently got a function of type void that works swimmingly in  
the debugger.  I now need to populate a text field with the value of  
the generated string within the function.  The function is declared  
along the lines:


- (void)convertFunctionWithValues:(NSString *)valueOne ValueTwo: 
(double)valueTwo ValueThree:(double)valueThree ValueFour: 
(double)valueFour ValueFive:(NSString *)valueFive ValueSix: 
(double)valueSix ValueSeven:(double)valueSeven ValueEight: 
(double)valueEight Precision:(int)precision;

{
// Declarations here
NSString *retVal = @"";   

// Calculations go here...
// Lots of them...

// We've got the result, now we want to return it
	retVal = [NSString stringWithFormat:@"%c%c%i%i", retLet1,  
retLet2,retFinalCalcA,retFinalCalcB];


}

How do I now return this string value?  The initialisation and  
calling is done via:


convertedValue = [[convertValues alloc] init];
	valToBeDisplayed = [convertedValue  
convertFunctionWithValues:valueOne ValueTwo:valueTwo  
ValueThree:valueThree ValueFour:valueFour ValueFive:valueFive  
ValueSix:valueSix ValueSeven:valueSeven ValueEight:valueEight  
Precision:precision];

// Display returned value
self.valDisplayField.text = valToBeDisplayed;
[convertedValue release];

Any ideas appreciated.

Thanks,

Stu


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com

This email sent to [EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]