Accounts framework - does unexpected things sometimes / freezes system preferences ...

2013-05-12 Thread Robert Vojta
Hi all,

we do use accounts framework on Mac OS X for Facebook and we did find two 
issues (+- 15 % of cases) …

1. ACAccountStore returns non sense sometimes

Here's the code to check account store status, request access, etc. 
https://gist.github.com/robertvojta/ecc7a790664b3c432f63

This code does work on almost all testing Mac computers. But sometimes, this 
does happen:

 - account store tell me that we do not have access (granted is 0), it's okay,
 - there is Facebook account in system accounts,
 - I'm going to request access via 
requestAccessToAccountsWithType:options:completion:
 - and the result in completion handler is - granted 0, error is set, error 
code is 6 (= ACErrorAccountNotFound) with description Operation couldn't be 
completed - this is problem

[FBUFacebookAccount readPermissions] used as ACFacebookPermissionsKey value is 
simple array with read only permissions. We do need write permissions as well, 
but we're asking for them later. Permissions are okay.

What's weird - system dialog that we want to access Facebook account never 
appears in this case. And our app is not listed in Security  Privacy - Privacy 
- Facebook pane. Nothing helps - restart, add/remove Facebook account in System 
Preferences, etc. The only way which fixes this state is to call …

tccutil reset Facebook

… and when I do this, it works as expected. Drawback is that I can't call this 
because it resets granted access for all apps - it simply removes all of them. 
And also we're targetting MAS  Sandbox - no way to call it - and we do not 
want to call it at all to avoid resetting other apps which do use Facebook. 
Just pointing it out as a solution for this issue.

When I call tccutil, it fixes all issues and app, ie. ACAccountStore, does work 
as expected.

An idea what can be wrong? This problem did appear on 3 testing Macs (20 
testing Macs in total). It's 15 % of Macs and it's huge number of users. It's 
not acceptable. All systems are up to date Mountain Lions (we're targetting 
10.8 only).

2. System Preferences freezing

Sometimes, less frequent than mentioned 15 %, when I do receive 
ACAccountStoreDidChangeNotification, I'm …

 - trashing currect ACAccountStore object,
 - allocating new one,
 - and checking accounts in the same way as I described,

… if I do this immediately when I do receive this notification, System 
Preferences … freezes sometimes and my app freezes as well. When I reallocated 
/ recheck account store few seconds, let's say 5s, after I do receive 
notification, everything's okay. It seems that there's some kind of problem in 
Accounts framework, which can causes this freeze - kind of deadlock or don't 
know what it can be. This is on my todo list to sample both apps and check 
what's going on here.

Thanks for any insights,
Robert

___

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: UIWebView IBOutlet is always nil

2013-05-12 Thread Michael Crawford
 I've seen this before, but only in the case where there was no
@synthesize; did your actual code use it?

Yes.

My best guess is that it's some corruption in the nib.  I'll make a
standalone App with nothing but a UIWebView in it.  Maybe if that works I
could just copy the xib over to my production project.

Or maybe it's a bug in the simulator.  I don't have a device to test on
right now, as my iPhone was stolen.  I'm planning on getting an iPod Touch,
but not for a little while.

If I can't get it working I'll file a Radar.

Thanks for your help.

Mike Crawford
mdcrawf...@gmail.com


On Fri, May 10, 2013 at 5:34 AM, Fritz Anderson fri...@manoverboard.orgwrote:

 On 5 May 2013, at 6:47 PM, Michael Crawford mdcrawf...@gmail.com wrote:

@property (retain,nonatomic) IBOutlet UIWebView *webView;
 ...
@synthesize webView;
 ...
NSLog( @%@, webView );

 I've seen this before, but only in the case where there was no
 @synthesize; did your actual code use it?

 In recent compilers, if the getter and setter for a property are generated
 without @synthesize, the backing variable would be named _webView. When I
 ran into the bug, the coder had defined a global of the same name, which
 masked the error from the compiler.

 But my experiment shows that if you use @synthesize, the backing ivar is
 named without the underscore. If your production code is as you show, I'm
 not helping you here.

 — F



 --
 Fritz Anderson
 Xcode 4 Unleashed: 4.5 supplement for free!
 http://www.informit.com/store/xcode-4-unleashed-9780672333279




-- 
Michael David Crawford
mdcrawford at gmail dot com

  Custom Software Development for the iPhone and Mac OS X
  http://www.dulcineatech.com/custom-software-development/
___

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: UIWebView IBOutlet is always nil

2013-05-12 Thread Alex Zavatone
Sorry, I missed the beginning of this thread, so apologies if these suggestions 
have already been covered.

When in that case, I make sure to delete the UIWebView in the storyboard, 
create another one and reconnect the outlet to the property in the class.

Did you create the IBOutlet property in the header file or the method file?

If the little circle next to the property is always empty, it's not being 
regarded as being properly hooked up.

Try mousing over the little circle and see if it shows the storyboard it's 
connected to.

If you want, send me some screenshots and I'll try to help diagnose the patient.

Cheers.

On May 12, 2013, at 11:35 AM, Michael Crawford wrote:

 I've seen this before, but only in the case where there was no
 @synthesize; did your actual code use it?
 
 Yes.
 
 My best guess is that it's some corruption in the nib.  I'll make a
 standalone App with nothing but a UIWebView in it.  Maybe if that works I
 could just copy the xib over to my production project.
 
 Or maybe it's a bug in the simulator.  I don't have a device to test on
 right now, as my iPhone was stolen.  I'm planning on getting an iPod Touch,
 but not for a little while.
 
 If I can't get it working I'll file a Radar.
 
 Thanks for your help.
 
 Mike Crawford
 mdcrawf...@gmail.com
 
 
 On Fri, May 10, 2013 at 5:34 AM, Fritz Anderson 
 fri...@manoverboard.orgwrote:
 
 On 5 May 2013, at 6:47 PM, Michael Crawford mdcrawf...@gmail.com wrote:
 
  @property (retain,nonatomic) IBOutlet UIWebView *webView;
 ...
  @synthesize webView;
 ...
  NSLog( @%@, webView );
 
 I've seen this before, but only in the case where there was no
 @synthesize; did your actual code use it?
 
 In recent compilers, if the getter and setter for a property are generated
 without @synthesize, the backing variable would be named _webView. When I
 ran into the bug, the coder had defined a global of the same name, which
 masked the error from the compiler.
 
 But my experiment shows that if you use @synthesize, the backing ivar is
 named without the underscore. If your production code is as you show, I'm
 not helping you here.
 
— F
 
 
 
 --
 Fritz Anderson
 Xcode 4 Unleashed: 4.5 supplement for free!
 http://www.informit.com/store/xcode-4-unleashed-9780672333279
 
 
 
 
 -- 
 Michael David Crawford
 mdcrawford at gmail dot com
 
  Custom Software Development for the iPhone and Mac OS X
  http://www.dulcineatech.com/custom-software-development/
 ___
 
 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/zav%40mac.com
 
 This email sent to z...@mac.com


___

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

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

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

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

Validate core data sqlite file

2013-05-12 Thread Peng Gu
Hi

I am building an core data app that allows me to backup and restore the
data.
For backup, I simply copy the sqlite file to selected directory with a name
'app.backup'.
For restore, I also simply copy the selected file to the application
storage directory with name 'app.sqlite'

My question is: when I do restoring, How do I validate that the file is a
valid sqlite database and its schema matches the core data data model I am
using?

Thanks,
-
Peng
___

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


Parental Controls - [Was: NSTask Explodes. Clueless.]

2013-05-12 Thread Seth Willits


Update: I *finally* got a bead on this.


The user running my main application has parental controls enabled. The user is 
allowed to run the main application, and can, but the helper task that is 
bundled inside the main application's bundle is not allowed to run. When the 
*task* launches, *it* crashes, but since it happens *while* fork/exec'ing, the 
crash *appears* to be main application crashing, but it's not.

When the task launches, the user is shown a dialog by the OS: You don't have 
permission to use the application mytask. There are options to Always allow, 
allow once, and just ignore and move on. Allowing once, and even Always allow 
always results in the same message, and the task crashing. The permissions do 
not stick at all, probably because it's bundled inside the main .app package's 
Resource folder?

Any ideas what to do? 


--
Seth Willits





On Feb 4, 2013, at 11:26 AM, Seth Willits wrote:

 
 In my app I have to launch background processes (bundled within my app's 
 Resources folder) to do some things, and I launch them with NSTask. Every now 
 and then I get a crash report which shows NSTask throws some fatal exception 
 which is not caught by a wrapping @try block.
 
 
 For example:
 
 
 
 @try {
   NSString * taskPath = [[[NSBundle mainBundle] resourcePath] 
 stringByAppendingPathComponent:@mytask];
   task = [[NSTask alloc] init];
   task.launchPath = taskPath;
   task.arguments = @[aUUIDString];
   [task launch];
 }
 @catch (NSException * e) {
   ...
 }
 
 
 
 And it crashes:
 
 
 Exception Type:  EXC_BREAKPOINT (SIGTRAP)
 Exception Codes: 0x0002, 0x
 
 *** NSTask: Task create for path 
 '/Applications/App.app/Contents/Resources/mytask' failed: 22, Invalid 
 argument. Terminating temporary process.
 *** multi-threaded process forked ***
 
 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
 0   com.apple.Foundation  0x978142d8 
 ___NEW_PROCESS_COULD_NOT_BE_EXECD___ + 7
 1   com.apple.Foundation  0x976d2e16 -[NSConcreteTask 
 launchWithDictionary:] + 4698
 2   com.apple.Foundation  0x9777 -[NSConcreteTask launch] + 40
 

 




--
Seth Willits




___

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: Parental Controls - [Was: NSTask Explodes. Clueless.]

2013-05-12 Thread Ken Thomases
On May 12, 2013, at 8:08 PM, Seth Willits wrote:

 The user running my main application has parental controls enabled. The user 
 is allowed to run the main application, and can, but the helper task that is 
 bundled inside the main application's bundle is not allowed to run. When the 
 *task* launches, *it* crashes, but since it happens *while* fork/exec'ing, 
 the crash *appears* to be main application crashing, but it's not.
 
 When the task launches, the user is shown a dialog by the OS: You don't have 
 permission to use the application mytask. There are options to Always 
 allow, allow once, and just ignore and move on. Allowing once, and even 
 Always allow always results in the same message, and the task crashing. The 
 permissions do not stick at all, probably because it's bundled inside the 
 main .app package's Resource folder?
 
 Any ideas what to do? 

Is your helper task separately code-signed?  It should be.

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

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


Re: Parental Controls - [Was: NSTask Explodes. Clueless.]

2013-05-12 Thread Seth Willits
On May 12, 2013, at 6:47 PM, Ken Thomases wrote:

 On May 12, 2013, at 8:08 PM, Seth Willits wrote:
 
 The user running my main application has parental controls enabled. The user 
 is allowed to run the main application, and can, but the helper task that is 
 bundled inside the main application's bundle is not allowed to run. When the 
 *task* launches, *it* crashes, but since it happens *while* fork/exec'ing, 
 the crash *appears* to be main application crashing, but it's not.
 
 When the task launches, the user is shown a dialog by the OS: You don't 
 have permission to use the application mytask. There are options to 
 Always allow, allow once, and just ignore and move on. Allowing once, and 
 even Always allow always results in the same message, and the task 
 crashing. The permissions do not stick at all, probably because it's bundled 
 inside the main .app package's Resource folder?
 
 Any ideas what to do? 
 
 Is your helper task separately code-signed?  It should be.


Yep. Always, and with the same identity as the main app.


--
Seth Willits





___

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