extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%406
This commit is contained in:
kearwood
2012-02-10 05:48:59 +00:00
parent fe0fd86896
commit 26c5a29b29
14 changed files with 399 additions and 90 deletions

View File

@@ -213,22 +213,37 @@ double const PI = 3.141592653589793f;
lightDirection.normalize();
[self allocateShadowBuffers];
for(int iShadow=0; iShadow < m_cShadowBuffers; iShadow++) {
if(!shadowValid[iShadow] || true) {
int iOffset=m_iFrame % m_cShadowBuffers;
for(int iShadow2=iOffset; iShadow2 < m_cShadowBuffers + iOffset; iShadow2++) {
int iShadow = iShadow2 % m_cShadowBuffers;
GLfloat shadowMinDepths[3][3] = {{0.0, 0.0, 0.0},{0.0, 0.0, 0.0},{0.0, 0.05, 0.3}};
GLfloat shadowMaxDepths[3][3] = {{0.0, 0.0, 1.0},{0.1, 0.0, 0.0},{0.1, 0.3, 1.0}};
KRMat4 newShadowMVP;
if(shadowMaxDepths[m_cShadowBuffers - 1][iShadow] == 0.0) {
KRBoundingVolume ext = KRBoundingVolume(pScene->getExtents());
newShadowMVP = ext.calcShadowProj(pScene, sun_yaw, sun_pitch);
} else {
KRBoundingVolume frustrumSliceVolume = KRBoundingVolume(viewMatrix, m_camera.perspective_fov, m_camera.perspective_aspect, m_camera.perspective_nearz + (m_camera.perspective_farz - m_camera.perspective_nearz) * shadowMinDepths[m_cShadowBuffers - 1][iShadow], m_camera.perspective_nearz + (m_camera.perspective_farz - m_camera.perspective_nearz) * shadowMaxDepths[m_cShadowBuffers - 1][iShadow]);
newShadowMVP = frustrumSliceVolume.calcShadowProj(pScene, sun_yaw, sun_pitch);
}
if(!(shadowmvpmatrix[iShadow] == newShadowMVP)) {
shadowValid[iShadow] = false;
}
if(!shadowValid[iShadow]) {
shadowValid[iShadow] = true;
GLfloat shadowMinDepths[3][3] = {{0.0, 0.0, 0.0},{0.0, 0.0, 0.0},{0.0, 0.05, 0.3}};
GLfloat shadowMaxDepths[3][3] = {{0.0, 0.0, 1.0},{0.1, 0.0, 0.0},{0.1, 0.3, 1.0}};
if(shadowMaxDepths[m_cShadowBuffers - 1][iShadow] == 0.0) {
shadowmvpmatrix[iShadow] = pScene->getExtents().calcShadowProj(pScene, sun_yaw, sun_pitch);
} else {
KRBoundingVolume frustrumSliceVolume = KRBoundingVolume(viewMatrix, m_camera.perspective_fov, m_camera.perspective_aspect, m_camera.perspective_nearz + (m_camera.perspective_farz - m_camera.perspective_nearz) * shadowMinDepths[m_cShadowBuffers - 1][iShadow], m_camera.perspective_nearz + (m_camera.perspective_farz - m_camera.perspective_nearz) * shadowMaxDepths[m_cShadowBuffers - 1][iShadow]);
shadowmvpmatrix[iShadow] = frustrumSliceVolume.calcShadowProj(pScene, sun_yaw, sun_pitch);
}
shadowmvpmatrix[iShadow] = newShadowMVP;
[self renderShadowBufferNumber: iShadow ForScene: pScene];
break;
}
}

View File

@@ -61,7 +61,6 @@ GLfloat *KRMat4::getPointer() {
// Copy constructor
KRMat4::KRMat4(const KRMat4 &m) {
memcpy(m_mat, m.m_mat, sizeof(GLfloat) * 16);
}
@@ -72,6 +71,11 @@ KRMat4& KRMat4::operator=(const KRMat4 &m) {
return *this;
}
// Overload comparison operator
bool KRMat4::operator==(const KRMat4 &m) {
return memcmp(m_mat, m.m_mat, sizeof(GLfloat) * 16) == 0;
}
// Overload compound multiply operator
KRMat4& KRMat4::operator*=(const KRMat4 &m) {
GLfloat temp[16];
@@ -93,15 +97,7 @@ KRMat4& KRMat4::operator*=(const KRMat4 &m) {
return *this;
}
/*
// Overload multiply operator
KRMat4& KRMat4::operator*(const KRMat4 &m, const KRMat4 &m) {
KRMat4 result = *this;
result *= m;
return result;
}
*/
KRMat4 KRMat4::operator*(const KRMat4 &m) {
KRMat4 ret = *this;
ret *= m;
@@ -137,7 +133,6 @@ void KRMat4::translate(GLfloat x, GLfloat y, GLfloat z) {
/* Rotate a matrix by an angle on a X, Y, or Z axis */
void KRMat4::rotate(GLfloat angle, AXIS axis) {
// const GLfloat d2r = 0.0174532925199; /* PI / 180 */
const int cos1[3] = { 5, 0, 0 };
const int cos2[3] = { 10, 10, 5 };
const int sin1[3] = { 6, 2, 1 };
@@ -153,6 +148,7 @@ void KRMat4::rotate(GLfloat angle, AXIS axis) {
*this *= newMatrix;
}
/* Scale matrix by separate x, y, and z amounts */
void KRMat4::scale(GLfloat x, GLfloat y, GLfloat z) {
KRMat4 newMatrix; // Create new identity matrix
@@ -163,12 +159,13 @@ void KRMat4::scale(GLfloat x, GLfloat y, GLfloat z) {
*this *= newMatrix;
}
/* Scale all dimensions equally */
void KRMat4::scale(GLfloat s) {
scale(s,s,s);
}
// Initialize with a bias matrix
void KRMat4::bias() {
// Initialize with a bias matrix
static const GLfloat BIAS_MATRIX[] = {
0.5, 0.0, 0.0, 0.0,
0.0, 0.5, 0.0, 0.0,
@@ -182,15 +179,6 @@ void KRMat4::bias() {
/* Generate an orthographic view matrix */
void KRMat4::ortho(GLfloat left, GLfloat right, GLfloat top, GLfloat bottom, GLfloat nearz, GLfloat farz) {
memset(m_mat, 0, sizeof(GLfloat) * 16);
/*
m_mat[0] = 2.0f / (right - left);
m_mat[3] = -(right + left) / (right - left);
m_mat[5] = 2.0f / (top - bottom);
m_mat[7] = -(top + bottom) / (top - bottom);
m_mat[10] = -2.0f / (farz - nearz);
m_mat[11] = -(farz + nearz) / (farz - nearz);
m_mat[15] = 1.0f;
*/
m_mat[0] = 2.0f / (right - left);
m_mat[5] = 2.0f / (bottom - top);
m_mat[10] = -1.0f / (farz - nearz);
@@ -198,30 +186,8 @@ void KRMat4::ortho(GLfloat left, GLfloat right, GLfloat top, GLfloat bottom, GLf
m_mat[15] = 1.0f;
}
/* Replace matrix with its inverse */
bool KRMat4::invert() {
/*
GLfloat inverseTranslation[16];
GLfloat inverseRotation[16];
inverseTranslation[0] = 1 ; inverseTranslation[4] = 0 ; inverseTranslation[8] = 0 ; inverseTranslation[12] = -m_mat[12] ;
inverseTranslation[1] = 0 ; inverseTranslation[5] = 1 ; inverseTranslation[9] = 0 ; inverseTranslation[13] = -m_mat[13] ;
inverseTranslation[2] = 0 ; inverseTranslation[6] = 0 ; inverseTranslation[10] = 1 ; inverseTranslation[14] = -m_mat[14] ;
inverseTranslation[3] = 0 ; inverseTranslation[7] = 0 ; inverseTranslation[11] = 0 ; inverseTranslation[15] = 1 ;
inverseRotation[0] = m_mat[0] ; inverseRotation[4] = m_mat[1] ; inverseRotation[8] = m_mat[2] ; inverseRotation[12] = 0 ;
inverseRotation[1] = m_mat[4] ; inverseRotation[5] = m_mat[5] ; inverseRotation[9] = m_mat[6] ; inverseRotation[13] = 0 ;
inverseRotation[2] = m_mat[8] ; inverseRotation[6] = m_mat[9] ; inverseRotation[10] = m_mat[10] ; inverseRotation[14] = 0 ;
inverseRotation[3] = 0 ; inverseRotation[7] = 0 ; inverseRotation[11] = 0 ; inverseRotation[15] = 1 ;
KRMat4 inverseRotMat(inverseRotation);
KRMat4 inverseTransMat(inverseTranslation);
KRMat4 m = inverseRotMat * inverseTransMat;
memcpy(m_mat, m.m_mat, sizeof(GLfloat) * 16);
*/
// Based on gluInvertMatrix implementation
double inv[16], det;
@@ -272,12 +238,10 @@ bool KRMat4::invert() {
m_mat[i] = inv[i] * det;
}
return true;
}
/* Dot Product */
Vector3 KRMat4::dot(const Vector3 &v) const {
return Vector3(
v.x * (float)m_mat[0*4 + 0] + v.y * (float)m_mat[1*4 + 0] + v.z * (float)m_mat[2*4 + 0] + (float)m_mat[3*4 + 0],

View File

@@ -75,6 +75,9 @@ public:
// Overload assignment operator
KRMat4& operator=(const KRMat4 &m);
// Overload comparison operator
bool operator==(const KRMat4 &m);
// Overload compound multiply operator
KRMat4& operator*=(const KRMat4 &m);

View File

@@ -99,12 +99,10 @@ void KRModel::loadPack(std::string path, KRMaterialManager *pMaterialManager) {
m_pBuffers = new GLuint[m_cBuffers];
glGenBuffers(m_cBuffers, m_pBuffers);
for(GLsizei iBuffer=0; iBuffer < m_cBuffers; iBuffer++) {
// if(iBuffer < 30) {
GLsizei cVertexes = iBuffer < m_cBuffers - 1 ? MAX_VBO_SIZE : pHeader->vertex_count % MAX_VBO_SIZE;
glBindBuffer(GL_ARRAY_BUFFER, m_pBuffers[iBuffer]);
glBufferData(GL_ARRAY_BUFFER, sizeof(VertexData) * cVertexes, m_pVertexData + iBuffer * MAX_VBO_SIZE, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
// }
GLsizei cVertexes = iBuffer < m_cBuffers - 1 ? MAX_VBO_SIZE : pHeader->vertex_count % MAX_VBO_SIZE;
glBindBuffer(GL_ARRAY_BUFFER, m_pBuffers[iBuffer]);
glBufferData(GL_ARRAY_BUFFER, sizeof(VertexData) * cVertexes, m_pVertexData + iBuffer * MAX_VBO_SIZE, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
}
@@ -438,8 +436,6 @@ void KRModel::loadWavefront(std::string path, KRMaterialManager *pMaterialManage
// Calculate surface normals and tangents
// http://www.terathon.com/code/tangent.html
// http://www.fabiensanglard.net/bumpMapping/index.php
for(std::vector<Material *>::iterator itr = m_materials.begin(); itr != m_materials.end(); itr++) {
VertexData *pStart = m_pVertexData + (*itr)->start_vertex;

View File

@@ -166,17 +166,7 @@ void KRShader::bind(KRCamera *pCamera, KRMat4 &mvpMatrix, Vector3 &cameraPositio
glUniform1i(m_uniforms[KRENGINE_UNIFORM_SHADOWTEXTURE2], 4);
glUniform1i(m_uniforms[KRENGINE_UNIFORM_SHADOWTEXTURE3], 5);
/*
#if defined(DEBUG)
if (![self validateProgram:m_iProgram])
{
NSLog(@"Failed to validate program: %d", m_shadowShaderProgram);
return;
}
#endif
*/
GLint logLength, status;
glValidateProgram(m_iProgram);
@@ -188,15 +178,8 @@ void KRShader::bind(KRCamera *pCamera, KRMat4 &mvpMatrix, Vector3 &cameraPositio
fprintf(stderr, "Program validate log:\n%s", log);
free(log);
}
/*
glGetProgramiv(m_iProgram, GL_VALIDATE_STATUS, &status);
if (status == 0) {
return false;
} else {
return true;
}
*/
#endif
}
GLuint KRShader::getProgram() {

View File

@@ -371,8 +371,6 @@ void KROBJPacker::pack(const char *szPath) {
// Calculate surface normals and tangents
cout << " Pass 3 - Calculate surface normals and tangents\n";
// http://www.terathon.com/code/tangent.html
// http://www.fabiensanglard.net/bumpMapping/index.php
for(std::vector<pack_material *>::iterator itr = m_materials.begin(); itr != m_materials.end(); itr++) {
VertexData *pStart = m_pVertexData + (*itr)->start_vertex;
@@ -415,7 +413,7 @@ void KROBJPacker::pack(const char *szPath) {
pVertex[2].normal.z = normal.z;
}
// -- Calculate tangent --
// -- Calculate tangent vector for normal mapping --
TexCoord st1; // = pVertex[2].texcoord;
TexCoord st2; // = pVertex[1].texcoord;
st1.u = pVertex[1].texcoord.u - pVertex[0].texcoord.u;

View File

@@ -44,6 +44,8 @@
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
[self.window addSubview:viewController.view];
[self.window makeKeyAndVisible];
[TestFlight takeOff:@"bee30f66de8a537484b210b6ac8fa118_NDA5MTIyMDExLTExLTE0IDE1OjUxOjQwLjA0MzM4MA"];
return YES;
}

View File

@@ -54,7 +54,7 @@
if ([self respondsToSelector:@selector(setContentScaleFactor:)])
{
self.contentScaleFactor = [[UIScreen mainScreen] scale];
}
}
eaglLayer.opaque = YES;
eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];

View File

@@ -252,7 +252,7 @@
break;
}
}
}

View File

@@ -27,6 +27,9 @@
E46FED3113C9A49F009F5814 /* ObjectShader.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E46FED2513C9A488009F5814 /* ObjectShader.vsh */; };
E46FED3213C9A49F009F5814 /* PostShader.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E46FED2613C9A488009F5814 /* PostShader.vsh */; };
E49EB29C13806C5D00A4E727 /* MainWindow-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = E49EB29B13806C5D00A4E727 /* MainWindow-iPad.xib */; };
E4C5FCEC1471B51A00821FB1 /* libTestFlight.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E4C5FCE81471B51A00821FB1 /* libTestFlight.a */; };
E4C5FCED1471B51A00821FB1 /* README.txt in Resources */ = {isa = PBXBuildFile; fileRef = E4C5FCE91471B51A00821FB1 /* README.txt */; };
E4C5FCEE1471B51A00821FB1 /* release_notes.txt in Resources */ = {isa = PBXBuildFile; fileRef = E4C5FCEA1471B51A00821FB1 /* release_notes.txt */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -56,6 +59,10 @@
E46FED2513C9A488009F5814 /* ObjectShader.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = ObjectShader.vsh; path = ../KREngine/KREngine/Shaders/ObjectShader.vsh; sourceTree = "<group>"; };
E46FED2613C9A488009F5814 /* PostShader.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = PostShader.vsh; path = ../KREngine/KREngine/Shaders/PostShader.vsh; sourceTree = "<group>"; };
E49EB29B13806C5D00A4E727 /* MainWindow-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MainWindow-iPad.xib"; path = "iPad/MainWindow-iPad.xib"; sourceTree = "<group>"; };
E4C5FCE81471B51A00821FB1 /* libTestFlight.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libTestFlight.a; sourceTree = "<group>"; };
E4C5FCE91471B51A00821FB1 /* README.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.txt; sourceTree = "<group>"; };
E4C5FCEA1471B51A00821FB1 /* release_notes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = release_notes.txt; sourceTree = "<group>"; };
E4C5FCEB1471B51A00821FB1 /* TestFlight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestFlight.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -71,6 +78,7 @@
1063FBAE136BA13F00EE555B /* CoreVideo.framework in Frameworks */,
1063FBB0136BA13F00EE555B /* OpenGLES.framework in Frameworks */,
1063FBB2136BA13F00EE555B /* QuartzCore.framework in Frameworks */,
E4C5FCEC1471B51A00821FB1 /* libTestFlight.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -101,6 +109,7 @@
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
isa = PBXGroup;
children = (
E4C5FCE71471B51A00821FB1 /* TestFlightSDK0.8 */,
E43A7A6D13CA2BA2000A565E /* libKREngine.a */,
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
@@ -174,6 +183,17 @@
name = iPad;
sourceTree = "<group>";
};
E4C5FCE71471B51A00821FB1 /* TestFlightSDK0.8 */ = {
isa = PBXGroup;
children = (
E4C5FCE81471B51A00821FB1 /* libTestFlight.a */,
E4C5FCE91471B51A00821FB1 /* README.txt */,
E4C5FCEA1471B51A00821FB1 /* release_notes.txt */,
E4C5FCEB1471B51A00821FB1 /* TestFlight.h */,
);
path = TestFlightSDK0.8;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -232,6 +252,8 @@
E46FED3213C9A49F009F5814 /* PostShader.vsh in Resources */,
28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */,
E49EB29C13806C5D00A4E727 /* MainWindow-iPad.xib in Resources */,
E4C5FCED1471B51A00821FB1 /* README.txt in Resources */,
E4C5FCEE1471B51A00821FB1 /* release_notes.txt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -267,6 +289,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)\"",
"\"$(SRCROOT)/TestFlightSDK0.8\"",
);
PRODUCT_NAME = KRObjView;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -287,6 +310,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)\"",
"\"$(SRCROOT)/TestFlightSDK0.8\"",
);
PRODUCT_NAME = KRObjView;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -322,6 +346,42 @@
};
name = Release;
};
E4C5FCF01471B78500821FB1 /* Ad Hoc */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PREBINDING = NO;
SDKROOT = iphoneos;
};
name = "Ad Hoc";
};
E4C5FCF11471B78500821FB1 /* Ad Hoc */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = KRObjView_Prefix.pch;
"HEADER_SEARCH_PATHS[arch=*]" = /Users/kearwood/Documents/dev/svn/sarofax/tools/krengine/trunk/KREngine/KREngine/Classes;
INFOPLIST_FILE = "KRObjView-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)\"",
"\"$(SRCROOT)/TestFlightSDK0.8\"",
);
PRODUCT_NAME = KRObjView;
TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "/Users/applemac/circa1948/circa1948_circa1948/tools/krengine/**";
VALIDATE_PRODUCT = YES;
};
name = "Ad Hoc";
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -330,6 +390,7 @@
buildConfigurations = (
1D6058940D05DD3E006BFB54 /* Debug */,
1D6058950D05DD3E006BFB54 /* Release */,
E4C5FCF11471B78500821FB1 /* Ad Hoc */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
@@ -339,6 +400,7 @@
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
E4C5FCF01471B78500821FB1 /* Ad Hoc */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;

View File

@@ -5,4 +5,5 @@
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "TestFlight.h"
#endif

View File

@@ -0,0 +1,168 @@
Thanks for downloading the TestFlight SDK 0.8!
This document is also available on the web at https://www.testflightapp.com/sdk/doc
1. Why use the TestFlight SDK?
2. Considerations
3. How do I integrate the SDK into my project?
4. Using the Checkpoint API
5. Using the Feedback API
6. Upload your build
7. Questions API
8. View your results
9. Advanced Exception Handling
START
1. Why use the TestFlight SDK?
The TestFlight SDK allows you to track how beta testers are testing your application. Out of the box we track simple usage information, such as which tester is using your application, their device model/OS, how long they used the application, logs of their test session, and automatic recording of any crashes they encounter.
To get the most out of the SDK we have provided the Checkpoint API.
The Checkpoint API is used to help you track exactly how your testers are using your application. Curious about which users passed level 5 in your game, or posted their high score to Twitter, or found that obscure feature? With a single line of code you can finally gather all this information. Wondering how many times your app has crashed? Wondering who your power testers are? We've got you covered. See more information on the Checkpoint API in section 4.
Alongside the Checkpoint API is the Questions interface. The Questions interface is managed on a per build basis on the TestFlight website. Find out more about the Questions Interface in section 6.
2. Considerations
Information gathered by the SDK is sent to the website in real time. When an application is put into the background (iOS 4.x) or terminated (iOS 3.x) we try to send the finalizing information for the session during the time allowed for finalizing the application. Should all of the data not get sent the remaining data will be sent the next time the application is launched. As such, to get the most out of the SDK we recommend your application support iOS 4.0 and higher.
This SDK can be run from both the iPhone Simulator and Device and has been tested using Xcode 4.0.
3. How do I integrate the SDK into my project?
1. Add the files to your project: File -> Add Files to "<your project name>"
1. Find and select the folder that contains the SDK
2. Make sure that "Copy items into destination folder (if needed)" is checked
3. Set Folders to "Create groups for any added folders"
4. Select all targets that you want to add the SDK to
2. Verify that libTestFlight.a has been added to the Link Binary With Libraries Build Phase for the targets you want to use the SDK with
1. Select your Project in the Project Navigator
2. Select the target you want to enable the SDK for
3. Select the Build Phases tab
4. Open the Link Binary With Libraries Phase
5. If libTestFlight.a is not listed, drag and drop the library from your Project Navigator to the Link Binary With Libraries area
6. Repeat Steps 2 - 5 until all targets you want to use the SDK with have the SDK linked
3. In your Application Delegate:
1. Import TestFlight: `#import "TestFlight.h"`
NOTE: If you do not want to import TestFlight.h in every file you may add the above line into you pre-compiled header (`<projectname>_Prefix.pch`) file inside of the
#ifdef __OBJC__ section.
This will give you access to the SDK across all files.
2. Get your Team Token which you can find at [http://testflightapp.com/dashboard/team/](http://testflightapp.com/dashboard/team/) select the team you are using from the team selection drop down list on the top of the page and then select edit.
3. Launch TestFlight with your Team Token
-(BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// start of your application:didFinishLaunchingWithOptions
// ...
[TestFlight takeOff:@"Insert your Team Token here"];
// The rest of your application:didFinishLaunchingWithOptions method
// ...
}
4. To report crashes to you we install our own uncaught exception handler. If you are not currently using an exception handler of your own then all you need to do is go to the next step. If you currently use an Exception Handler, or you use another framework that does please go to the section on advanced exception handling.
4. To enable the best crash reporting possible we recommend setting the following project build settings in Xcode to NO for all targets that you want to have live crash reporting for You can find build settings by opening the Project Navigator (default command+1 or command+shift+j) then clicking on the project you are configuring (usually the first selection in the list). From there you can choose to either change the global project settings or settings on an individual project basis. All settings below are in the Deployment Section.
1. Deployment Post Processing
2. Strip Debug Symbols During Copy
3. Strip Linked Product
4. Use the Checkpoint API to create important checkpoints throughout your application.
When a tester passes a level, or adds a new todo item, you can pass a checkpoint. The checkpoint progress is used to provide insight into how your testers are testing your apps. The passed checkpoints are also attached to crashes, which can help when creating steps to replicate.
`[TestFlight passCheckpoint:@"CHECKPOINT_NAME"];`
Use `passCheckpoint:` to track when a user performs certain tasks in your application. This can be useful for making sure testers are hitting all parts of your application, as well as tracking which testers are being thorough.
5. Using the Feedback API
To launch unguided feedback call the `openFeedbackView` method. We recommend that you call this from a GUI element.
-(IBAction)launchFeedback {
[TestFlight openFeedbackView];
}
Once users have submitted feedback from inside of the application you can view it in the feedback area of your build page.
6. Upload your build.
After you have integrated the SDK into your application you need to upload your build to TestFlight. You can upload from your dashboard or or using the Upload API, full documentation at <https://testflightapp.com/api/doc/>
7. Add Questions to Checkpoints
In order to ask a question, you'll need to associate it with a checkpoint. Make sure your checkpoints are initialized by running your app and hitting them all yourself before you start adding questions.
There are three question types available: Yes/No, Multiple Choice, and Long Answer.
To create questions, visit your builds Questions page and click on 'Add Question'. If you choose Multiple Choice, you'll need to enter a list of possible answers for your testers to choose from &mdash; otherwise, you'll only need to enter your question's, well, question. If your build has no questions, you can also choose to migrate questions from another build (because seriously &mdash; who wants to do all that typing again)?
After restarting your application on an approved device, when you pass the checkpoint associated with your questions a Test Flight modal question form will appear on the screen asking the beta tester to answer your question.
After you upload a new build to TestFlight you will need to associate questions once again. However if your checkpoints and questions have remained the same you can choose "copy questions from an older build" and choose which build to copy the questions from.
8. View your results.
As testers install your build and start to test it you will see their session data on the web on the build report page for the build you've uploaded.
9. Advanced Exception Handling
An uncaught exception means that your application is in an unknown state and there is not much that you can do but try and exit gracefully. Our SDK does its best to get the data we collect in this situation to you while it is crashing, but it is designed in such a way that the important act of saving the data occurs in as safe way a way as possible before trying to send anything. If you do use uncaught exception or signal handlers install your handlers before calling `takeOff`. Our SDK will then call your handler while ours is running. For example:
/*
My Apps Custom uncaught exception catcher, we do special stuff here, and TestFlight takes care of the rest
**/
void HandleExceptions(NSException *exception) {
NSLog(@"This is where we save the application data during a exception");
// Save application data on crash
}
/*
My Apps Custom signal catcher, we do special stuff here, and TestFlight takes care of the rest
**/
void SignalHandler(int sig) {
NSLog(@"This is where we save the application data during a signal");
// Save application data on crash
}
-(BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// installs HandleExceptions as the Uncaught Exception Handler
NSSetUncaughtExceptionHandler(&HandleExceptions);
// create the signal action structure
struct sigaction newSignalAction;
// initialize the signal action structure
memset(&newSignalAction, 0, sizeof(newSignalAction));
// set SignalHandler as the handler in the signal action structure
newSignalAction.sa_handler = &SignalHandler;
// set SignalHandler as the handlers for SIGABRT, SIGILL and SIGBUS
sigaction(SIGABRT, &newSignalAction, NULL);
sigaction(SIGILL, &newSignalAction, NULL);
sigaction(SIGBUS, &newSignalAction, NULL);
// Call takeOff after install your own unhandled exception and signal handlers
[TestFlight takeOff:@"Insert your Team Token here"];
// continue with your application initialization
}
You do not need to add the above code if your application does not use exception handling already.
END
Please contact us if you have any questions.
The TestFlight Team
w. http://www.testflightapp.com
e. beta@testflightapp.com

View File

@@ -0,0 +1,58 @@
//
// TestFlight.h
// libTestFlight
//
// Created by Jonathan Janzen on 06/11/11.
// Copyright 2011 TestFlight. All rights reserved.
#import <Foundation/Foundation.h>
#define TESTFLIGHT_SDK_VERSION @"0.8"
/**
* TestFlight object
* All methods are class level
*/
@interface TestFlight : NSObject {
}
/**
* Add custom environment information
* If you want to track custom information such as a user name from your application you can add it here
*
* @param information A string containing the environment you are storing
* @param key The key to store the information with
*/
+ (void)addCustomEnvironmentInformation:(NSString *)information forKey:(NSString*)key;
/**
* Starts a TestFlight session
*
* @param teamToken Will be your team token obtained from https://testflightapp.com/dashboard/team/edit/
*/
+ (void)takeOff:(NSString *)teamToken;
/**
* Sets custom options
*
* @param options NSDictionary containing the options you want to set available options are described below
*
* Option Accepted Values Description
* reinstallCrashHandlers [ NSNumber numberWithBool:YES ] Reinstalls crash handlers, to be used if a third party
* library installs crash handlers overtop of the TestFlight Crash Handlers
*/
+ (void)setOptions:(NSDictionary*)options;
/**
* Track when a user has passed a checkpoint after the flight has taken off. Eg. passed level 1, posted high score
*
* @param checkpointName The name of the checkpoint, this should be a static string
*/
+ (void)passCheckpoint:(NSString *)checkpointName;
/**
* Opens a feedback window that is not attached to a checkpoint
*/
+ (void)openFeedbackView;
@end

View File

@@ -0,0 +1,59 @@
0.8 - November 8, 2011
Added SIGTRAP as a signal type that we catch
Removed all Objective-c from crash reporting
Removed the use of non signal safe functions from signal handling
Created a signal safe way to get symbols from a stack trace
Changed the keyboardType for Long Answer Questions and Feedback to allow for international character input
Changed TESTFLIGHT_SDK_VERSION string to be an NSString
Changed cache folder from Library/Caches/TestFlight to Library/Caches/com.testflight.testflightsdk
Fixed issue with saving data when device is offline
Fixed compability issues with iOS 3
Added calling into the rootViewController shouldAutorotateToInterfaceOrientation if a rootViewController is set
Made the comments in TestFlight.h compatible with Appledoc
Tested compiled library with
Xcode 4.2
Xcode 4.1
Xcode 3.2
0.7.2 - September 29, 2011
Changed TESTFLIGHT_SDK_VERSION string to be an NSString
Fixed an issue where exiting an application while the SDK is active caused modal views to be dismissed
0.7.1 - September 22, 2011
Internal release
Refactoring
0.7 - September 21, 2011
Moved TestFlight images and data to the Library/Caches folder
Resolved an issue where sometimes the rootViewController could not be found and feedback, questions and upgrade views would not be displayed
In application upgrade changed to allow skipping until the next version is installed and allows upgrades to be forced
Fixed a memory leak when launching questions
0.6 - September 2, 2011
Renamed base64_encode to testflight_base64_encode to remove a conflict with other third party libraries
Added ability to reinstall crash handlers when they are overwritten using the setOptions API
Fixed an issue where crash reports might not get sent under certain circumstances
Fixed a deadlock when the application is put in the background and then resumed before all information can be sent
Fixed an issue when attempting to un-install all signal handlers during a signal
Added support for landscape mode on the iPad to the Questions and Feedback views
Crash reporting now works in versions of Xcode earlier than 4.2
Fixed a memory leak during handshake
0.5 - August 19, 2011
Feedback that is not attached to a checkpoint [TestFlight openFeedbackView]
Usability changes to question views
Removed pause and resume sessions, replaced with sessions being stopped and started
Added text auto correction to the Long Answer question type
Crash reports now send on crash instead of next launch
0.4 - August 15, 2011
In Application Feedback with Questions
In application updates
Custom Environment Information added
Networking stack reimplementation
Exception handling fixes
0.3 - June 15, 2011
Removed all mention of JSONKit from the README
Added support for using both the Bundle Version and the Bundle Short Version string
0.2 - June 14, 2011
Removed all categories this allows users to use the SDK without having to set -ObjC and -load_all
Prefixed JSONKit for use in TestFlight to remove reported issues where some users were already using JSONKit
Added support for armv6 again
0.1 - June 11, 2011
Initial Version