Unable to find Categories referenced from Static Library containing in another Static Library

2010-05-13 Thread Symadept
Hi,

I have one Static Library called A.a which contains some categories. I am
referencing A.a into another library called B.a. I am using this B.a into
one Executable. In this case I am calling a method in B.a which calls the
category from A.a. Here it crashes with error unreference. Both A.a and B.a
has the Other Linker Flags as -all_load and -ObjC set. And the Executable
also has these flags set. Am I missing anything in this case?

Any sort of clue is really helpful.

Regards
Mustafa shaik
___

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


[iPhone] How to create a unique string

2010-05-13 Thread Tharindu Madushanka
Hi,

I want to generate a unique string every time i push a button. Can I create
some string like that using a time stamp NSDate object may be.

ex. e3df44646ngfd5454nrteter

Its really useful to know about a small code segment or way to create a
unique string in iPhone.

Thank you and Kind Regards,

Tharindu
___

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] How to create a unique string

2010-05-13 Thread John Pannell
Hi Tharindu-

In the past, I have used a UUID for this purpose.  You could add the following 
method to a category on NSString to make it quite easy:

+ (NSString*) stringWithNewUUID
{
CFUUIDRef uuidObj = CFUUIDCreate(nil);
NSString *newUUID = (NSString*)CFUUIDCreateString(nil, uuidObj);
CFRelease(uuidObj);
return [newUUID autorelease];
}

Then, you could just call [NSString stringWithNewUUID] every time you needed a 
new unique string.

Hope this helps!

John

On May 13, 2010, at 6:48 AM, Tharindu Madushanka wrote:

> Hi,
> 
> I want to generate a unique string every time i push a button. Can I create
> some string like that using a time stamp NSDate object may be.
> 
> ex. e3df44646ngfd5454nrteter
> 
> Its really useful to know about a small code segment or way to create a
> unique string in iPhone.
> 
> Thank you and Kind Regards,
> 
> Tharindu

___

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] How to create a unique string

2010-05-13 Thread Eric Gorr

On May 13, 2010, at 8:48 AM, Tharindu Madushanka wrote:

> Hi,
> 
> I want to generate a unique string every time i push a button.

As John P. said, I would going with a UUID. They are, by definition, what you 
want.

___

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] How to create a unique string

2010-05-13 Thread Jonathan del Strother
On 13 May 2010 14:00, John Pannell  wrote:
> Hi Tharindu-
>
> In the past, I have used a UUID for this purpose.  You could add the 
> following method to a category on NSString to make it quite easy:
>
> + (NSString*) stringWithNewUUID
> {
>    CFUUIDRef uuidObj = CFUUIDCreate(nil);
>    NSString *newUUID = (NSString*)CFUUIDCreateString(nil, uuidObj);
>    CFRelease(uuidObj);
>    return [newUUID autorelease];
> }
>
> Then, you could just call [NSString stringWithNewUUID] every time you needed 
> a new unique string.
>
> Hope this helps!
>
> John
>
> On May 13, 2010, at 6:48 AM, Tharindu Madushanka wrote:
>
>> Hi,
>>
>> I want to generate a unique string every time i push a button. Can I create
>> some string like that using a time stamp NSDate object may be.
>>
>> ex. e3df44646ngfd5454nrteter
>>
>> Its really useful to know about a small code segment or way to create a
>> unique string in iPhone.
>>
>> Thank you and Kind Regards,
>>
>> Tharindu
>

It might be simpler to just use [[NSProcessInfo processInfo]
globallyUniqueString]

-Jonathan
___

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] How to create a unique string

2010-05-13 Thread Tharindu Madushanka
Hi,

Thanks a lot. [[NSProcessInfo processInfo] globallyUniqueString] seems to be
the easiest one.

cool.

Thank you very much,

Tharindu

>
> It might be simpler to just use [[NSProcessInfo processInfo]
> globallyUniqueString]
>
> -Jonathan
>
___

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] How to create a unique string

2010-05-13 Thread Eric Gorr
So long as it is ok for the string to be unique for the network the user is on 
only. From the docs:

The ID includes the host name, process ID, and a time stamp, which ensures that 
the ID is unique for the network.

A UUID (Universally Unique Identifier) is entirely unique.



On May 13, 2010, at 10:18 AM, Tharindu Madushanka wrote:

> Hi,
> 
> Thanks a lot. [[NSProcessInfo processInfo] globallyUniqueString] seems to be
> the easiest one.
> 
> cool.
> 
> Thank you very much,
> 
> Tharindu
> 
>> 
>> It might be simpler to just use [[NSProcessInfo processInfo]
>> globallyUniqueString]
>> 
>> -Jonathan
>> 
> ___
> 
> 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/mailist%40ericgorr.net
> 
> This email sent to mail...@ericgorr.net

___

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] How to create a unique string

2010-05-13 Thread Thomas Davie

On 13 May 2010, at 15:33, Eric Gorr wrote:

> So long as it is ok for the string to be unique for the network the user is 
> on only. From the docs:
> 
> The ID includes the host name, process ID, and a time stamp, which ensures 
> that the ID is unique for the network.
> 
> A UUID (Universally Unique Identifier) is entirely unique.

No it's not, as can easily be proven by observing that there are only a finite 
number of 40 character strings.  A UUID is probabilistically 
unique.___

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] How to create a unique string

2010-05-13 Thread Michael Ash
On Thu, May 13, 2010 at 10:56 AM, Thomas Davie  wrote:
>
> On 13 May 2010, at 15:33, Eric Gorr wrote:
>
>> So long as it is ok for the string to be unique for the network the user is 
>> on only. From the docs:
>>
>> The ID includes the host name, process ID, and a time stamp, which ensures 
>> that the ID is unique for the network.
>>
>> A UUID (Universally Unique Identifier) is entirely unique.
>
> No it's not, as can easily be proven by observing that there are only a 
> finite number of 40 character strings.  A UUID is probabilistically unique.

CFUUID includes the MAC address, so unless your MAC address is cloned
or you manage to generate two UUIDs on the same device in the same
100ns time interval or the calendar rolls over (which will take about
3700 years), they are entirely unique within the universe of CFUUID
strings.

Mike
___

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] How to create a unique string

2010-05-13 Thread Thomas Wetmore
UUID is the way to go. Here is a category I use to generate unique ids. It uses 
core foundation to generate a 128-bit UUID and converts that to a 22-character 
string. The conventional string form of a UUID is 36 characters long. A goal of 
this code was to minimize the size of the id since my application generates 
billions of them.



static unichar x (unsigned int);

// This category uses Apple's core foundation to generate a 128-bit universal 
id and then
// encodes the bits into a 22 character string. The conventional string form of 
a universal
// id is 36 characters long, so this saves 14 characters.
//
@implementation NSString (TWUUID)

+ (NSString*) stringWithUniqueId
{
CFUUIDRef uuid = CFUUIDCreate(NULL);
CFUUIDBytes b = CFUUIDGetUUIDBytes(uuid);
unichar unichars[22];
unichar* c = unichars;
*c++ = x(b.byte0 >> 2);
*c++ = x((b.byte0 & 3 << 4) + (b.byte1 >> 4));
*c++ = x((b.byte1 & 15 << 2) + (b.byte2 >> 6)); 
*c++ = x(b.byte2 & 63);
*c++ = x(b.byte3 >> 2);
*c++ = x((b.byte3 & 3 << 4) + (b.byte4 >> 4));
*c++ = x((b.byte4 & 15 << 2) + (b.byte5 >> 6));
*c++ = x(b.byte5 & 63);
*c++ = x(b.byte6 >> 2);
*c++ = x((b.byte6 & 3 << 4) + (b.byte7 >> 4));
*c++ = x((b.byte7 & 15 << 2) + (b.byte8 >> 6));
*c++ = x(b.byte8 & 63);
*c++ = x(b.byte9 >> 2);
*c++ = x((b.byte9 & 3 << 4) + (b.byte10 >> 4));
*c++ = x((b.byte10 & 15 << 2) + (b.byte11 >> 6));
*c++ = x(b.byte11 & 63);
*c++ = x(b.byte12 >> 2);
*c++ = x((b.byte12 & 3 << 4) + (b.byte13 >> 4));
*c++ = x((b.byte13 & 15 << 2) + (b.byte14 >> 6));
*c++ = x(b.byte14 & 63);
*c++ = x(b.byte15 >> 2);
*c = x(b.byte15 & 3);
CFRelease(uuid);
return [NSString stringWithCharacters: unichars length: 22];
}

@end

// Convert six-bit values into letters, numbers or _ or $ (64 characters in 
that set).
//
unichar x (unsigned int c)
{
if (c < 26) return 'a' + c;
if (c < 52) return 'A' + c - 26;
if (c < 62) return '0' + c - 52;
if (c == 62) return '$';
return '_';
}

On May 13, 2010, at 11:05 AM, Michael Ash wrote:
> 
> CFUUID includes the MAC address, so unless your MAC address is cloned
> or you manage to generate two UUIDs on the same device in the same
> 100ns time interval or the calendar rolls over (which will take about
> 3700 years), they are entirely unique within the universe of CFUUID
> strings.
> 
> Mike
> ___
> 
> 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/ttw4%40verizon.net
> 
> This email sent to t...@verizon.net

Tom Wetmore, Chief Bottle Washer, DeadEnds Software

___

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: How to edit/resize embedded graphics and images in a NSTextView ?

2010-05-13 Thread Anders Sommer Lassen
Hi,

When I noticed that IB has a control called "Image Editing" for the NSTextView, 
I hope that this was going to be easy.

Later on I discovered, that I have to do more.

As I mentioned in my email, I have tried to set the property

>> -(void)setAllowsImageEditing:(BOOL)

but this did not help. (I guess, this is what IB does behind the scene, when 
enabling "Image Editing" ).

Now, I think that I will have to override some methods in the two classes you 
mentioned to get the resize handles visible.


Kind regards,

Anders Lassen



On Apr 17, 2010, at 6:29 AM, Chaitanya Pandit wrote:

> NSTextView by default won't allow you to resize the media objects, these 
> media objects are actually NSTextAttachments displayed in 
> NSTextAttachmentCells.
> 
> Thanks,
> 
> Chaitanya
> 
> On May 12, 2010, at 10:27 PM, Anders Sommer Lassen wrote:
> 
>> Hi,
>> 
>> I want to embed graphics and images in a NSTextView, and hopefully support 
>> resizing of these embedded object.
>> 
>> So far, I can embed an image object in my NSTextView, but I cannot figure 
>> out, how to make editing of the object possible.
>> 
>> The NSTextView has a property called:
>> 
>> -(void)setAllowsImageEditing:(BOOL)
>> 
>> Which I have set to YES.
>> 
>> The documentation for this property states:
>> 
>> "Indicates whether image attachments should permit editing of their images."
>> 
>> But when I select the embedded objects nothing happens (I hoped to see a 
>> resize handle when I clicked the embedded image).
>> 
>> Any suggestions are welcome.
>> 
>> 
>> Kind regards,
>> 
>> Anders Lassen
>> 
>> ___
>> 
>> 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/chaitanya%40expersis.com
>> 
>> This email sent to chaita...@expersis.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


Xcode 3.2 - Missing iPhoneOS 2.2.1

2010-05-13 Thread Patrick M. Rutkowski
Is it just me, or is Xcode 3.2 missing the 2.2.1 version of the iPhone SDK?

Can that be remedied somehow? Or is Apple intentionally dropped support there?

-Patrick

P.S.
Is there a better list to be posting iPhone questions to?
___

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] How to create a unique string

2010-05-13 Thread Louis Gerbarg
On May 13, 2010, at 11:05 AM, Michael Ash  wrote:

> On Thu, May 13, 2010 at 10:56 AM, Thomas Davie  wrote:
>> 
>> On 13 May 2010, at 15:33, Eric Gorr wrote:
>> 
>>> So long as it is ok for the string to be unique for the network the user is 
>>> on only. From the docs:
>>> 
>>> The ID includes the host name, process ID, and a time stamp, which ensures 
>>> that the ID is unique for the network.
>>> 
>>> A UUID (Universally Unique Identifier) is entirely unique.
>> 
>> No it's not, as can easily be proven by observing that there are only a 
>> finite number of 40 character strings.  A UUID is probabilistically unique.
> 
> CFUUID includes the MAC address, so unless your MAC address is cloned
> or you manage to generate two UUIDs on the same device in the same
> 100ns time interval or the calendar rolls over (which will take about
> 3700 years), they are entirely unique within the universe of CFUUID
> strings.

No, it doesn't use the MAC address. MAC addresses are uses as part of type 1 
uuids, CFUUID has generated type 4 (random) uuids by default since Tiger, and 
has always generated type 4 on iPhone. If you look at the source to CF there is 
a way to force it to generate type 1 uuids, but I doubt that is supported. 

Louis  ___

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] How to create a unique string

2010-05-13 Thread Eric Gorr

On May 13, 2010, at 11:52 AM, Louis Gerbarg wrote:

> On May 13, 2010, at 11:05 AM, Michael Ash  wrote:
> 
>> On Thu, May 13, 2010 at 10:56 AM, Thomas Davie  wrote:
>>> 
>>> On 13 May 2010, at 15:33, Eric Gorr wrote:
>>> 
 So long as it is ok for the string to be unique for the network the user 
 is on only. From the docs:
 
 The ID includes the host name, process ID, and a time stamp, which ensures 
 that the ID is unique for the network.
 
 A UUID (Universally Unique Identifier) is entirely unique.
>>> 
>>> No it's not, as can easily be proven by observing that there are only a 
>>> finite number of 40 character strings.  A UUID is probabilistically unique.
>> 
>> CFUUID includes the MAC address, so unless your MAC address is cloned
>> or you manage to generate two UUIDs on the same device in the same
>> 100ns time interval or the calendar rolls over (which will take about
>> 3700 years), they are entirely unique within the universe of CFUUID
>> strings.
> 
> No, it doesn't use the MAC address. MAC addresses are uses as part of type 1 
> uuids, CFUUID has generated type 4 (random) uuids by default since Tiger, and 
> has always generated type 4 on iPhone. If you look at the source to CF there 
> is a way to force it to generate type 1 uuids, but I doubt that is supported. 

From the documentation:

http://bit.ly/9m1Ggb
UUIDs (Universally Unique Identifiers), also known as GUIDs (Globally Unique 
Identifiers) or IIDs (Interface Identifiers), are 128-bit values guaranteed to 
be unique. A UUID is made unique over both space and time by combining a value 
unique to the computer on which it was generated—usually the Ethernet hardware 
address—and a value representing the number of 100-nanosecond intervals since 
October 15, 1582 at 00:00:00.

So, regardless, a UUID (via the CFUUID API) is going to be better then 
[[NSProcessInfo processInfo] globallyUniqueString] 
___

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] How to create a unique string

2010-05-13 Thread Douglas Davidson

On May 13, 2010, at 8:52 AM, Louis Gerbarg wrote:

>>> No it's not, as can easily be proven by observing that there are only a 
>>> finite number of 40 character strings.  A UUID is probabilistically unique.
>> 
>> CFUUID includes the MAC address, so unless your MAC address is cloned
>> or you manage to generate two UUIDs on the same device in the same
>> 100ns time interval or the calendar rolls over (which will take about
>> 3700 years), they are entirely unique within the universe of CFUUID
>> strings.
> 
> No, it doesn't use the MAC address. MAC addresses are uses as part of type 1 
> uuids, CFUUID has generated type 4 (random) uuids by default since Tiger, and 
> has always generated type 4 on iPhone. If you look at the source to CF there 
> is a way to force it to generate type 1 uuids, but I doubt that is supported. 

The use of the MAC address was removed because of privacy concerns.  CFUUID 
generation is only probabilistically unique, but the probability of collisions 
is vanishingly small.

Douglas Davidson

___

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] How to create a unique string

2010-05-13 Thread Michael Ash
On Thu, May 13, 2010 at 11:52 AM, Louis Gerbarg  wrote:
> On May 13, 2010, at 11:05 AM, Michael Ash  wrote:
>
>> On Thu, May 13, 2010 at 10:56 AM, Thomas Davie  wrote:
>>>
>>> On 13 May 2010, at 15:33, Eric Gorr wrote:
>>>
 So long as it is ok for the string to be unique for the network the user 
 is on only. From the docs:

 The ID includes the host name, process ID, and a time stamp, which ensures 
 that the ID is unique for the network.

 A UUID (Universally Unique Identifier) is entirely unique.
>>>
>>> No it's not, as can easily be proven by observing that there are only a 
>>> finite number of 40 character strings.  A UUID is probabilistically unique.
>>
>> CFUUID includes the MAC address, so unless your MAC address is cloned
>> or you manage to generate two UUIDs on the same device in the same
>> 100ns time interval or the calendar rolls over (which will take about
>> 3700 years), they are entirely unique within the universe of CFUUID
>> strings.
>
> No, it doesn't use the MAC address. MAC addresses are uses as part of type 1 
> uuids, CFUUID has generated type 4 (random) uuids by default since Tiger, and 
> has always generated type 4 on iPhone. If you look at the source to CF there 
> is a way to force it to generate type 1 uuids, but I doubt that is supported.

Apple ough to update the docs, then, since they say, " UUID is made
unique over both space and time by combining a value unique to the
computer on which it was generated—usually the Ethernet hardware
address"

I guess I should know better than to trust Apple's docs by now.

Mike
___

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: How to edit/resize embedded graphics and images in a NSTextView ?

2010-05-13 Thread Kyle Sluder
On Thu, May 13, 2010 at 8:38 AM, Anders Sommer Lassen
 wrote:
> Now, I think that I will have to override some methods in the two classes you 
> mentioned to get the resize handles visible.

There are no resize handles. The code simply doesn't exist in the text system.

You will be writing quite a bit of custom code, including subclassing
NSTextContainer. See the last illustration in Common Configurations in
the Text System Overview:
http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/TextArchitecture/Concepts/CommonConfigs.html#//apple_ref/doc/uid/2840-CJBJHGAG

--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: [iPhone] How to create a unique string

2010-05-13 Thread Eric Gorr

On May 13, 2010, at 12:01 PM, Michael Ash wrote:

> On Thu, May 13, 2010 at 11:52 AM, Louis Gerbarg  wrote:
>> On May 13, 2010, at 11:05 AM, Michael Ash  wrote:
>> 
>>> On Thu, May 13, 2010 at 10:56 AM, Thomas Davie  wrote:
 
 On 13 May 2010, at 15:33, Eric Gorr wrote:
 
> So long as it is ok for the string to be unique for the network the user 
> is on only. From the docs:
> 
> The ID includes the host name, process ID, and a time stamp, which 
> ensures that the ID is unique for the network.
> 
> A UUID (Universally Unique Identifier) is entirely unique.
 
 No it's not, as can easily be proven by observing that there are only a 
 finite number of 40 character strings.  A UUID is probabilistically unique.
>>> 
>>> CFUUID includes the MAC address, so unless your MAC address is cloned
>>> or you manage to generate two UUIDs on the same device in the same
>>> 100ns time interval or the calendar rolls over (which will take about
>>> 3700 years), they are entirely unique within the universe of CFUUID
>>> strings.
>> 
>> No, it doesn't use the MAC address. MAC addresses are uses as part of type 1 
>> uuids, CFUUID has generated type 4 (random) uuids by default since Tiger, 
>> and has always generated type 4 on iPhone. If you look at the source to CF 
>> there is a way to force it to generate type 1 uuids, but I doubt that is 
>> supported.
> 
> Apple ough to update the docs, then, since they say, " UUID is made
> unique over both space and time by combining a value unique to the
> computer on which it was generated—usually the Ethernet hardware
> address"
> 
> I guess I should know better than to trust Apple's docs by now.

Sigh. Off to file a bug.

rdar://7979423



___

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: Xcode 3.2 - Missing iPhoneOS 2.2.1

2010-05-13 Thread Nick Zitzmann

On May 13, 2010, at 9:47 AM, Patrick M. Rutkowski wrote:

> Is it just me, or is Xcode 3.2 missing the 2.2.1 version of the iPhone SDK?

You're correct.

> Can that be remedied somehow?

If you can go back to Leopard and the older SDK. Otherwise, no.

> Or is Apple intentionally dropped support there?

Xcode usually only includes SDKs for the current and previous two major 
versions of the OS.

BTW, this is probably a better question for the xcode-users list...

Nick Zitzmann


___

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: Xcode 3.2 - Missing iPhoneOS 2.2.1

2010-05-13 Thread Clark Cox
On Thu, May 13, 2010 at 8:47 AM, Patrick M. Rutkowski
 wrote:
> Is there a better list to be posting iPhone questions to?

The forums at https://devforums.apple.com/ are the proper place (and
the *only* place for content that is under NDA).

-- 
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/archive%40mail-archive.com

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


Re: Finder refresh issue in Mac OS 10.5

2010-05-13 Thread Sachin Porwal
Hi James,

Thanks for your help provided. I tried to use the function provided, but it
didn't help much. The symbolic link is not getting refreshed & still shows
the broken target path. I noticed that if i browse the complete target path
in finder before launching the .app thru symlink, it works fine.

Thanks,
Sachin

On Tue, May 11, 2010 at 10:52 PM, James Walker wrote:

> On 5/10/2010 7:36 AM, Sachin Porwal wrote:
>
>  I also tried using noteFileSystemChanged after creating the shortcut :
>>
>
> Try sending a kAESync event to the Finder.  Here's my code to do it. Note
> that although this is Carbon code, it will compile for the x86_64
> architecture.  Use CFURLGetFSRef to go from an NSURL* to an FSRef.
>
> #import 
>
> /*!
>@function   SendFinderSyncEvent
>
>@abstract   Send an Apple event to the Finder to update the display
>of the item specified.
>
>@param  inObjectRef A reference to a file or folder.
>
>@result An OS error code.
> */
> OSStatusSendFinderSyncEvent( const FSRef* inObjectRef )
> {
>AppleEvent  theEvent = { typeNull, NULL };
>AppleEvent  replyEvent = { typeNull, NULL };
>AliasHandle itemAlias = NULL;
>const OSTypekFinderSig = 'MACS';
>
>OSStatuserr = FSNewAliasMinimal( inObjectRef, &itemAlias );
>if (err == noErr)
>{
>err = AEBuildAppleEvent( kAEFinderSuite, kAESync,
>typeApplSignature, &kFinderSig, sizeof(OSType),
>kAutoGenerateReturnID,  kAnyTransactionID, &theEvent,
>NULL, "'':alis(@@)", itemAlias );
>
>if (err == noErr)
>{
>err = AESendMessage( &theEvent, &replyEvent, kAENoReply,
>kAEDefaultTimeout );
>
>AEDisposeDesc( &replyEvent );
>AEDisposeDesc( &theEvent );
>}
>
>DisposeHandle( (Handle)itemAlias );
>}
>
>return err;
> }
>
> --
>  James W. Walker, Innoventive Software LLC
>  
>
___

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


Filling a drawer (Core Data and a newbie problem)

2010-05-13 Thread Paul Johnson
I have a Core Data application with a drawer. The drawer contents is an
array that I want to initialize from a file created by a Core Data Command
Line tool.


In applicationDidFinishLaunching: I have set up the Managed Object Context.
I've initialized the Persistent Store Coordinator, read the .mom file, and
near as I can tell I've set everything up as I'm supposed to.


Now in Interface Builder I'm trying to set up the Bindings so the data gets
read from memory and displayed when I open the drawer. Pardon my ignorance,
but I wonder if someone can suggest what I need to do to accomplish this. I
just can't seem to get this to work.
___

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 find Categories referenced from Static Library containing in another Static Library

2010-05-13 Thread Jens Alfke


On May 13, 2010, at 2:51 AM, Symadept wrote:


Here it crashes with error unreference.


I don't know what that means. What exactly is the error message? (It's  
always better to quote actual error messages.)


—Jens___

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


CocoaHeadsNYC TONIGHT (Thursday), 6PM

2010-05-13 Thread Andy Lee
Alex McAuley will give a talk entitled "You're a Tool If You Don't Use 
Instruments."

As usual:

(1) Please feel free to bring questions, code, and works in progress. We have a 
projector and we like to see code and try to help.
(2) We'll have burgers and beer afterwards.
(3) If there's a topic you'd like presented, let us know.
(4) If *you'd* like to give a talk, let me know.

Thursday, May 13
6:00- 8:00
Downstairs at Tekserve, on 23rd between 6th and 7th
 for directions and map
Everyone's welcome. Just tell the person at the front you're there for 
CocoaHeads.

Hope to see you there!

--Andy
___

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


CocoaHeads Utah Tonight (Thursday), 7pm

2010-05-13 Thread Dave DeLong
Reed Olsen will be presenting on xiblessness (how to write apps without xibs).

We'll be meeting in room W110 of the Tanner building on BYU campus 
(http://map.byu.edu/?building=tnrb) from 7 to 9 pm.

Parking is free.

See you there!

Dave

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 arch...@mail-archive.com

Re: Filling a drawer (Core Data and a newbie problem)

2010-05-13 Thread Quincey Morris
On May 13, 2010, at 10:25, Paul Johnson wrote:

> In applicationDidFinishLaunching: I have set up the Managed Object Context.
> I've initialized the Persistent Store Coordinator, read the .mom file, and
> near as I can tell I've set everything up as I'm supposed to.
> 
> Now in Interface Builder I'm trying to set up the Bindings so the data gets
> read from memory and displayed when I open the drawer.

The answer depends on what "the data" is. Typically, there are three 
possibilities:

1. You're trying to display all the objects in a one-to-many relationship. In 
that case, create a NSArrayController in your XIB file, configure it for 
"entity" mode and bind its content set to the relationship.

2. You're trying to display only some objects in a one-to-many relationship. Do 
the same as #1, but also specify a fetch predicate for the array controller.

3. You're trying to display some other collection of managed objects. In that 
case, create an array controller in "class" mode, and bind its content to an 
array property of File's Owner. Have your code initially load and subsequently 
maintain this array property KVO-compliantly.

In any of the cases, you can also use sort descriptors or filter predicates on 
the array controller if necessary.

Does that get you any closer to your goal?


___

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


Figuring out what's causing redrawing

2010-05-13 Thread Nick Zitzmann
I've tried searching around but haven't found an answer to this. I have several 
views that are being constantly & apparently needlessly redrawn and I can't 
figure out why this is happening. How do I catch the culprit that is causing 
the views to be redrawn? The redrawing is appearing in the usual place, within 
a call to -[NSWindow displayIfNeeded] in the run loop.

I already tried the following:

1. Breaking on -[NSView setNeedsDisplayInRect:], but -drawRect: kept being 
called anyway, so whatever is causing this is circumventing this method.

2. Observing the value of -[NSView needsDisplay], but the value never changes, 
and it keeps getting redisplayed anyway. Apparently the value is a perpetual 
YES...

Nick Zitzmann


___

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: How to edit/resize embedded graphics and images in a NSTextView ?

2010-05-13 Thread Anders Sommer Lassen
Thanks, I think this was helpful.

On May 13, 2010, at 6:02 PM, Kyle Sluder wrote:

> On Thu, May 13, 2010 at 8:38 AM, Anders Sommer Lassen
>  wrote:
>> Now, I think that I will have to override some methods in the two classes 
>> you mentioned to get the resize handles visible.
> 
> There are no resize handles. The code simply doesn't exist in the text system.
> 
> You will be writing quite a bit of custom code, including subclassing
> NSTextContainer. See the last illustration in Common Configurations in
> the Text System Overview:
> http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/TextArchitecture/Concepts/CommonConfigs.html#//apple_ref/doc/uid/2840-CJBJHGAG
> 
> --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


Notification of unmount events

2010-05-13 Thread BJ Homer
I'm trying to detect disk mount/unmount notifications from a Foundation
tool. Previous questions to this list (e.g.
http://lists.apple.com/archives/cocoa-dev/2007/Jan/msg01170.html) on this
topic have suggested the DiskArbitration framework, which I am using.

The DiskArbitration framework has a number of callbacks. However, none seems
to do what I'm wanting to do.

DiskAppeared callback:
- Called when a volume is attached, even if not mounted. That is, if I have
2 partitions on an external drive but only 1 mounted, I will still hear
about both.

DiskDisappeared callback:
- Called when a volume is physically gone, not just unmounted. If I unmount
one volume on my external drive and leave the other mounted, I won't hear
about the unmount through this callback.

DiskDescriptionChanged callback:
- I can register for changes on the DAVolumePath key, and this works if the
volume is a physical external drive. If it's a network drive, though, then
the description never *changes*; it begins life with the DAVolumePath key
correctly populated. Between DiskAppeared, DiskDisappeared and
DiskDescription I can usually be notified of all disk mount events, but I
get some duplication, and in general it feels very hacked together.

DiskMountApproval callback:
- Notifies me that someone *wants* to mount the volume, but does not
guarantee that the disk was actually mounted.

DiskUnmountApproval callback:
- Notifies me that someone *wants* to unmount the volume, but does not
guarantee that the volume was actually unmounted. In one case I'm working on
right now, I'll have an external drive attached. On reboot, I register for
the mountApproval and unmountApproval callbacks. The volume is mounted and
then I immediately get an unmountApproval callback. If I treat this callback
as a sign that the drive actually *was* unmounted, then I would assume that
the volume is being mounted and immediately unmounted (within milliseconds)
upon startup. That is clearly not the case, since the volume is still
attached when I get up into my login session. This is in a LaunchDaemon, and
the code has been running the whole time without any further
DiskArbitrationCallbacks.


Previous answers (including the one I linked to) have suggested looking at
the code of the disktool utility. It correctly handles situations like this.
It appears, though, that it is using additional information. disktool.c
includes 
http://www.opensource.apple.com/source/DiskArbitration/DiskArbitration-183/DiskArbitration/DiskArbitrationPrivate.h>>,
and calls functions defined there including
DiskArbRegisterCallback_UnmountPreNotification
and DiskArbRegisterCallback_UnmountPostNotification. That "PostNotification"
part looks like what I need in the case of unmounting. Unfortunately, it's
in a private header. I could, of course, copy that header into my project,
but I would have no guarantee that the API would be stable between Leopard
and Snow Leopard, for example. And even though the header is open source and
publicly available, I think it still falls into the category of a private
API, and thus I'd rather avoid that.

The context of all this, since I'm sure someone will ask, is a backup daemon
(a LaunchDaemon) which is keeping track of what files are dirty; when a
volume is mounted, I need to check to see whether any files on that volume
match my rules of what to back up. When a volume is unmounted, I need to
update some internal state to stop tracking those files.

So, my question: is there a better way to be notified of disk mount/unmount
events?

If there's a better list for such questions, please feel free to direct me
there. I searched on lists.apple.com, and everything relating to
DiskArbitration was showing up on Cocoa-dev.

Thanks,

-BJ Homer
___

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] Frustrated by a simple task

2010-05-13 Thread WT
On May 13, 2010, at 12:39 AM, Ricky Sharp wrote:

> Splash screens should be avoided at all costs in iPhone OS apps.  Remember 
> that you want the app to launch as quickly as possible and let the user 
> immediately begin doing tasks.  Splash screens are typically only useful when 
> a desktop app needs to pre-load lots of resources.  On iPhone OS, you want to 
> load things lazily.

I totally concur, but...

> But, if your hand is being forced, then read on...

... my hand is being forced. I've tried to argue some HIGs sense into the 
client, to no avail. In the end, it's their money, their call, and their fault, 
if the app doesn't do well in the app store.

> It sounds like the app, when running, always displays the status bar.

Correct.

> All you need to do is load up the original launch image in say Photoshop, 
> then basically lob off the top 20 rows of pixels.  The resultant image will 
> then be the bottom-most 460 horizontal lines.

That was one of the things I tried, but somehow it still doesn't work. Clearly, 
I've changed some property somewhere that's messing things up. I think I'll try 
a sample app built afresh and try again, since now I know that just nipping off 
a 20-pixel-long bar at the top should work.

Thanks for the help.
WT___

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


selecting a "sub" icon from an icns file

2010-05-13 Thread John Stoneham
With Icon Composer, you can have 5 separate images for the 5 icon sizes.
Cool. So I've got an icns file set up as my application icon, and I'd like
to use of the smaller "sub" icons in it for an NSAlert message. Problem is I
can't seem to figure out a way to do this. Anyone have any suggestions?
___

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: selecting a "sub" icon from an icns file

2010-05-13 Thread Jens Alfke


On May 13, 2010, at 3:32 PM, John Stoneham wrote:

With Icon Composer, you can have 5 separate images for the 5 icon  
sizes.

Cool.


They're supposed to be conceptually the same image, just tweaked for  
better legibility at different sizes. (16 and 32 pixel icons often  
look blurry if they're automatically scaled down from larger images.)



So I've got an icns file set up as my application icon, and I'd like
to use of the smaller "sub" icons in it for an NSAlert message.  
Problem is I
can't seem to figure out a way to do this. Anyone have any  
suggestions?


If the image is displayed at the size of that sub-image, then the sub- 
image will be drawn. But NSAlert has a single size it uses for icons.


If you want a different icon, you should probably specify it  
explicitly. It's not hard to create your own alert panel in a nib.


—Jens___

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


NSArrayController Undo

2010-05-13 Thread Richard Somers
Consider a Core Data document based application that uses a  
NSArrayController. When the selected objects are removed or deleted  
and then the user does an undo the selected objects are restored but  
the selection is not. I have a custom view object.


I would like the state of the selection to also be restored with an  
undo similar to what happens when working with the Cocoa text system.  
When text is selected, then deleted, and then the user does an undo,  
the restored text is selected.


Should I try to use the persistent document undo manager, create an  
undo manager in the custom NSArrayController subclass, create an undo  
manager in the custom view, or create an undo manager in one of my  
other classes?


--Richard

___

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


new to cocoa

2010-05-13 Thread Alejandro Marcos Aragón
Hi all,

I'm new to Cocoa, and I couldn't find information about an error that I'm 
getting on the web. I'm trying to create an NSMutableDictionary where the keys 
are of type UIButton*:


// create button for unit
UIButton* unitButton = [[UIButton alloc] init];
[sourceButtonMap setObject:[NSString 
stringWithString:@"no"] forKey:unitButton];

Of course, the sourceButtonMap is defined in the class and initialized in the 
init function as sourceButtonMap = [[NSMutableDictionary alloc] init];

The error I get when I try to add the key-value pair is:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '*** -[UIButton copyWithZone:]: unrecognized selector sent to instance 
0x3931e90'

Is this happening because I can't store UIButton* as keys?
Can anyone point me why I'm getting this error? Thank you all,

aa___

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


iPhone: viewDidAppear called, Default.png still visible

2010-05-13 Thread sebi
Hello,

How can I find out if my first view is up and running? When viewDidAppear is 
called on my fist UIViewController I'm still looking only at the Default.png.

What I do first in my app is:
1. wait for viewDidAppear to be called
2. show some wait-indicator
3. load some data from the net
4. hide the wait-indicator
5. display the loaded data

The problem is, that the Default.png doesn't go away until the data is fully 
loaded, so the user only sees a passive screen for some time and doesn't know 
what's going on.
Where can I start the wait indicator and download process so that the user 
actually sees it?
I use some NavigationControllers within a TabBarController, could that be the 
problem? 

thanks and regards,
sebastian mecklenburg___

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


iPad interface orientation basics

2010-05-13 Thread sebi
hello,

sorry, this is probably a very simple thing, but i am quite puzzled right now.

when i do this in my view controller:

- 
(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
 {
CGSize size = self.view.frame.size;
NSLog(NSStringFromCGSize(size));
}

the size is always {768, 1024}, regardless of the orientation. why is it not 
{1024, 768} in landscape mode? The view definitely changes its size, since it 
always fills the full screen...

Thanks and regards,
Sebastian Mecklenburg___

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


AsyncUdpSocket: Receiving duplicate UDP Packet

2010-05-13 Thread Todd Burch
Hi all,

I am using the AsyncUdpSocket class from the AsyncSocket library 
(http://code.google.com/p/cocoaasyncsocket/) to receive UDP packets.

I'm early in development, and all I'm doing is receiving a UDP packet over a 
given port, and logging it to the console. However, for some reason my UDP 
packet (transmitted from other software) appears to be arriving twice!   I'm 
able to verify (via an independent UDP monitoring utility) that the software is 
only broadcasting each packet onceso something must be wrong with my code.  
Can someone help?  This is my first Cocoa project.  The code's not 
pretty...just doing a concept test right now.

The other software is broadcasting UDP packets that look like this: 
"X=1.1243533512, Y=18.129583212, Z=194.129182412" (ASCII encoding) and each 
line is terminated by a newline character.

Here are the relevant bits of my code, from my view controller:

- (void)viewDidLoad {
[super viewDidLoad];

AsyncUdpSocket *aSyncSocket=[[AsyncUdpSocket alloc] initWithDelegate:self]; 
 //We are the delegate for the asynchronous socket object.
[aSyncSocket bindToPort:1234 error:nil];  //We want to listen on port 
1234...don't care about errors for now.
[aSyncSocket receiveWithTimeout:-1 tag:1];  //Start listening for a UDP 
packet.
}

#pragma mark AsyncUdpSocket Delegate Method
//This method is called by the AsyncUdpSocket object when a packet is received:
- (BOOL)onUdpSocket:(AsyncUdpSocket *)sock didReceiveData:(NSData *)data 
withTag:(long)tag fromHost:(NSString *)host port:(UInt16)port
{
 NSString *theLine=[[NSString alloc] initWithData:data 
encoding:NSASCIIStringEncoding];  //Convert the UDP data to an NSString
 NSLog(@"%@", theLine);
 [theLine release];

 [aSyncSocket receiveWithTimeout:-1 tag:1];  //Listen for the next UDP 
packet to arrive...which will call this method again in turn.
 return YES;  //Signal that we didn't ignore the packet.
}

Even though the transmitting software sends out a single packet, like this:
"X=1.12345678, Y=2.3456789, Z=3.4567890" (verified independently),

my console keeps showing this:
"X=1.12345678, Y=2.3456789, Z=3.4567890"
"X=1.12345678, Y=2.3456789, Z=3.4567890"

It's as if the packet is not cleared from the AsyncUdpSocket object's queue 
until *after* I return YES from the delegate method.  If I remove the 
[aSyncSocket receiveWithTimeout:-1 tag:1]; line from the delegate method, then 
I receive one packet...but of course, since I'm not continuing to put more 
"listen" requests into the socket's queue, no more packets are received.

Can anyone who's used AsyncUdpSocket before help out a beginner? Frustrated...

Thanks,
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/archive%40mail-archive.com

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


Re: simple CATextLayer scaling problem

2010-05-13 Thread Scott Anguish

On May 10, 2010, at 7:35 PM, Kyle Sluder wrote:

> On Mon, May 10, 2010 at 3:45 PM, douglas welton
>  wrote:
>> I would suggest that you use KVO to observe the value of the bounds property 
>> of your layer.  When you are notified of the property change, compute the 
>> new size for your font at that point.
> 
> CALayer is not KVO-compliant for its properties.


OK, this turns out not to be true on the desktop.

Anything that is declared as a property in the header is KVO compliant. 

I’ll be updating the documentation when I get the exact list back from 
engineering.

This is not the case on 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/archive%40mail-archive.com

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


Re: new to cocoa

2010-05-13 Thread Dave DeLong
Yes, you cannot use UIButton's as keys in a dictionary, because keys in a 
dictionary are copied, and buttons are not copyable.

Here's the better question:  what are you trying to do?  Using buttons as keys 
in a dictionary seems... odd.

Cheers,

Dave

On May 11, 2010, at 2:36 PM, Alejandro Marcos Aragón wrote:

> Hi all,
> 
> I'm new to Cocoa, and I couldn't find information about an error that I'm 
> getting on the web. I'm trying to create an NSMutableDictionary where the 
> keys are of type UIButton*:
> 
> 
>   // create button for unit
>   UIButton* unitButton = [[UIButton alloc] init];
>   [sourceButtonMap setObject:[NSString 
> stringWithString:@"no"] forKey:unitButton];
> 
> Of course, the sourceButtonMap is defined in the class and initialized in the 
> init function as sourceButtonMap = [[NSMutableDictionary alloc] init];
> 
> The error I get when I try to add the key-value pair is:
> 
> *** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
> reason: '*** -[UIButton copyWithZone:]: unrecognized selector sent to 
> instance 0x3931e90'
> 
> Is this happening because I can't store UIButton* as keys?
> Can anyone point me why I'm getting this error? Thank you all,
> 
> aa


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 arch...@mail-archive.com

Re: new to cocoa

2010-05-13 Thread Kiel Gillard
On 12/05/2010, at 6:36 AM, Alejandro Marcos Aragón wrote:

> Hi all,
> 
> I'm new to Cocoa, and I couldn't find information about an error that I'm 
> getting on the web. I'm trying to create an NSMutableDictionary where the 
> keys are of type UIButton*:
> 
> 
>   // create button for unit
>   UIButton* unitButton = [[UIButton alloc] init];
>   [sourceButtonMap setObject:[NSString 
> stringWithString:@"no"] forKey:unitButton];
> 
> Of course, the sourceButtonMap is defined in the class and initialized in the 
> init function as sourceButtonMap = [[NSMutableDictionary alloc] init];
> 
> The error I get when I try to add the key-value pair is:
> 
> *** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
> reason: '*** -[UIButton copyWithZone:]: unrecognized selector sent to 
> instance 0x3931e90'
> 
> Is this happening because I can't store UIButton* as keys?

Welcome to iPhone OS development!

This most certainly is happening because you cannot use UIButton objects as 
keys in a dictionary because NSDictionary copies the objects used as keys. 
Furthermore, UIButton does implement the NSCopying methods.

> Can anyone point me why I'm getting this error? Thank you all,



See the second paragraph of the section titled "Overview".

I suggest you revise your design. I don't know exactly what you're trying to 
do. Perhaps @"no" should be the key for the UIButton?

Kiel


> 
> aa___
> 
> 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/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@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/archive%40mail-archive.com

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


Re: NSArrayController Undo

2010-05-13 Thread Quincey Morris
On May 13, 2010, at 21:20, Richard Somers wrote:

> Consider a Core Data document based application that uses a 
> NSArrayController. When the selected objects are removed or deleted and then 
> the user does an undo the selected objects are restored but the selection is 
> not. I have a custom view object.
> 
> I would like the state of the selection to also be restored with an undo 
> similar to what happens when working with the Cocoa text system. When text is 
> selected, then deleted, and then the user does an undo, the restored text is 
> selected.
> 
> Should I try to use the persistent document undo manager, create an undo 
> manager in the custom NSArrayController subclass, create an undo manager in 
> the custom view, or create an undo manager in one of my other classes?

This is a little bit harder than it seems. You certainly want to have the 
document undo manager keep track of the selection changes, in order to stay in 
sync with the really undoable changes. So:

1. You need to add a transient property for the selection to your managed data 
model. (Or non-transient, if you want the selection to persist when the 
document is re-opened.)

2. You need to keep track of the changes to the selection by modifying your 
Core Data selection property whenever the selection changes. However, you don't 
want these to be recorded as undoable actions (most likely, although there are 
scenarios -- think of Photoshop -- where selection changes are undoable), so 
you have to disable the undo manager temporarily around such changes. (Don't 
forget to invoke processPendingChanges before disabling the undo manager, and 
again before enabling it.)

3. You can't just track the selection state at the time of the undoable action, 
because the selection you ultimately want is different depending on whether 
you're undoing or redoing. (Convincing yourself that this is an issue is left 
as an exercise for the reader.) I think the easiest way to do this is to create 
an undo group for each action that needs to restore the selection, with 2 
actions in the group: the first one changes all the non-selection properties to 
their new values; the second changes the selection property to the post-change 
selection. (The latter changes the selection without disabling the undo 
manager, of course.) I *think* that gives the right selection depending whether 
you're undoing or redoing. (But I haven't actually tried this approach. The 
last time I had to deal with this problem in a Core Data environment, I think I 
did something clunkier.)

___

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: new to cocoa

2010-05-13 Thread Ken Thomases
On May 13, 2010, at 11:38 PM, Kiel Gillard wrote:

> This most certainly is happening because you cannot use UIButton objects as 
> keys in a dictionary because NSDictionary copies the objects used as keys. 
> Furthermore, UIButton does implement the NSCopying methods.

I assume you meant "does _not_ implement".

Regards,
Ken

___

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: new to cocoa

2010-05-13 Thread Kiel Gillard

On 14/05/2010, at 3:15 PM, Ken Thomases wrote:

> On May 13, 2010, at 11:38 PM, Kiel Gillard wrote:
> 
>> This most certainly is happening because you cannot use UIButton objects as 
>> keys in a dictionary because NSDictionary copies the objects used as keys. 
>> Furthermore, UIButton does implement the NSCopying methods.
> 
> I assume you meant "does _not_ implement".

Yes, my apologies. This was an accidental omission. UIButton does NOT implement 
the NSCopying methods.

Thanks, Ken!

> 
> Regards,
> Ken
> 
___

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


Noise in CALayer

2010-05-13 Thread Chaitanya Pandit
I'm playing with cover flow in one of my apps with the "CovertFlow" sample code 
from apple (http://www.letscocoa.com/CovertFlow.zip)
However, sometimes i see a weird noise kinda thing in the shadows, here is a 
snapshot:
http://cl.ly/17ci

Any idea what might be going wrong?

Thanks,

Chaitanya Pandit

___

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: Noise in CALayer

2010-05-13 Thread Bertrand Landry-Hetu
By the looks of that screen shot I'd suggest you had a look at the
bitmap used to fade out the reflection, there is probably a semi
transparent gradient being drawn on top of a uninitialized image
buffer. The easiest way to fix this is to fill it with [NSColor
clearColor] before drawing the gradient.

2010/5/14 Chaitanya Pandit :
> I'm playing with cover flow in one of my apps with the "CovertFlow" sample 
> code from apple (http://www.letscocoa.com/CovertFlow.zip)
> However, sometimes i see a weird noise kinda thing in the shadows, here is a 
> snapshot:
> http://cl.ly/17ci
>
> Any idea what might be going wrong?
>
> Thanks,
>
> Chaitanya Pandit
>
> ___
>
> 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/bertrandl%40gmail.com
>
> This email sent to bertra...@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/archive%40mail-archive.com

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


Re: iPad interface orientation basics

2010-05-13 Thread David Duncan
On May 12, 2010, at 12:52 PM, sebi  wrote:

> hello,
> 
> sorry, this is probably a very simple thing, but i am quite puzzled right now.
> 
> when i do this in my view controller:
> 
> - 
> (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
>  {
>   CGSize size = self.view.frame.size;
>   NSLog(NSStringFromCGSize(size));
> }
> 
> the size is always {768, 1024}, regardless of the orientation. why is it not 
> {1024, 768} in landscape mode? The view definitely changes its size, since it 
> always fills the full screen...

Because the frame is in the parent coordinate system, and technically that 
coordinate system doesn't change when you rotate. If you look at the bounds 
instead, you will find that they have changed as you expect, because the bounds 
is in the view's own coordinate system.
--
David Duncan___

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