Whenever i pick the file from the iCloud using UIDocumentPickerviewcontroller from my application but it will show this alert on iPhone simulator.
NSArray *types = #[(NSString*)kUTTypeArchive];
UIDocumentPickerViewController *docPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:types inMode:UIDocumentPickerModeImport];
docPicker.delegate = self;
docPicker.modalPresentationStyle = UIModalPresentationPopover;
[self presentViewController:docPicker animated:YES completion:nil];
I think it's problem in only new Xcode 11.2.1 Simulator OS 13.2.
Because I also try in Xcode 10.2 and XS Max, It's work properly.
In all Device work properly so don't worry about this alert.
Hope it will be solve by Apple soon.
I use the privite API to change wallpapper. It works well in iOS 9.3, but in iOS 10 nothing happend, no crash.
Class class = NSClassFromString(#"PLStaticWallpaperImageViewController");
_wallPaper = [[class alloc] performSelector:NSSelectorFromString(#"initWithUIImage:") withObject:_image];
int wallpaperMode = 0;
[_wallPaper setValue:#(wallpaperMode) forKey:#"wallpaperMode"];
[_wallPaper setValue:#(YES) forKeyPath:#"allowsEditing"];
[_wallPaper setValue:#(YES) forKeyPath:#"saveWallpaperData"]; //
NSString *selector = #"setImageAsLockScreenClicked:";
[_wallPaper performSelector:NSSelectorFromString(selector) withObject:nil];
Does anyone know how to do this in iOS 10?
I have some trouble with the new Core Spotlight API in iOS 9. The problem is that the init methods for CSSearchableItemAttributeSet returns nil. Here is an example that does not work for me:
CSSearchableItemAttributeSet* attributeSet = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(NSString *)kUTTypeImage];
attributeSet.title = movie.movieName;
attributeSet.contentDescription = movie.shortDescription ? movie.shortDescription : movie.longDescription;
attributeSet.thumbnailURL = [NSURL URLWithString: [movie posterURLStringWithWidth:100]];
the attributeSet is nil directly from start, so the last three lines does nothing. I have added the CoreSpotlight and MobileCoreService framework to the project and imported them in the same file. I have tried [[CSSearchableItemAttributeSet alloc] init] and this as well returns nil. I really can't figure out what I'm doing wrong. Using Xcode 7.0 beta 4. Any idea why it would return nil is highly appreciated!
From some trying back and forth I realised I did not have an iOS 9 beta installed on my phone which kind of explains why iOS 9 features does not work.. So, to answer my own question, you need to install iOS 9 (beta) when using CoreSpotlight.
I know this question has been asked several times, but Im looking for a more general answer.
I have developed an app for iOS 6, I tested it on simulator(Retina 3.5 and 4 inch) and also on an iPhone 4 device.
It has never crashed but when I submitted the app to Apple and they answered with:
We found that your app crashed upon launch on iPhone 5 running iOS 6.1.3,
Looking at the crash log
We see that it crashes in line 164 from a index out of bounds, which makes sense because I have this code there:
I added that "if" to stop the execution whenever the indexTimesArray was bigger than the length of the array and see why that happened, but I was unable to reproduce the error. I never get an index out of bounds as they do...
It's true that I haven't test it on a iPhone 5 device, but I have XCode 4.6 and iOS 6.1 on my computer, and also a iPhone 4 with iOS 6.1.3, but it's also true that the guys at Apple are getting the app crashed, so how to reproduce the error?
I tried to install the app from TestFlight because it installs it as a brand new app, just like they do when they test it, but still no errors...
How can I reproduce the error? Could it be a problem with th build settings?
Thanks
[EDIT]
I initialize the contents of timesArray in the init method of the object, like this:
- (id)init{
self = [super init];
df = [[NSDateFormatter alloc] init];
[df setDateFormat:#"yyyy-MM-dd HH:mm"];
rangeDates = [[NSArray alloc]initWithObjects:#"2013-04-11 10:00", #"2013-04-12 10:00", #"2013-04-13 10:00", #"2013-04-14 10:00", nil];
timesArray = [[NSArray alloc]initWithArray:[NSArray arrayWithObjects:#"10:00", #"11:00", #"12:00", #"13:00", #"14:00", #"15:00", #"16:00", #"17:00", #"18:00", #"19:00", #"20:00", #"21:00", #"22:00", nil]];
colorDictio = [[NSDictionary alloc]initWithObjects:[NSArray arrayWithObjects:[UIColor colorWithRed:0.74 green:0.66 blue:0.37 alpha:1.0], [UIColor colorWithRed:0.64 green:0.15 blue:0.11 alpha:1.0], [UIColor colorWithRed:0.313 green:0.65 blue:0.69 alpha:1.0], [UIColor colorWithRed:0.79 green:0.4 blue:0.59 alpha:1.0], [UIColor colorWithRed:0.45 green:0.55 blue:0.53 alpha:1.0], [UIColor colorWithRed:0.14 green:0.27 blue:0.66 alpha:1.0], nil] forKeys:[NSArray arrayWithObjects:#"showers area", #"zinctalks", #"zincnetwork", #"zincshows", #"zinclabs", #"zinczone", nil] ];
return self;
}
To figure out how to reproduce that error you have to look at the code where you create timesArray.
The out of bounds error happens because [timesArray count] is less than 2 (or the whole array is nil). So you have to figure out which condition leads to an array with one or zero objects. Maybe it happens because there is no internet connection.
It's always a good idea to wrap objectAtIndex: in a check for the actual size of the array.
I would replace else { with else if ([timesArray count] >= 2) { and add an additional else that handles <2 arrays.
First of all this is not a OS related error. Your app is crashing because the wrong index of array is being accessed.
How can I reproduce the error? : Try to use the same credential which you must have provided to apple.
Could it be a problem with th build settings? : No.
To debug the error what you can do is try to print the value of indexTimesArray before the if. Also, try to print all the values you are passing to access the array element. Which will help you track the wrong index which is being sent.
Thanks to #mayur, his comment is the right answer, "I had faced a similar error earlier with arrays in Objective-C... My suggestion would be to use self with NSMutableArrays or NSArrays"
In iPhone can we set the lock screen, wallpaper and ringtone programmatically?
If Yes, then please let me know how to set them?
This can all be done easily, but will be rejected by Apple.
The ringtone can be changed by altering com.apple.SpringBoard.plist, specifically the ringtone key.
The following code can be used to read the actual ringtone title of custom ringtones (synced by iTunes).
NSMutableDictionary *custDict = [[NSMutableDictionary alloc] initWithContentsOfFile:#"/private/var/mobile/Media/iTunes_Control/iTunes/Ringtones.plist"];
NSMutableDictionary *dictionary = [custDict objectForKey:#"Ringtones"];
NSArray *keys = [dictionary allKeys];
id key = [keys objectAtIndex:indexPath.row];
NSMutableDictionary *customRingtone = [dictionary objectForKey:key];
NSString *name = [customRingtone objectForKey:#"Name"];
cell.textLabel.text = name;
The Wallpapers can be overwritten at:
NSString *homePath1 = #"/private/var/mobile/Library/SpringBoard/HomeBackground.jpg";
NSString *homePath2 = #"/private/var/mobile/Library/SpringBoard/HomeBackgroundPortrait.jpg";
NSString *lockPath1 = #"/private/var/mobile/Library/SpringBoard/LockBackground.jpg";
NSString *lockPath2 = #"/private/var/mobile/Library/SpringBoard/LockBackgroundPortrait.jpg";
These examples were used in one of my Cydia apps. Theres not really much more to them, but these should get you going in the right direction.
The answer by WrightsCS stopped working at some point due to a change in iOS. Unfortunately, this is something you have to live with if you wish to use undocumented features.
If you still need to do this, for non-App Store apps only, this code works in iOS 9.3. It could stop working in any future iOS release, though. (see comment below: no longer working in iOS 10)
#import "SBSUIWallpaperPreviewViewController.h"
#import <dlfcn.h>
// open the private framework dynamically
void *handle = dlopen("/System/Library/PrivateFrameworks/SpringBoardUIServices.framework/SpringBoardUIServices", RTLD_NOW);
UIImage *wallpaper = [UIImage imageNamed: #"background.jpg"];
Class sbClass = NSClassFromString(#"SBSUIWallpaperPreviewViewController");
// we create a view controller, but don't display it.
// just use it to load image and set wallpaper
SBSUIWallpaperPreviewViewController *controller = (SBSUIWallpaperPreviewViewController*)[[sbClass alloc] initWithImage: wallpaper];
[controller setWallpaperForLocations: 3]; // 3 -> set both for lock screen and home screen
dlclose(handle);
You'll need to add the private API header to your project. You can usually find these online with a little searching, for example, here.
In the example above, [SBSUIWallpaperPreviewViewController setWallpaperForLocations:] is called with an argument of 3: 3 indicates the image should be used for both lock and home screens. 1 indicates Lock screen only. 2 indicates Home screen only.
For an explanation of why I open this framework up dynamically, see my related answer here.
I don't have an answer regarding ringtones. This really should be a separate question: completely different APIs at work.
use private api if you can
check PLStaticWallpaperImageViewController