Cocos2D V3.0 crash CCLabelTTF - cocos2d-iphone

I am converting my project from using Cocos2D v2.1 to V3.0. It's a UIKit project with Cocos2D added as a sub-project and the director loaded lazily in a couple of viewcontrollers.
I managed to get rid of all the compiler warnings, it runs fine and seems to load the director fine, but then crashes as follows:
-[NSConcreteMutableAttributedString hasAttribute:]: unrecognized selector sent to instance 0xc4f8ff0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteMutableAttributedString hasAttribute:]: unrecognized selector sent to instance 0xc4f8ff0'
*** First throw call stack:
(
0 CoreFoundation 0x0291a1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x026998e5 objc_exception_throw + 44
2 CoreFoundation 0x029b7243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0290a50b ___forwarding___ + 1019
4 CoreFoundation 0x0290a0ee _CF_forwarding_prep_0 + 14
5 0x0019d7d0 -[CCLabelTTF updateTexture] + 544
6 0x0019d546 -[CCLabelTTF visit] + 70
7 0x00181c86 -[CCNode visit] + 566
8 0x00181c86 -[CCNode visit] + 566
9 0x00202b9d -[CCDirectorIOS drawScene] + 381
10 0x00203fdc -[CCDirectorDisplayLink mainLoop:] + 92
The breakpoint stops in the CCLabelTTF function - (BOOL) updateTexture at
#ifdef __CC_PLATFORM_IOS
// Font color
if (![formattedAttributedString hasAttribute:NSForegroundColorAttributeName])
There is only one CCLabelTTF in the code, and I create it like so:
self.scoreLabel = [CCLabelTTF labelWithString:NSLocalizedString(#"Score", #"") fontName:#"Marker Felt" fontSize:20 dimensions:CGSizeMake(100, 50)];
self.scoreLabel.horizontalAlignment = (CCTextAlignment)NSTextAlignmentRight;
scoreLabel.position = ccp(250,70);
[self addChild:scoreLabel z:1];
Any help much appreciated. I've searched Cocos2D forums and here and can't find anything similar to this issue.

Ahh... just solved it. Since Cocos2d is a sub-project, I had to include the -ObjC flag under Other Linker Flags for the target. This wasn't necessary with v2.1, but then that version didn't use the NSAttributedString+CCAdditions category.

Related

I have a problem running Foundation Watch (gulp error) - /_input-group.scss

The compile fails because of the error:
Error in plugin "sass"
Message:
node_modules\foundation-sites\scss\forms\_input-group.scss
Error: Incompatible units: 'rem' and 'rem*rem'.
on line 25 of node_modules/foundation-sites/scss/forms/_input-group.scss, in mixin `foundation-form-prepostfix`
from line 30 of node_modules/foundation-sites/scss/forms/_forms.scss, in mixin `foundation-forms`
from line 14 of scss/app.scss
> $height: ($input-font-size * $input-line-height) + (get-side($input-paddin
-----------^
I use the input-group features in login and sign forms and can't afford to not include the foundation-forms; in my app.scss file. This problem arised when i switched from win 7 to win 10.
Thanks for the answers but I have already found the solution. I updated the _input-group.scss file. See below.
From
$height: ($input-font-size * $input-line-height) + (get-side($input-padding, 'top') + get-side($input-padding, 'bottom')) - rem-calc(1);
to
$height: ($input-font-size + $form-spacing * 1.5);
Best regards,
Jure

NativeScript AWS AppSync Integration

I've followed several AppSync tutorials for angular web, but trying to repeat the process in NativeScript has been more difficult. It looks like people have done it before so any input from anyone who has gotten this to work would be awesome.
Following the same general procedure I did for a regular angular angular app, I attempted to use aws-appsync and nativescript-nodeify to attempt to make it nativescript-compatible. Adding nativescript-nodeify got rid of my initial error, but now I'm getting a new error:
The error I'm getting is:
***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1 0x100b9373c NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool, bool)
2 0x100bc4068 -[TNSRuntime executeModule:referredBy:]
3 0x10056229c
4 0x184fcdfc0 <redacted>
JavaScript stack trace:
1 moduleDeclarationInstantiation#file:///app/tns_modules/aws-appsync/lib/link/non-terminating-link.js:71:26
2 link#[native code]
3 #[native code]
4 promiseReactionJob#[native code]
5 require#[native code]
6 anonymous#file:///app/tns_modules/aws-appsync/lib/link/non-terminating-link.js:71:26
7 evaluate#[native code]
8 moduleEvaluation#[native code]
9 #[native code]
10 promiseReactionJob#[native code]
11 require#[native code]
12 anonymous#file:///app/tns_modules/aws-appsync/lib/link/non-terminating-http-link.js:25:37
13 evaluate#[native code]
14 moduleEvaluation#[native code]
15 #[native code]
16 promiseReactionJob#[native code]
17 require#[native code]
18 anonymous#file:///app/tns_modules/aws-appsync/lib/link/index.js:21:42
19 evaluate#[native code]
20 moduleEvaluation#[native code]
21 #[native code]
22 promiseReactionJob#[native code]
23 require#[native code]
24 anonymous#file:///app/tns_modules/aws-appsync/lib/client.js:87:21
25 evaluate#[native code]
26 moduleEval<\M-b\M^#\M-&>
JavaScript error:
file:///app/tns_modules/aws-appsync/lib/link/non-terminating-link.js:71:26: JS ERROR SyntaxError: Importing binding name 'print' is not found.
I'm getting an error when initializing AWSAppSyncConfig. The relevant code is below:
require('nativescript-nodeify');
const appSyncConfig = ...
import AWSAppSyncClient from 'aws-appsync';
import { AUTH_TYPE } from 'aws-appsync/lib/link/auth-link';
...
const client = new AWSAppSyncClient({
url: appSyncConfig.aws_appsync_graphqlEndpoint,
region: appSyncConfig.aws_appsync_region,
auth: {
type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
jwtToken: ACCESS_TOKEN
}
});
The error message points to this line in non-terminating-link.js:
var linkUtils_1 = require("apollo-link/lib/linkUtils");
The problem ended up being related to a problem with compatibility between typescript 2.9.* and aws-appsync 1.3.4. I updated my typescript to 3.0.3 and it's working now

Classes not found in third party iOS framework

I am using Appcelerator Hyperloop in the hopes of integrating a third party iOS framework called KolorEyes into my Titanium app.
Here is my appc.js file:
module.exports = {
hyperloop: {
ios: {
xcodebuild: {
flags: {
FRAMEWORK_SEARCH_PATHS: '../../src',
LD_RUNPATH_SEARCH_PATHS: '#executable_path'
},
frameworks: [
'KolorEyes'
]
},
thirdparty: {
'KolorEyes': {
source: ['src'],
header: 'src',
resource: 'src'
}
}
}
}
};
I have my KolorEyes.framework folder in my src folder at the root of my project.
What I'm doing looks like it should work:
index.js
var KolorEyes = require('KolorEyes/KolorEyes');
var KolorEyesSessionParams = require('KolorEyes/KolorEyesSessionParams');
var KolorEyesRenderViewParams = require('KolorEyes/KolorEyesRenderViewParams');
console.log('CLASS: ' + KolorEyes);
console.log('CLASS: ' + KolorEyesSessionParams);
console.log('CLASS: ' + KolorEyesRenderViewParams);
And here is the output:
[INFO] : CLASS: [class KolorEyes]
[INFO] : CLASS: [class KolorEyesSessionParams]
[INFO] : CLASS: [class KolorEyesRenderViewParams]
But when I try to do this:
var params = KolorEyesSessionParams.alloc().init();
It tells me it cannot find the class KolorEyesSessionParams:
[ERROR] : Cannot find class with name: KolorEyesSessionParams
[ERROR] : Script Error {
[ERROR] : column = 32;
[ERROR] : description = "Cannot find class with name: KolorEyesSessionParams";
[ERROR] : line = 108;
[ERROR] : message = "Cannot find class with name: KolorEyesSessionParams";
[ERROR] : name = ClassNotFound;
[ERROR] : nativeStack = "1 libobjc.A.dylib 0x23a6ae17 objc_exception_throw + 38\n2 kolor_test 0x0019ce0b kolor_test + 1515019\n3 kolor_test 0x00195d05 kolor_test + 1486085\n4 JavaScriptCore 0x275f77cd <redacted> + 364\n5 JavaScriptCore 0x273c7dfb <redacted> + 314\n6 JavaScriptCore 0x273c6629 <redacted> + 120\n7 JavaScriptCore 0x2768302f <redacted> + 20366\n8 JavaScriptCore 0x27683039 <redacted> + 20376\n9 JavaScriptCore 0x2767de91 <redacted> + 336\n10 JavaScriptCore 0x275d87db <redacted> + 102\n11 JavaScriptCore 0x273caa09 <redacted> + 344\n12 JavaScriptCore 0x273ca8ad _ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE + 52\n13 JavaScriptCore 0x275887a3 <redacted> + 126\n14 JavaScriptCore 0x276dc183 _ZNK3JSC12PropertySlot14functionGetterEPNS_9ExecStateE + 42\n15 JavaScriptCore 0x273c220b <redacted> + 1406\n16 JavaScriptCore 0x276804ed <redacted> + 9292\n17 JavaScriptCore 0x27683039 <redacted> + 20376\n18 JavaScriptCore 0x27683135 <redacted> + 20628\n19 JavaScriptCore 0x27683039 <redacted> + 20376\n20 JavaScriptCore 0x2767de91 <redacted> + 336\n21 JavaScriptCore 0x275d87db <redacted> + 102\n22 JavaScriptCore 0x273b8d0d <redacted> + 7292\n23 JavaScriptCore 0x274c839b _ZN3JSC8evaluateEPNS_9ExecStateERKNS_10SourceCodeENS_7JSValueERN3WTF8NakedPtrINS_9ExceptionEEE + 354\n24 JavaScriptCore 0x275f6ba5 JSEvaluateScript + 268\n25 kolor_test 0x0003c91d kolor_test + 71965\n26 kolor_test 0x00042fa7 kolor_test + 98215\n27 kolor_test 0x00044741 kolor_test + 104257\n28 kolor_test 0x00044b81 kolor_test + 105345\n29 kolor_test 0x0003caf3 kolor_test + 72435\n30 kolor_test 0x0003da83 kolor_test + 76419\n31 kolor_test 0x00045589 kolor_test + 107913\n32 kolor_test 0x00044521 kolor_test + 103713\n33 libdispatch.dylib 0x23e3d823 <redacted> + 10\n34 libdispatch.dylib 0x23e3d80f <redacted> + 22\n35 libdispatch.dylib 0x23e4bba9 <redacted> + 1524\n36 CoreFoundation 0x24291b6d <redacted> + 8\n37 CoreFoundation 0x24290067 <redacted> + 1574\n38 CoreFoundation 0x241df229 CFRunLoopRunSpecific + 520\n39 CoreFoundation 0x241df015 CFRunLoopRunInMode + 108\n40 GraphicsServices 0x257cfac9 GSEventRunModal + 160\n41 UIKit 0x288b3189 UIApplicationMain + 144\n42 kolor_test 0x00030747 kolor_test + 22343\n43 libdyld.dylib 0x23e87873 <redacted> + 2";
[ERROR] : sourceURL = "file:///var/containers/Bundle/Application/1536D545-76AB-48FA-BDF7-C2729A175F82/kolor_test.app/hyperloop/koloreyes/koloreyessessionparams.js";
[ERROR] : }
I have no issue using UIKit stuff, but these third party classes are just not seen. Even though Hyperloop says it's generating classes for them:
[INFO] : [Hyperloop] Generating class GLKit/GLKView
[INFO] : [Hyperloop] Generating class GLKit/GLKViewController
[INFO] : [Hyperloop] Generating class KolorEyes/KolorEyes
[INFO] : [Hyperloop] Generating class KolorEyes/KolorEyesRenderViewParams
[INFO] : [Hyperloop] Generating class KolorEyes/KolorEyesSessionParams
[INFO] : [Hyperloop] Generating class ModelIO/MDLCamera
[INFO] : [Hyperloop] Generating class ModelIO/MDLLight
Any ideas?
I am having this same issue. According to this response, the issue is that a framework is being used on a platform earlier than what the framework was created for.
Can confirm that once I rebuilt the framework (needed to build against iOS 12 instead of iOS 13) with an older version of the SDK that this issue was resolved for me.
This is a general issue where you cannot run version-specific code on
older devices. Will move and rename it, thanks for reporting this!
Jan Vennemann That's what we discussed a few days ago. I have no final
plan for this, yet, but as the error occurs with referencing the iOS
framework (not the actual API) that's only available in a certain
version and higher (in this case: "Speech.framework", iOS 10+), we may
be able to solve this by guarding the frameworks with their iOS
version if their version is higher then the default one (e.g. 8.1 in
our case).
I could even think of a workaround: If we pass link the framework via
the appc.js, we can pass linker-flags as well, so something like I've
done in my ARKit module maybe. Btw, this could eventually be a
module-related issue as well, as we don't need the module.xcconfig
there anymore and frameworks are linked automatically. If we can
ensure to pass them to the correct architecture and version, we should
be fine!
Source:
https://jira.appcelerator.org/browse/TIMOB-25440?focusedCommentId=429553&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-429553

The page cannot be displayed because an internal server error has occurred

I have a site deployed on azure with django. I have been working on the site for about 6 months and it was working fine. Today all of a sudden the site is not working any more.
The only output I am getting is - "The page cannot be displayed because an internal server error has occurred."
I have the same django code working perfectly on localhost. My azure account has 2 django sites running. Each site is deployed from 2 separate branches from a git repo. Both of them are down.
I tried deploying earlier deployments on azure. it is still showing the same error.
I have also tried setting debug to true on production server. Same results. It seems django is not even being loaded.
My azure account shows a lot of "html server error", when I check under the monitor tab for the site.
What is the problem and how do I solve it? Is a django not loading problem or an azure problem? How do I debug this?
Edit - error log from ftp - logfiles/http/rawlogs
# date time s-sitename cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
2013-07-19 13:20:30 MAKEYSTREET GET /robots.txt X-ARR-LOG-ID=dbb6383f-5342-4fe4-a419-e3f5f373a8f8 80 - 66.249.74.139 Mozilla/5.0+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html) - - www.makeystreet.com 500 0 0 245 416 3484
2013-07-19 13:34:28 MAKEYSTREET GET / X-ARR-LOG-ID=b4c37c5c-46b3-4ff5-9ae7-e0f18f04b404 80 - 10.21.91.242 Mozilla/5.0+(X11;+Linux+i686)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Ubuntu+Chromium/28.0.1500.52+Chrome/28.0.1500.52+Safari/537.36 ARRAffinity=cf6d46f9fadcc9b088669ec23467baf056a50376566d6aacdbea46e06b6acfa5;+WAWebSiteSID=6c2bf64764594b7ca90e2b539b89b9e6;+sessionid=rhvhu9ibb814v1vwqe3nahkkt1lw0yvu;+csrftoken=gO1x5Vm6kzDRKhmbyjbUuVqWKLUjW3Qy;+_ga=GA1.2.1129966823.1374156576 - makeystreet.com 500 0 0 269 897 3546
2013-07-19 13:34:28 MAKEYSTREET GET /favicon.ico X-ARR-LOG-ID=d918daf9-815e-4ef7-8360-525c9c31506c 80 - 10.21.91.242 Mozilla/5.0+(X11;+Linux+i686)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Ubuntu+Chromium/28.0.1500.52+Chrome/28.0.1500.52+Safari/537.36 ARRAffinity=cf6d46f9fadcc9b088669ec23467baf056a50376566d6aacdbea46e06b6acfa5;+WAWebSiteSID=6c2bf64764594b7ca90e2b539b89b9e6;+sessionid=rhvhu9ibb814v1vwqe3nahkkt1lw0yvu;+csrftoken=gO1x5Vm6kzDRKhmbyjbUuVqWKLUjW3Qy;+_ga=GA1.2.1129966823.1374156576 - makeystreet.com 500 0 0 269 864 93
2013-07-19 14:04:47 MAKEYSTREET GET /robots.txt X-ARR-LOG-ID=1b516136-4a39-4543-b9a4-540ce1fce959 80 - 66.249.74.139 Mozilla/5.0+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html) - - www.makeystreet.com 500 0 0 245 416 3515
2013-07-19 14:05:54 MAKEYSTREET GET / X-ARR-LOG-ID=7dc870f8-a7d4-4701-8b75-042789a362cf 80 - 122.166.237.111 Mozilla/5.0+(Windows+NT+6.1;+WOW64;+rv:22.0)+Gecko/20100101+Firefox/22.0 - - www.makeystreet.com 500 0 0 245 440 187
2013-07-19 14:05:54 MAKEYSTREET GET /favicon.ico X-ARR-LOG-ID=64681a43-c47e-4aea-982d-bd3dace9b19e 80 - 122.166.237.111 Mozilla/5.0+(Windows+NT+6.1;+WOW64;+rv:22.0)+Gecko/20100101+Firefox/22.0 ARRAffinity=cf6d46f9fadcc9b088669ec23467baf056a50376566d6aacdbea46e06b6acfa5;+WAWebSiteSID=2e0ff00f9fd84e28ac6b757c93b43b23 - www.makeystreet.com 500 0 0 245 595 62
2013-07-19 14:06:10 MAKEYSTREET GET / X-ARR-LOG-ID=db1870ec-3b2a-4449-ac13-05ab67ffa212 80 - 122.166.237.111 Mozilla/5.0+(Windows+NT+6.1;+WOW64;+rv:22.0)+Gecko/20100101+Firefox/22.0 ARRAffinity=cf6d46f9fadcc9b088669ec23467baf056a50376566d6aacdbea46e06b6acfa5;+WAWebSiteSID=2e0ff00f9fd84e28ac6b757c93b43b23 - www.makeystreet.com 500 0 0 245 573 109
2013-07-19 14:21:55 MAKEYSTREET GET / X-ARR-LOG-ID=4e72fbec-ff2e-4068-b9fe-0a536718e8c7 80 - 10.21.91.242 Mozilla/5.0+(X11;+Linux+i686)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Ubuntu+Chromium/28.0.1500.52+Chrome/28.0.1500.52+Safari/537.36 ARRAffinity=cf6d46f9fadcc9b088669ec23467baf056a50376566d6aacdbea46e06b6acfa5;+WAWebSiteSID=6c2bf64764594b7ca90e2b539b89b9e6;+sessionid=rhvhu9ibb814v1vwqe3nahkkt1lw0yvu;+csrftoken=gO1x5Vm6kzDRKhmbyjbUuVqWKLUjW3Qy;+_ga=GA1.2.1129966823.1374156576 - makeystreet.com 500 0 0 245 887 3515
2013-07-19 14:21:56 MAKEYSTREET GET /favicon.ico X-ARR-LOG-ID=ee05ce88-08cc-4837-94a4-4ef0326a46be 80 - 10.21.91.242 Mozilla/5.0+(X11;+Linux+i686)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Ubuntu+Chromium/28.0.1500.52+Chrome/28.0.1500.52+Safari/537.36 ARRAffinity=cf6d46f9fadcc9b088669ec23467baf056a50376566d6aacdbea46e06b6acfa5;+WAWebSiteSID=6c2bf64764594b7ca90e2b539b89b9e6;+sessionid=rhvhu9ibb814v1vwqe3nahkkt1lw0yvu;+csrftoken=gO1x5Vm6kzDRKhmbyjbUuVqWKLUjW3Qy;+_ga=GA1.2.1129966823.1374156576 - makeystreet.com 500 0 0 269 864 124

Checking IBOutlet connection with OCMock

I want to verify with unit tests that all the IBoutlets in my controller class are correctly hooked up in the NIB file. I'd like to do this with OCMock - even though I know I could simply assert the controllers variables are not nil after loading the NIB. This is more a matter of general understanding of how the process works - as far as I understand it, this should be working, too.
The NIB OnOffSwitchCell has as its File's Owner OnOffSwitchCellController.
This is my test method:
- (void) testIBOutletCellIsWiredToXib {
id mockController = [OCMockObject mockForClass:[OnOffSwitchCellController class]];
[[mockController expect] awakeAfterUsingCoder:OCMOCK_ANY];
[[mockController expect] setValue:OCMOCK_ANY forKey:#"cell"];
[[mockController expect] setValue:OCMOCK_ANY forKey:#"thelabel"];
[[mockController expect] setValue:OCMOCK_ANY forKey:#"theswitch"];
NSArray* nibContents = [guiBundle loadNibNamed:#"OnOffSwitchCell"
owner:mockController
options:nil];
assertThat(nibContents, isNot(nil));
assertThatInt([nibContents count], is(equalToInt(1)));
assertThat([nibContents objectAtIndex:0], is(instanceOf([OnOffSwitchCell class])));
[mockController verify];
}
guiBundle exists and is verified to be a valid NSBundle object.
From what I understand loadNibNamed:owner:options: will deserialize the objects in the NIB, call awakeAfterUsingCoder: and then set the outlets by calling setValue:forKey: for each one.
I put in three more asserts to make sure the loaded NIB actually contains the correct objects - these pass OK when I put in an instance of the real controller. But when I use the mock as shown above, it does not even get this far. Instead, the test crashes with this:
Test Case '-[OnOffSwitchCellControllerTestCase testIBOutletCellIsWiredToXib]' started.
2011-01-14 10:48:35.364 GTMTest[67797:903] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'OCMockObject[OnOffSwitchCellController]:
unexpected method invoked: awakeAfterUsingCoder:<UINibDecoder: 0x500e800>
expected: setValue:<OCMAnyConstraint: 0x4c718e0> forKey:#"cell"
expected: setValue:<OCMAnyConstraint: 0x4c71ce0> forKey:#"thelabel"
expected: setValue:<OCMAnyConstraint: 0x4c71ed0> forKey:#"theswitch"'
*** Call stack at first throw:
(
0 CoreFoundation 0x00e3dbe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f925c2 objc_exception_throw + 47
2 CoreFoundation 0x00e3db21 -[NSException raise] + 17
3 GTMTest 0x0001a049 -[OCMockObject handleUnRecordedInvocation:] + 322
4 GTMTest 0x00019aca -[OCMockObject forwardInvocation:] + 77
5 CoreFoundation 0x00daf404 ___forwarding___ + 1124
6 CoreFoundation 0x00daef22 _CF_forwarding_prep_0 + 50
7 UIKit 0x0062394a UINibDecoderDecodeObjectForValue + 2438
8 UIKit 0x00624693 -[UINibDecoder decodeObjectForKey:] + 398
9 UIKit 0x0053cf43 -[UIRuntimeConnection initWithCoder:] + 212
10 UIKit 0x0053d4b1 -[UIRuntimeEventConnection initWithCoder:] + 64
11 UIKit 0x006239e4 UINibDecoderDecodeObjectForValue + 2592
12 UIKit 0x006232dc UINibDecoderDecodeObjectForValue + 792
13 UIKit 0x00624693 -[UINibDecoder decodeObjectForKey:] + 398
14 UIKit 0x0053c200 -[UINib instantiateWithOwner:options:] + 804
15 UIKit 0x0053e081 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
16 GTMTest 0x000140dc -[OnOffSwitchCellControllerTestCase testIBOutletCellIsWiredToXib] + 503
17 GTMTest 0x000041f3 -[SenTestCase invokeTest] + 163
18 GTMTest 0x0000479a -[GTMTestCase invokeTest] + 146
19 GTMTest 0x00003e90 -[SenTestCase performTest] + 37
20 GTMTest 0x00002f3d -[GTMIPhoneUnitTestDelegate runTests] + 1413
21 GTMTest 0x000028fb -[GTMIPhoneUnitTestDelegate applicationDidFinishLaunching:] + 197
22 UIKit 0x00347253 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1252
23 UIKit 0x0034955e -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
24 UIKit 0x00348ef0 -[UIApplication _run] + 452
25 UIKit 0x0035542e UIApplicationMain + 1160
26 GTMTest 0x00003500 main + 104
27 GTMTest 0x0000273d start + 53
28 ??? 0x00000002 0x0 + 2
)
terminate called after throwing an instance of 'NSException'
So it is complaining the call to awakeAfterUsingCoder: as being unexpected, even though I clearly expected it.
I also tried removing that expectation and replacing the mock with a nice mock that will not report superfluous method calls, but then it still aborts and reports the setValue:forKey: not being called.
What am I missing here?
Have you tried running this on the main system thread? You cannot instance UIKit classes off the main thread. Not sure how GTM does it, but with GHUnit you can put the following into your test case class:
- (BOOL)shouldRunOnMainThread {
/* Tell GHUnit to run on a separate thread */
return YES;
}
you cant actually do any visual stuff in unit tests. The views are never actually loaded. Also, you dont need to test that awakeAfterUsingCoder is invoked. Thats Apple's stuff. Typically your unit tests must only test your logic. You can safely assume that awakeAfterUsingCoder is invoked from init, because it's Apple's code. You just need to make sure your methods are invoked