Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional iPhone and iPad Application Development
This is the forum to discuss the Wrox book Professional iPhone and iPad Application Development by Gene Backlin; ISBN: 978-0-470-87819-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional iPhone and iPad Application Development section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 4th, 2011, 11:00 AM
Friend of Wrox
Points: 1,671, Level: 16
Points: 1,671, Level: 16 Points: 1,671, Level: 16 Points: 1,671, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
Default Chapter 12

Well that was fun… I guess. Having never done Unit Testing before, trying to reconcile the book's instructions with Xcode 4's integrated Unit Test was a journey. Didn't succeed on the first try, so went back and did it in Xcode 3.
There are a few minor issues with the instructions.
1. On page 432 User Interaction should be disabled for the textFields
2. p. 437 dealloc should also have [pickerViewController release];
3. p. 440 PickerViewController.m should implement a -dealloc method releasing the instance variables.
4. p. 442 step 3 is a little muddled, since the name key is linked with the age value and the age key is not mentioned at all. Fortunately, the screen shot (Figure 12-15) does clarify what is intended.
5. If the step 3 is not understood, step 5 is a non sequitur

As far as the Unit Test section, Xcode 4 handles everything for you and my mistake was to try to find a way to apply the book's steps in Xcode 4. There is no need to. The question I had about Xcode 3 (which does not seem relevant for Xcode 4) is, the steps in the book involve creating a separate profile for the Unit Test (which I did). Would an existing profile work?

A plus for Xcode 4 is that the tests can be run in the simulator, the bundle identifier does not need to be changed and other than implementing the tests, the bundles, targets and templates are all created for you. Unfortunately, for me 2 errors are coming up when attempting to run the tests on a device which do not appear when running the tests in the simulator. (Both from the book project and an unaltered template project) The tests complete successfully in the simulator but log the following on the iPad:

warning: Couldn't get real path for inserted library /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.1 (8G4)/Symbols/Developer/Library/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection

I can't find a DevToolsBundleInjection.framework anywhere. "Symbols" does not even have a subdirectory called "Developer"

and

gdb-arm-apple-darwin(48411,0x7fff704d4ca0) malloc: *** error for object 0x10161d418: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug


and a broken pipe error
'putpkt: write failed':

Hope to resolve this soon, and curious as to whether this is something others have run into.

Bob
Reply With Quote
  #2 (permalink)  
Old April 4th, 2011, 11:58 PM
Wrox Author
Points: 362, Level: 6
Points: 362, Level: 6 Points: 362, Level: 6 Points: 362, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2010
Posts: 61
Thanks: 0
Thanked 9 Times in 7 Posts
Default

Yes, Xcode 4 and Xcode 3 have something different going under the hood. I'll see if I can recreate your errors and see what happens. Stay tuned...
Reply With Quote
  #3 (permalink)  
Old May 26th, 2011, 02:24 AM
Registered User
 
Join Date: May 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I've got the same error as Bob. Anyone managed to solve this already on Xcode 4?
Reply With Quote
  #4 (permalink)  
Old May 26th, 2011, 05:56 AM
Wrox Author
Points: 362, Level: 6
Points: 362, Level: 6 Points: 362, Level: 6 Points: 362, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2010
Posts: 61
Thanks: 0
Thanked 9 Times in 7 Posts
Default

Quote:
Originally Posted by veed View Post
I've got the same error as Bob. Anyone managed to solve this already on Xcode 4?
Hi veed !

Are you running the latest version of Xcode 4 ?
Reply With Quote
  #5 (permalink)  
Old May 26th, 2011, 01:17 PM
Wrox Author
Points: 362, Level: 6
Points: 362, Level: 6 Points: 362, Level: 6 Points: 362, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2010
Posts: 61
Thanks: 0
Thanked 9 Times in 7 Posts
Default

I have uploaded the project that works on the current release of Xcode 4.

Quote:
NOTE: You are going to have to change the bundle id's and get your own provisioning profile for this to work for you. This currently is for my device, so it will fail if is not changed.
UnitTests.zip

Setting the target:
target.png

Test Case source:
testcases.png

Sample run:
Code:
GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:56:02 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin --target=arm-apple-darwin".tty /dev/ttys000
warning: Couldn't get real path for inserted library /Developer/Xcode4/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/Developer/Library/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection

warning: Couldn't get real path for inserted library /Developer/Xcode4/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/Developer/Library/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection

target remote-mobile /tmp/.XcodeGDBRemote-1320-29
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
[Switching to process 11523 thread 0x0]
[Switching to process 11523 thread 0x0]
sharedlibrary apply-load-rules all
warning: Unable to read symbols for /Developer/Xcode4/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/Developer/Library/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection (file not found).
warning: Unable to read symbols for /Developer/Xcode4/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/Developer/Library/Frameworks/SenTestingKit.framework/SenTestingKit (file not found).
warning: Unable to read symbols for /Developer/Xcode4/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/usr/lib/info/dns.so (file not found).
Test Suite 'All tests' started at 2011-05-26 16:50:20 +0000
Test Suite '/var/mobile/Applications/4AC66F56-838A-4434-8FCA-D70B6A566293/UnitTests.app/UnitTestsBundle.octest(Tests)' started at 2011-05-26 16:50:20 +0000
Test Suite 'AppTests' started at 2011-05-26 16:50:20 +0000
Test Case '-[AppTests testAppDelegate]' started.
2011-05-26 11:50:20.994 UnitTests[1160:307] -[AppTests testAppDelegate] setUp
2011-05-26 11:50:21.021 UnitTests[1160:307] -[AppTests testAppDelegate] tearDown
Test Case '-[AppTests testAppDelegate]' passed (0.043 seconds).
Test Case '-[AppTests testNamesCount]' started.
2011-05-26 11:50:21.039 UnitTests[1160:307] -[AppTests testNamesCount] setUp
2011-05-26 11:50:21.061 UnitTests[1160:307] -[AppTests testNamesCount] tearDown
Test Case '-[AppTests testNamesCount]' passed (0.037 seconds).
Test Case '-[AppTests testPickerSelection]' started.
2011-05-26 11:50:21.078 UnitTests[1160:307] -[AppTests testPickerSelection] setUp
2011-05-26 11:50:21.111 UnitTests[1160:307] -[AppTests testPickerSelection] tearDown
Test Case '-[AppTests testPickerSelection]' passed (0.057 seconds).
Test Case '-[AppTests testViewController]' started.
2011-05-26 11:50:21.138 UnitTests[1160:307] -[AppTests testViewController] setUp
2011-05-26 11:50:21.156 UnitTests[1160:307] -[AppTests testViewController] tearDown
Test Case '-[AppTests testViewController]' passed (0.031 seconds).
Test Suite 'AppTests' finished at 2011-05-26 16:50:21 +0000.
Executed 4 tests, with 0 failures (0 unexpected) in 0.168 (0.185) seconds

Test Suite '/var/mobile/Applications/4AC66F56-838A-4434-8FCA-D70B6A566293/UnitTests.app/UnitTestsBundle.octest(Tests)' finished at 2011-05-26 16:50:21 +0000.
Executed 4 tests, with 0 failures (0 unexpected) in 0.168 (0.216) seconds

Test Suite '/Developer/Library/Frameworks/SenTestingKit.framework(Tests)' started at 2011-05-26 16:50:21 +0000
Test Suite 'SenInterfaceTestCase' started at 2011-05-26 16:50:21 +0000
Test Suite 'SenInterfaceTestCase' finished at 2011-05-26 16:50:21 +0000.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.011) seconds

Test Suite '/Developer/Library/Frameworks/SenTestingKit.framework(Tests)' finished at 2011-05-26 16:50:21 +0000.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.036) seconds

Test Suite 'All tests' finished at 2011-05-26 16:50:21 +0000.
Executed 4 tests, with 0 failures (0 unexpected) in 0.168 (0.300) seconds

Program ended with exit code: 0

Last edited by gbacklin; May 30th, 2011 at 10:07 AM.
Reply With Quote
The Following User Says Thank You to gbacklin For This Useful Post:
veed (May 29th, 2011)
  #6 (permalink)  
Old May 29th, 2011, 12:48 PM
Registered User
 
Join Date: May 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi Gene, I got mine working after a doing a clean, deleting the app and restarting both Xcode and my iPhone. Subsequent tests won't work without repeating the 4 steps above. Can't explain why though.

Vernon

Console Output:
Code:
GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:56:02 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin --target=arm-apple-darwin".tty /dev/ttys000
warning: Couldn't get real path for inserted library /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3 (8J2)/Symbols/Developer/Library/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection

warning: Couldn't get real path for inserted library /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3 (8J2)/Symbols/Developer/Library/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection

target remote-mobile /tmp/.XcodeGDBRemote-6578-22
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
[Switching to process 11779 thread 0x0]
[Switching to process 11779 thread 0x0]
sharedlibrary apply-load-rules all
warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3 (8J2)/Symbols/Developer/Library/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection (file not found).
warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3 (8J2)/Symbols/Developer/Library/Frameworks/SenTestingKit.framework/SenTestingKit (file not found).
Test Suite 'All tests' started at 2011-05-29 16:18:34 +0000
Test Suite '/Developer/Library/Frameworks/SenTestingKit.framework(Tests)' started at 2011-05-29 16:18:34 +0000
Test Suite 'SenInterfaceTestCase' started at 2011-05-29 16:18:34 +0000
Test Suite 'SenInterfaceTestCase' finished at 2011-05-29 16:18:34 +0000.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.002) seconds

Test Suite '/Developer/Library/Frameworks/SenTestingKit.framework(Tests)' finished at 2011-05-29 16:18:34 +0000.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.006) seconds

Test Suite '/var/mobile/Applications/7062E42B-69B3-4BA3-A6F3-BAD0D3F4AC6D/UnitTestsTests.octest(Tests)' started at 2011-05-29 16:18:34 +0000
Test Suite 'UnitTestsTests' started at 2011-05-29 16:18:34 +0000
Test Case '-[UnitTestsTests testAppDelegate]' started.
Test Case '-[UnitTestsTests testAppDelegate]' passed (0.000 seconds).
Test Case '-[UnitTestsTests testNamesCount]' started.
Test Case '-[UnitTestsTests testNamesCount]' passed (0.000 seconds).
Test Case '-[UnitTestsTests testPickerSelection]' started.
Test Case '-[UnitTestsTests testPickerSelection]' passed (0.001 seconds).
Test Case '-[UnitTestsTests testViewController]' started.
Test Case '-[UnitTestsTests testViewController]' passed (0.000 seconds).
Test Suite 'UnitTestsTests' finished at 2011-05-29 16:18:34 +0000.
Executed 4 tests, with 0 failures (0 unexpected) in 0.002 (0.005) seconds

Test Suite '/var/mobile/Applications/7062E42B-69B3-4BA3-A6F3-BAD0D3F4AC6D/UnitTestsTests.octest(Tests)' finished at 2011-05-29 16:18:34 +0000.
Executed 4 tests, with 0 failures (0 unexpected) in 0.002 (0.010) seconds

Test Suite 'All tests' finished at 2011-05-29 16:18:34 +0000.
Executed 4 tests, with 0 failures (0 unexpected) in 0.002 (0.031) seconds

Program ended with exit code: 0
Reply With Quote
  #7 (permalink)  
Old May 29th, 2011, 12:54 PM
Registered User
 
Join Date: May 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

A subsequent test output:
Code:
GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:56:02 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin --target=arm-apple-darwin".tty /dev/ttys000
warning: Couldn't get real path for inserted library /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3 (8J2)/Symbols/Developer/Library/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection

warning: Couldn't get real path for inserted library /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3 (8J2)/Symbols/Developer/Library/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection

target remote-mobile /tmp/.XcodeGDBRemote-7539-21
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
gdb-arm-apple-darwin(7751,0x7fff71102ca0) malloc: *** error for object 0x10045fac8: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Reply With Quote
  #8 (permalink)  
Old May 30th, 2011, 11:13 AM
Wrox Author
Points: 362, Level: 6
Points: 362, Level: 6 Points: 362, Level: 6 Points: 362, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2010
Posts: 61
Thanks: 0
Thanked 9 Times in 7 Posts
Default

Ok, re-download this project and change the bundle id's from mine to yours in the plists so you can install on your device.


UnitTests.zip


See how this goes :)

FYI, I downloaded Apple's Sample code on UnitTests and also received:
Code:
warning: Couldn't get real path for inserted library /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3 (8J2)/Symbols/Developer/Library/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection

warning: Couldn't get real path for inserted library /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3 (8J2)/Symbols/Developer/Library/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection
the DevToolsBundleInjection.framework only seems to come up in Xcode 3 Tools:
/Developer/XCode3/Library/PrivateFrameworks/DevToolsBundleInjection.framework

There is however in Xcode 4 :
/Developer/Xcode4/Library/PrivateFrameworks/IDEBundleInjection.framework

Last edited by gbacklin; May 30th, 2011 at 11:28 AM.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 12 meriadoc1971 BOOK: Professional Windows Phone 7 Application Development: Building Applications and Games Using Vi 0 January 18th, 2011 12:01 PM
Generics chapter 12 difficult chapter i found ...? Larryz C# 2005 1 July 4th, 2007 09:40 PM
Errors on Chapter 12 example(12.8) sonnie ASP.NET 2.0 Professional 2 June 7th, 2006 10:55 AM



All times are GMT -4. The time now is 09:41 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.