steventroughtonsmith / tvOSBrowser

tvOS Web Browser sample project (Private API)
444 stars 358 forks source link

Gray border around web view #21

Open philipjefferies opened 6 years ago

philipjefferies commented 6 years ago

After following the instructions to load the app, everything worked and Google.com showed up but the browser was down and to the the right of top left. It almost appears as if a thick gray border is around the web view. I've experimented with full screen but it appears that full screen is already set but the border is preventing it.

I'm in XCode 9.2 running on Apple TV (not the 4K version).

djk12587 commented 6 years ago

i see the same thing, whats weird is the border only shows up when you place the view on the edge of the screen. If you place the view in the middle of the view and not touching the edge the borders are not there. This really limits the full screen aspect though...

I wish apple would just support the browser in the first place without having to hack around it.

PlasmaSoftUK commented 6 years ago

If you guys want to keep the browser, I'd avoid the new tvOS update. I'm running 11.3 beta and Safari won't even install, let alone run, looks like they have removed the tvOS Webview Framework all together. :(

djk12587 commented 6 years ago

@PlasmaSoftUK I just installed the latest xcode beta, and everything ran fine on the 11.3 tvOS simulator. Are you running on a real device with 11.3?

PlasmaSoftUK commented 6 years ago

Yep, I've tried it with the simulator and with a real device non 4k ATV running 11.3. Get an unusual error on all 3 of my projects that use the WebView, I'll maybe blow out Xcode beta and download a fresh copy, must be something local to me if it works for you.

ld: in '/System/Library/PrivateFrameworks/UIFoundation.framework/UIFoundation', missing required architecture arm64 in file /System/Library/PrivateFrameworks/UIFoundation.framework/UIFoundation (2 slices) for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

PlasmaSoftUK commented 6 years ago

I've installed the latest Xcode 9.3 beta 4 still giving same error, looks like something is corrupt / broken in my /System/Library/PrivateFrameworks folder. :(

yidan commented 6 years ago

@philipjefferies You can fix the build error by opening a new project and copying the code over (instead of cloning the git repo)

yidan commented 6 years ago

I found a hack! Replace self.webview = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].bounds]; with self.webview = [[UIWebView alloc] initWithFrame:CGRectMake(-100, -80, 2120, 1260)];

This will shift the screen to the left, hiding the grey border. Not a perfect solution, but it works fine for my use case.

djk12587 commented 6 years ago

@yidan I found this calculation of the webviews frame doesnt show the grey border and takes into account different screen sizes and resolutions.

let uiview = webview as! UIView uiview.frame = CGRect(x: 90, y: 90, width: view.bounds.width - 90 * 2, height: view.bounds.height - 90 * 2)