Build iOS app for Facebook Review

2 minute read

Apple’s App Review is not enough? Let’s make our app reviewed also by Facebook! I mean, why not?!

I don't wanna live on this planet anymore

If you, like me, have an iOS app that requests some publish permissions, you have to let Facebook reviews it to make sure you’re requesting those for a good reason (and in a clear way).

There a simple guide available at developer.facebook.com, but it does not work if your app has a workspace.

Let’s say that your app uses third party libraries integrated with Cocoapods. The command suggested there will fail miserably (of course).

Build the Simulator package using workspaces

The proper command is something like this

$ xcodebuild -arch i386 -sdk {simulator_sdk} -workspace {project_name}.xcworkspace -scheme {scheme_name}

Another important detail (at least I think it is) is the configuration used. In the guide, they are OK with building in Release configuration. Because of my complex workspace setup, I also specified the configuration to use. That’s the final command:

$ xcodebuild clean build -arch i386 -sdk iphonesimulator8.1 -workspace Studio.xcworkspace -scheme "Studio Prod" -configuration ProdRelease

clean build is not required but it’s for extra safety.

As said in the guide, if you’re not sure about what SDK you have, you can retrieve them with xcodebuild -showsdks

$ xcodebuild -showsdks
OS X SDKs:
	OS X 10.9                     	-sdk macosx10.9
	OS X 10.10                    	-sdk macosx10.10

iOS SDKs:
	iOS 8.1                       	-sdk iphoneos8.1

iOS Simulator SDKs:
	Simulator - iOS 7.1           	-sdk iphonesimulator7.1
	Simulator - iOS 8.1           	-sdk iphonesimulator8.1

And for the name of schemes and configurations, you can use xcodebuild -list

$ xcodebuild -list
Information about project "Studio":
	Targets:
    	Studio
		Tests

Build Configurations:
	ProdDebug
	ProdRelease
	BetaRelease
	BetaDebug
	DevDebug
	DevRelease

If no build configuration is specified and -scheme is not passed then "ProdRelease" is used.

Schemes:
	Studio Prod
	Studio Dev
	Studio Beta

Once the command terminates, you can see where the app files are:

Touch Build/Products/ProdRelease-iphonesimulator/Studio.app
   		cd /workspace/ios-studio
	export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:**some-privacy-here**"
	/usr/bin/touch -c /workspace/ios-studio/Build/Products/ProdRelease-iphonesimulator/Studio.app

** BUILD SUCCEEDED **

Test your build on the Simulator

-bash: ios-sim: command not found.

Don’t you have ios-sim installed? These are the steps to do it

  • Grab node.js from http://nodejs.org/download/.
  • Open node package file.
  • Install it on your system.
  • run the command: $ npm install ios-sim -g

Launch the app

With ios-sim installed on your system, you can launch your app with the command

ios-sim launch {app path}

and verify that the app works (or at least runs on the simulator).

The path came easily from the last part of the building log, but in general should be in

{project_directory}/build/{configuration}-iphonesimulator/{project_name}.app

Remember to zip the .app for uploading into Facebook’s backend.

And after that, as always, wait for review.

Alessandro

Categories:

Updated: