Suppose you are selling a web app. There is no data or operation that involves more than 1 customer. Each customer is totally separate.

How would you prefer to make the deployments?

1) Deploy one instance for each customer, meaning you are running and managing many small apps on different servers/virtual machines/on the cloud etc.

2) Build a multitenant app that manages different customers itself, manage 1 big app, scale it on the cloud. You are basically selling a username/pass pair.

OR a 3rd approach I am not aware of.

Is the choice clear (like everyone is doing this second way), or are there many considerations, pro-cons between those models?

I have an event handler. It receives an event and needs to do some work on it. That work is split between common work - things that have to be done for all types of event handler - and specific work - things that only need to be done for a specific app.

There seem to be two approaches to implementing this design. I could write a non-virtual member function, that invokes a differently named pure virtual member function:

struct Base {
    virtual ~Base() = default;

    void onEvent(Event const& ev) {
        // do common stuff
        onEventImpl(ev);
    }
private:
    void onEventImpl(Event const& ) = 0;
};

or, I could have a single virtual member function and rely upon the derived classes to always call the Base class first:

struct Base {
    virtual ~Base() = default;

    virtual void onEvent(Event const& ) {
        // do common stuff
    }
};

struct Derived : Base {
    void onEvent(Event const& ev) override {
        Base::onEvent(ev);
        // do specific stuff
    }
};

The former is safe, but involves having two of every function named basically the same.

The latter is error-prone in that the derived classes could forget to call the base class (although this error would be readily apparent from the first test - not the kind of subtle error that could creep up on you), but at least we just have the one onEvent() function.

What's the right approach to solving this problem? Is there a better option than these two?

I have tried and failed many times to get some inherited code to successfully send a background session request. When in the foreground, it works flawlessly, but in the background it will either never return, or, in some cases, receive a auth challenge.

The code to create the request is pretty boilerplate:

NSURLSessionConfiguration *sessionConfig =
[NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:identifier];
sessionConfig.sessionSendsLaunchEvents = true;
sessionConfig.discretionary = false;
sessionConfig.requestCachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
sessionConfig.timeoutIntervalForResource = 60 * 60 * 24; //One day. Default is 7 days!

/* Create session, and optionally set a NSURLSessionDelegate. */
NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig
                                                      delegate:self
                                                 delegateQueue:[NSOperationQueue mainQueue]];

NSURLComponents *urlComponents = [NSURLComponents new];
urlComponents.scheme           = @"https";
urlComponents.host             = @"jsonplaceholder.typicode.com";
urlComponents.path             = @"/posts/1";

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[urlComponents URL]];
request.HTTPMethod           = @"PUT";

NSLog(@"Making request: %@", request);

/* Start a new Task */
NSURLSessionDataTask *task = [session dataTaskWithRequest:request];
[task resume];

But I never get anything back. I do have the required background modes (probably)

      <key>UIBackgroundModes</key>
      <array>
              <string>fetch</string>
              <string>remote-notification</string>
      </array>

and my delegate is delegating everything

<NSURLSessionDelegate, NSURLSessionDataDelegate,NSURLConnectionDataDelegate,NSURLConnectionDelegate,NSURLSessionTaskDelegate>

Any help would be appreciated- I'm pretty sure I'm missing just one line of code somewhere. I even went so far as to create a GitHub repo just to test this code out- it schedules a Local Notification to allow you to run the session task in the background.

GitHub repo for BackgroundSender

I am using Ramotion folding cell but i shows error like java.lang.IllegalStateException: Content View height is too small atcom.ramotion.foldingcell.FoldingCell.calculateHeightsForAnimationParts(FoldingCell.java:253) at com.ramotion.foldingcell.FoldingCell.unfold(FoldingCell.java:114) at com.ramotion.foldingcell.FoldingCell.toggle(FoldingCell.java:202) atcom.example.money.conatusapp.Home.HomeFragment$HomeViewHolder$1.onClick(HomeFragment.java:187) at android.view.View.performClick(View.java:4783) at android.view.View$PerformClick.run(View.java:19887) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5290) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) atcom.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)

My Code for folding cell :

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/folded_view"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/folded_image"
            android:layout_width="0dp"
            android:layout_height="170dp"
            android:layout_weight="3"
            android:src="@drawable/conatus" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="170dp"
            android:layout_weight="4"
            android:orientation="vertical"
            android:padding="3dp">

            <TextView
                android:id="@+id/folded_heading"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="1dp"
                android:text="Heading"
                android:textColor="#000000"
                android:textSize="17sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/folded_date"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="1dp"
                android:text="date"
                android:textColor="#000000"
                android:textSize="13sp" />

            <TextView
                android:id="@+id/folded_time"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="1dp"
                android:text="time"
                android:textColor="#000000"
                android:textSize="13sp" />


            <TextView
                android:id="@+id/folded_subheading"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="3dp"
                android:text="sub heading..........."
                android:textSize="16sp" />
        </LinearLayout>
    </LinearLayout>





    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:id="@+id/content_view"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#425353"
            android:orientation="horizontal"
            android:padding="5dp">

            <TextView
                android:id="@+id/heading"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="3"
                android:padding="2dp"
                android:text="Heading"
                android:textColor="#ffffff"
                android:textSize="17sp"
                android:textStyle="bold" />


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"
                android:padding="2dp">

                <TextView
                    android:id="@+id/date"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:padding="1dp"
                    android:text="date"
                    android:textColor="#ffffff"
                    android:textSize="13sp" />

                <TextView
                    android:id="@+id/time"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:padding="1dp"
                    android:text="time"
                    android:textColor="#ffffff"
                    android:textSize="13sp" />
            </LinearLayout>
        </LinearLayout>


        <TextView
            android:id="@+id/subheading"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="2dp"
            android:text="sub heading..........."
            android:textSize="16sp" />


        <ImageView
            android:id="@+id/article_image"
            android:layout_width="match_parent"
            android:layout_height="500dp"
            android:layout_gravity="center"
            android:src="@drawable/conatus" />


        <TextView
            android:id="@+id/articel_content_field"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="6dp"
            android:textSize="16sp" />
    </LinearLayout>

I have a UITableViewController loads 2 text and 1 image for each row in the tableview from firebase. When I navigate to that TableViewController it loads the data perfectly and the cache works and all.

I have another ViewController that adds more information to that tableview which pushes data to firebase and then the table view pulls it back. This is where the problem occurs once I add more information and then popviewcontroller back to the tableview, then firebase pulls the data using observeEventType and pulls the new row in However it then also adds that same row two more times to the tableview so it ends up having 3 of the same row.

If I navigate to a different view controller and go back to that tableview the tableview works perfect and the duplicate rows all disappear.

I have tried many solutions like

[[self tableview]reloadData]
[[self view] setNeedsDisplay]

dispatch_async(dispatch_get_main_queue(), ^(void) {
    [self.myTableView reloadData];
}); 

I have tried putting all these in viewDidLoad, viewDidAppear, viewWillAppear but all of it doesn't work. Please have a look at my code and help me out please!

LifeCycle func:

-(void)viewDidAppear:(BOOL)animated{
    ref = [[[FIRDatabase database] reference] child:@"moment-item"];
    [self startObservingDB];    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    imageCache = [[NSCache alloc] init];
    cachedImage = [[UIImage alloc] init];
    self.tableView.estimatedRowHeight = 250;
    self.tableView.rowHeight = UITableViewAutomaticDimension;
    imgCacheObj = [[ImageCache alloc] init];
}

Retreive Firebase:

- (void)startObservingDB{

    momentsArray = [[NSMutableArray alloc] init];

    [ref observeEventType:FIRDataEventTypeChildAdded withBlock:^(FIRDataSnapshot *snapshot) {
         NSLog(@"observeEventType");
         Moments *moments = [[Moments alloc] init];
         [moments setUser:[snapshot.value objectForKey:@"user"]];
         [moments setImage:[snapshot.value objectForKey:@"image"]];
         [moments setContent:[snapshot.value objectForKey:@"content"]];     
         [momentsArray addObject:moments];
         [self.tableView reloadData];
         NSLog(@"Moments array: %@", momentsArray);
     }];
}

Table Data Source:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    NSLog(@"Moments Array : %@", momentsArray );
    return momentsArray.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString* identifier = @"momentCell";
    [self.tableView registerNib:[UINib nibWithNibName:@"MomentsTableViewCell" bundle:nil] forCellReuseIdentifier:identifier];

    MomentsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];
    cellPostionNum = [NSString stringWithFormat:@"%d", indexPath.row];

    cell.cellMomentImage.image = nil;
    cell.cellComments.text = nil;
    cell.cellUsername.text = nil;

    if(cell == nil){
        cell = [[MomentsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
    }

    cell.cellUsername.text = [NSString stringWithFormat:@"%@",[[momentsArray objectAtIndex:indexPath.row] valueForKey:@"user"]];
    cell.cellComments.text = [NSString stringWithFormat:@"%@",[[momentsArray objectAtIndex:indexPath.row] valueForKey:@"content"]];

    NSURL *imagePath = [NSURL URLWithString:[[momentsArray objectAtIndex:indexPath.row]valueForKey:@"image"]];

    NSLog(@"Image path: %@", imagePath);

    if(imageCache){
        NSLog(@"imageCache NSCache %@",[imageCache objectForKey:cellPostionNum]);
    }

    if(cachedImage){
        NSLog(@"Cached Image %@",cachedImage);
    }

    if([[ImageCache sharedImageCache] DoesExist:[NSString stringWithFormat:@"%@", imagePath]] == true){
        cell.cellMomentImage.image = [[ImageCache sharedImageCache] GetImage:[NSString stringWithFormat:@"%@", imagePath]];;
        return cell;
    }
    else{
        // Block code to download image from firebase
        NSURLSessionTask *task = [[NSURLSession sharedSession] dataTaskWithURL:imagePath completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
            NSLog(@"download image");

            //Log if there are errors
            if(error != nil){
                NSLog(@"%@", error);
            }
            else if (data) {
                UIImage *downloadedImage = [UIImage imageWithData:data];
                if (downloadedImage) {
                    dispatch_async(dispatch_get_main_queue(), ^{
                        MomentsTableViewCell *newCell = (id)[tableView cellForRowAtIndexPath:indexPath];
                        if(newCell){
                            cachedImage = downloadedImage;
                            // Store downloaded image into imageCache and use forkey with the imagePath
                            [imageCache setObject:downloadedImage forKey:cellPostionNum];

                            [imgCacheObj AddImage:[NSString stringWithFormat:@"%@",imagePath] myImage:downloadedImage];

                            // Assign image to cell
                            newCell.cellMomentImage.image = downloadedImage;
                        }
                    });
                }
            }

        }];
        [task resume];
    }
    return cell;
}

When I upload my app to iTunes Connect with the new Siri Intents I receive a message saying:

Invalid Siri Support - No example phrase was provided for INSetMessageAttributeIntent in the "en" language

Invalid Siri Support - No example phrase was provided for INSendMessageIntent in the "en" language

I have created a AppIntentVocabulary.plist in the main App and Localized it but keep receiving this issue every time I upload.

Is the file in the incorrect place or am I putting these example phrases in the wrong place?

Thanks

I'm a newbie.
But I do not understand why the UITableView was not all elements loads (10 element in array).
With Xcode7 works but with Xcode8 (Swift 3) no.
I rewrote the code but to no avail: one element is being loaded ...

This is the code inside the UIViewController (with extension UITableViewDelegate, UITableViewDataSource)

CODE:

// MARK: UITableView
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return commentArray.count
}

// cell height
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
    return UITableViewAutomaticDimension
}

func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
    return true  
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    let cell = mytableView.dequeueReusableCell(withIdentifier: "CellComment", for: indexPath ) as! commentCell


    // connect objects with our information from arrays
    cell.usernameBtn.setTitle(usernameArray[indexPath.row], for: UIControlState.normal)
    cell.usernameBtn.sizeToFit()
    cell.commentLbl.text = commentArray[indexPath.row]
    return cell
}

I think the problem is in the cellForRowAt....
I also have the following error:

BFTask caught an exception in the continuation block. This behaviour is discouraged and will be removed in a future release. Caught Exception: Invalid index path for use with UITableView. Index paths passed to table view must contain exactly two indices specifying the section and row. Please use the category on NSIndexPath in UITableView.h if possible.

I do not understand. Does anyone have an idea? Thank you

I have one requirement to implement an offline support IOS application, the scenario is no matter whether the device can access the network, the app get/save data from/into local database, and when device can access the network, the application will do bi-direction sync up from local to server and also from server to local.

Generally speaking, I need to make one backend thread to do download and upload operation and store the date to local database, but at the same time, user is using application by load data from local database, and the UI have no chance to know whether the data he is viewing the updated or not. So the question is when the data is changed in local database, how to notify the UI that data has been changed, and trigger a refresh on UI automatically?

I am new to IOS, and per I know, there is one best practice in Android which is called Android rest client, but for IOS , I have no idea about how to fulfill the requirement.

I want to save rounded image in Photos Library. I am trying but saved image is not rounded.

extension UIImage {
convenience init(view: UIView) {
    UIGraphicsBeginImageContextWithOptions(view.frame.size, view.opaque, 0)

    view.drawViewHierarchyInRect(view.bounds, afterScreenUpdates: true)

    view.layer.renderInContext(UIGraphicsGetCurrentContext()!)
    let image = UIGraphicsGetImageFromCurrentImageContext()

    UIGraphicsEndImageContext()
    self.init(CGImage: image.CGImage!)
}
}
//calling 
let image = UIImage(view: myView)
 UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)

Since upgrading to Xcode 8 I cannot run any app on my iPhone. The build fails with error: error: Task failed with exit 0 signal 11 I can run the apps on the simulators, just not on a device. The full error message: Please help. Coby Reshef

The full error message:

error: Task failed with exit 0 signal 11 { /usr/bin/codesign '--force' '--sign' '7F49C2A625C8976762BDEA351F8DA88E4F6FED22' '--verbose' '/Users/reshef/Library/Developer/Xcode/DerivedData/testXcode-eltpwhxdshmmlygolxcnsroevmoo/Build/Products/Debug-iphoneos/testXcode.app/Frameworks/libswiftCore.dylib' }

I have a button in which i want to set the text programatically.

as for right now i have the following:

@IBAction func saveButtonClicked(_ sender: AnyObject) {
    sender.setTitle("Action", for: UIControlState.normal)
    closeKeyboard()
}

the issue is, that this is an action outlet, so the text only appends to the button when i press it..

I tried to put the setTitle inside the viewdidload function, but it wont compile. How do i make the text constant? do i have to make multiple outlets, or can it be done in another way?

I have 2 Xcodes in my Mac(7.3.1 & 8.1). I want to work with ReactiveCocoa so I installed it via Cocoapods and later with Carthage. And when I import later in my ViewController import ReactiveCocoa I get the next error:

Module compiled with Swift 2.3 cannot be imported in Swift 3.0: /Users/myUser/Library/Developer/Xcode/DerivedData/RAC-grddczfrbaumbtglfcuzhxyzoodk/Build/Products/Debug-iphonesimulator/ReactiveCocoa.framework/Modules/ReactiveCocoa.swiftmodule/x86_64.swiftmodule

How can I fix that? I'm already working over it over 3-4 hours and nothing

I have been doing so research on integrating 3rd party ads into ios applications and there is a lot of options. All Im really looking for is to be able to add a simple ad at the bottom of the screen, but Im not sure which would be the best ad network to use. Tapjoy seems to be the biggest one but it looks to be too big to integrate into a small/simple app. Im just wondering if anyone had any experience or helpful information on picking the right ad network to integrate in a small/simple ios app.

Thanks

I am looking for a development environment which would support libraries to allow the following requirements:

  1. The product would be cross platform, meaning it would run the same on android, ios, and (not a must) windows phone.

  2. There must be support for image processing and computer vision. something like opencv.

Please direct me for some environments that would suit those requirements.

I have read about xamarin, which is supposed to satisfy req. 1., but how would I encorporate image pricessing into it?

maybe xamarin is not the way to go?

thanks!

I have a dynamic gif file, which has been dragged to my project, I intend to load it into my scene via code snippet:

let pen = SKSpriteNode(imageNamed: "basketball.gif")

override func didMoveToView(view: SKView) {
    backgroundColor = SKColor.whiteColor()

    pen.position = CGPoint(x: size.width * 0.5, y: size.height * 0.1)
    addChild(pen)
}

But it only shows the static one, not dynamic. Could anyone give me any idea why this can't work? Thanks!

I am trying to determine if a device is Jailbroken. The code I use crashes on a Jailbroken device. Three Questions. 1. Is this the correct way to check for a Jailbroken Device? 2. How does Crashlytics determine a Jailbroken device? 3.I attempt to insert the value of this method into a dictionary but it crashes "Attempting to insert nil" inside of the dictionary. Why would this return nil?

- (NSNumber*)isJailBroken {

NSBundle *bundle = [NSBundle mainBundle];
NSDictionary *info = [bundle infoDictionary];

NSNumber *boolNumber;

if ([info objectForKey: @"SignerIdentity"] != nil) {
    return boolNumber = [NSNumber numberWithBool:YES];
}else {
    return boolNumber = [NSNumber numberWithBool:NO];
}
}

If we have a code snippet like:

      public class Finalizer
     {
       static List list = new ArrayList();

       public void finalize( )
      {
         System.out.println("hello");
      }
      }

What is so special about static here that affects the call to finalize ( ). Is it because that static members have lifecycle of whole program so a variable referring to the Finalizer object won't be out of scope because of static unless we say null on it?

I want to do movie ticket booking and event ticket booking.

In that how to avoid duplicate booking in short cuncurrency.

I have five seats remaining in my event.

Two user comes both will see 5 seats but only one can book it.

How can I achieve this?

Please help me solve this issue.

Thanks to reading this question; i am a lucky of android;Now i have an project which need to update the vehicle lat-lnt by an thread looping pull an Api;But i found that thread will be kill sometimes in android life circle; can any body give me some suggestion to handler the thread keep live in life circle?

I actually have a custom uiview that works, and I think everything in the uiview that doesn't work is set up the same as the one that works. Here is the code:

protocol SessionDisplayViewDelegate: class
{
     func homeButtonTapped()
}

class SessionDisplayView: UIView 
{

@IBOutlet var view: UIView!


@IBOutlet weak var accountImage: UIButton!

@IBOutlet weak var mySKView: SKView!
@IBOutlet weak var sessionTitle: UILabel!

weak var delegate: SessionDisplayViewDelegate?
required init(coder aDecoder: NSCoder)
{
    super.init(coder: aDecoder)!
    commonInitialization()

}

override init(frame: CGRect)  {
    super.init(frame: frame)
    commonInitialization()
}

func commonInitialization()
{
    Bundle.main.loadNibNamed("SessionDisplayView", owner: self, options: nil)
    self.addSubview(self.view)


    //accountImage = UIImage(data: ShareData.sharedInstance.accounts[ShareData.sharedInstance.indexOfCurrentAccount].picture!, scale: 1.0)

}

func onView()
{
    let curScene = MyScene(size: mySKView.bounds.size)
    curScene.scaleMode = SKSceneScaleMode.aspectFill
    mySKView.presentScene(curScene)
    let myImage = UIImage(data: (ShareData.sharedInstance.accounts[ShareData.sharedInstance.indexOfCurrentAccount]?.picture!)! as Data, scale: 0.5)

    accountImage.setImage(myImage, for: UIControlState())
    sessionTitle.text = ShareData.sharedInstance.accounts[ShareData.sharedInstance.indexOfCurrentAccount]?.name
    var myTest = sessionTitle.text
    self.view.setNeedsDisplay()

 }

@IBAction func homeButtonTouched(_ sender: UIButton)
{
    delegate?.homeButtonTapped()
}
}

I don't know that the self.view.setNeedsDisplay() needs to be called- I'm just trying to make it work. The title doesn't change even though the variable for the title does change- I've checked that, and that is working. Either there's a connection issue between the label and the variable, or the view controller isn't getting the update signal to change the view controller. I don't know which- and I don't know how to nail down which it is, either. Any ideas on how to fix this would be deeply appreciated. Here is the ViewController code:

class SessionDisplayViewController: UIViewController, SessionDisplayViewDelegate
{

@IBOutlet weak var mySessionView: SessionDisplayView!
func homeButtonTapped()
{
   self.performSegue(withIdentifier: "ReturnHome", sender: self)
}
override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view.
    mySessionView.onView()
    mySessionView.sessionTitle.text = "Test"

}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}
override var shouldAutorotate : Bool {
    if (UIDevice.current.orientation == UIDeviceOrientation.landscapeLeft) || (UIDevice.current.orientation == UIDeviceOrientation.landscapeRight) || (UIDevice.current.orientation == UIDeviceOrientation.unknown)
    {
        return true
    }
    else
    {
        return false
    }
}

override var supportedInterfaceOrientations : UIInterfaceOrientationMask {
    return [UIInterfaceOrientationMask.portrait, UIInterfaceOrientationMask.portraitUpsideDown]
}
override var preferredStatusBarStyle : UIStatusBarStyle
{
    return UIStatusBarStyle.lightContent
}
}

Any thoughts or suggestion on how to get the UIView to update would be most welcome. Thanks.

Sincerely,
Sean

    UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
    content.sound = [UNNotificationSound defaultSound];
    NSDateComponents *components = [[NSDateComponents alloc] init];
    components.hour = 0;
    UNCalendarNotificationTrigger *trigger = [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:components repeats:YES];
    UNNotificationRequest *notificationRequest = [UNNotificationRequest requestWithIdentifier:kUserNotificationTag content:content trigger:trigger];
    [[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:notificationRequest withCompletionHandler:nil];

This is my code to post local notification in iOS10.When I set the sound is

[UNNotificationSound defaultSound]

or

[UNNotificationSound soundNamed:@""]

the sound of the notification is both the default sound.

but if I don't set the sound,the local notification will not work.

Does anybody have any ideas?Thanks so much!