Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warnings and bundle name #13

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
Expand All @@ -9,10 +15,19 @@ build/
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
xcuserdata/*
*.xcuserdatad

## Other
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
*.xccheckout
*.xcscmblueprint

## SJT - do we need this still, given above lines?
# *.xcuserstate

## Cocoapods
Pods

## Subversion
.svn
59 changes: 42 additions & 17 deletions ObjectiveWMM.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
DC71D8C8197E067F00C665CB /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0600;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "Crookneck Consulting LLC";
TargetAttributes = {
DC71D8D0197E067F00C665CB = {
Expand All @@ -226,6 +226,7 @@
};
DC71D8DB197E067F00C665CB = {
CreatedOnToolsVersion = 6.0;
DevelopmentTeam = RMH7P6Q49N;
};
};
};
Expand Down Expand Up @@ -305,21 +306,33 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand All @@ -332,7 +345,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
METAL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand All @@ -350,13 +363,23 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
Expand All @@ -365,13 +388,14 @@
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
METAL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -384,22 +408,21 @@
DC71D8E8197E067F00C665CB /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/ObjectiveWMM",
);
FRAMEWORK_SEARCH_PATHS = "";
INFOPLIST_FILE = "$(SRCROOT)/ObjectiveWMM/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = mh_dylib;
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = "com.crookneckconsulting.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = ObjectiveWMM;
PROVISIONING_PROFILE = "";
SKIP_INSTALL = YES;
Expand All @@ -409,22 +432,20 @@
DC71D8E9197E067F00C665CB /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/ObjectiveWMM",
);
FRAMEWORK_SEARCH_PATHS = "";
INFOPLIST_FILE = "$(SRCROOT)/ObjectiveWMM/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = mh_dylib;
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = "com.crookneckconsulting.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = ObjectiveWMM;
PROVISIONING_PROFILE = "";
SKIP_INSTALL = YES;
Expand All @@ -434,6 +455,7 @@
DC71D8EB197E067F00C665CB /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEVELOPMENT_TEAM = RMH7P6Q49N;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
Expand All @@ -445,20 +467,23 @@
INFOPLIST_FILE = ObjectiveWMMTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
METAL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.crookneckconsulting.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = ObjectiveWMMTests;
};
name = Debug;
};
DC71D8EC197E067F00C665CB /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEVELOPMENT_TEAM = RMH7P6Q49N;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
INFOPLIST_FILE = ObjectiveWMMTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
METAL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.crookneckconsulting.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = ObjectiveWMMTests;
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>ObjectiveWMM.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>2</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
Expand Down
3 changes: 2 additions & 1 deletion ObjectiveWMM/CCMagneticDeclination.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@

@interface CCMagneticDeclination : NSObject <NSCopying, NSCoding>

- (id) initWithCoordinate:(CLLocationCoordinate2D)coordinate elevation:(CLLocationDistance)elevation date:(NSDate *)date magneticDeclination:(CLLocationDirection)magneticDeclination;
- (id) initWithCoordinate:(CLLocationCoordinate2D)coordinate elevation:(CLLocationDistance)elevation date:(NSDate *)date magneticDeclination:(CLLocationDirection)magneticDeclination fieldStrength:(double)fieldStrength;

@property (readonly, nonatomic) CLLocationCoordinate2D coordinate;
@property (readonly, nonatomic) CLLocationDistance elevation;
@property (readonly, nonatomic, strong) NSDate *date;
@property (readonly, nonatomic) CLLocationDirection magneticDeclination;
@property (readonly, nonatomic) double fieldStrength; // in μT

- (CLLocationDirection) trueHeadingFromMagneticHeading:(CLLocationDirection)magneticHeading;
- (CLLocationDirection) magneticHeadingFromTrueHeading:(CLLocationDirection)trueHeading;
Expand Down
25 changes: 18 additions & 7 deletions ObjectiveWMM/CCMagneticDeclination.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,38 @@ @interface CCMagneticDeclination()
@property (readwrite, nonatomic) CLLocationDistance elevation;
@property (readwrite, nonatomic, strong) NSDate *date;
@property (readwrite, nonatomic) CLLocationDirection magneticDeclination;
@property (readwrite, nonatomic) double fieldStrength;

@end

@implementation CCMagneticDeclination

- (id) initWithCoordinate:(CLLocationCoordinate2D)coordinate elevation:(CLLocationDistance)elevation date:(NSDate *)date magneticDeclination:(CLLocationDirection)magneticDeclination {
- (id) initWithCoordinate:(CLLocationCoordinate2D)coordinate elevation:(CLLocationDistance)elevation date:(NSDate *)date magneticDeclination:(CLLocationDirection)magneticDeclination fieldStrength:(double)fieldStrength {

self = [super init];
if (self) {
self.coordinate = coordinate;
self.elevation = elevation;
self.date = date;
self.magneticDeclination = magneticDeclination;
_coordinate = coordinate;
_elevation = elevation;
_date = date;
_magneticDeclination = magneticDeclination;
_fieldStrength = fieldStrength;
}

return self;
}

- (NSString *) description {

NSString *desc = [NSString stringWithFormat:@"%1.3f°,%1.3f° / %1.2fm at %@: decl: %1.2f° F: %1.2fμT", self.coordinate.latitude, self.coordinate.longitude, self.elevation, self.date.description, self.magneticDeclination, self.fieldStrength];

return desc;
}

#pragma mark - NSCopying

- (id)copyWithZone:(NSZone *)zone {

CCMagneticDeclination *magneticDeclination = [[CCMagneticDeclination allocWithZone:zone] initWithCoordinate:self.coordinate elevation:self.elevation date:self.date magneticDeclination:self.magneticDeclination];
CCMagneticDeclination *magneticDeclination = [[CCMagneticDeclination allocWithZone:zone] initWithCoordinate:self.coordinate elevation:self.elevation date:self.date magneticDeclination:self.magneticDeclination fieldStrength:self.fieldStrength];

return magneticDeclination;
}
Expand All @@ -53,8 +62,9 @@ - (id)initWithCoder:(NSCoder *)aDecoder {
CLLocationDistance elevation = [aDecoder decodeDoubleForKey:@"elevation"];
NSDate *date = [aDecoder decodeObjectForKey:@"date"];
CLLocationDirection magneticDeclination = [aDecoder decodeDoubleForKey:@"magneticDeclination"];
double fieldStrength = [aDecoder decodeDoubleForKey:@"fieldStrength"];

self = [self initWithCoordinate:coord elevation:elevation date:date magneticDeclination:magneticDeclination];
self = [self initWithCoordinate:coord elevation:elevation date:date magneticDeclination:magneticDeclination fieldStrength:fieldStrength];
if (!self) {
return nil;
}
Expand All @@ -69,6 +79,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder {
[aCoder encodeDouble:self.elevation forKey:@"elevation"];
[aCoder encodeObject:self.date forKey:@"date"];
[aCoder encodeDouble:self.magneticDeclination forKey:@"magneticDeclination"];
[aCoder encodeDouble:self.fieldStrength forKey:@"fieldStrength"];
}

#pragma mark - Public
Expand Down
7 changes: 2 additions & 5 deletions ObjectiveWMM/CCMagneticModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ - (id) init {
int epochs = 1;
int numTerms, nMax = 0;

NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.crookneckconsulting.ObjectiveWMM"];
NSString *path = [bundle pathForResource:@"WMM" ofType:@"COF"];

char *filename = (char *) [path cStringUsingEncoding:NSUTF8StringEncoding];
char *filename = (char *) getPathForResource("WMM", "COF");

MAG_robustReadMagModels(filename, &_magneticModels, epochs);

Expand Down Expand Up @@ -139,7 +136,7 @@ - (CCMagneticDeclination *) declinationForCoordinate:(CLLocationCoordinate2D)coo

MAG_CalculateGridVariation(coordGeodetic, &geoMagneticElements);

CCMagneticDeclination *result = [[CCMagneticDeclination alloc] initWithCoordinate:coordinate elevation:elevation date:date magneticDeclination:geoMagneticElements.Decl];
CCMagneticDeclination *result = [[CCMagneticDeclination alloc] initWithCoordinate:coordinate elevation:elevation date:date magneticDeclination:geoMagneticElements.Decl fieldStrength:geoMagneticElements.F/1000.0];

return result;
}
Expand Down
2 changes: 1 addition & 1 deletion ObjectiveWMM/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.crookneckconsulting.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
Loading