How to collect xcode log? - xcode

I file a bug to Apple through their bug report. Now they ask me send log.
How to collect xcode log? I have system log and console log ready.

I do not believe Xcode writes a dedicated log file. However, the Console app should have everything you need (you'd need to filter by PROCESS|Xcode to see only Xcode entries).
Alternatively, starting Xcode from the terminal window (via /Applications/Xcode-beta.app/Contents/MacOS/Xcode) should produce only Xcode logs.
Please see my other answer for more details.

You can collect an Xcode sysdiagnose log using the following command in the terminal:
sudo sysdiagnose Xcode
This presents the following information:
This tool generates files that allow Apple to investigate issues with your computer and help improve Apple products. The files might
contain personal information found on your device or associated with
your iCloud accounts, including but not limited to your name, serial
numbers of your device, your device name, your attached peripheral
devices, your user name, your email address and email settings, file
paths, file names, Siri suggestions, your computer's IP addresses, and
network connection information.
This information is used by Apple in accordance with its privacy
policy (www.apple.com/privacy) and is not shared with any other
company. By using this tool and sending the results to Apple, you
consent to Apple using the contents of these files to improve Apple
products.
The process can take up to 10 minutes to complete.
The resulting tar.gz file will be found in /private/var/tmp when completed and can be 100's of Mbs in size.

Connect the iPad or iPhone to the Mac and sync it as usual
Hit Command+Shift+G and navigate to
~/Library/Logs/CrashReporter/MobileDevice/
For those with multiple iOS devices, select the proper device that
you want to retrieve the crash log from
Look for files with the app name you want the crash reports from,
copy that out of the folder, or copy multiple logs and zip them up
for the developer

Related

Why does Xcode Fail to complete App Upload

I have a new "independent" watchOS 8 app built with Xcode 13.1 that I wish to put in the App Store.
I have current profiles, distribution certificates etc.
I archive it and try to push the archive via Xcode Organizer/Distribute. It passes all the tests and uploads roughly the correct about of data (size of .ipa) to a blobstore.apple.com URL.
Then it just stops, for up to hours before I kill the process. No messages or Alerts.
Is there a log file somewhere which monitors the app upload process so I can try to diagnose the issue? I ran through a number on logs in Console but did not see anything related. Any other suggestions?
A kindly Framework Engineer replied:
There should be a log at
~/Library/Application Support/com.apple.dt.Xcode.ITunesSoftwareService/Logs that might be illuminating.

MacOS Notarize - Gatekeeper does not recognize notarized app

I have a MacOS app and want to distribute to beta users as DMG file outside AppStore.
I have read some articles about how to notarize an app and follow the steps to successfully notarize the DMG file without any problem.
My development machine runs on MacOS 10.14, and XCode version is 10.1.
However when I try to check the notarized DMG file on another testing machine which runs on MacOS 10.14.5 (by sending the file via AirDrop, or download from my website), I still see the popup from GateKeeper with message "'myApp.dmg' can’t be opened because Apple cannot check it for malicious software." on that machine.
It seems Gatekeeper does not work properly to check notarized DMG file. Is there anybody having the same problem and how to fix that?
Short answer
It could be due to an RPATH referencing a path outside the App bundle. Removing this RPATH would resolve the issue.
Inspecting log files
You can find extra information about the rejection (after trying to launch the blocked app) in the Console.app. Note that you should open the Console.app, before trying to open your blocked app, otherwise not all messages may be logged. You should look for process XprotectService in the logs of your device (i.e. choose your device in the left side bar of the Console.app). If the RPATH is indeed the problem, you should find a record like this:
XprotectService: [com.apple.xprotect:xprotect] File /path/to/your/executable/or/library failed on rPathCmd /rpath/causing/the/problem (rpath resolved to: (path not found), bundleURL: /path/to/your/bundle.app)
Inspecting these log files may give you a key to solve other issues too.
Note that I received the following information from an Apple engineer:
Gatekeeper does not inform users via UI about the specifics of the
error, though it is in the logs for developers to look at. The
notarization process is purely about a detecting malicious software
and does not replicate Gatekeeper enforcement. You still need to get
software notarized and test with Gatekeeper.
We are looking to provide better tooling for developers in the future
to pre-flight some of these common errors.
Contact Apple
If you are not able to solve your issue with the above information, you may want to contact Apple itself using the Feedback Assistant. They do not respond very quickly (~1-2 weeks), but the answers are rather to the point.

How to check if my iPhone app is influenced by xcodeGhost?

One year ago I downloaded my Xcode from a third-party source and I'm afraid that if my app has been influenced by the xcodeGhost. Can somebody tell me how to check it?
You can check wether your copy of Xcode contains malicious software by verifying it's code signature:
codesign -vv /Applications/Xcode.app
The code signature will fail verification if Xcode has been tampered with and it will list the files that are suspect.
More information here
XcodeGhost adds an extra CoreServices.framework at:
Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/Library/Frameworks/
to an infected Xcode.
Don't worry,xcodeGhost was writen early this year.If you download Xcode one year ago,your Xcode is totally fine.
For more informations , you can check on xcodeGhost
To go save you can prevent xCodeGhost anyway with a little script in your project. The first version of xCodeGhost is easy to detect:
You need a file with possible xcodeghost links
You need a script to search for this links in your whole project (with grep)
To read more aboutxcodeghost v1, just look at:
https://possiblemobile.com/2015/11/a-lesson-in-xcode-ghost-third-party-frameworks
For v2 of xcodeghost, its not easy as v1, because the links will be generated on a later point of building of app - therefore the only way to detect this is to check your app network acitivity (e.g. with wireshark). Detecting on everything which is not a usual communication of your app. This gives you the possibility to see which frameworks also will communicate with the internet.
The newest version 2 of xcodeghost, you can read here a little bit more:
http://prog3.com/article/2015-11-11/2826185-a-lesson-in-xcode-ghost-third-party-frameworks
Also important if you really want to protect your app/project: Do every test on real device (even analyizing network connection, therefore just give your device a network connection over your macbook (mobile hotspot), this will give you the permission to check explicitely the network connection of your device). Because some hackers are also adding testscripts on 3rd party framework to detect if its on simulator or device.

Mac Unidentified App

I normally create some Mac apps on one computer and transfer them to another computer for testing. Several months ago I ran into the "gateway problem" where the Mac blocks unidentified apps and solved it by going to the security & privacy and changing my settings to allow apps downloaded from "anywhere". Now all of a sudden apps that I transfer for testing will not run on the test computer. When I double-click on the app there is a brief flash but nothing happens. I can click on the same app file that I transferred to the test computer four months ago and it has no problem opening.
I'm running OSX 10.9.2.
It sounds like some part of the application isn't getting transferred properly between the two computers. My guess would be that the executable file (generally AppName.app/Contents/MacOS/AppName) lost its execute permission in the transfer. I Googled that Console error message, and found a couple of cases where missing execute permissions caused that error (1, 2).
I haven't tested, but this might be a result of transferring it via SMB instead of AFP file sharing (SMB version 2 is now the default between Mavericks computers). If I'm right, there are several ways to fix/avoid the problem:
Add execute access with something like chmod +x /Applications/AppName.app/Contents/MacOS/AppName (note: it's possible there are other executables in the the app bundle that'll also need execute added).
Transfer the app with AFP instead of SMB. You can force AFP connections by using the Finder's Go menu > Connect to Server option, and using "AFP://servername.local" to connect.
Zip the app (using the Finder's File menu > Compress option), transfer the zip archive, then expand it (using the Finder/Archive Utility) on the other computer.

iOS Remote Debugging on external Devices

I am not sure if I can remote debug an application running on an Iphone which is not next to me? We test your app. well but some users have issues sometimes we can not replicate and dont know where to start digging in this cases. So it would be very easy for us when we can just connect the remote debugger via the internet to an device. Is is possible somehow?
Most of the guys using the app we could remote to there PCs (but the majority dont uses macs...) and run tools there, is this maybe an easier solution?
For Mac Os I found this http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/XcodeDebugging/300-Debugging_Programs_Remotely/remote_debugging.html
But this is not for iOS...
Thx very very much already
Our company just released a service exactly for that purpose: http://apphance.com . It allows you to very easily (5 minutes) integrate your application - add framework project basically and you get all the remote debugging capability included (you can access everything from very nice web panel):
You can see logs of running application (in near-real-time)
You can see how device conditions change over time (rotation, wifi/gprs, battery, others)
You get crashes reported to you automatically with all relevant information
Even out-of-memory errors are reported
Your testers can even report problems by shaking the device - including automated screenshots
and more.....
It's currently, closed beta stage but you can request access and for sure you get it.
All you need to do is get the crash log(you can get this at any time through the Xcode Organizer or iTunes Connect in released Applications) symbolicate it and ask the tester what they did to cause the error. This will give you every piece of info you could of gotten from GDB.
Check out https://testflightapp.com/sdk/, you can get crash reports, remote logs, see how is the teststing going and much more, see link for further details.

Resources