Sunday, December 22, 2013

Method 1: Flattened Objects with Field Keys

Method 1: Flattened Objects with Field Keys

The idea here is that, although SharedPreferences only stores primitive types, an object construct is ultimately a “bag” of primitives. So we can decompose an object into a set of primitives and store each one of those individually with a unique key. However we do need to keep track of which saved field belongs to which object if we want to reconstruct our objects from storage.
So before writing the CRUD methods on a given User object in our UserPrefs class, we need to define unique keys on each User class member. For convenience we can write a method to ensure key uniqueness across the board:
01/** The prefix for flattened user keys */
02public static final String KEY_PREFIX =
03            "com.our.package.KEY";
04 
05/** Method to return a unique key for any field belonging to a given object
06* @param id of the object
07* @param fieldKey of a particular field belonging to that object
08* @return key String uniquely identifying the object's field
09*/
10private String getFieldKey(int id, String fieldKey) {
11       return  KEY_PREFIX + id + "_" + fieldKey;
12}
Notice how getFieldKey() gives us a unique identifier per field name and per user.

Next, we need to write our preferences class:

Next, we need to write our preferences class:
view sourceprint?
01/** stores the user object in SharedPreferences */
02public class UserPrefs{
03 
04    /** This application's preferences label */
05    private static final String PREFS_NAME = "com.our.package.UserPrefs";
06 
07    /** This application's preferences */
08    private static SharedPreferences settings;
09 
10   /** This application's settings editor*/
11   private static SharedPreferences.Editor editor;
12 
13   /** Constructor takes an android.content.Context argument*/
14   public UserPrefs(Context ctx){
15        if(settings == null){
16           settings = ctx.getSharedPreferences(PREFS_NAME,
17                                               Context.MODE_PRIVATE );
18        }
19       /*
20        * Get a SharedPreferences editor instance.
21        * SharedPreferences ensures that updates are atomic
22        * and non-concurrent
23        */
24        editor = settings.edit();    
25   }
26   //...
27}

Storing Objects in Android

Storing Objects in Android

One alternative to using SQLite on Android is to store Java objects in SharedPreferences. Here, we’ll look at two different ways to do that.
Why not go for SQLite for all storage needs? The reasons can be varied: besides the impedance mismatch between object orientation and relational databases, SQLite might be overkill (brings more overhead) for some simple use cases, or its use and syntax might be disliked altogether.
As an example, we’ll work with the following User class:

 
01/** User object to be saved in db */
02public class User{
03 
04    private int id; // used for object storage
05    private String userName;
06    private boolean registered;
07    private double score;
08 
09    /** Constructor */
10   public User(int id, String userName, boolean registered, double score){
11       this.id = id;
12       this.userName = userName;
13       this.registered = registered;
14       this.score = score;
15   }
16   // getters and setters here...
17}
The unique identifier id would most likely be handed out by our server, though we could also compute it on the device itself once we create a User and store it separately in SharedPreferences, depending on the design of our application. Here, we’ll just use it as an object storage key.

Xcode 4.2 Release Notes

Xcode 4.2 Release Notes

Installation

  • You can install Xcode 4.2 for OS X v10.6 Snow Leopard only if you have purchased an earlier release of Xcode.
    Install or update Xcode through the Purchases or Updates panes.
  • If you purchased Xcode from the Mac App Store, the Install Xcode app is on the volume on which you installed Xcode.
    To install Xcode 4.2 on another volume, you must delete all copies of the Install Xcode app from your file system.

Xcode

  • In Xcode 4.2 with iOS 5, support for running and debugging applications in the iOS 4.3 Simulator and on devices with iOS versions older than 4.2 is optional and installed only on demand. In addition, this support is no longer shipped as part of the core tools packaging, and is instead made available for download and installation through the "Downloads" pane of the Xcode Preferences panel. A valid iOS developer ADC account is required to obtain this content.
    To obtain the iOS 4.3 Simulator, choose More Simulators from the Run Destinations popup in the main toolbar. This item presents the Downloads pane of the Preferences and includes UI to initiate the installation of the simulator.
    To obtain iOS device support for pre-iOS 4.2 devices, connect a device and activate it for development in the Organizer. Xcode prompts you to initiate the download of the device support components.
    If Xcode 4.2 in iOS 5 is installed over a previous Xcode 4.2 beta or over Xcode 4.1, the iOS 4.3 Simulator and device support from the previous install will already be present, and the additional components will display as "Installed" in the Downloads pane of the Xcode Preferences.
    The installation packages for the downloaded components are stored in ~Library/Developer/Xcode. When a new version of Xcode (beta or GM) is installed, subsequent requests to install these components use the local packages without requiring a new download.
  • In some cases, Xcode 4.2 Organizer does not display a device that is in restore mode. As a workaround you can use iTunes to restore.
  • In iOS 5, iOS Simulator is not compatible with previous releases of the iCloud Developer Seed for OS X. It is highly recommended that you update to the latest iCloud Developer Seed to ensure compatibility.
  • The iOS 5 SDK supports both iOS 4.3 and iOS 5.0 simulators.
  • Be sure to quit any running Xcode before starting the uninstall-devtools script.
  • The Network Link Conditioner daemon cannot be launched after installing the Networking Link Conditioner preference pane without first rebooting the system. As a result, the tool will not function without a system reboot.
    If you do not want to reboot the system, you can issue the following command from Terminal instead: sudo launchctl load /system/library/launchdaemons/com.apple.networklinkconditioner.plist
  • If you are using multiple tabs in Xcode 4.2, some behaviors that are dependent on the Run Generates Output and Run Completes events may not get triggered. This bug will be fixed in future versions.

Interface Builder

  • When initiating a refactoring rename operation from the declaration of a property, any Interface Builder files that refer to that property will not be updated correctly. Instead, perform the rename operation on a usage of the property, or an associated @synthesize statement.
  • In Xcode 4.2, when copying views (either a single view or multiple views), both the user defined constraints on the selected view and the user defined constraints between the views are copied to the pasteboard.
  • When developing Mac apps, changing the segment style of an NSSegmentedControl object to Automatic might crash in documents using Cocoa Auto Layout. To workaround the issue use an explicit segment style such as Round or Textured, and at runtime, change the segment style to automatic using the setSegmentStyle: method.

Instruments

  • There is a known issue with the Profile action from Xcode 4.2. After a build in which no source files have changed, Instruments will be unable to gather symbols for the target application.
    This affects projects where both:
    1. The Release configuration is selected for the Profile action. (default)
    2. The Strip Linked Product build setting is set to "Yes”, or a custom Run Script build phase strips the product. (non-default)
    The workaround is to do any one of the following:
    1. Perform a "Clean" on the product before initiating the Profile action.
    2. Do a Clean of the product and temporarily set the Strip Linked Product build setting to "No" while Profiling.
    3. Set the configuration of the Profile action to Debug.
    4. Run successive profiles directly from within Instruments when you do not need to rebuild.
  • When developing Mac apps, using the GC Monitor template in Instruments may cause Instruments to crash. To workaround the problem please consider migrating your application to ARC.

iOS Simulator

  • When running Mac OS 10.7, Location Services are not functional in iOS simulator when simulating iOS 4.3 and earlier. This issue is not present when running Mac OS 10.6 or when simulating iOS 5.0.

Xcode 4.3 Release Notes

Xcode 4.3 Release Notes

Resolved Issues

General

  • Xcode crashes when dragging tabs in full-screen mode. 9987358
  • Xcode crashes when opening multiple workspaces that contain the same folder reference (blue folder). 10079252

Installing

  • Installing Xcode on OS X v10.7.3 or later breaks the Xcode 4.3 Instruments app. 10619572

Editing User Interfaces

  • After enabling autolayout in a nib file, the wrong constraints are applied. 8201103
  • When resizing views that use autolayout, Xcode applies constraints to the descendants of the view being resized, but not to its siblings and ancestors. 9450655
  • Xcode doesn’t allow constraints with negative values. 9717632
  • When you create a user constraint, Xcode removes redundant constrains, which is not always desirable. 9794979
  • You cannot add width and height constraints to top-level views. 9877773

Building

  • Xcode imports incorrect header in projects containing targets that produce different header files with the same name. 8201103
  • A build may hang if Xcode encounters a build error and the “Continue building after errors” option in general preferences is turned on. 10642885

Known Issues

General

  • The App Store app cannot install Xcode in the /Applications directory because there are beta releases of Xcode in that directory.
    Do not install beta releases of Xcode in the /Applications directory. 10824869

iOS SDK Support

  • Xcode cannot launch your app on a device for debugging after you install the iOS 3.x device debugging support component.
    Unplug and plug-in your device to your Mac, and ensure that you build your app for the armv6 architecture. 10538662

Editing Source Code

  • Xcode doesn’t show code-completion suggestions when there are mismatched braces.
    Turn on the “Automatically insert closing "}"” option in text editing preferences to reduce the number of mismatched braces. 10775381

Debugging

  • Some debugger commands and log expressions in breakpoints fail when using the LLDB debugger because Xcode uses the wrong frame when executing the debugger command or evaluating the log expression.
    If you know what thread the the debugger command or log expression must run relative to, add a breakpoint action that sets the current frame to the appropriate one before the breakpoint action with the problem. 10426977

Debugging: LLDB

  • The variables pane in the debug area does’t display correctly the child values of variables with dynamic types (Objective-C object pointers and virtual C++ pointers).
    Use the console pane in the debug area: enter the commands frame variable *self or frame variable *this to the values.10658091
  • LLDB cannot be used to debug apps on devices running iOS 3.x or iOS 4.x.
    Set GDB instead of LLDB as the debugger in the scheme that builds your app. 10776590

Performance Measurement and Analysis

  • When there are more than one Xcode releases installed on your Mac, Xcode 4.3 may not find your app’s symbols when displaying crash reports and the trace data for instruments.
    To enable Instruments to find your app’s symbols when displaying trace data:
    1. In Instruments, choose File > Re-symbolicate Document.
    2. Search for you app’s name, and locate it in your app’s build directory, such as ~/Library/Developer/Xcode/DerivedData/<MyApp>. 10552213
  • You cannot run System Time Profile from the Instruments icon in the Dock by Control-clicking the icon and choosing System Time Profile.
    Control-click the Instruments icon in the Dock, and select the Allow Tracing of Any Process option. 10755622

Source Control and Snapshots

  • When Xcode attempts to authenticate Subversion repositories that require approval of a server certificate, one or more svn processes hangs.
    Authenticate the server in Terminal. 10042297


Xcode 4.4 Release Notes

Xcode 4.4 Release Notes

New Features

General

  • You can drag file, directory, and group icons from the jump bar to the project navigator, a Finder window, and other apps. 7452760
  • The Use Base Internationalization setting in the project editor works only on Mac products for deployment on OS X v.10.8 and later. Xcode must also be running on OS X v.10.8 or later. This setting is not supported on iOS projects. 11712855

Editing Source Code

  • The source editor can remove trailing whitespace at the end of a line after you have edited it. You control this behavior with the “Automatically trim trailing whitespace” option in Text Editing preferences. 2535591
  • When the “Automatically insert closing braces” option in Text Editing preference is turned on, as you type an opening parenthesis, brace, or quotation mark, the source editor adds the corresponding closing character. When the “Enable type-over completions” option is turned on, the editor adds the closing character in a state in which you can type over the character. This feature reduces the appearance of duplicate closing characters, such as when you type both the open and close characters quickly. 3780948
    Press Tab to jump over the closing character.

Compiling: ARM

  • LLVM integrated assembler for ARM. This new assembler improves compilation times for iOS products, and provides better user level diagnostics for ARM assembly code. This assembler uses only Unified Assembly Language (UAL) assembly code; therefore, you may need to update projects that use manually generated assembly code. 9136376
    Use the clang -no-integrated-as command-line option in projects with substantial Divided Syntax assembly code while transitioning to UAL.

Enhancements

Editing Source Code

  • During a code completion interaction, Xcode gives higher priority to completions you have used recently. 9790948

Editing Property Lists

  • You can view and modify the root object of a custom property list file. 8635494

Creating Projects

  • When creating a project, you can choose whether to add it to a workspace or create a standalone project. 8032086

Resolved Issues

Editing User Interfaces

  • When you hold down Option and place the pointer over views in the canvas, the distance values are not obscured by other elements, such as the resizing handles. 8204499

File System

  • You can rename a file just by changing the case of one of the letters in its filename, even on a case-insensitive file system. 7846036

New Issues

General

  • A failure to rebuild precompiled header (PCH) files causes syntax highlighting, code completion, and Command+click navigation to behave incorrectly. 11538640
    Delete the PCH index folder.
  • Xcode may not show any windows when it’s launched. This happens when you download Xcode from https://developer.apple.com and the “Close windows when quitting an application” preference in System Preferences is unselected. 11865559
    Switch to another app and relaunch Xcode.

Editing Source Code

  • Text and font rendering on OS X v10.8 is optimized for Retina display. On a non–Retina display running OS X v.10.8, some font configurations can appear blurry in Xcode. 11486875
    Switch back to non–Retina display optimized text and font appearance in Xcode by entering this command in Terminal:
    defaults write com.apple.dt.Xcode NSFontDefaultScreenFontSubstitutionEnabled -bool YES

Editing Core Data Models

  • MobileMe syncing support is deprecated. However, the syncable property is still set to YES by default in the User Info Dictionary for entities and properties, but the model editor doesn’t show this setting. 10787672
    To explicitly set syncable to NO for an entity or a property, add a key/value pair in your User Info Dictionary:
    1. Select the entity or property for which you want to turn off synching on a model file.
    2. In the User Info section in the Data Model inspector, add this key/value pair:

      key
      "com.apple.syncservices.Syncable"
      value
      "NO"

Localization

  • When you select the Use Base Internationalization option in the project editor, Xcode generates strings files for each your project’s user interface documents. 11462724
    To resynchronize your strings files with new content from your user interface documents, use the --generate-strings-file option of the ibtool command to produce new strings files. Then, manually merge the new files into your existing localized strings.

Debugging: LLDB

  • The po, print, and expression commands cannot access enumerators directly. You must use the name of the enumeration. 11485295
    For example, if your code contains enum MyEnum { e1, e2 };, LLDB emits an error if you type print e1. Instead type, print MyEnum::e1.

Autolayout: Runtime

  • At runtime, when adding subviews to a split view while loading both views from nib files, you may see log messages about unsatisfiable constraints because of autoresizing mask constraints on the split view panes. These are benign log messages because a split view automatically fixes the problem after adding the subview. 11614767
    In your code, before adding the subview to the split view, send setTranslatesAutoresizingMaskIntoConstraints:NO to the subview.

Monday, December 16, 2013

Xcode 4.5 Release Notes

Xcode 4.5 Release Notes

New Features

Editing User Interfaces

  • The Interface Builder canvas includes a new button to toggle between iPhone screen layouts. When you click the button, Xcode resizes full-screen views to match the selected iPhone screen size. When the top level views are resized, Xcode uses the resizing rules specified by layout constraints or springs and struts in the size inspector to reflow the contained views. 12290237
    Use this button to toggle between layouts and ensure that the resizing rules you define work as expected on both the new Retina 4 screen and previous screen sizes.

Editing User Interfaces: Storyboards

  • Storyboards now support view controller containment. You can add child view controllers to a parent view controller in a storyboard. At runtime, when the viewDidLoad method is called on the parent controller, its view hierarchy (composed of the view hierarchies of its child controllers) is already loaded. 9630246
    To add a view controller as the child of another view controller:
    1. Add a container view from the Object library.
    2. Connect the container view to the child view controller with an embed segue.

Enhancements

General

  • When Xcode autocreates schemes, it now adds the new schemes in project order (within the workspace) and target order (within each project). 7996506

Editing User Interfaces: Storyboards

  • You can now specify that modal segues be presented without animation. 10384049
  • You can now create unwind segues that allow transitioning to existing instances of scenes in a storyboard. 9211697.
    With earlier releases of Xcode, you may have implemented unwind segues programmatically. See iOS SDK Usage for details.

iOS SDK Usage

  • When your app runs on iOS 6.0 or later, in the shouldPerformSegueWithIdentifier:sender: method of your UIViewController subclass, you can decide whether to trigger a segue with a specific identifier, which you set in the segue’s Attributes inspector. 9447109

Source Control: Subversion

  • When you update your Subversion-managed project, Xcode now automatically applies the update if there are no conflicts. 11913482
    To see changes from the repository before applying them, choose File > Source Control > Update while holding down the Control key.

Changes

General: iOS

  • This version of Xcode does not generate armv6 binaries. 12282156
  • The minimum deployment target is iOS 4.3. 12282166
  • In this Xcode release, Auto Layout is turned on for new user interface documents (storyboards and nib files). Because Auto Layout requires iOS 6.0, using such user interface documents on earlier iOS releases results in a crash or other undefined behavior. 12289644
    For your app to run on earlier iOS releases, turn off Auto Layout in its user interface documents.

Distributing Apps: IOS

  • This release of Xcode doesn’t allow submitting to the App Store apps with iOS Deployment Target set to iOS releases earlier than iOS 4.3. The validation process fails with the message “This bundle is invalid. The key UIRequiredDeviceCapabilities in the Info.plist may not contain values that would prevent this application from running on devices that were supported by previous versions.” 12309358
    Set the app’s iOS Deployment Target to iOS 4.3 or later.

Creating Projects

  • Projects created using this Xcode release use the new libc++ implementation of the standard C++ library. The libc++ library is available only on iOS 5.0 and later and OS X 10.7 and later. 12221787
    To enable deployment on earlier releases of iOS and OS X in your project, set the C++ Standard Library build setting to libstdc++ (Gnu C++ standard library).

Managing Devices

  • Uploading app data files to an iOS device works correctly on OS X v10.7 and v10.8. 12017933

Source Control

  • RCS and CVS are deprecated in this Xcode release. 12252058

Installing

  • Starting in Xcode 4.3, the Xcode.app file package contains all the Xcode developer tools. The man pages for the command-line tools Xcode uses are also placed in this package. However, these man pages are not included in the places searched by the man command. To access these man pages, you must add them to the index of man pages used by the man command. 10658081
    To add the Xcode man pages to the man-page index:
    1. Construct MANPATH for the Xcode.app package you’re using by executing these shell commands:
      #!/bin/tcsh
      set xcodeManPathsTmp=/tmp/Xcode
       
      # Expect to find Xcode.app in /Applications
      find /Applications/Xcode.app -name man >! $xcodeManPathsTmp
      sudo cp $xcodeManPathsTmp /etc/manpaths.d
    2. Set the MANPATH environment variable in your command shell:
      • C-Shell
        Edit /etc/csh.login by adding this line before the <code>if ( -x /usr/libexec/path_helper ) then line:
        setenv MANPATH ""
      • Bourne Shell
        Edit /etc/profile by adding this line before the if [ -x /usr/libexec/path_helper ]; then line:
        export MANPATH=""
        The path_helper command adds the paths in the manpaths.d file to the PATH and MANPATH environment variables.
    3. Open a new shell window, and verify that MANPATH lists the paths to the Xcode.app package you’re using.
    4. Index the man pages by executing this shell command:
      sudo /usr/libexec/makewhatis

New Issues

Editing User Interfaces

  • When you add a gesture recognizer in a storyboard, it mistakenly overrides the system-supplied gesture recognizers for the target view. For example, adding a tap gesture recognizer to a table view results in a table view that does not scroll. 12200238
    Disconnect the gesture recognizer in the storyboard, and apply it in code.

Performance Measurement and Analysis: Instruments

  • A UI automation script being run with a simulator target in Instruments fails if your Mac contains multiple copies of Xcode and the Xcode install path is not set up correctly. 12288632
    Determine the path to the running Xcode instance by executing this shell command:
    $ xcode-select --print-path
    If the returned path doesn’t point to the running Xcode instance, execute this shell command:
    $ xcode-select -switch <path_to_the_Xcode_package>
    • In the command, <path_to_the_Xcode_package> is the path to the Xcode.app package you’re using—for example, /Applications/Xcode.app.

Known Issues

General

  • Xcode may not show any windows when it’s launched. This happens when you download Xcode from https://developer.apple.com and the “Close windows when quitting an application” preference in System Preferences is unselected. 11865559
    Switch to another app and relaunch Xcode.

Editing Core Data Models

  • MobileMe syncing support is deprecated. However, the syncable property is still set to YES by default in the User Info Dictionary for entities and properties, but the model editor doesn’t show this setting. 10787672
    To explicitly set syncable to NO for an entity or a property, add a key-value pair in your User Info Dictionary:
    1. Select the entity or property for which you want to turn off synching on a model file.
    2. In the User Info section in the Data Model inspector, add this key-value pair:

      key
      "com.apple.syncservices.Syncable"
      value
      "NO"

Editing Source Code

  • Text and font rendering on OS X v10.8 is optimized for Retina display. On a non–Retina display running OS X v10.8, some font configurations can appear blurry in Xcode. 11486875
    Switch back to non–Retina display optimized text and font appearance in Xcode by entering this command in Terminal:
    defaults write com.apple.dt.Xcode NSFontDefaultScreenFontSubstitutionEnabled -bool YES

Localization

  • When you select the Use Base Internationalization option in the project editor, Xcode generates strings files for each your project’s user interface documents. 11462724
    To resynchronize your strings files with new content from your user interface documents, use the --generate-strings-file option of the ibtool command to produce new strings files. Then, manually merge the new files into your existing localized strings.

Autolayout: Runtime

  • At runtime, when adding subviews to a split view while loading both views from nib files, you may see log messages about unsatisfiable constraints because of autoresizing mask constraints on the split view panes. These are benign log messages because a split view automatically fixes the problem after adding the subview. 11614767
    In your code, before adding the subview to the split view, send setTranslatesAutoresizingMaskIntoConstraints:NO to the subview.

Debugging: LLDB

  • The po, print, and expression commands cannot access enumerators directly. You must use the name of the enumeration. 11485295
    For example, if your code contains enum MyEnum { e1, e2 };, LLDB emits an error if you type print e1. Instead, type print MyEnum::e1.

Xcode 4.4.1 Release Notes

Changes

Distributing Apps

  • Xcode no longer preserves an app’s designated requirements when you submit it to the App Store. 12006125
    Some apps where prevented from submission because of designated requirements.

Resolved Issues

Debugging

  • After quitting iOS Simulator directly, Xcode continues to show the process launched on the simulator as running. 11998376

Editing Source Code

  • Xcode doesn’t offer code completion in Objective-C++ files. 12006547

Compiling: LLVM

  • The LLDB debugger gets the wrong address for some variables. 12006552
  • When compiling an Objective-C++ file in C++11 with vectors under automatic reference counting (ARC), the LLVM compiler generates incorrect code. 12006560
  • Objective-C code compiled under ARC and optimized for size may crash at runtime. 12006567

Unit Testing

  • Xcode becomes unresponsive while running unit tests. 12017975

Known Issues

Managing Devices

  • Uploading app data files to an iOS device may not work. 12017933
    • On OS X v10.8, duplicate the .xcappdata file, and upload the duplicate.
    • On OS X v10.7 there is no workaround to this issue.

Xcode 4.4 Release Notes

New Features

General

  • You can drag file, directory, and group icons from the jump bar to the project navigator, a Finder window, and other apps. 7452760
  • The Use Base Internationalization setting in the project editor works only on Mac products for deployment on OS X v.10.8 and later. Xcode must also be running on OS X v.10.8 or later. This setting is not supported on iOS projects. 11712855

Editing Source Code

  • The source editor can remove trailing whitespace at the end of a line after you have edited it. You control this behavior with the “Automatically trim trailing whitespace” option in Text Editing preferences. 2535591
  • When the “Automatically insert closing braces” option in Text Editing preference is turned on, as you type an opening parenthesis, brace, or quotation mark, the source editor adds the corresponding closing character. When the “Enable type-over completions” option is turned on, the editor adds the closing character in a state in which you can type over the character. This feature reduces the appearance of duplicate closing characters, such as when you type both the open and close characters quickly. 3780948
    Press Tab to jump over the closing character.

Compiling: ARM

  • LLVM integrated assembler for ARM. This new assembler improves compilation times for iOS products, and provides better user level diagnostics for ARM assembly code. This assembler uses only Unified Assembly Language (UAL) assembly code; therefore, you may need to update projects that use manually generated assembly code. 9136376
    Use the clang -no-integrated-as command-line option in projects with substantial Divided Syntax assembly code while transitioning to UAL.

Enhancements

Editing Source Code

  • During a code completion interaction, Xcode gives higher priority to completions you have used recently. 9790948

Editing Property Lists

  • You can view and modify the root object of a custom property list file. 8635494

Creating Projects

  • When creating a project, you can choose whether to add it to a workspace or create a standalone project. 8032086

Resolved Issues

Editing User Interfaces

  • When you hold down Option and place the pointer over views in the canvas, the distance values are not obscured by other elements, such as the resizing handles. 8204499

File System

  • You can rename a file just by changing the case of one of the letters in its filename, even on a case-insensitive file system. 7846036

New Issues

General

  • A failure to rebuild precompiled header (PCH) files causes syntax highlighting, code completion, and Command+click navigation to behave incorrectly. 11538640
    Delete the PCH index folder.
  • Xcode may not show any windows when it’s launched. This happens when you download Xcode from https://developer.apple.com and the “Close windows when quitting an application” preference in System Preferences is unselected. 11865559
    Switch to another app and relaunch Xcode.

Editing Source Code

  • Text and font rendering on OS X v10.8 is optimized for Retina display. On a non–Retina display running OS X v.10.8, some font configurations can appear blurry in Xcode. 11486875
    Switch back to non–Retina display optimized text and font appearance in Xcode by entering this command in Terminal:
    defaults write com.apple.dt.Xcode NSFontDefaultScreenFontSubstitutionEnabled -bool YES

Editing Core Data Models

  • MobileMe syncing support is deprecated. However, the syncable property is still set to YES by default in the User Info Dictionary for entities and properties, but the model editor doesn’t show this setting. 10787672
    To explicitly set syncable to NO for an entity or a property, add a key/value pair in your User Info Dictionary:
    1. Select the entity or property for which you want to turn off synching on a model file.
    2. In the User Info section in the Data Model inspector, add this key/value pair:

      key
      "com.apple.syncservices.Syncable"
      value
      "NO"

Localization

  • When you select the Use Base Internationalization option in the project editor, Xcode generates strings files for each your project’s user interface documents. 11462724
    To resynchronize your strings files with new content from your user interface documents, use the --generate-strings-file option of the ibtool command to produce new strings files. Then, manually merge the new files into your existing localized strings.

Debugging: LLDB

  • The po, print, and expression commands cannot access enumerators directly. You must use the name of the enumeration. 11485295
    For example, if your code contains enum MyEnum { e1, e2 };, LLDB emits an error if you type print e1. Instead type, print MyEnum::e1.

Autolayout: Runtime

  • At runtime, when adding subviews to a split view while loading both views from nib files, you may see log messages about unsatisfiable constraints because of autoresizing mask constraints on the split view panes. These are benign log messages because a split view automatically fixes the problem after adding the subview. 11614767
    In your code, before adding the subview to the split view, send setTranslatesAutoresizingMaskIntoConstraints:NO to the subview.