Comments (11)
Thanks you, but what's the version of your SDK? iOS 5.0 at least. :)
from ipokemon.
And hi @ultragtx , can you paste your crash log here, please?
from ipokemon.
you should remove your session by delete and reinstall the app and you will see how it crash at launch
from ipokemon.
oh,seems that simply delete the app cannot clear the session
from ipokemon.
What's session? Do you mean the app content?
from ipokemon.
Google OAuth
在 2013-1-20,下午7:35,Kaijie Yu [email protected] 写道:
What's session? Do you mean the app content?
—
Reply to this email directly or view it on GitHub.
from ipokemon.
Sorry @ultragtx, I tried several times but without any crash issue at -[UINavigationBar viewCount]
... :?
Your crash might occurs in the message below ( CustomNavigationController.m ):
- (void)pushViewController:(UIViewController *)viewController
animated:(BOOL)animated {
...
// If |viewCount| == 2, add |backButton| for previous view
if (++((CustomNavigationBar *)self.navigationBar).viewCount == 2)
[(CustomNavigationBar *)self.navigationBar addBackButtonForPreviousView];
...
}
Here the navigationBar
is a CustomNavigationBar
, so it'll crash if you push vc (by sending -pushViewController:animated:
message) before the custom navigationBar is initialized correctly, cause the default navigationBar does not have the viewCount
property.
And if you put a log in -initWithRootViewController:
of CustomNavigationController.m, you'll find that: When you send -initWithRootViewController:
, it'll send -init
first.
So just use -initWithRootViewController:
to initialize your navigation controller is fine.
B.t.w, you can refresh your session in this way: Logout in "Settings View" & re-login via VPN or SSH (in CN).
from ipokemon.
Log:
2013-01-20 23:21:21:743 iPokeMon[2271:2311] -[AppDelegate application:didFinishLaunchingWithOptions:] [Line 45] Register Defaults From Settings.bundle...
2013-01-20 23:21:21:795 iPokeMon[2271:2311] -[AppDelegate persistentStoreCoordinator] [Line 232] >>> storePath: /var/mobile/Applications/15F613D1-E7B1-4851-8B48-A48634E53C46/Documents/Pokemon.sqlite3 ---
2013-01-20 23:21:22:013 iPokeMon[2271:2311] TestFlight: Started Session
2013-01-20 23:21:22:351 iPokeMon[2271:2311] TestFlight: Crash Handlers are installed
2013-01-20 23:21:22:466 iPokeMon[2271:2311] -[OAuthManager isSessionValid] [Line 102] CHECKING SESSION...
2013-01-20 23:21:22:475 iPokeMon[2271:2311] -[OAuthManager isSessionValid] [Line 105] INVALID SESSION...
2013-01-20 23:21:22.603 iPokeMon[2271:907] -[UINavigationBar viewCount]: unrecognized selector sent to instance 0x1e513800
Strange behavior, Code run this way
CustomNavigationController.m
-
(id)initWithRootViewController:(UIViewController *)rootViewController {
#1 self = [super initWithRootViewController:rootViewController];
#2 if (self) {
}
return self;
} -
(void)pushViewController:(UIViewController *)viewController
animated:(BOOL)animated {
// Set original |backButton| hidden to show custom |backButton|
#3 [viewController.navigationItem setHidesBackButton:YES];// If |viewCount| == 2, add |backButton| for previous view
#4 if (++((CustomNavigationBar *)self.navigationBar).viewCount == 2)
[(CustomNavigationBar *)self.navigationBar addBackButtonForPreviousView];
...
I set several break point, stopped at #1 >> #3 >> #4(crash) but did not stop at #2, wonder why pushViewController:animated can be called by [super initWithRootViewController:]
Also, the crash can be repeated both on a device and the simulator, but when I fix the crash using the method I post, the crash cannot be repeated even I fully reset the simulator. Still crash on the device, because I did not run the modified code on it.
在 2013-1-20,下午10:57,Kaijie Yu [email protected] 写道:
Sorry @ultragtx, I tried several times but without any crash issue at -[UINavigationBar viewCount]... :?
Your crash might occurs in the message below ( CustomNavigationController.m ):
- (void)pushViewController:(UIViewController *)viewController
animated:(BOOL)animated {
...
// If |viewCount| == 2, add |backButton| for previous view
if (++((CustomNavigationBar *)self.navigationBar).viewCount == 2)
[(CustomNavigationBar *)self.navigationBar addBackButtonForPreviousView];
...
}
Here the navigationBar is a CustomNavigationBar, so it'll crash if you push vc (by sending -pushViewController:animated: message) before the custom navigationBar is initialized correctly, cause the default navigationBar does not have the viewCount property.And if you put a log in -initWithRootViewController: of CustomNavigationController.m, you'll find that: When you send -initWithRootViewController:, it'll send -init first.
So just use -initWithRootViewController: to initialize your navigation controller is fine.
B.t.w, you can refresh your session in this way: Logout in "Settings View" & re-login via VPN or SSH (in CN).
—
Reply to this email directly or view it on GitHub.
from ipokemon.
Yes, it's so weird...
BreakPoint #2 will be focused last, and -init
will be dispatched in BreakPoint #1.
About -initWithRootViewController:
, it said:
This is a convenience method for initializing the receiver and pushing a root view controller onto the navigation stack. Every navigation stack must have at least one view controller to act as the root.
So it'll do the initialization job (send -init
) before pushing root vc (send -pushViewController:animated:
).
My Log looks like this:
2013-01-20 23:52:02:813 iPokeMon[9596:90371] TestFlight: Started Session
2013-01-20 23:52:02:853 iPokeMon[9596:90371] TestFlight: Crash Handlers are installed
2013-01-20 23:52:02:879 iPokeMon[9596:90371] -[OAuthManager isSessionValid] [Line 102] CHECKING SESSION...
2013-01-20 23:52:02:886 iPokeMon[9596:90371] -[OAuthManager isSessionValid] [Line 105] INVALID SESSION...
2013-01-20 23:52:02:911 iPokeMon[9596:90371] -[CustomNavigationController init] [Line 23] ......INIT......
2013-01-20 23:52:02:935 iPokeMon[9596:90371] -[CustomNavigationBar setBackToRootButtonToHidden:animated:] > > [Line 135] --- |CustomNavigationBar|: hide navigation bar...
Does your -init
like this right now?
- (id)init {
self = [super initWithNibName:nil bundle:nil];
if (self) {
NSLog(@"......INIT......");
CustomNavigationBar * customNavigationBar = [CustomNavigationBar alloc];
[customNavigationBar initWithFrame:CGRectMake(0.f, 0.f, kViewWidth, kNavigationBarHeight)];
customNavigationBar.delegate = self;
[self setValue:customNavigationBar forKey:@"navigationBar"];
[customNavigationBar release];
[self setNavigationBarHidden:YES];
}
return self;
}
from ipokemon.
I found the key issue:
In iOS6.0 -initWithRootViewController:
will not send -init
message.
So as a fix, you can just do the navigation bar setting job before -initWithRootViewController:
.
- (id)initWithRootViewController:(UIViewController *)rootViewController {
[self _setupNavigationBar];
self = [super initWithRootViewController:rootViewController];
if (self) {
}
return self;
}
...
- (void)_setupNavigationBar {
CustomNavigationBar * customNavigationBar = [CustomNavigationBar alloc];
[customNavigationBar initWithFrame:CGRectMake(0.f, 0.f, kViewWidth, kNavigationBarHeight)];
customNavigationBar.delegate = self;
[self setValue:customNavigationBar forKey:@"navigationBar"];
[customNavigationBar release];
[self setNavigationBarHidden:YES];
}
from ipokemon.
You can pull my commits on dev
branch right now. :)
from ipokemon.
Related Issues (20)
- Move effect & related animations
- Seperate PokeMon releated resources
- Combine DRAGON BALL's gaming element
- Annotation completion for other countries
- Give up iOS5.0 ? HOT 2
- client端的Config文件配置 HOT 3
- 请问一下,编译出现这个错误是什么回事 HOT 24
- v0.4.6 released on App Store now
- Players should not login others' account to catch PokeMon for him/her in different places
- Invitation-only to make it free HOT 1
- Reserve some words for user registration process HOT 1
- Getting "_OBJC_CLASS_$_DeviceBlockingViewController", referenced from: HOT 1
- Nonexistant submodule HOT 3
- Support ARC.
- Support iOS7 HOT 1
- Fix layouts for 4" screen
- Upgrade Cocos2D-iPhone lib & fix related bugs.
- Progress (battles) HOT 1
- Cannot download the app on Iphone device HOT 1
- Computers for PokeMon storage & transmission
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ipokemon.