running xctest from command line - xctest

I want to create logic tests for my library and run them on iOS device. I know that we can only run them on simulator. But I have seen that I can run the default test on iOS device. Here is the setup.
Create new iOS 7.0 app (single view application, nothing fancy) using xcode 5.
This will create default test which fails with message failed - No implementation for "-[MyAppTests testExample] when you try to run it.
I am able to run this test both on simulator and device using xcode with same output.
Does that mean I can run XCTests on device also?
Also when I try to run the same test using command line it gives me error saying the scheme is not testable. The how come Xcode is able to run it? Here is the command line that I execute to run on device.
xcodebuild test -scheme MyApp -configuration Debug -destination name=TestIPhone
and am seeing following message
2014-03-14 16:04:12.423 xcodebuild[620:1207] [MT] DVTAssertions: Warning in /SourceCache/IDEFoundation/IDEFoundation-3582/Framework/Classes/Model/Execution/RunContext/IDEScheme.m:1290
Details: Scheme <IDEScheme:0x7ff6abc8d2b0:'MyAppTests'> was asked to test, but it is not testable and shouldn't have allowed this action.
Object: <IDEScheme: 0x7ff6abc8d2b0>
Method: -testOperationWithExecutionContext:buildIfNeeded:onlyBuild:destination:overridingProperties:overridingTestingSpecifiers:buildLog:overridingBuildConfiguration:restorePersistedBuildResults:invocationRecord:name:title:error:actionCallbackBlock:
Thread: <NSThread: 0x7ff6abc0e5d0>{name = (null), num = 1}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
xcodebuild: error: Failed to build project MyAppTests with scheme MyAppTests.
Reason: Scheme "MyAppTests" is not testable.
Any insight would be helpful. I am confused.

This issue has been resolved with Xcode5.1 update.

Related

expo error installing or running app

when I try to run my app on the iOS simulator I get the error :
Error running xcrun simctl openurl booted exp://localhost:19000: An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=60):
The operation couldn’t be completed. Operation timed out
Operation timed out
Error installing or running app. Error: Process exited with non-zero code: 60
any idea how to solve this error ?
This usually is an error with the Simulator. If you remove expo (delete the app) from the simulator and run the command again, it should build fine.
However, if it still fails, Erasing all content and settings on the simulator does the trick too.
FOUNT IT!
you must have a .watchmanconfig file (like below)
File example
When you initialize a project with expo init "projectname", there is no .watchmanconfig file.
So, create one and in this file, just initialize an empty object like this : {}
Then you can start with expo start or yarn/npm start
It solved all my problem.
Hope it does for you too.
For anyone like me also searching this issue, it is possible to un-eject your app and run again like normal. From the docs, Delete the ios and android directories from your project. Delete the isDetached and detach keys from your project's app.json. You can now use your project like a normal Expo project (with no ExpoKit). Read more at https://docs.expo.io/versions/latest/expokit/advanced-expokit-topics/
It may be an issue with some outdated simulators in your simulator cache. On MacOS remove the sub-directories in the following directory:
~/Library/Developer/CoreSimulator/Caches/
check if you have .watchmanconfig file present in root, if not create one .watchmanconfig and initialize empty object and run command npm start again

OSX App doesn't start(Buid succeeded)

Problem: I am unable to launch my OSX app.
Software versions:
XCode Version 8.1 (8B62)
macOS Siera 10.12.1 (16B2657)
I've already tried:
I don't have any changes in my version control.
Also it works fine on my colleague's computer
I've already tried to clean, Also used deep clean
I've overloaded my mac twice
I've already removed derived data
But still unable to run OSX app. It just build successfully all the time and isn't going to launch my app.
I googled about it.
https://www.google.com/search?q=xcode+%22build+secceded%22&oq=xcode+%22build+secceded%22&aqs=chrome..69i57.12138j0j7&sourceid=chrome&ie=UTF-8#q=xcode+%22build+succeeded%22+%22App+doesn%27t+run%22
But haven't found something helpful.
Any suggestions? Probably I missed something... but I think it is a system bug. And I have to clean or relaunch something. But I've already tried all what I was able to guess.
Information from console:
/Users/UserName/Library/Developer/Xcode/DerivedData/AppName-awtljghmrbqhgebrvruwulpmysqx/Build/Products/Debug/App Name.app/Contents/MacOS/App Name signature not valid: -67030
proc 1042: load code signature error 4 for file "App Name"
AMFI: allowing exception handler for 'App Name' (2504) because the process is unsigned.
Got a connection, waiting for process information for launching or attaching.
error: Attach failed: "No such process".
error: attach failed.
1 +0.000000 sec [09c9/1503]: error: ::read ( 3, 0x700009325a40, 1024 ) => -1 err = Bad file descriptor (0x00000009)
Exiting.
PS
Any way. thanks for attention.

Xcode 7 - Cannot open document (storyboard file)

I recently updated to Xcode 7 and as usual something has to go wrong. Its really a shame because I was looking forward to the new features in Xcode 7.
I am faced with a an error which I cannot seem to fix. Every time I try and build the project I get the following error:
I thought there was something wrong with my project, so I made a new Single View application and I still get the same error.
I have tried the following things but none of them has worked for me:
Restart Xcode (Didn't work).
Clean and rebuild project (Didn't work).
Restart Mac (Didn't work).
Reinstall Xcode 7 from the Mac App Store (Didn't work).
Installed Xcode 7 on a different Mac (Still got the same issue, even with a new Xcode project).
I tried the solution in this Stack Overflow question: https://stackoverflow.com/a/31614717/1598906 - But alas it did not work.
Finally, I tried the following Terminal command with no avail: $ sudo killall -9 ibtoold
Is anyone else having this issue with Xcode 7.0? And if so, have you managed to come with any other solutions? I have tried everything I can think of and nothing works.
Lastly, below is a copy of the error Log:
2015-09-18 21:09:28.416 ibtoold[1598:39510] [MT] IBPlatformTool: ***
Failed to launch tool with description
System content
1x for IBCocoaTouchFramework-EightAndLater w/ default fidelity: Failed
to find or create execution context for description
System content
1x for IBCocoaTouchFramework-EightAndLater w/ default fidelity: Failed
to find a suitable device for the type SimDeviceType :
com.apple.dt.Xcode.IBSimDeviceType.iPad-1x with runtime SimRuntime :
9.0 (13A340) - com.apple.CoreSimulator.SimRuntime.iOS-9-0 (Failure reason: Failed to create SimDeviceSet at path
/Users/daniel/Library/Developer/Xcode/UserData/IB Support/Simulator
Devices. You'll want to check the logs in ~/Library/Logs/CoreSimulator
to see why creating the SimDeviceSet failed.) 2015-09-18 21:09:38.290
ibtoold[1598:39510] [MT] IBPlatformTool: Wrote failed marshalling
request diagnostics to path:
/var/folders/lx/kkhv57fd2ll7rhdt0bwfpkb00000gn/T/IB-agent-diagnostics_2015-09-18_21-09-28_418000
/* com.apple.ibtool.errors */ /Users/daniel/Desktop/DS
APPS/BT/BloodyTest/BloodyTest/Base.lproj/LaunchScreen.storyboard:
error: Could not open document
Recovery Suggestion: Failed to connect with the iOS agent. Please file a bug report at bugreport.apple.com and attach a zip file of the
diagnostics located at
"/var/folders/lx/kkhv57fd2ll7rhdt0bwfpkb00000gn/T/IB-agent-diagnostics_2015-09-18_21-09-28_418000".
Underlying Errors:
Description: Failed to find or create execution context for description
System content 1x for IBCocoaTouchFramework-EightAndLater w/ default
fidelity
Underlying Errors:
Description: Failed to find a suitable device for the type SimDeviceType : com.apple.dt.Xcode.IBSimDeviceType.iPad-1x with
runtime SimRuntime : 9.0 (13A340) -
com.apple.CoreSimulator.SimRuntime.iOS-9-0
Failure Reason: Failed to create SimDeviceSet at path /Users/daniel/Library/Developer/Xcode/UserData/IB Support/Simulator
Devices. You'll want to check the logs in ~/Library/Logs/CoreSimulator
to see why creating the SimDeviceSet failed.
Thanks for your time, Dan.
Well thanks to the community for all there help..... not.
In the end I got it working by simply upgrading to OS X El Capitan and Xcode 7.0.1.
One thing I would point out though, is that when I was looking through the Xcode app files, some of them were corrupted and when I updated to Xcode 7.0.1 this issue was not fixed. So before installing OS X El Capitan, I deleted the following:
Xcode 7.0.1 app
Library/Developer folder
Macintosh HD/Library/Developer folder
I then installed OS X El Capitan and then installed Xcode 7.0.1 and now everything works fine.
I hope this helps anyone else who is experiencing the same issue.

FSEventStream errors when using xcodebuild - related to Mail?

Since upgrading to OSX 10.10, I have been getting these odd errors when running xcodebuild, the following in the terminal output:
xcodebuild[6484] (FSEvents.framework) FSEventStreamStart:
register_with_server: ERROR: f2d_register_rpc() => (null) (-21)
xcodebuild[6484] (FSEvents.framework) FSEventStreamInvalidate():
failed assertion 'streamRef != NULL'
xcodebuild[6484] (FSEvents.framework) FSEventStreamRelease(): failed
assertion 'streamRef != NULL'
xcodebuild[6484:104132] DVTFilePathFSEvents: Failed to start fs event
stream.
This hasn't been a particular problem, as my scripts will just continue and xcodebuild is fine, however today I found that some apps that use xcodebuild (like TestFlight) will see this as an error and stop working.
I tailed the system log and found the culprit may be Mac Mail, with constant entries like this:
fseventsd[20]: implementation_added_client : failed to add client for
path /Users/mok9/Library/Mail/V2/IMAP-...[removed full path for
privacy]...
Quitting Mac Mail caused this issue in xcodebuild to go away... that was not a dependency I was expecting!
So, is the Mail issue just a symptom of another problem, or is Mail setting up some issue that causes xcodebuild to be affected? I suppose I am less concerned about the Mail issue and more concerned with what causes Xcode to be affected by this issue...

GHUnit target: failed to attach to process

I have a GHUnit test target, TestGH, which I'd like to use to test classes in my application, TestApp. I'm using Xcode 4.5 and trying to run TestGH on iPad 6.0 Simulator.
I believe I've configured the TestGH build correctly in the Build Settings and Build Phases. I've set the Target Dependencies to "TestApp" I've added the *.m files for the classes I'd like to test--along with the test case classes which will test them--to the Compile Sources section TestGH.
Other notable configuration:
In the app target, TestApp:
Symbols Hidden By Default: No
Product Name: TestApp
In the test target, TestGH:
Bundle Loader: $(BUILT_PRODUCTS_DIR)/TestApp.app/TestApp
Mach-O Type: Bundle
Other linker flags: -ObjC, -all_load
Product name: TestGH
Test Host: $(BUNDLE_LOADER)
I suppose I have this mostly right, as I discovered these settings by fighting through compile/link errors, reading stackoverflow, and blogs.
However, when I launch TestGH, the Log Navigator shows:
error: failed to attach to process ID 2305 (2305 corresponds to 'sh' according to activity monitor, fyi)
Simulator screen remains black, and Xcode shows "Attaching to TestGH" in the status.
Any ideas?
I've gone through many suggested fixes/workarounds I've seen discussed here related to "failed to attach to process."
Deleted DerivedData folder in Library/Developer/Xcode, deleted everything under Library/Application Support/iPhone Simulator. Tried all the options under Product->Edit Scheme for the TestGH target--tried Debugger = GDB, LLDB, None, Launch = Automatically, wait. Results are always the same.