Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I agree with Mattia, Xcode is probably the best way to go, however: <strong>CHALLENGE ACCEPTED</strong>.</p> <hr> <p>First, let's get CodeRunner to compile with UIKit. In the CodeRunner preferences, duplicate the Objective-C language and name it something like "iOS". I'm using the command that Xcode uses (which you can find in the Log Navigator) as a template. This is also what Mattia was talking about. Set the Compilation Flags to something like this:</p> <blockquote> <p>-arch i386 -fmessage-length=0 -std=c99 -fpascal-strings -O0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -fexceptions -fasm-blocks -g -fvisibility=hidden -fobjc-abi-version=2 -fobjc-legacy-dispatch -mios-simulator-version-min=5.1 -framework Foundation -framework UIKit -F /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks</p> </blockquote> <p>Note the <code>iPhoneSimulator5.1.sdk</code> path and <code>-mios-simulator-version-min=5.1</code> flag. You may need to change these for your own system and versions.</p> <p>To start, try using the following iOS code (you can also make this your template in the preferences):</p> <pre><code>#import &lt;Foundation/Foundation.h&gt; #import &lt;UIKit/UIKit.h&gt; @interface AppDelegate : NSObject &lt;UIApplicationDelegate&gt; @property (nonatomic, retain) UIWindow * window; @property (nonatomic, retain) UIViewController * viewController; @end @implementation AppDelegate @synthesize window = _window; @synthesize viewController = _viewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.viewController = [[[UIViewController alloc] initWithNibName:nil bundle:nil] autorelease]; self.viewController.view.backgroundColor = [UIColor orangeColor]; UILabel * label = [[UILabel alloc] initWithFrame:self.viewController.view.bounds]; label.font = [UIFont boldSystemFontOfSize:48.0]; label.textColor = [UIColor whiteColor]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = UITextAlignmentCenter; label.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; label.text = @"Hello World"; [self.viewController.view addSubview:label]; [label release]; self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease]; self.window.rootViewController = self.viewController; [self.window makeKeyAndVisible]; return YES; } @end int main(int argc, char *argv[]) { @autoreleasepool { UIApplicationMain(argc, argv, nil, @"AppDelegate"); } } </code></pre> <p>If you try to run, it should compile, however the application will crash with this error:</p> <blockquote> <p>dyld: Library not loaded: /System/Library/Frameworks/UIKit.framework/UIKit</p> </blockquote> <p>This is because you're trying to run an iOS app on a Mac, which doesn't have UIKit available; it needs to run in the simulator. Back in the preferences, change Run Command to:</p> <blockquote> <p>/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication $PWD/$compiler</p> </blockquote> <p>Now run the same code. The iOS Simulator should launch and you should see an orange screen with "Hello World":</p> <p><img src="https://i.stack.imgur.com/fIaaJ.png" alt="Hello World"></p> <p>Now to get it to work with SecureUDID. You'll need to save the code somewhere. Now copy the SecureUDID .h and .m files into the same folder as the saved code. Add <code>#import "SecureUDID.h"</code> to the top of the file, change the font size to <code>14.0</code>, and change <code>@"Hello World"</code> to <code>[SecureUDID UDIDForDomain:@"com.example.test" usingKey:@"abcdefg"]</code>. If you run the code, it will complain that it can't find the SecureUDID symbols, as you were seeing. We'll need to add "SecureUDID.m" to the Compilation Flags. So you can reuse the iOS language in CodeRunner, you can add this to the flags in Custom Run, however you'll need to deal with that modal view each time you want to run.</p> <p>And there you go:</p> <p><img src="https://i.stack.imgur.com/wxMyr.png" alt="SecureUDID"></p> <p>Unfortunately, logging will not appear in the CodeRunner console, but you can open up the Mac app, Console, to see them. I'm also getting some extra black padding. Not yet sure what I'm doing wrong to get that.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload