It is currently Sat Dec 16, 2017 4:22 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 51 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: PureBasic Incompatibility with 2016 MacBook Pro?!
PostPosted: Sun Jul 02, 2017 12:34 am 
Offline
Addict
Addict
User avatar

Joined: Tue Apr 29, 2003 9:18 pm
Posts: 1459
Location: North by Northwest
It works now :!:

The solution is to only add:
Code:
   <key>NSAppTransportSecurity</key>
   <dict>
      <key>NSAllowsArbitraryLoads</key>
      <true/>
   </dict>

and leave NSAllowsArbitraryLoadsInWebContent out :!:
Now remote videos are played.
Finally :!:
:mrgreen:


Fred,

if you implement my findings:

1) Use NSApplicationMain in the main function (works beautifully without a NIB)
    Now the Webview should work nicely
2) Add only NSAllowsArbitraryLoads into NSAppTransportSecurity (plist)
    Now AVPlayer plays remote videos as well

There will be no crashes anymore.

Everything should work on 2016/2017 MacBook Pro's :wink:
Please let me know if you have something to test.

Disclaimer: Did all my tests in Objective C...

_________________

I am to provide the public with beneficial shocks.
Alfred Hitshock


Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Incompatibility with 2016 MacBook Pro?!
PostPosted: Sun Jul 30, 2017 7:10 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13148
Location: France
Thank you for all your investigations ! Unfortunately, we don't use "[NSApplication run]" as it's a blocking function. To have an PB event loop compatiable with Windows and Linux, we have reimplemented it using the following article: https://www.cocoawithlove.com/2009/01/d ... on-by.html

So probably Apple changed something when introducing the touchbar. I don't have such a mac to test so it will be probably tricky for us to fix the bug, i will try to find one.


Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Incompatibility with 2016 MacBook Pro?!
PostPosted: Tue Aug 01, 2017 5:56 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Apr 29, 2003 9:18 pm
Posts: 1459
Location: North by Northwest
Fred,
Thanks for looking into this.

At this point in time I have a good handle on this issue.
Have managed to create Objective C programs that work with both NSApplicationMain or [NSApp run] without any crashes.

During my investigation I figured out that crashes occur when some cocoa related code is started while not on the main thread.
One good link is here under the heading: Protecting the Cocoa Frameworks.

Also, it seems cocoa initialises its locks & other concurrency protections only if it notices an NSThread being spawned.
So, what I do is I start one that does nothing. (before going into the main loop and use autorelease to kill it automatically)
There are some cocoa controls that are very sensitive about this (like using NSWindow as a sheet or using the NSAlert as a sheet).

When calling code and always doing a "dispatch_async" is not working either.
Also releasing cocoa objects if they are already released might result in a crash.

Fred, you could use the ALPHA TESTING section in the forum and post links there of libraries you need to have tested.
I'm glad to help you out with this.
:mrgreen:

BTW: I really like my MacBook Pro with TouchBar.
Utilizing the TouchBar with my own programs is very easy; using Objective C...
8)

_________________

I am to provide the public with beneficial shocks.
Alfred Hitshock


Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Incompatibility with 2016 MacBook Pro?!
PostPosted: Tue Aug 01, 2017 6:30 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13148
Location: France
No problem, will build some lib with trace to see where it crash exactly


Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Incompatibility with 2016 MacBook Pro?!
PostPosted: Mon Aug 07, 2017 7:31 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13148
Location: France
I downloaded TouchBarServer to emulate the toolbar on older mac and I got the crash as well for the printrequester

https://github.com/bikkelbroeders/Touch ... p/releases

Investigating..


Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Incompatibility with 2016 MacBook Pro?!
PostPosted: Mon Aug 07, 2017 8:39 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Apr 29, 2003 9:18 pm
Posts: 1459
Location: North by Northwest
Fred,
Congratulation, now you can start digging.

I've downloaded the source code from Github and compiled the server and the client.
(the server is running on a 2015 MacBook Pro without TouchBar, the client is running on an iPhone 5)

On the phone there is now a picture of a new MacBook Pro with TouchBar.
Wrote a ObjC program that creates 5 Buttons onto the TouchBar.
When the program is started all Buttons are visible on the visualized TouchBar (on the iPhone).
I can tap on a visualized TouchBar Button and an event is fired.

This being said: the TouchBar emulator seems to work fine.

_________________

I am to provide the public with beneficial shocks.
Alfred Hitshock


Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Incompatibility with 2016 MacBook Pro?!
PostPosted: Wed Aug 09, 2017 12:24 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13148
Location: France
Fixed.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] PureBasic Incompatibility with 2016 MacBook
PostPosted: Fri Aug 11, 2017 10:14 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13148
Location: France
Actually not fixed, I was on the wrong track and reverted the 'fix'. Still clueless about this one, even if I can replicate the crash there is no much help as it crash in an Apple function.


Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Incompatibility with 2016 MacBook
PostPosted: Fri Aug 11, 2017 7:07 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Apr 29, 2003 9:18 pm
Posts: 1459
Location: North by Northwest
Fred,
you could - before calling the "Apple Function" - test if the current code is running on the main thread:
Code:
[NSThread isMainThread];

If not:
Code:
dispatch_async(dispatch_get_main_queue(), ^{ FredFunction(); });

is your friend.

What I learned is that using dispatch_async at the wrong spot also lets the program crash.

_________________

I am to provide the public with beneficial shocks.
Alfred Hitshock


Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Incompatibility with 2016 MacBook
PostPosted: Fri Aug 11, 2017 7:41 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13148
Location: France
There is only one thread in your test program, we don't spawn thread under the hood. IMHO it sounds more like a bug in Apple implementation, as not using NSApplicationMain() is officially supported and should work the same..


Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Incompatibility with 2016 MacBook
PostPosted: Tue Aug 15, 2017 12:03 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1042
Location: Germany
As long as this is not solved, I have found a workaround.

Link: viewtopic.php?f=19&t=68964
:wink:

_________________
My Projects OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer /
PB v3.30 / v5.60 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Incompatibility with 2016 MacBook
PostPosted: Wed Aug 16, 2017 8:20 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13148
Location: France
Here is a new build of Cocoa lib for 5.45 x64 with the fix, just overwrite it.

https://www.purebasic.com/beta/macosx_x64/Cocoa


Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Incompatibility with 2016 MacBook
PostPosted: Wed Aug 16, 2017 11:44 am 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1042
Location: Germany
Same problem with new cocoa lib
Code:
;-TOP

; Touchbar workaround by mk-soft
; Version v1.03
; Date 08/15/2017

Procedure IsTouchbar()
  Protected standardUserDefaults, r1
  standardUserDefaults = CocoaMessage(0, 0, "NSUserDefaults standardUserDefaults")
  r1 = CocoaMessage(0, standardUserDefaults, "integerForKey:$", @"NSFunctionBarAPIEnabled")
  ProcedureReturn r1
EndProcedure

Procedure DisableTouchbar()
  Protected standardUserDefaults
  If IsTouchbar()
    standardUserDefaults = CocoaMessage(0, 0, "NSUserDefaults standardUserDefaults")
    CocoaMessage(0, standardUserDefaults, "setBool:", #NO, "forKey:$", @"NSFunctionBarAPIEnabled")
    RunProgram(ProgramFilename(), ProgramParameter(), GetCurrentDirectory())
    End
  EndIf
EndProcedure

Procedure EnableTouchbar()
  Protected standardUserDefaults
  If IsTouchbar() = 0
    standardUserDefaults = CocoaMessage(0, 0, "NSUserDefaults standardUserDefaults")
    CocoaMessage(0, standardUserDefaults, "setBool:", #YES, "forKey:$", @"NSFunctionBarAPIEnabled")
    RunProgram(ProgramFilename(), ProgramParameter(), GetCurrentDirectory())
    End
  EndIf
EndProcedure

; ***************************************************************************************

EnableTouchbar()
;DisableTouchbar()

If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CreateMenu(0, WindowID(0))
  ; this website doesn't crash the app
  ;WebGadget(0, 10, 10, 580, 280, "http://www.apple.com")
  ; this website crashes the app
  WebGadget(0, 10, 10, 580, 280, "http://google.com")
 
  Repeat
    ; crash with "http://google.com"
  Until WaitWindowEvent() = #PB_Event_CloseWindow  ; <- Invalid memory access
EndIf


Thank you that works there.
If it is at the API of apple, we will want to work with the workaround.

_________________
My Projects OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer /
PB v3.30 / v5.60 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Incompatibility with 2016 MacBook
PostPosted: Wed Aug 16, 2017 2:29 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5695
Location: Wales, UK
Casey Neistat's entertaining thoughts on the MacBookPro
https://www.youtube.com/watch?v=7QpJ_VDbIPA

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Last edited by IdeasVacuum on Wed Aug 16, 2017 2:33 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Incompatibility with 2016 MacBook
PostPosted: Wed Aug 16, 2017 2:33 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13148
Location: France
mk-soft wrote:
Same problem with new cocoa lib


Did you test with the original snippet ?

Code:
If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CreateMenu(0, WindowID(0))
  ; this website doesn't crash the app
  ;WebGadget(0, 10, 10, 580, 280, "http://www.apple.com")
  ; this website crashes the app
  WebGadget(0, 10, 10, 580, 280, "http://google.com")
 
  Repeat
    ; crash with "http://google.com"
  Until WaitWindowEvent() = #PB_Event_CloseWindow  ; <- Invalid memory access
EndIf


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 51 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye