Selaa lähdekoodia

Apex Mobile
service location 新增保存到iPhone contact 的功能。

Ray Zhang 8 vuotta sitten
vanhempi
commit
bb196cc782

BIN
Apex Mobile/Apex Mobile.xcodeproj/project.xcworkspace/xcuserdata/Ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 42 - 42
Apex Mobile/Apex Mobile.xcodeproj/xcuserdata/Ray.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -90,7 +90,7 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/OrderHistoryViewController.m"
-            timestampString = "545125164.179463"
+            timestampString = "545188735.727091"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "287"
@@ -490,27 +490,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/LocationViewController.m"
-            timestampString = "544849390.859576"
+            timestampString = "545196441.057852"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "370"
-            endingLineNumber = "370"
-            landmarkName = "-addLocation"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "Apex Mobile/LocationViewController.m"
-            timestampString = "544849390.860075"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "371"
-            endingLineNumber = "371"
+            startingLineNumber = "394"
+            endingLineNumber = "394"
             landmarkName = "-addLocation"
             landmarkType = "7">
          </BreakpointContent>
@@ -538,11 +522,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/LocationViewController.m"
-            timestampString = "544849390.860342"
+            timestampString = "545196441.058282"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "439"
-            endingLineNumber = "439"
+            startingLineNumber = "463"
+            endingLineNumber = "463"
             landmarkName = "-updateLocation"
             landmarkType = "7">
          </BreakpointContent>
@@ -554,11 +538,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/LocationViewController.m"
-            timestampString = "544849390.860568"
+            timestampString = "545196441.058588"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "443"
-            endingLineNumber = "443"
+            startingLineNumber = "467"
+            endingLineNumber = "467"
             landmarkName = "-updateLocation"
             landmarkType = "7">
             <Locations>
@@ -617,7 +601,7 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/RANetwork.m"
-            timestampString = "545125164.179822"
+            timestampString = "545196441.058917"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "895"
@@ -633,7 +617,7 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/RANetwork.m"
-            timestampString = "545125164.180137"
+            timestampString = "545196441.059021"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "22"
@@ -713,7 +697,7 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/RANetwork.m"
-            timestampString = "545125164.180425"
+            timestampString = "545196441.0592051"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "903"
@@ -729,7 +713,7 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/RANetwork.m"
-            timestampString = "545125164.1806901"
+            timestampString = "545196441.059305"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "909"
@@ -745,7 +729,7 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/RANetwork.m"
-            timestampString = "545125164.180931"
+            timestampString = "545196441.059407"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "1034"
@@ -761,7 +745,7 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/RANetwork.m"
-            timestampString = "545125164.181172"
+            timestampString = "545196441.059516"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "1031"
@@ -777,7 +761,7 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/RANetwork.m"
-            timestampString = "545125164.181411"
+            timestampString = "545196441.059623"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "1040"
@@ -846,14 +830,14 @@
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "455"
             endingLineNumber = "455"
-            landmarkName = "-setCheckLessThanPercent:"
+            landmarkName = "-setAmountText:"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            shouldBeEnabled = "Yes"
+            shouldBeEnabled = "No"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/PieChart/XYRotatedView.m"
@@ -869,7 +853,7 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            shouldBeEnabled = "Yes"
+            shouldBeEnabled = "No"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/PieChart/XYRenderView.m"
@@ -885,7 +869,7 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            shouldBeEnabled = "Yes"
+            shouldBeEnabled = "No"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/PieChart/XYPieChartView.m"
@@ -901,7 +885,7 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            shouldBeEnabled = "Yes"
+            shouldBeEnabled = "No"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/PieChart/XYPieChartView.m"
@@ -910,14 +894,14 @@
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "280"
             endingLineNumber = "280"
-            landmarkName = "-initWithFrame:withPieChartTypeArray:withPercentArray:withColorArray:"
-            landmarkType = "7">
+            landmarkName = "XYPieChartView"
+            landmarkType = "3">
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            shouldBeEnabled = "Yes"
+            shouldBeEnabled = "No"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/PieChart/XYPieChartView.m"
@@ -926,7 +910,23 @@
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "268"
             endingLineNumber = "268"
-            landmarkName = "-awakeFromNib"
+            landmarkName = "XYPieChartView"
+            landmarkType = "3">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/LocationViewController.m"
+            timestampString = "545196441.059909"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "372"
+            endingLineNumber = "372"
+            landmarkName = "-contactViewController:didCompleteWithContact:"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>

+ 5 - 1
Apex Mobile/Apex Mobile/LocationViewController.h

@@ -12,8 +12,10 @@
 #import "const.h"
 #import "RANetwork.h"
 #import <AddressBookUI/AddressBookUI.h>
+#import <Contacts/Contacts.h>
+#import <ContactsUI/ContactsUI.h>
 
-@interface LocationViewController : UIViewController<GMSMapViewDelegate>
+@interface LocationViewController : UIViewController<GMSMapViewDelegate,CNContactViewControllerDelegate>
 
 @property (strong,nonatomic) NSMutableDictionary * params;
 -(void)  updateLocation;
@@ -22,4 +24,6 @@
 @property (strong, nonatomic) IBOutlet UIView *mapContainer;
 @property BOOL showNavigation;
 @property (strong,nonatomic) UINavigationController * aBNewPersonNav;
+
+@property (strong,nonatomic) CNMutableContact *contact;
 @end

+ 24 - 0
Apex Mobile/Apex Mobile/LocationViewController.m

@@ -343,12 +343,21 @@ didTapInfoWindowOfMarker:(GMSMarker *)marker
     }
     contact.phoneNumbers = phoneArray;
     
+    
+    self.contact = contact;
     // View
     CNContactViewController *contactVC = [CNContactViewController viewControllerForUnknownContact:contact];
     
     self.aBNewPersonNav = [[UINavigationController alloc] initWithRootViewController:contactVC] ;
     UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"close", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onCloseClick:)];
     
+    
+//    UIBarButtonSystemItemSave,
+//    UIBarButtonSystemItemAdd
+    UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(onSaveClick:)];
+    
+    contactVC.navigationItem.rightBarButtonItem = saveButton;
+    
     contactVC.navigationItem.leftBarButtonItem = closeButton;
     
     contactVC.navigationItem.title =[self.params valueForKey:@"company"];
@@ -357,6 +366,21 @@ didTapInfoWindowOfMarker:(GMSMarker *)marker
     }];
     
 }
+- (void)contactViewController:(CNContactViewController *)viewController didCompleteWithContact:(nullable CNContact *)contact
+{
+    if(contact ==nil)
+        [self.aBNewPersonNav popViewControllerAnimated:false];
+}
+- (void)onSaveClick:(UIButton *)sender {
+    
+        CNContactViewController *contactVC = [CNContactViewController viewControllerForNewContact:self.contact];
+    contactVC.delegate = self;
+    
+    [self.aBNewPersonNav pushViewController:contactVC animated:false];
+//    [self.aBNewPersonNav dismissViewControllerAnimated:true completion:^{
+//        ;
+//    }];
+}
 
 - (void)onCloseClick:(UIButton *)sender {
     [self.aBNewPersonNav dismissViewControllerAnimated:true completion:^{