XCTest in xcode 5--tests fail without any issue generated - ios

I am doing an Max OS X terminal project. After I am done with the implementation I wanted to try try unit test. So I created a test target and set the target to be the one that I want to test. I wrote some simple test cases but it tells the link error ""_OBJC_CLASS_$_SomeClassUnderTest", referenced from:
objc-class-ref in SomeTest.o"
I looked at link
so first of all, why the error happened? I mean apple's official document does not mention anything about bundle loader or whatsoever, why I have to do that? there is something wrong with my original config or something? the linking should go the executable file? or it should go to static library file? but where to find that for testing and how to reference that?
and now the issue about linking issue is gone. but I got test fail even if I do "XCTAssertTrue(1==1,"")"! and I do not see any issue generated saying tests not pass or pass, just after build succeed there is a message saying test failed? why is this so?

This is a bug in Xcode and is corrected in version 5.1 . When using the simulator, tests can sometimes show the message Test target [test name] encountered an error (Test process exited with code -1)
See Xcode release notes for official details:
enter link description here

Related

How do I track down this error message "could not find upload server" in Xcode?

I have recently inherited an iOS project within our company. It is written in Objective-C and all of those who have previously worked on it are no longer in the company.
Anytime I use the Product -> Clean Build Folder or Product -> Build I get an error message pop up at the end of the build that says "could not find upload server".
I have searched the code and do not see this anywhere, I have went though the build settings and do not see this anywhere either, and I have went through the build phases and rules and just can't figure out where this message is coming from.
Does anyone have a clue what this error message means or where I could look to figure it out?
The app compiles and builds fine, but I'd like to resolve this issue.
We do have a report upload project within the app so I'm not sure if it's related to that or if Xcode is trying to upload the project to some type of build server somewhere on our network. From some digging around, I was able to learn we used to have a MacMini that did builds but it hasn't been used for years and is no longer online.
Where can I look to find this issue?
I found the issue after searching through GitHub. It seems there was a PostBuild script on the Scheme file which I was not aware existed.

Firebase Crash Reporting Multiple Issues

I am setting up Firebase Crash Reporting on my iOS App. I have imported the necessary json files and set up the shell script. However, when I click run on the simulator, I get 11 errors all say about the same thing. Here are two of them:
warning: dump_syms: /var/folders/5l/20by_c_57fb7jhv3jh72jw9m0000gn/T/com.google.FirebaseCrashReporter.TAlixfZc/**App Name**.dSYM/Contents/Resources/DWARF/**App Name**: in compilation unit '/Users/mikelehen/firebase/firebase-client-objc/Firebase/Firebase/Utilities/FUtilities.m' (offset 0x28a2e): `
warning: dump_syms: /var/folders/5l/20by_c_57fb7jhv3jh72jw9m0000gn/T/com.google.FirebaseCrashReporter.TAlixfZc/**App name**.dSYM/Contents/Resources/DWARF/**App Name**: the DIE at offset 0x28fc1 has a DW_AT_abstract_origin attribute referring to the die at offset 0x2940f, which either was not marked as an inline, or comes later in the file `
When I try to run it on my iPhone I get only four issues.
Also, my name is not mikelehen which is for some reason in one of the issues.
After following the instructions on Firebase's website about simulating a crash, I never get the log output about the crash being uploaded.
Any idea of what I'm doing wrong here?
Edit:
Here is the script that is in my build phases:
JSON_FILE="../**App Name**/ServiceAccount.json"
GOOGLE_APP_ID=1:**App ID**
defaults write com.google.SymbolUpload version -integer 1
JSON=$(cat "${JSON_FILE}")
/usr/bin/plutil -replace "app_${GOOGLE_APP_ID//:/_}" -json "${JSON}" "$HOME/Library/Preferences/com.google.SymbolUpload.plist"
"${PODS_ROOT}"/FirebaseCrash/upload-sym
Try:
Build Phases --> Run Script
Click Run script only when installing
Those warnings are not harmful for the most part. The dump_syms utility that ships with the Cocoapod is not fully productized, so it reports errors using file names of the person who compiled it last (mikelehen in this case). We are actively looking into alternatives to dump_syms as the warnings are distracting.
As mentioned by Robert, the warnings are innocuous. Here are some suggestions that might help you out if you're having issues getting a crash to upload:
1) Make sure the debugger is not attached when you cause the crash to occur. It will intercept the exception, and nothing will get reported. So compile your program, hit stop in the debugger, manually launch the app (in either the simulator or the device), trigger the crash, then relaunch the app (without the crash so the error has time to report).
2) You should see a log message that Firebase Crash Reporting was initialized. If this is missing, make sure you've included the Firebase/Crash pod and called [FIRApp configure];.
3) Within 15 seconds, you should see another message indicating the report has been successfully sent. Be sure to wait at least 15 seconds. Reports are uploaded after a delay to avoid interfering with your app startup.
4) After the report has been uploaded, there is a delay of up to 20 minutes before data shows up in the web console.
5) If you're not using cocoapods, make sure you've added the ObjC linker flag in your Other Linker Settings in your target's build settings.
The dump_syms warnings generated are not harmful and are generated when symbol files are uploaded. So if you want to avoid warnings every time you build, you can create two targets; debug and release.
Then just disable the option of 'Run script only when installing' for Debug and enable it for release.
This will upload the symbol files.

Error running XCTest for Swift/Obj-c project (Error 83)

I'm having the following error when trying to run the tests for my Swift/Obj-c app:
2016-02-07 00:02:26.752 xctest[3275:115122] The bundle “MyAppTests” couldn’t be loaded. Try reinstalling the bundle.
2016-02-07 00:02:26.752 xctest[3275:115122] (dlopen(/Users/raphaelcruzeiro/Library/Developer/Xcode/DerivedData/MyApp-bjdolynlskqvavgryvznzbluqele/Build/Products/Debug-iphonesimulator/MyAppTests.xctest/MyAppTests, 265): Symbol not found: _CLSDevelopmentPlatformNameKey
Referenced from: /Users/raphaelcruzeiro/Library/Developer/Xcode/DerivedData/MyApp-bjdolynlskqvavgryvznzbluqele/Build/Products/Debug-iphonesimulator/MyAppTests.xctest/MyAppTests
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/xctest
in /Users/raphaelcruzeiro/Library/Developer/Xcode/DerivedData/MyApp-bjdolynlskqvavgryvznzbluqele/Build/Products/Debug-iphonesimulator/MyAppTests.xctest/MyAppTests)
Program ended with exit code: 83
It's a fairly big app and it does not use Frameworks as I need to support iOS 7 if that makes any difference. The app had no tests. I have just created the first test suite now.
I got the same problem, and it was because the Host Application wasn't set.
I don't know why it got reset, but it makes sense since the swift file were not in the test target.
After hitting my head a few times over this, I decided to delete the test target and recreate it from scratch. that solved my problem.
I resolved it by adding missing Info.plist file.

IDEBundleInjection.c: Error 3587 on Xcode 6.4

I am trying to start testing my app, and so I enabled a new test target and a Swift file for the testing. Yet when I try to execute the testing I receive error:
IDEBundleInjection.c: Error 3587 loading bundle '/Users/fbartolom/Library/Developer/Xcode/DerivedData/inArrivoHD-ebjdiuuwdpdvchgmpsyqkpvvvyhw/Build/Products/Debug-iphonesimulator/inArrivoHD Tests.xctest
By reading some threads I also recovered the XCTest.framework from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks/ given it was not available in the selection, after locating it with find on the shell as Spotlight reported no results. Yet in so doing I got some missing symbols in the linking phase, so by reading How do I migrate from SenTestingKit/OCUnit to XCTest? I removed it.
I tried clearing the DerivedData folder several times to no avail. I also put code signing to "Don't Code signing" with changing anything.
What should I do?
I think I fixed the issue by followng the advice at:
http://dunghnt.blogspot.it/2014/12/problems-of-migrating-from-sen-test-to.html
The issue was due to incorrectly importing the MacOS test kit. Once I correctly chose the iOS one everything went in order. Perhaps a better error message would be appreciated.

iOS Metal: Unable to create compute pipeline state with function

I was trying to make a simple app for sudoku solving on GPU with iOS Metal Framework.
I was following instructions from this blog post:
http://memkite.com/blog/2014/12/15/data-parallel-programming-with-metal-and-swift-for-iphoneipad-gpu/
I version my code here:
https://github.com/mateuszbuda/Sudoku
(As of writing this question HEAD is commit c3e06e0)
And I've encountered error when calling
newComputePipelineStateWithFunction
that is while setting up MTLDevice in ViewController (line 95):
https://github.com/mateuszbuda/Sudoku/blob/c3e06e0e1edc724eea20962f32e49f0df8143b7d/Sudoku/ViewController.swift
The error I get is:
Error Domain=AGXMetal Code=1 "Compiler encountered an internal error"
I'm running this on iPhone 6 Plus with iOS 8.1.3
Have someone any idea what can cause the error I get?
You are experiencing one of the unfinished matters in Metal. The reason the error says "internal" is because this is a compiler error, CAUSED by the compiler. Not you. Try this:
Copy all of the code in the ".metal" file that is not compilable.
Delete the .metal file (NOT just the reference).
Remove all of the content of the "DerivedData" folder located at users/yourUser/Library/Developer/Xcode/DerivedData
Create a new .metal file and paste the old code in this new metal file.
Now build and run, you should be good to go.
Anybody who finds this error make sure to send some sort of error report to Apple so that they can properly debug it and fix it in the next release of Xcode.
For anyone having the same problem, I've figured it out.
It just means that there is something wrong with a kernel function. Most probably it doesn't compile, even if you don't see any errors in Xcode.

Resources