Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8959299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:24:08+00:00 2026-06-15T15:24:08+00:00

I try to authenticate my app with Twitter with following code: pastebin However, if

  • 0

I try to authenticate my app with Twitter with following code: pastebin

However, if I remove the (useless?) loop line 23ff

for (ACAccount *acc in arrayOfAccounts) {
    [acc accountType].identifier;
    //Otherwise the identifier get lost - god knows why -__-
}

the acc.type becomes (null) when it gets executed further in
AccountHandler checkAccountOf:acc. If I leave the loop in, the type is correctly set.
I am pretty sure it has to do with the fact that I am in a block and then move on to the main queue, but I am wondering if I am doing something wrong? This loop does not look like sth I am supposed to have to do.

Something kinda similar happened here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:24:09+00:00Added an answer on June 15, 2026 at 3:24 pm

    ACAccounts are not thread safe. You should use them only on the thread that they originate. And for this purpose you can read ‘thread’ as ‘queue’.

    While I’ve not seen formal documentation of that, if you NSLog an account you’ll see that it’s a Core Data object and the lack of thread safety on Core Data objects is well documented.

    The specific behaviour is that a Core Data object can be a fault. That means that what you’re holding is a reference to the object but not the actual object. When you try to access a property the object will be loaded into memory.

    What Core Data is doing underneath is caching things in memory and returning faults until it knows that an object is really needed. The efficient coordination of that cache is what limits individual instances of the Core Data object that coordinates objects to a single thread.

    If you do the action that should bring the object into memory on the wrong thread — which is what happens when you access identifier here — then the behaviour is undefined. You could just get a nil result or you could crash your application.

    (aside: the reason that Core Data works like this is that it stores an object graph, so possibly 1000s of interconnected objects, and you can traverse it just like any other group of objects. However you don’t normally want to pay the costs associated with loading every single one of them into memory just to access whatever usually tiny subset of information you’re going to use, so it needs a way of providing a normal Objective-C interface while lazily loading)

    The code you’ve linked to skirts around that issue by ensuring that the objects are in the cache, and hence in memory, before queue hopping. So the ‘fetch from store’ step occurs on the correct queue. However the code is nevertheless entirely unsafe because objects may transition from being in memory back to being faults according to whatever logic Core Data cares to apply.

    The author obviously thinks they’ve found some bug on Apple’s part. They haven’t, they’ve merely decided to assume something is thread safe when it isn’t and have then found a way of relying on undefined behaviour that happened to work in their tests.

    Moral of the story: keep the accounts themselves on a single thread. If you want to do some processing with the properties of an account then collect the relevant properties themselves as fundamental Foundation objects and post those off.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing an App using JTwitter however I need to authenticate in order
when I try to share on twitter I do the following steps if (!twitterEngine)
In my app the user may try a search for twitter users category wise
Try this code - import java.io.StringReader; public class StringReaderTest { public static void main(String[]
Try this piece of code - public class WhitespaceTest { public static void main(String[]
Try executing the following in JavaScript: parseInt('01'); //equals 1 parseInt('02'); //equals 2 parseInt('03'); //equals
I am using DotNetOpenAuth to authenticate an app on Windows Azure. From time to
My overall goal is to let users of my Rails app authenticate against our
I'm following the rails 3 guide to create a shopify app using oauth2 to
I'm using the following setup to first authenticate users, and then use the authentication

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.