Skip to content

Commit

Permalink
Merge pull request #6475 from jonalter/TIMOB-18176
Browse files Browse the repository at this point in the history
[TIMOB-18176][TIMOB-18193] iOS: Reporting correct architectures for 64bit
  • Loading branch information
vishalduggal committed Dec 12, 2014
2 parents 914f626 + 2c9dd70 commit cec6667
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
3 changes: 2 additions & 1 deletion iphone/Classes/KrollBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,8 @@ -(id)require:(KrollContext*)kroll path:(NSString*)path
return module;
}

@throw [NSException exceptionWithName:@"org.appcelerator.kroll" reason:[NSString stringWithFormat:@"Couldn't find module: %@",path] userInfo:nil];
NSString *arch = [TiUtils currentArchitecture];
@throw [NSException exceptionWithName:@"org.test.kroll" reason:[NSString stringWithFormat:@"Couldn't find module: %@ for architecture: %@", path, arch] userInfo:nil];
}

+ (NSArray *)krollBridgesUsingProxy:(id)proxy
Expand Down
10 changes: 5 additions & 5 deletions iphone/Classes/PlatformModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ -(id)init
version = [[theDevice systemVersion] retain];
processorCount = [[NSNumber numberWithInt:1] retain];
username = [[theDevice name] retain];
#ifdef __LP64__
ostype = [@"64bit" retain];
#else
ostype = [@"32bit" retain];
#endif

if ([TiUtils isIPad])
{
Expand All @@ -55,8 +59,6 @@ -(id)init
struct utsname u;
uname(&u);

NSString *arch = @"arm";

// detect iPhone 3G model
if (!strcmp(u.machine, "iPhone1,2"))
{
Expand Down Expand Up @@ -86,19 +88,17 @@ -(id)init
else if (!strcmp(u.machine, "i386"))
{
model = [@"Simulator" retain];
arch = @"i386";
}
// detect simulator for x86_64
else if (!strcmp(u.machine, "x86_64"))
{
model = [@"Simulator" retain];
arch = @"x86_64";
}
else
{
model = [[NSString alloc] initWithUTF8String:u.machine];
}
architecture = [arch retain];
architecture = [[TiUtils currentArchitecture] retain];

// needed for platform displayCaps orientation to be correct
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
Expand Down
2 changes: 2 additions & 0 deletions iphone/Classes/TiUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,8 @@ typedef enum
+(NSString*)jsonStringify:(id)value;
+(id)jsonParse:(NSString*)value;

+(NSString*)currentArchitecture;

+(NSString*)jsonStringify:(id)value error:(NSError**)error;
+(id)jsonParse:(NSString*)value error:(NSError**)error;;

Expand Down
17 changes: 17 additions & 0 deletions iphone/Classes/TiUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -1912,4 +1912,21 @@ +(id)jsonParse:(NSString*)value
return r;
}

+(NSString*)currentArchitecture
{
#ifdef __arm64__
return @"arm64";
#endif
#ifdef __arm__
return @"armv7";
#endif
#ifdef __x86_64__
return @"x86_64";
#endif
#ifdef __i386__
return @"i386";
#endif
return @"Unknown";
}

@end

0 comments on commit cec6667

Please sign in to comment.