dsmelov / simsim

Use SimSim to explore iOS application folders in Terminal or Finder. Fast, stable, free alternative to SimPholders.
MIT License
1.47k stars 95 forks source link

Getting error Value of optional type 'Unmanaged<CFArray>?' must be unwrapped to refer to member 'takeRetainedValue' of wrapped base type 'Unmanaged<CFArray>' on OS 11.6 #60

Closed amrinder2105 closed 2 years ago

amrinder2105 commented 2 years ago

I'm trying to run application on macOS BigSur 11.6 M1 chip and getting error Value of optional type 'Unmanaged?' must be unwrapped to refer to member 'takeRetainedValue' of wrapped base type 'Unmanaged'.

I tried making changes with possible solutions but it still not working. Please check this and let me know what I have to do to run this on my system.

gsl-anthonymerle commented 2 years ago

Is this repo still maintained ? Did you managed to work around the error @amrinder2105 ?

DesmanLead commented 2 years ago

@gsl-anthonymerle we're not able to reproduce it. Could you debug it, please?

gsl-anthonymerle commented 2 years ago

@DesmanLead Yes, I just fixed errors on myself, but I'll dive into the context so that you can hopefully see the same things

I'm currently on MacOS Montery version 12.2.1 (21D62), with an XCode version 13.4.1 (13F100). As for the repository, I downloaded the master branch as a .zip file

Then I tried to build and got the few errors (Unmanaged<***> not unwraped)

The fix was mostly to use Xcode's auto fix feature which adviced to add the optional chaining ? when needed, and for one line to specify something instead of a nil value.

For the nil value, it was in the SimSim/Settings.swift file, at line 48, replacing: LSSharedFileListInsertItemURL(loginItems, nil, nil, nil, appURL as CFURL, nil, nil)?.release() by LSSharedFileListInsertItemURL(loginItems, kLSSharedFileListItemBeforeFirst as! LSSharedFileListItem, nil, nil, appURL as CFURL, nil, nil)?.release() (note the ad of kLSSharedFileListItemBeforeFirst as! LSSharedFileListItem for the second parameter. It's totaly arbitrary, I had no idea of what I was doing on this part as I didn't put too much time on reading&understanding the doc, but compilation succeed and it launched)

DesmanLead commented 2 years ago

I see. It's not that easy to add the app as a login item, the old approach doesn't work anymore. I'll disable this feature for now.

gsl-anthonymerle commented 2 years ago

Yes, I can imagine, and Apple may event have made it harder through updates because of their strong focus on user's privacy and activity control :x

But in any case, I'm glad I helped and you came up with a solution 🙏

Have a great day ! :)