Group Group Group Group Group Group Group Group Group

Challenge Solutions?

I am currently on Chapter 7 and hit the “Where to go from here?” challenges, but need some help or hints.

Can someone post hints and solutions to the challenges that are at the end of the chapters?

Thanks!

Hi! Did someone help you with this topic! I need some hints too! [=

@lolgrep Can you please help with this when you get a chance? Thank you - much appreciated! :]

(lldb) po $stringView

<_UIStatusBarStringView: 0x7fa282d43630; frame = (17 -1; 33.5 18); text = ‘9:29’; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x6000019d97c0>>

i just solve this problem, just walk through the status bar subviews and you will find a view position at the upper left corner, just using po command to print , you will find it shows the current time .

po [$stringView setText:@"Hello!"] : type this command several times , you will see the result.

1 Like

@guopp Thank you for sharing your solution - much appreciated! :]

You know why this is happening to me, since I execute this command

(lldb) po [[UIApplication sharedApplication] statusBar]
2020-04-19 18:46:27.250155-0500 Signals[92078:1996376] *** Assertion failure in -[UIApplication _createStatusBarWithRequestedStyle:orientation:hidden:], /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3920.26.113/UIApplication.m:5382
error: Execution was interrupted, reason: internal ObjC exception breakpoint(-5)…
The process has been returned to the state before expression evaluation.

I get this error, additionally the breakpoint that I put for this chapter in my xcode never works, I appreciate your help.

@lolgrep Can you please help with this when you get a chance? Thank you - much appreciated! :]

@sasaga looking at the message looks like you have breakpoints enabled and Apple has code that is asserting on that. You can remove the breakpoints with a br del

@lolgrep

I am getting the same error.

I have run the code without any breakpoints, then paused it and executed po [[UIApplication sharedApplication] statusBar] and got the same error.

@lolgrep I’ve got it.

@sasaga here is the solution. Create statusbar as new UIView and it to keyWindow.

(lldb) po id $statusBar = [UIView new]
(lldb) po [$statusBar setFrame:[[UIApplication sharedApplication] statusBarFrame]]
(lldb) po [$statusBar setBackgroundColor:[UIColor purpleColor]]
(lldb) po [[[UIApplication sharedApplication] keyWindow] addSubview:$statusBar]
(lldb) continue