Re: Ownership follows the 'Create' Rule' - not literally

2013-08-24 Thread Quincey Morris
On Aug 23, 2013, at 21:13 , Jerry Krinock je...@ieee.org wrote:

 Lesson: When documentation says that Ownership follows the 'Create Rule' 
 for a parameter, what they really mean to say is that When applying the 
 'Create Rule' to this function, proceed as though this function had 'Create' 
 in its name.

That's not quite the right thing to take away. The name indicates the ownership 
policy only of the function return value. Parameters returning objects by 
reference need their own (explicit) documentation of ownership policy, which 
could be different from that of the return value.

  Or, more succinctly, You own this object.

Exactly.

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Protocols and the +initialize class method

2013-08-24 Thread Kevin Meaney
Thanks for the feedback everyone.

I was confusing how I was going about doing the necessary initialization to be 
able implement the protocol in a class. I've been using the +initialize method 
to do this, but this is as someone pointed out is an implementation detail. So 
adding +initialize to the protocol is not appropriate and to just leave it up 
to the developer implementing the class how to achieve the necessary 
initialization to be able to implement the protocol. I should not be foisting 
on them how I've been doing it, even when it is just me implementing the 
classes conforming to the protocol.

My take away is to be reminded to keep implementation details out of the 
protocol.

Kevin

On 23 Aug 2013, at 20:11, Glenn L. Austin gl...@austin-soft.com wrote:

 
 On Aug 23, 2013, at 10:30 AM, David Duncan david.dun...@apple.com wrote:
 
 On Aug 23, 2013, at 2:49 AM, Kevin Meaney k...@yvs.eu.com wrote:
 
 I have a protocol where I would like to include the class method 
 +(void)initialize as being required. This way all classes that conform to 
 the protocol have to implement  initialize as part of the protocol. I 
 suppose I'm wondering if anyone perceives any problem with doing this?
 
 For example, will including +initialize as a required protocol method 
 interfere with objective-c automatically calling the initialize method 
 before the class is used for the first at runtime.
 
 
 What is it that you are actually trying to achieve by doing this?
 
 Especially since *every* class that derives from NSObject will have an 
 +initialize method...
 
 
 -- 
 Glenn L. Austin, Computer Wizard and Race Car Driver 
 http://www.austin-soft.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Static analyser grumbling

2013-08-24 Thread Kevin Meaney
Stupid me.

In the super class context is stored in a var which is the storage for a 
readonly property and I was assigning to the var in the init method without 
retaining. So I should be retaining when assigning and doing a release when 
calling. I don't know where I got the idea parameters passed into the init 
method would be consumed. Glad that's squashed.

After reading the discussion I was wondering why the analyzer wasn't 
complaining about the release of the context in the dealloc method of the super 
class since it wasn't retained on initialization. But I think that is probably 
asking too much of the static analyzer.

Kevin


On 23 Aug 2013, at 16:42, Kyle Sluder k...@ksluder.com wrote:

 On Aug 23, 2013, at 4:27 AM, Kevin Meaney k...@yvs.eu.com wrote:
 
 
 But my feeling is that the analyzer is talking about context. Normally I'd 
 consider that an object passed into an init method will consume a retain 
 count.
 
 Nope. The only consumed refcount is that of the receiver. How is the analyzer 
 supposed to assume what -initWithFoo: does with its argument? Maybe it's a 
 weak pointer, or perhaps it doesn't use the argument at all. The -init 
 convention only applies to the receiver and the return value.
 
 --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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

UIDocument + NSFileWrapper, how to get incremental saving to work?

2013-08-24 Thread Markus Spoettl

Hi,

  I have an iOS app that uses UIDocument in conjunction with a document package 
that is implemented through NSFileWrapper.


It seems no matter what I do, I can't get incremental saving to work. The more 
sub-wrappers my package wrapper contains, the longer it takes for the document 
to get saved. It doesn't matter how many sub-wrappers actually changed, the time 
it takes to save increases with the number of wrappers.


The documentation in UIDocument's 
-writeContents:toURL:forSaveOperation:originalContentsURL:error: helpfully 
states that if one wants incremental saving, one has to implement it there. I 
took that to mean that UIDocument's use of NSFileWrapper doesn't support 
incremental saving for some reason.


So I went and implemented my own -writeContents: that essentially calls the 
root package wrapper's -writeToURL:options:originalURL:error:. This method's 
documentation states that it implements incremental saving by using hard links 
for unchanged content. Still, the performance is unchanged compared to 
UIDocument's own implementation.


Which makes me think that NSFileWrapper isn't really doing what it allegedly 
does.

Any ideas what I might be doing wrong, or what alternative I could try?

Regards
Markus
--
__
Markus Spoettl
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Issues with NSTextView Attachments

2013-08-24 Thread Gordon Apple
Thanks, Kyle.  I¹ll look into that.  It¹s not clear exactly how this gets
used, especially within an attrituted string, but, hopefully, I¹ll figure it
out.

Reference docs are good to have, but they are often (and usually) deficient
in telling you how to use it.  Frameworks are somewhat akin to giving you
all the pieces of an automobile but letting you figure out how to actually
construct an automobile.

I wish someone really knowledgable would write a book on text editing, maybe
in the Prag Programming series.  Maybe it¹s too narrow a subject for broad
dissemination, but I think a lot of people would be interested, especially
now that much of it is migrating to iOS.  I could write a chapter on text
containers.  I¹ve had a text container for years now that does what the new
iOS stuff does, and more, on MacOS.  But there is so much I don¹t know.


On 8/22/13 8:24 PM, Kyle Sluder k...@ksluder.com wrote:

 On Thu, Aug 22, 2013, at 04:40 PM, Gordon Apple wrote:
  I guess the operative word here is ³custom².  So how does NSTextView
  handle
  attachments which are not custom, because it does?  Why not RTFD?  I
  thought
  RTF didn¹t handle attachments.
 
 It uses RTFD, but it might be the case that RTFD might only support file
 wrappers.
 
 Have you implemented -[NSTextViewDelegate
 textView:writablePasteboardTypesForCell:atIndex:] and
 -[NSTextViewDelegate textView:writeCell:atIndex:toPasteboard:type:]?
 
 --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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: UIDocument + NSFileWrapper, how to get incremental saving to work?

2013-08-24 Thread Quincey Morris
On Aug 24, 2013, at 06:15 , Markus Spoettl ms_li...@shiftoption.com wrote:

 It seems no matter what I do, I can't get incremental saving to work. The 
 more sub-wrappers my package wrapper contains, the longer it takes for the 
 document to get saved. It doesn't matter how many sub-wrappers actually 
 changed, the time it takes to save increases with the number of wrappers.
 
 The documentation in UIDocument's 
 -writeContents:toURL:forSaveOperation:originalContentsURL:error: helpfully 
 states that if one wants incremental saving, one has to implement it there. I 
 took that to mean that UIDocument's use of NSFileWrapper doesn't support 
 incremental saving for some reason.

The file wrapper optimization is not, AFAIK, regarded as incremental saving, 
though the intended effect is of course somewhat similar.

 So I went and implemented my own -writeContents: that essentially calls 
 the root package wrapper's -writeToURL:options:originalURL:error:. This 
 method's documentation states that it implements incremental saving by using 
 hard links for unchanged content. Still, the performance is unchanged 
 compared to UIDocument's own implementation.

What file wrapper are you returning from 'contentsForType:error:'? Are you 
constructing it there? If so, that might explain why all the files are being 
re-written.

Normally, you'd keep track of the file wrapper originally passed to 
'loadFromContents:ofType:error:', and return *that* at save time, after 
replacing the sub-wrappers for any files that have changed. Using that 
approach, I've never run into a problem with the hard-linking optimization for 
unchanged files.

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Exception After Adding a WebView to a NIB

2013-08-24 Thread Thomas Wetmore
I am writing an app that does NLP on web pages for genealogical information and 
adds semantic tags to the HTML showing the results.

I am having a basic problem. When I add a WebView object to the main NIPB using 
the interface builder, the app immediately crashes by throwing an objc 
exception at the testb instruction below in NSApplicationMain:

0x7fff96ce99dc:  jne0x7fff96ce9a07; NSApplicationMain + 406
0x7fff96ce99de:  leaq   13979171(%rip), %rax  ; GCC_except_table67 + 16
0x7fff96ce99e5:  movq   (%rax), %rcx
0x7fff96ce99e8:  movq   13142833(%rip), %rsi  ; SecKeySignDigest + 36
0x7fff96ce99ef:  movq   13292330(%rip), %rdi  ; 
Security::PasswordDBLookup::lookupInfoOnUID(unsigned int) + 84
0x7fff96ce99f6:  movq   %r15, %rdx
0x7fff96ce99f9:  callq  *11792009(%rip)   ; _value_entry_table_resize + 
213
0x7fff96ce99ff:  testb  %al, %al

I see the exception occurs right after some security stuff. Does anyone know 
what is going on here?

I am still just prototyping the user interface. No outlets and actions are set 
up. I just added the WebView and ran the program to see what the UI would look 
like. If I take the WebView out it runs fine again. I tried the WebView first 
in a tab view within a split view, and second in a split view.

Thanks,

Tom Wetmore


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

NSValue valueWithBytes:objCType:

2013-08-24 Thread Andreas Grosam
What's the purpose of NSValue's class method 

+ (NSValue *)valueWithBytes:(const void *)value objCType:(const char *)type; ?

It seems, NSValue will simply memcpy the content of value, and somehow 
determine the size in bytes from the string given in type. Is that reliable at 
all? (I have major doubts).


It also seems, despite making the illusion having knowledge about the 
underlaying type, NSData fails to compare correctly two NSData objects which 
have been initialized by the same Objective-C  type.


That is, this code is generally unsafe:

struct a_s {
   unsigned char _b;
   long _l;
};

-(void) foo {
   struct a_s;

   // suppose, we scramble some bits on the stack …

   a._b = 0;
   a._l = 1;

   b._b = a._b;
   b._l = a._l;

   NSValue *a_encoded = [NSValue valueWithBytes:a objCType:@encode(struct 
a_s)];
   NSValue *b_encoded = [NSValue valueWithBytes:b objCType:@encode(struct 
a_s)];

   assert([a_encoded isEqualToValue: b_encoded]);  // May fail!
}


The assert may fail, since apparently NSData simply performs a memcpy. This of 
course fails miserably if we intended to compare the _struct_ values. 

Nonetheless, NSData pretends to be able to return the correct result when 
comparing the encoded values. Well, of course this may be considered by NSData 
as correct - despite it's different to comparing the corresponding struct 
values - since only NSData knows and defines what makes a NSValue equal to 
another ;)


So again, I cannot see where this feature can be ever sensible, and does not 
simultaneously introduce more harm than use.

Additionally, I'm worried about the fact, that a *particular Apple library* 
will use the above technique to *compare structs*.


Andreas
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: NSValue valueWithBytes:objCType:

2013-08-24 Thread Jean-Daniel Dupas

Le 24 août 2013 à 22:09, Andreas Grosam agro...@onlinehome.de a écrit :

 What's the purpose of NSValue's class method 
 
 + (NSValue *)valueWithBytes:(const void *)value objCType:(const char *)type; ?
 
 It seems, NSValue will simply memcpy the content of value, and somehow 
 determine the size in bytes from the string given in type. Is that reliable 
 at all? (I have major doubts).
 
 
 It also seems, despite making the illusion having knowledge about the 
 underlaying type, NSData fails to compare correctly two NSData objects which 
 have been initialized by the same Objective-C  type.
 
 
 That is, this code is generally unsafe:
 
 struct a_s {
   unsigned char _b;
   long _l;
 };
 
 -(void) foo {
   struct a_s;
 
   // suppose, we scramble some bits on the stack …
 
   a._b = 0;
   a._l = 1;
 
   b._b = a._b;
   b._l = a._l;
 
   NSValue *a_encoded = [NSValue valueWithBytes:a objCType:@encode(struct 
 a_s)];
   NSValue *b_encoded = [NSValue valueWithBytes:b objCType:@encode(struct 
 a_s)];
 
   assert([a_encoded isEqualToValue: b_encoded]);  // May fail!
 }
 
 
 The assert may fail, since apparently NSData simply performs a memcpy. This 
 of course fails miserably if we intended to compare the _struct_ values. 
 
 Nonetheless, NSData pretends to be able to return the correct result when 
 comparing the encoded values. Well, of course this may be considered by 
 NSData as correct - despite it's different to comparing the corresponding 
 struct values - since only NSData knows and defines what makes a NSValue 
 equal to another ;)
 

When compiling a struct, the compiler add padding where needed so that each 
field is aligned as required by the ABI. The padding can contains any value and 
nothing force it to be initialized to 0.
When you memcpy a struct, you include the padding, which can contains anything. 
When you restore the value, all field are restored properly though, but there 
is no guarantee that a memcmp of two struct with all field containing the same 
value will always returns the same result.

 So again, I cannot see where this feature can be ever sensible, and does not 
 simultaneously introduce more harm than use.
 
 Additionally, I'm worried about the fact, that a *particular Apple library* 
 will use the above technique to *compare structs*.


That's not a problem specifics to NSValue. You should know what you do when 
manipulating structs.

-- Jean-Daniel





___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: UIDocument + NSFileWrapper, how to get incremental saving to work?

2013-08-24 Thread Markus Spoettl

On 8/24/13 8:07 PM, Quincey Morris wrote:

So I went and implemented my own -writeContents: that essentially calls
the root package wrapper's -writeToURL:options:originalURL:error:. This
method's documentation states that it implements incremental saving by using
hard links for unchanged content. Still, the performance is unchanged compared
to UIDocument's own implementation.


What file wrapper are you returning from 'contentsForType:error:'? Are you
constructing it there? If so, that might explain why all the files are being
re-written.

Normally, you'd keep track of the file wrapper originally passed to
'loadFromContents:ofType:error:', and return *that* at save time, after
replacing the sub-wrappers for any files that have changed. Using that approach,
I've never run into a problem with the hard-linking optimization for unchanged
files.


That's exactly what I'm doing. My save times are so bad, the only explanation 
that I can come up with is that UIDocument/NSFileWrapper isn't really 
hard-linking unchanged wrappers. Or it does and also does something else to 
counter the gain.


Regards
Markus
--
__
Markus Spoettl
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: UIDocument + NSFileWrapper, how to get incremental saving to work?

2013-08-24 Thread Kyle Sluder
On Sat, Aug 24, 2013, at 02:31 PM, Markus Spoettl wrote:
 That's exactly what I'm doing. My save times are so bad, the only
 explanation 
 that I can come up with is that UIDocument/NSFileWrapper isn't really 
 hard-linking unchanged wrappers. Or it does and also does something else
 to 
 counter the gain.

Rather than guess, you should measure.

* What does -matchesContentsOfURL: say when sent to your sub-wrappers?
* Does -matchesContentsOfURL: even get called?
* What does Instruments say is actually going on?

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Exception After Adding a WebView to a NIB

2013-08-24 Thread dangerwillrobinsondanger
Did you add the WebKit framework to your project and #include it ?


On 2013/08/25, at 4:08, Thomas Wetmore t...@verizon.net wrote:

 I am writing an app that does NLP on web pages for genealogical information 
 and adds semantic tags to the HTML showing the results.
 
 I am having a basic problem. When I add a WebView object to the main NIPB 
 using the interface builder, the app immediately crashes by throwing an objc 
 exception at the testb instruction below in NSApplicationMain:
 
 0x7fff96ce99dc:  jne0x7fff96ce9a07; NSApplicationMain + 406
 0x7fff96ce99de:  leaq   13979171(%rip), %rax  ; GCC_except_table67 + 16
 0x7fff96ce99e5:  movq   (%rax), %rcx
 0x7fff96ce99e8:  movq   13142833(%rip), %rsi  ; SecKeySignDigest + 36
 0x7fff96ce99ef:  movq   13292330(%rip), %rdi  ; 
 Security::PasswordDBLookup::lookupInfoOnUID(unsigned int) + 84
 0x7fff96ce99f6:  movq   %r15, %rdx
 0x7fff96ce99f9:  callq  *11792009(%rip)   ; _value_entry_table_resize 
 + 213
 0x7fff96ce99ff:  testb  %al, %al
 
 I see the exception occurs right after some security stuff. Does anyone know 
 what is going on here?
 
 I am still just prototyping the user interface. No outlets and actions are 
 set up. I just added the WebView and ran the program to see what the UI would 
 look like. If I take the WebView out it runs fine again. I tried the WebView 
 first in a tab view within a split view, and second in a split view.
 
 Thanks,
 
 Tom Wetmore
 
 
 ___
 
 

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Exception After Adding a WebView to a NIB

2013-08-24 Thread Thomas Wetmore
Danger Man,

I got the include part but forgot the framework part.

Thanks!

Tom Wetmore


On Aug 24, 2013, at 7:27 PM, dangerwillrobinsondan...@gmail.com wrote:

 Did you add the WebKit framework to your project and #include it ?
 
 
 On 2013/08/25, at 4:08, Thomas Wetmore t...@verizon.net wrote:
 
 I am writing an app that does NLP on web pages for genealogical information 
 and adds semantic tags to the HTML showing the results.
 
 I am having a basic problem. When I add a WebView object to the main NIPB 
 using the interface builder, the app immediately crashes by throwing an objc 
 exception at the testb instruction below in NSApplicationMain:
 
 0x7fff96ce99dc:  jne0x7fff96ce9a07; NSApplicationMain + 406
 0x7fff96ce99de:  leaq   13979171(%rip), %rax  ; GCC_except_table67 + 16
 0x7fff96ce99e5:  movq   (%rax), %rcx
 0x7fff96ce99e8:  movq   13142833(%rip), %rsi  ; SecKeySignDigest + 36
 0x7fff96ce99ef:  movq   13292330(%rip), %rdi  ; 
 Security::PasswordDBLookup::lookupInfoOnUID(unsigned int) + 84
 0x7fff96ce99f6:  movq   %r15, %rdx
 0x7fff96ce99f9:  callq  *11792009(%rip)   ; 
 _value_entry_table_resize + 213
 0x7fff96ce99ff:  testb  %al, %al
 
 I see the exception occurs right after some security stuff. Does anyone know 
 what is going on here?
 
 I am still just prototyping the user interface. No outlets and actions are 
 set up. I just added the WebView and ran the program to see what the UI 
 would look like. If I take the WebView out it runs fine again. I tried the 
 WebView first in a tab view within a split view, and second in a split view.
 
 Thanks,
 
 Tom Wetmore
 
 
 ___
 
 


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: NSValue valueWithBytes:objCType:

2013-08-24 Thread Sandor Szatmari
Would defining the structs as packed make a difference for the comparisson?

Sandor Szatmari

On Aug 24, 2013, at 17:01, Jean-Daniel Dupas devli...@shadowlab.org wrote:

 
 Le 24 août 2013 à 22:09, Andreas Grosam agro...@onlinehome.de a écrit :
 
 What's the purpose of NSValue's class method 
 
 + (NSValue *)valueWithBytes:(const void *)value objCType:(const char *)type; 
 ?
 
 It seems, NSValue will simply memcpy the content of value, and somehow 
 determine the size in bytes from the string given in type. Is that reliable 
 at all? (I have major doubts).
 
 
 It also seems, despite making the illusion having knowledge about the 
 underlaying type, NSData fails to compare correctly two NSData objects which 
 have been initialized by the same Objective-C  type.
 
 
 That is, this code is generally unsafe:
 
 struct a_s {
  unsigned char _b;
  long _l;
 };
 
 -(void) foo {
  struct a_s;
 
  // suppose, we scramble some bits on the stack …
 
  a._b = 0;
  a._l = 1;
 
  b._b = a._b;
  b._l = a._l;
 
  NSValue *a_encoded = [NSValue valueWithBytes:a objCType:@encode(struct 
 a_s)];
  NSValue *b_encoded = [NSValue valueWithBytes:b objCType:@encode(struct 
 a_s)];
 
  assert([a_encoded isEqualToValue: b_encoded]);  // May fail!
 }
 
 
 The assert may fail, since apparently NSData simply performs a memcpy. This 
 of course fails miserably if we intended to compare the _struct_ values. 
 
 Nonetheless, NSData pretends to be able to return the correct result when 
 comparing the encoded values. Well, of course this may be considered by 
 NSData as correct - despite it's different to comparing the corresponding 
 struct values - since only NSData knows and defines what makes a NSValue 
 equal to another ;)
 
 When compiling a struct, the compiler add padding where needed so that each 
 field is aligned as required by the ABI. The padding can contains any value 
 and nothing force it to be initialized to 0.
 When you memcpy a struct, you include the padding, which can contains 
 anything. When you restore the value, all field are restored properly though, 
 but there is no guarantee that a memcmp of two struct with all field 
 containing the same value will always returns the same result.
 
 So again, I cannot see where this feature can be ever sensible, and does not 
 simultaneously introduce more harm than use.
 
 Additionally, I'm worried about the fact, that a *particular Apple library* 
 will use the above technique to *compare structs*.
 
 
 That's not a problem specifics to NSValue. You should know what you do when 
 manipulating structs.
 
 -- Jean-Daniel
 
 
 
 
 
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com
 
 This email sent to admin.szatmari@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Exception After Adding a WebView to a NIB

2013-08-24 Thread dangerwillrobinsondanger
No worries. 
It's such a common miss with such a common framework that it is arguable Xcode 
should be smart enough to add it for you or suggest it when using a webview. 

Sent from my iPhone

On 2013/08/25, at 9:09, Thomas Wetmore t...@verizon.net wrote:

 Danger Man,
 
 I got the include part but forgot the framework part.
 
 Thanks!
 
 Tom Wetmore
 
 
 On Aug 24, 2013, at 7:27 PM, dangerwillrobinsondan...@gmail.com wrote:
 
 Did you add the WebKit framework to your project and #include it ?
 
 
 On 2013/08/25, at 4:08, Thomas Wetmore t...@verizon.net wrote:
 
 I am writing an app that does NLP on web pages for genealogical information 
 and adds semantic tags to the HTML showing the results.
 
 I am having a basic problem. When I add a WebView object to the main NIPB 
 using the interface builder, the app immediately crashes by throwing an 
 objc exception at the testb instruction below in NSApplicationMain:
 
 0x7fff96ce99dc:  jne0x7fff96ce9a07; NSApplicationMain + 406
 0x7fff96ce99de:  leaq   13979171(%rip), %rax  ; GCC_except_table67 + 16
 0x7fff96ce99e5:  movq   (%rax), %rcx
 0x7fff96ce99e8:  movq   13142833(%rip), %rsi  ; SecKeySignDigest + 36
 0x7fff96ce99ef:  movq   13292330(%rip), %rdi  ; 
 Security::PasswordDBLookup::lookupInfoOnUID(unsigned int) + 84
 0x7fff96ce99f6:  movq   %r15, %rdx
 0x7fff96ce99f9:  callq  *11792009(%rip)   ; 
 _value_entry_table_resize + 213
 0x7fff96ce99ff:  testb  %al, %al
 
 I see the exception occurs right after some security stuff. Does anyone 
 know what is going on here?
 
 I am still just prototyping the user interface. No outlets and actions are 
 set up. I just added the WebView and ran the program to see what the UI 
 would look like. If I take the WebView out it runs fine again. I tried the 
 WebView first in a tab view within a split view, and second in a split view.
 
 Thanks,
 
 Tom Wetmore
 
 
 ___
 

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Exception After Adding a WebView to a NIB

2013-08-24 Thread Maxthon Chan
Well in Xcode [REDACTED] (or rather, clang 3.3) it is automated if you included 
its header file. So sit still and it will no longer be an issue soon.

On Aug 25, 2013, at 11:26, dangerwillrobinsondan...@gmail.com wrote:

 No worries. 
 It's such a common miss with such a common framework that it is arguable 
 Xcode should be smart enough to add it for you or suggest it when using a 
 webview. 
 
 Sent from my iPhone
 
 On 2013/08/25, at 9:09, Thomas Wetmore t...@verizon.net wrote:
 
 Danger Man,
 
 I got the include part but forgot the framework part.
 
 Thanks!
 
 Tom Wetmore
 
 
 On Aug 24, 2013, at 7:27 PM, dangerwillrobinsondan...@gmail.com wrote:
 
 Did you add the WebKit framework to your project and #include it ?
 
 
 On 2013/08/25, at 4:08, Thomas Wetmore t...@verizon.net wrote:
 
 I am writing an app that does NLP on web pages for genealogical 
 information and adds semantic tags to the HTML showing the results.
 
 I am having a basic problem. When I add a WebView object to the main NIPB 
 using the interface builder, the app immediately crashes by throwing an 
 objc exception at the testb instruction below in NSApplicationMain:
 
 0x7fff96ce99dc:  jne0x7fff96ce9a07; NSApplicationMain + 406
 0x7fff96ce99de:  leaq   13979171(%rip), %rax  ; GCC_except_table67 + 16
 0x7fff96ce99e5:  movq   (%rax), %rcx
 0x7fff96ce99e8:  movq   13142833(%rip), %rsi  ; SecKeySignDigest + 36
 0x7fff96ce99ef:  movq   13292330(%rip), %rdi  ; 
 Security::PasswordDBLookup::lookupInfoOnUID(unsigned int) + 84
 0x7fff96ce99f6:  movq   %r15, %rdx
 0x7fff96ce99f9:  callq  *11792009(%rip)   ; 
 _value_entry_table_resize + 213
 0x7fff96ce99ff:  testb  %al, %al
 
 I see the exception occurs right after some security stuff. Does anyone 
 know what is going on here?
 
 I am still just prototyping the user interface. No outlets and actions are 
 set up. I just added the WebView and ran the program to see what the UI 
 would look like. If I take the WebView out it runs fine again. I tried the 
 WebView first in a tab view within a split view, and second in a split 
 view.
 
 Thanks,
 
 Tom Wetmore
 
 
 ___
 
 
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/xcvista%40me.com
 
 This email sent to xcvi...@me.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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