Closed mwyld closed 3 years ago
@mwyld the snippet you copied is incomplete. Here is the full version:
<key>NSBonjourServices</key>
<array>
<string>_nslogger._tcp</string>
<string>_nslogger-ssl._tcp</string>
</array>
<key>NSLocalNetworkUsageDescription</key>
<string>Access to the local network for development builds</string>
You were missing the first <key>
line. I think this should solve your issue.
Thanks @fpillet for checking this out for me. I got excited it could have been this fix but after checking it looks like I left it off my github description. I had the key in there all along
@mwyld ok the issue may be something else then. I don't use OS_ACTIVITY_MODE
and it didn't cause any issue for me. On Big sur there may be some issue with capturing the local console, so try this very early when running your app (i.e. first thing in applicationDidFinishLaunching
):
LoggerSetOptions(nil, (LoggerGetOptions(nil) & ~UInt32(kLoggerOption_CaptureSystemConsole)) | UInt32(kLoggerOption_BufferLogsUntilConnection))
This will prevent NSLogger from trying to capture the local console. Not sure it will fix your issue though.
I assume you have the desktop viewer up and running? When it's not logging, it doesn't display any window currently.
I just had a quick go at adding it in (Will have a further look into it when I've got some more time available). I build hybrid apps in the ionic framework and export it to Xcode so I don't have too much knowledge with swift/objectiveC
add this line along with the other import lines:
import NSLogger
Also if the problem is capturing the local console and you do not specifically use NSLogger for logging, I don't think it will be of much use to you...
@mwyld I also see that you patched the wrong function. Move the LoggerSetOptions
call to the previous function just before FirebaseApp.configure()
Okay, I've made those amendments and tried re-running. But it doesn't run the NSLogger.
I think I just need something easier to read than the xcode output version. When a JSON string comes through, it just becomes unreadable!
To verify that NSLogger works correctly you can add this just after LoggerSetOptions
:
LogMessageRaw("Hello from NSLogger")
If everything works the NSLogger window will open on your Mac
Ah interestingly, it still didn't come up?
Maybe I've missed a previous step. This may be a couple of dumb questions but...
Apologies for, lack of experience with Xcode
You obviously did a pod install
otherwise your import NSLogger
wouldn't have compiled at all, so I think you're good on this front.
You don't need to have NSLogger installed both in Podfile and Carthage -- only one is necessary. Throw away the other.
No need to apologize, build systems have become more complex and macOS / iOS more restrictive over the years, and getting NSLogger to work can be more challenging than it should be. Sorry about that.
No worries. I didn't realise the confirmation for
<key>NSLocalNetworkUsageDescription</key>
<string>Access to the local network for development builds</string>
popped up on my iPhone, after accepting this the NSLogger appeared! but looks like its not logging anything else.
Maybe it's because its a hybrid app. There could be craziness going on under the hood that bypasses the hooks this needs?
Now that you have the Alert thing sorted out, you can comment out the LoggerSetOptions
line so that NSLogger can start capturing the console again! Try it that should work now.
Scrap that. I pulled the two lines we originally put in. It now works! looks like all it needed was the import!
Wheyyy! thanks so much @fpillet ! your a legend! Maybe just an update to the README file might help others that hit the same issue?
@mwyld yeah I'm a bit behind on documenting how to cope with the latest changes in the OS. Glad you got it working 👍 Enjoy !
In Swift, you have to specifically import frameworks to make them available to your class.
On Dec 9, 2020, at 4:25 PM, Matt Wyld notifications@github.com wrote:
Scrap that. I pulled the two lines we originally put in. It now works! looks like all it needed was the import!
https://user-images.githubusercontent.com/12820928/101696035-611bf300-3a6d-11eb-83fd-e8e06c5b70d6.png — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fpillet/NSLogger/issues/301#issuecomment-742102005, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGEU2CZD4EQVCYZLG2AAEDST72NXANCNFSM4URHGOCQ.
On Dec 9, 2020, at 4:26 PM, Matt Wyld notifications@github.com wrote:
Wheyyy! thanks so much @fpillet https://github.com/fpillet ! your a legend! Maybe just an update to the README file might help others that hit the same issue?
It’s kind of understood that you have to do that. It might not hurt as a reminder though.
This looks great and keen to get it up and running. Although, I'm really struggling to get it to work.
I have followed the instructions, but feel I may be missing something? Could someone help me debug it?
I am using Xcode
12.2
on macOS Big SurI have downloaded the Desktop App and I have added the pod to my podfile
I have tried Real Devices running iOS 14 and Simulators on
12.4
with no luck.I have tried adding the following snippets into the list
I have tried adding
OS_ACTIVITY_MODE
set todisable
in Environment Variables for the run schemaCould someone point me in the right direction?